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

Error when logging into Google Docs #22882

Closed
ogomez92 opened this issue Jul 21, 2022 · 8 comments · Fixed by #23885
Closed

Error when logging into Google Docs #22882

ogomez92 opened this issue Jul 21, 2022 · 8 comments · Fixed by #23885
Labels
Reproducible Can be reproduced type: bug

Comments

@ogomez92
Copy link

ogomez92 commented Jul 21, 2022

Current behavior

Currently, Cypress is not letting me login using the Google Docs login form. It displays an error on the page with no additional message, not even showing me as a bot.

We have a Google Add-on that we want to test, and for this we need to login to Google Docs, I already know about the API based authentication for specific apps but I don't need a token, I need to login to Google.

I have tried several things, including passing my Chrome profile as --user-data-dir and preserving its cookies (didn't work), and also to login using docs.google.form sign in form. as soon as you hit next on this form, it breaks with a generic error message.

I also tried setting the user agent, and using another browser like Edge .

Desired behavior

It should let you login normally and show the password field, focus it, and let you type in the password for login.

Test code to reproduce

module.exports = defineConfig({
  "chromeWebSecurity": false,
  e2e: {
    "chromeWebSecurity": false,
    baseUrl: 'https://docs.google.com',
    experimentalSessionAndOrigin: true,
  }
})

// Test code

describe('empty spec', () => {
  it('opens the google test document', () => {
    cy.visit('/', {
      headers: {
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36',
      }
    });

    googleLoginPage.getEmailAddressField().type(Cypress.env('googleUser'));
    googleLoginPage.getNextButton().click()

  })
})

Cypress Version

10.3.1

Other

Not sure other that I tried a lot of different things and none works.. :(

@ogomez92
Copy link
Author

Forgot to include google login page!

class GoogleLogin {
    getEmailAddressField() {
        return cy.get('#identifierId');
    }

    getNextButton() {
        return cy.get('#identifierNext');
    }
}

export default GoogleLogin;

@cypress-bot cypress-bot bot added the stage: investigating Someone from Cypress is looking into this label Jul 21, 2022
@ogomez92
Copy link
Author

Here is the request:
https://www.oriolgomez.com/files/request.har

@mjhenkes
Copy link
Member

@ogomez92, I'm sorry that you're having this issue. We recently have looked into enabling cypress with google auth for issue #21474 and have spawned a couple of other tasks to try and improve the problem (#22952 and #22953). With these fixes we were able to log into google via edge, but not through chrome as there seems to be more security in place around google auth in googles own browser. We're doing our best, but at the end of the day, google wants to prevent automated logins to their auth system.

@AtofStryker AtofStryker assigned AtofStryker and unassigned mjhenkes Aug 9, 2022
@ogomez92
Copy link
Author

I see this issue was apparently solved in version 10.4.0 #21474

I looked at the released notes and saw the new flag, I went ahead and enabled this in cypress.config

module.exports = defineConfig({

  e2e: {
    "chromeWebSecurity": false,
    baseUrl: 'https://docs.google.com',
    experimentalSessionAndOrigin: true,
    experimentalModifyObstructiveThirdPartyCode : true,
..

Then I tried to login using the same test code I posted at first.
Am I doing something wrong do I need to enable something else for it to work?

I'm using Electron because I see that Google Chrome is not yet supported.

Thanks.

@AtofStryker
Copy link
Contributor

@ogomez92 seems like a legit bug. I created a repository that recreates the issue

@AtofStryker
Copy link
Contributor

possibly fixed with #23885 if using cy.origin and #24094 if trying to interact with google as top

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 4, 2022

The code for this is done in cypress-io/cypress#23885, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@ogomez92
Copy link
Author

ogomez92 commented Oct 5, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reproducible Can be reproduced type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants