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
When running all spec files is invoked from GUI using the "Run ## integrations tests" button, then all beforeEach and before hooks run as many times as there are spec files before each and before all tests.
This is the hook in question - it resides in a common steps file
This is what I see when the test runs - it slows the whole test suite by a lot.
The same does not happen when tests are invoked in headless mode - then all hooks run correctly.
Desired behavior
before hooks should only run once per the whole test suite (before each spec file would also be acceptable) beforeEach hooks should only run once before each scenario.
Test code to reproduce
I will provide one when I have more time to work on this
Versions
Cypress version: 9.3.5
Preprocessor version: 9.2.1
Node version: 16.9.1
The text was updated successfully, but these errors were encountered:
ghost
changed the title
Before/After hooks run multiple times when "Run x"
Before/beforeEach hooks run multiple times when running all tests is invoked from Cypress GUI
May 19, 2022
Ah, I see. Would it be difficult to work around the issue by wrapping each feature in a describe block, as pointed out by this comment? I understand it might be undesirable to "fix" underlying problems by introducing workarounds, but I guess this one might be warranted.
Current behavior
When running all spec files is invoked from GUI using the "Run ## integrations tests" button, then all
beforeEach
andbefore
hooks run as many times as there are spec files before each and before all tests.This is the hook in question - it resides in a common steps file
This is what I see when the test runs - it slows the whole test suite by a lot.
The same does not happen when tests are invoked in headless mode - then all hooks run correctly.
Desired behavior
before
hooks should only run once per the whole test suite (before each spec file would also be acceptable)beforeEach
hooks should only run once before each scenario.Test code to reproduce
I will provide one when I have more time to work on this
Versions
The text was updated successfully, but these errors were encountered: