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

Browser isn't fired the load event after loading page #26792

Closed
PavelRybalko opened this issue May 18, 2023 · 8 comments
Closed

Browser isn't fired the load event after loading page #26792

PavelRybalko opened this issue May 18, 2023 · 8 comments
Assignees

Comments

@PavelRybalko
Copy link

PavelRybalko commented May 18, 2023

Current behavior

The page visually is loaded but the cypress is still waiting for the loading.
image
image

Desired behavior

Browser is fired the load event after loading page

Test code to reproduce

 it.only("can authenticate with Google UI", () => {
      Cypress.on(
        "uncaught:exception",
        (err) =>
          !err.message.includes("ResizeObserver loop") &&
          !err.message.includes("Error in protected function")
      );
      cy.visit("https://app.inkit.com/");
      cy.contains("Continue with Google").click();
      cy.origin("https://accounts.google.com", {}, () => {
        Cypress.on(
          "uncaught:exception",
          (err) =>
            !err.message.includes("ResizeObserver loop") &&
            !err.message.includes("Error in protected function")
        );

        cy.get("button:visible").eq(3).click();
        cy.get('input[type="email"]').type("test@gmail.com", {
          log: false,
        });
      });
    });

Cypress Version

12.12.0

Node version

v18.16.0

Operating System

Windows 10 LTSC, 21H2, 19044.2364

Debug Logs

No response

Other

No response

@marktnoonan
Copy link
Contributor

Hi @PavelRybalko, thank you for reporting this. The code provide does not allow us to reproduce the issue. Specifically, there is no initial cy.visit() so cy.contains("Continue with Google").click(); will not work.

If possible please create a test using https://github.com/cypress-io/cypress-test-tiny that reaches this problematic state, then we can pull that down and debug.

I would be curious if, in the network tab, there is some resource that is not loading which prevents the browser load event from firing.

@PavelRybalko
Copy link
Author

PavelRybalko commented May 19, 2023

Hi @marktnoonan, thank you for you answering. I fixed the example code and added the initial cy.visit. I realized that this bug only appears in Chrome. Made a repository https://github.com/PavelRybalko/endless-google-loading/tree/master

@marktnoonan
Copy link
Contributor

Thanks for the reproduction. I get a page load event but unfortunately I get it on a 403 error page, I'm not sure why.

Screenshot 2023-05-21 at 8 14 08 PM

@PavelRybalko
Copy link
Author

I got this error when "chromeWebSecurity" or "experimentalModifyObstructiveThirdPartyCode" option was false. The error disappeared when I ran the project without the "experimental ModifyObstructiveThirdPartyCode: true" option, and then with it.

@warrensplayer
Copy link
Contributor

@PavelRybalko I can see the same thing you are seeing.

Is this really what you want to test or do you just want to be able to authenticate with Google to get access to your app for testing?

Have you looked at our guide to authenticated with Google? https://docs.cypress.io/guides/end-to-end-testing/google-authentication

If this test was part of your CI, then I believe Google would eventually block it by throwing up captchas, etc.

@PavelRybalko
Copy link
Author

I need to test Google login via UI. I watched your guide to authenticated with Google, but I can't use it because in our application, authorization goes through firebase.

@warrensplayer
Copy link
Contributor

Have you looked at this library: https://github.com/prescottprue/cypress-firebase

I don't think Google will let you drive your tests through the create account flow for very long with your tests before it starts to block it.

@warrensplayer
Copy link
Contributor

Unfortunately we have to close this issue due to inactivity. Please comment if there is new information to provide concerning the original issue and we can reopen.

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

3 participants