Tengo un problema como el siguiente. Necesito probar la funcionalidad de inicio de sesión, pero me enfrento a este problema. También busqué algunas soluciones aquí en Stackoverflow, pero no ayudé a ninguna de ellas. por favor mírelo y amablemente comparta sus pensamientos. ¡Gracias!
describe("LoginFunctionality", function () { beforeEach(() => { cy.restoreLocalStorage(); Cypress.Cookies.defaults({ preserve: /[\s\S]*/, }); }); afterEach(() => { cy.saveLocalStorage(); }); let href; let LOCAL_STORAGE_MEMORY = {}; Cypress.Commands.add("saveLocalStorage", () => { Object.keys(localStorage).forEach((key) => { LOCAL_STORAGE_MEMORY[key] = localStorage[key]; }); }); Cypress.Commands.add("restoreLocalStorage", () => { Object.keys(LOCAL_STORAGE_MEMORY).forEach((key) => { localStorage.setItem(key, LOCAL_STORAGE_MEMORY[key]); }); }); Cypress.Commands.add("visitMultipleURL", (url) => { cy.window().then((win) => { return win.open(url, "_self"); }); }); it.only("LoginFunctionality", function () { cy.visit("xxx"); cy.get(".chakra-stack > .css-1n94901").click(); cy.contains("Login with aaaa").click(); cy.url().then((url) => { href = url; cy.log("href ", href); }); }); it.only("Verification of login", function () { cy.visit(href); cy.url().should("include", "bbbb"); //assertion of that we are in this url });