Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for shadow DOM elements in social login? #126

Open
AndyDonits opened this issue Sep 20, 2022 · 1 comment
Open

Support for shadow DOM elements in social login? #126

AndyDonits opened this issue Sep 20, 2022 · 1 comment

Comments

@AndyDonits
Copy link

Hello :)

I'm trying to execute the task GoogleSocialLogin;

Here is the custom command I'm using for this:

Cypress.Commands.add("userLoginWithGmail", () => {
    const socialLoginOptions = {
        username: "some_email",
        password: "some_password",
        loginUrl: "some url",
        headless: false,
        logs: true,
        loginSelector: "", // What should I put here in case of a shadow-dom element?
        popupDelay: 3000,
        cookieDelay: 2000,
        args: [" — disable-web-security", " — user-data-dir", " — allow-running-insecure-content"],
        isPopup: true,
        getAllBrowserCookies: true
    }
    return 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.")
    })
})

So what value should I put inside the loginUrl property in case I have an element that sits under the shadow-dom element?

I marked the shadow element I'm trying to reach:
Screen Shot 2022-09-20 at 17 11 54

@AndyDonits
Copy link
Author

AndyDonits commented Sep 20, 2022

BTW, already tried adding this: includeShadowDom: true to cypress.config.js, but unfortunately it doesn't work. I guess because the task opens a chromium browser separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant