-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Inconsistent beforeEach behavior when 'Run all specs' executed. #3323
Comments
Can recreate from provided repo: https://github.com/TheBrainFamily/cypress-cucumber-example/tree/beforeEach |
Related to: #1586 |
My team encountered this while working with vanilla Cypress (not the Cucumber plugin). Even more surprising, the behavior of Cypress varies depending on how it is invoked!
Based on the |
In GUI mode do you run by clicking on each spec file or by clicking the button “run all specs”?
…Sent from my iPhone
On Mar 29, 2019, at 18:16, Tony Spataro ***@***.***> wrote:
My team encountered this while working with vanilla Cypress (not the Cucumber plugin).
Even more surprising, the behavior of Cypress varies depending on how it is invoked!
cypress open behaves as this issue describes; there is no isolation between test files
cypress run seems to reset the Mocha context between test files; each file only runs its own hooks
Based on the type:bug status, it sounds like the intention of Cypress is to isolate different test files?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
The "leaky" behavior (no isolation) only happens when I click "run all tests." If I click an individual test file and later click another, isolation is maintained. Seems to me that "run all tests" should behave more like |
If the non-cucumber case encloses them in describe blocks do you see this behavior? In mocha use describe blocks for scope. I will test out locally. |
Yep. If the beforeEach are within a describe block they are isolated. The cucumber template should place a describe block around the entire file content to isolate. |
Still reproducible on versions 7.2.0, 7.4.0 and 8.4.1. Same steps to reproduce:
|
Run All specs functionality was removed in Cypress 10.0.0. See #21628 |
Current behavior:
As one of
cycpress-cucumber-preprocessor
plugin users found out:badeball/cypress-cucumber-preprocessor#139
the
beforeEach
defined in one file runs for every test.Having one file:
and another:
I would expect them to stick to their unique
beforeEach
es, and that's how it works when running them separately, and when running them together usingcypress run
. Withcypress open
and the "run all specs" function - they both run bothbeforeEach
es.Desired behavior:
Consistency between runing specs separately and all together.
Steps to reproduce: (app code and test code)
reproduction here: https://github.com/TheBrainFamily/cypress-cucumber-example/tree/beforeEach
Versions
as in the repro - I used macos
The text was updated successfully, but these errors were encountered: