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

Tests are running successfully locally, but consistently receiving a timeout when running in CI #125

Open
ryanwoconnor opened this issue Sep 9, 2022 · 1 comment

Comments

@ryanwoconnor
Copy link

ryanwoconnor commented Sep 9, 2022

I have the following test which works fine locally. However when run from CI I consistently am getting a timeout when trying to get the postLoginSelector.

Any ideas on why this might be?

  │ Cypress:        10.7.0                                                                         │
  │ Browser:        Electron 102 (headless)                                                        │
  │ Node Version:   v16.13.0 (/Users/ryanoconnor/.nvm/versions/node/v16.13.0/bin/node)             │
  │ Specs:          1 found (login.cy.ts)                                                          │
  │ Searched:       cypress/e2e/**/*.cy.{js,jsx,ts,tsx}         
describe("Login page", () => {
  before(() => {
    cy.log(`Visiting http://localhost:3000`);
    cy.visit("http://localhost:3000");
  });
  it("Login with Google", () => {
    const username = Cypress.env("GOOGLE_USER");
    const password = Cypress.env("GOOGLE_PW");
    const loginUrl = Cypress.env("SITE_NAME");
    const cookieName = Cypress.env("COOKIE_NAME");
    const socialLoginOptions = {
      username,
      password,
      loginUrl,
      headless: true,
      logs: true,
      isPopup: true,
      loginSelector: "button.GoogleButton",
      postLoginSelector: ".cleanersharelogo",
    };

    return cy
      .task("GoogleSocialLogin", socialLoginOptions)
      .then(({ cookies }) => {
        cy.clearCookies();
        const cookie = cookies
          .filter((cookie) => cookie.name === cookieName)
          .pop();
        if (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: cookieName,
          });

          // remove the two lines below if you need to stay logged in
          // for your remaining tests

          cy.visit("http://localhost:3000/");
          cy.wait(1000);

          cy.visit("http://localhost:3000/api/auth/signout");
          cy.get("form").submit();
        }
      });
  });
});

export {};
@ghost
Copy link

ghost commented Oct 30, 2022

Potentially due to this issue mentioned in the README?

This plugin doesn't work well in a CI environment, due to the anti-fraud detection mechanisms employed by the likes of Google, GitHub etc.

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