I am using the cypress-social-plugin to automate google login using cypress. But the problem is whenever I put new google account credentials inside of cypress-social-plugin commands as mentioned in docs and try to run the test for the first time it say me to verify that it's you if I verify manually and run the test again then it does not ask me verification and test pass successfully. I want to know if the cypress-social-plugin has a solution for this. If it does then please give me a proper example of it.
I am using the cypress-social-plugin to automate google login using cypress. But the problem is whenever I put new google account credentials inside of cypress-social-plugin commands as mentioned in docs and try to run the test for the first time it say me to verify that it's you if I verify manually and run the test again then it does not ask me verification and test pass successfully. I want to know if the cypress-social-plugin has a solution for this. If it does then please give me a proper example of it.
Here is code.
Commend.js Cypress.Commands.add("userLoginWithGmail", () => { const socialLoginOptions = { username: "some gmail here", password: "password here", headless: false, logs: true, cookieDelay: 2000, args: ["--no-sandbox", "--disable-setuid-sandbox"], getAllBrowserCookies: true, loginUrl: "https://some website URL/login", loginSelectorDelay: 3000, loginSelector: "a.auth0-lock-social-button.auth0-lock-social-big-button", postLoginSelector: "#drop-btn", }; cy.task("GoogleSocialLogin", socialLoginOptions).then( ({ cookies, lsd, ssd }) => { cookies.map((cookie) => { cy.setCookie(cookie.name, cookie.value, { domain: cookie.domain, expiry: cookie.expires, httpOnly: cookie.httpOnly, path: cookie.path, secure: cookie.secure, }); Cypress.Cookies.defaults({ preserve: cookie.name, }); }); cy.window().then((window) => { Object.keys(ssd).forEach((key) => window.sessionStorage.setItem(key, ssd[key]) ); Object.keys(lsd).forEach((key) => window.localStorage.setItem(key, lsd[key]) ); }); cy.log("login successful.");
); });
Config.js
e2e: { setupNodeEvents(on) { // implement node event listeners here on("task", { pageLoadTimeout: 10000, GoogleSocialLogin: GoogleSocialLogin, }); },