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
Spec hangs when error thrown in test:after:run listener #8701
Comments
Can you provide a reproducible example, we believe we have fixed it in #8363 but seems something else in your particular situation causes a problem |
I have the same issue . My tests in CI nightly build are normally completed around 2 hours . But it is still running even after 8-9 hours recently for the same number of tests and the same test execution environment , and it looks like never ending . So currently I am having no choice but to cancel the tests . |
@bahmutov https://github.com/dubbha/cypress-test-tiny/tree/issue8701%405.3.0 And while trying to create it I realized it all boils down to a script Cypress.on('test:after:run', (test) => {
if (test.state === 'failed') {
throw new Error('I am throwing')
}
}) Originally this was adding screenshots to mochawesome reports for the failed tests. Also it doesn't even matter if retries are configured in cypress.json or not. So I am not sure if it can still be considered a bug or just a thing to be aware of for the guys out there. |
Yeah I can recreate the problem in https://github.com/cypress-io/cypress-test-tiny/tree/throw-after /// <reference types="cypress" />
Cypress.on('test:after:run', (test) => {
if (test.state === 'failed') {
// https://github.com/cypress-io/cypress/issues/8701
throw new Error('I am throwing')
}
})
describe('page', () => {
it('works', () => {
cy.visit('https://example.cypress.io')
cy.get('[class^="main-nav-link active"]').should('contain', 'ZZZ')
})
}) The test fails, throws an error and keeps on spinning By the way, even in a successful test where you throw from
|
I have not verified what happens if an error is thrown in other event callbacks |
Looks like this has always causes the spec to hang, even before retries. I'll take a look. Thanks for the reproducible |
Duplicate of #2271 |
The code for this is done in cypress-io/cypress#8709, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Related to #8363, basically the same issue.
I've been waiting for the fix for quite a long time, and kind of disappointed to see that it seems that it still hangs for the
cy.get().should()
assertions, in bothcy run
andcy open
, in both 5.2.0 and 5.3.0.cy run
cy open
I obviously just changed the expected
Log Out
button text toLog OutZZZ
, and that's it, the test will hang for 4 hours in your CI, and will never retry, or skip to other tests.The text was updated successfully, but these errors were encountered: