You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a test suite that has one test file with a top-level beforeEach block
When I "Run all specs" in the GUI, the beforeEach block is run before every test file. As a result, the other test file was written to rely on the beforeEach block, and so it passes when run as part of the whole suite in the GUI:
But when running this suite in the CLI, the beforeEach block is only run for the test file it's in. As a result, the other test file fails, even though it succeeded in the GUI:
Desired behavior:
Running full test suite from the GUI or CLI should treat beforeEach blocks in the same way
Note that I don't desire the beforeEach block to behave one way or the other: whether it fails or succeeds consistently across the GUI and CLI is fine. A top-level beforeEach block is not recommended by Mocha. The desires is for consistency on this behavior across GUI and CLI.
Yes, this is a known limitation of 'Runs all specs'. In the future we will change it to behave the same as cypress run, so recommend that you update your test code accordingly.
Current behavior:
beforeEach
blockbeforeEach
block is run before every test file. As a result, the other test file was written to rely on thebeforeEach
block, and so it passes when run as part of the whole suite in the GUI:beforeEach
block is only run for the test file it's in. As a result, the other test file fails, even though it succeeded in the GUI:Desired behavior:
beforeEach
blocks in the same waybeforeEach
block is not recommended by Mocha. The desires is for consistency on this behavior across GUI and CLI.Test code to reproduce
https://github.com/CodingItWrong/cypress-persistent-stub - instructions in readme
Versions
The text was updated successfully, but these errors were encountered: