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

Infinite runtime with afterEach and retries enabled #18502

Closed
qlimlass opened this issue Oct 14, 2021 · 3 comments
Closed

Infinite runtime with afterEach and retries enabled #18502

qlimlass opened this issue Oct 14, 2021 · 3 comments

Comments

@qlimlass
Copy link

qlimlass commented Oct 14, 2021

Current behavior

My ticket on cypress-cucumber-preprocessor

Semi-reproducible behavior: With retries enabled and anything in afterEach on a test, if that test fails, then the test will run infinitely on the retry attempt whether the second attempt fails or succeeds.

The behavior on my project: I've got timeouts set to 60 seconds and if I have a bad network request hanging longer than that, then it will produce this infinite run on the retry. I'm only able to reproduce it consistently on a handful of websites with "pageLoadTimeout": 1000. The behavior is the same though.

Screen Shot 2021-10-14 at 4 26 52 PM

Desired behavior

I am trying to use cypress-cucumber-preprocessor which runs with logic in afterEach. I currently can't put these cucumber tests into CI because of the risk of running jobs infinitely. Desired behavior is that the tests fail or succeed on retry attempts and the test concludes, which is what happens if I remove the afterEach block from the test code below.

Any suggestions for workarounds?

Test code to reproduce

Infinite.js

describe('Infinite', function () {
    afterEach(() => {
        cy.then(() => {});
    });
    it('Infinite', function () {
        cy.visit('https://www.starwars.com/');
    });
});

cypress.json

{
	"retries": 2,
    "pageLoadTimeout": 1000
}

Cypress Version

8.6.0

@adrienjoly
Copy link

adrienjoly commented Dec 11, 2021

I have the same problem with Cypress 8.6.0 and 9.1.1, since I enabled retries!

You can find public run logs on https://github.com/openwhyd/openwhyd/runs/4493699111?check_suite_focus=true

Below, you'll see (based on timestamps) that tests should have timed out!

image

The project is open source, so you'll be able to inspect the tests, configuration and plugins used with Cypress.

@Regaddi
Copy link

Regaddi commented May 13, 2022

This issue is currently blocking us from utilizing retries. When we hit this issue, our GitHub Action runner keeps running for hours, unless we notice it's hanging, causing unnecessary usage of our Actions quota. Disabling retries has the side effect that some tests fail randomly due to overall network or infrastructure flakiness, forcing us to re-run the whole test suite again (which again causes unnecessary usage of our Actions and Cypress Dashboard quota).

@flotwig
Copy link
Contributor

flotwig commented Aug 22, 2022

Agreed that this seems like an issue. Closing this as duplicate of #21619 since that has more information in the thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants