Assertion failures or unexpected errors in both the before() and after() block of a nested suite will cause the NEXT suite's before() blocks to be skipped #30427
Labels
Reproducible
Can be reproduced
stage: needs investigating
Someone from Cypress needs to look at this
type: bug
Current behavior
Assertion failures or unexpected errors in both the before() and after() block will cause the NEXT suite's before() blocks to be skipped.
When doing a test run with Cypress v12.16.0, I had bad request failures (response code level of 400) in both the before() and after() blocks of a nested context() block (
Context block #1
). This caused the tests inContext block #1
to be to skipped (which was expected). However, the before() blocks of the next context() block (Context block #2
) were skipped, causing the tests in that suite to also fail (this was not expected).I have created a matching test structure to the tests where I found this issue and was able to replicate the scenario I'm describing above. See my examples of the test structure and console output.
I have also attached a log file of the debug output during a test run of only this file - cypress-issue-debug-output.log. In the logs, there is the following error message / stack trace:
which implies that only the blocks in
Context block #1
should be affected by the errors.Please let me know if this is expected behavior for Cypress, or if there is another active issue that is being tracked, as I was not able to find one.
Thanks!
Edit: Note that I initially encountered this error on Cypress v12.16.0, then upgraded my Cypress to the latest (v13.15.0) and saw the same issue.
Desired behavior
Cypress should treat nested suites as distinct entities. The failures of one suite shouldn't have any effect on another test suite's execution.
More specifically in this scenario, the before() blocks of
Context block #2
should execute and not be skipped.Test code to reproduce
In a new test file, copy and paste the following Cypress test code. Notice the actual console output below the code chunk.
Console output:
Cypress Version
13.15.0
Node version
18.15.0
Operating System
Windows 11
Debug Logs
Debug logs are attached as a .log file in the Current Behavior section.
Other
No response
The text was updated successfully, but these errors were encountered: