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

beforeEach with done causes tests to hang indefinitely when done() called in promise.then() #4790

Closed
viktomas opened this issue Jul 23, 2019 · 2 comments · Fixed by #5097
Closed

Comments

@viktomas
Copy link

viktomas commented Jul 23, 2019

Current behaviour:

When using the beforeEach with callback (i.e. beforeEach(done => promise.then(() => done())). The cypress runner hangs when a test fails.

Desired behavior:

When a test fails, move to the next one and in the end, turn off the runner.
At very least, implement timeout that won't allow runner to be running forever.

Steps to reproduce: (app code and test code)

Sorry I didn't know there is tiny version. Hopefully, tiny change to kitchensink should be ok
https://github.com/cypress-io/cypress-example-kitchensink/compare/master...viktomas:before-each-hangs?expand=1

This is the whole change in https://github.com/cypress-io/cypress-example-kitchensink that reproduces the issue.

diff --git a/cypress/integration/examples/actions.spec.js b/cypress/integration/examples/actions.spec.js
index 61c69fc..18c9f0f 100644
--- a/cypress/integration/examples/actions.spec.js
+++ b/cypress/integration/examples/actions.spec.js
@@ -1,8 +1,8 @@
 /// <reference types="Cypress" />

 context('Actions', () => {
-  beforeEach(() => {
-    cy.visit('http://localhost:8080/commands/actions')
+  beforeEach(done => {
+    cy.visit('http://localhost:8080/commands/actions').then(() => done())
   })

   // https://on.cypress.io/interacting-with-elements

Versions

Cypress 3.4.0, osx, node 8 and node 10

Note

Reading through #1075 I think these issues might be related.

@kuceb kuceb mentioned this issue Sep 6, 2019
6 tasks
@cypress-bot cypress-bot bot added the stage: needs review The PR code is done & tested, needs review label Sep 6, 2019
@cypress-bot cypress-bot bot added stage: work in progress and removed stage: needs review The PR code is done & tested, needs review labels Sep 25, 2019
@jennifer-shehane
Copy link
Member

The code for this is done, but this has yet to be released. We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 23, 2019

Released in 3.5.0.

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

Successfully merging a pull request may close this issue.

2 participants