lirantal / cypress-social-logins

Cypress authentication flows using social network providers
Apache License 2.0
247 stars 78 forks source link

Click on social login link in a new popup (which Cypress doesn't have access to) #4

Closed michaelwschultz closed 4 years ago

michaelwschultz commented 5 years ago

Nice little plugin! This is going to be really helpful if I can get it working.

I've turned off headless so I can see what's happening. The google login window opens automatically but I can't seem to get it to fill in the creds. Any ideas?

Screen Shot 2019-07-11 at 3 41 57 PM

mumairofficial commented 4 years ago

By adding popupDelay and headless : false configurations, I can see the popup and automated typing an email address. But there is another issue.

Video link: https://www.loom.com/share/0b13b447f9c54a4e81beeee856e45544

Screenshot: image

I have tried toggling chromeWebSecurity flag

Not sure if I am doing something wrong or google added extra browser security check,

Kindly help me out.

TomaszWaszczyk commented 4 years ago
    const username = Cypress.env('googleSocialLoginUsername')
    const password = Cypress.env('googleSocialLoginPassword')
    const loginUrl = Cypress.env('loginUrl')
    const cookieName = Cypress.env('cookieName')

Under those variables do you have real credentials to Gmail? loginUrl could be localhost? What should be value of cookieName?

iledzka commented 4 years ago

By adding popupDelay and headless : false configurations, I can see the popup and automated typing an email address. But there is another issue.

Video link: https://www.loom.com/share/0b13b447f9c54a4e81beeee856e45544

Screenshot: image

I have tried toggling chromeWebSecurity flag

Not sure if I am doing something wrong or google added extra browser security check,

Kindly help me out.

Log in to your gmail and turn on Allow less secure apps in Settings

    const username = Cypress.env('googleSocialLoginUsername')
    const password = Cypress.env('googleSocialLoginPassword')
    const loginUrl = Cypress.env('loginUrl')
    const cookieName = Cypress.env('cookieName')

Under those variables do you have real credentials to Gmail? loginUrl could be localhost? What should be value of cookieName?

loginUrl can be localhost, it's the url to your login page. I may be wrong, but I don't think that the cookieName matters that much. I managed to log it using arbitrary value in the cookieName.

TomaszWaszczyk commented 4 years ago

I solved it by implementation similar to: https://github.com/cypress-io/cypress-example-recipes/tree/master/examples/stubbing-spying__google-analytics

mumairofficial commented 4 years ago

Log in to your gmail and turn on Allow less secure apps in Settings

Thank you @iledzka for the tip 👍In my opinion, there is a possibility that google might introduce new anti-bot configurations in future and that might break CICD pipeline for no reason.

Testing around 3rd party is anti pattern and I manage to bypass google auth with stubbing and spying techniques.

marcovignotto commented 2 years ago

Hi Everyone! Looks like I'm not the only having problems! Cypress does not find the button, I tried every kind of syntax (type, classes... and a cy.get("class") works) but it does not find the button to open the google login. I'm stuck here.

I always get: waiting for selector "input#identifierId[type="email"]" failed: timeout 30000ms exceeded

but it does not open the login so it will never find it. Any idea? Thanks!

lindsaymacvean commented 1 year ago

I was able to write a complete login process from AWS Cognito to Google Login pages and back to my app. Might be helpful to some...

https://stackoverflow.com/a/74435696/2827300