cypress: window.Cypress is undefined

  • Operating System: OS-X 10.12.5
  • Cypress Version: 1.1.2
  • Browser Version: Chrome 62.0.3202.94

Is this a Feature or Bug?

bug

Current behavior:

Cypress randomly crashes after visiting website. (cy.visit('https://url'))

Desired behavior:

It would be nice without the crash 😄

Test code:

Cypress.Cookies.debug(true);
Cypress.Cookies.defaults({
  whitelist: cookieName,
});
// -- This is a parent command --
Cypress.Commands.add(
  'login',
  (username, password) => {
    cy.request(`${domain}netcenter/nacJS/loadNacProfilesV2`).then(response => {
      if (response.redirects) {
        cy.visit(domain);
        cy.get('#login').click();
        cy.get('#username').type(username);
        cy.get('#password').type(password);
        cy.get('#submit').click();
        cy.getCookie(cookieName).then(c => {
          cy.setCookie(cookieName, c.value, {
            domain: 'localhost',
            secure: false,
          });
        });
      }
    });
  },
);

Additional Info (images, stack traces, etc)

home:4 Uncaught Error: Something went terribly wrong and we cannot proceed. We expected to find the global Cypress in the parent window but it is missing!. This should never happen and likely is a bug. Please open an issue! at home:4

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 20 (6 by maintainers)

Most upvoted comments

I am sorry, but we cannot investigate an issue without a reproducible example. I welcome someone to create a new public repo with code showing the problem, or clone https://github.com/cypress-io/cypress-test-tiny or https://github.com/cypress-io/cypress-example-recipes to demonstrate it, then we can reconsider this issue.

This issue should not be closed, as it was never resolved. I suggest reopening the issue until it is resolved.

@kbaala88 you are commenting on an unrelated closed issue. Please open an issue with detailed description and reproducible steps we can run to see the problem.

window.Cypress is undefined when I run cypress run, if I run cypress open is working fine, in my case, I set the window.store only when window.Cypress is defined and if I run cypress run all my tests crash because window.store is not set it.