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

Cypress test runner running tests in Infinite Loop #7470

Closed
shivkaps opened this issue May 24, 2020 · 1 comment
Closed

Cypress test runner running tests in Infinite Loop #7470

shivkaps opened this issue May 24, 2020 · 1 comment
Labels
type: duplicate This issue or pull request already exists

Comments

@shivkaps
Copy link

shivkaps commented May 24, 2020

Cypress runs the tests in infinite loop in test runner if a different url is used in one of the tests. However, when we run the same test via CLI then it runs just once.

Desired behavior:

The test should run just once.

Test code to reproduce

  1. Clone this repo https://github.com/shivkaps/cypress-mastery/tree/cypress-issue
  2. Open this project in Visual Studio.
  3. Run the command npx cypress open
  4. Click on "Run All Specs"
  5. The test will run in infinite loop in the test runner

Root Cause

A different url for testing in this file. "http://example.com" as compared to other tests which are running test against a different url "http://zero.webappsecurity.com".
https://github.com/shivkaps/cypress-mastery/blob/cypress-issue/cypress/integration/visual-tests/full-page.spec.js

It seems it just restarts

Versions

Cypress 4.6.0, 4.5.0,
Operating system - MacOs
Browser - Chrome

@jennifer-shehane
Copy link
Member

I'm able to recreate this with the code below.

This is a duplicate of #1987. You can workaround this issue by moving the visits outside of the before hooks for now, but this will be fixed in #7154.

spec.js

before(() => {
  cy.visit('http://zero.webappsecurity.com/index.html')
})

it('test 1', () => {
})

it('test 2', () => {
  cy.visit('http://example.com/')
})

As a side note, you may want to consider excluding node_modules using .gitignore for your projects because the size of your repo is enormous to download with all the included node_modules.

@jennifer-shehane jennifer-shehane added the type: duplicate This issue or pull request already exists label May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants