Skip to content

Add 'BeforeAll' hook #758

@sszemer

Description

@sszemer

Current behavior

'Before' and 'After' hook names are missleading
from wiki:
"Before() and After() is similar to Cypress' beforeEach() and afterEach()"

Desired behavior

i want some code to run only once for all tests. in cypress i would do something like:
before(() => { // runs once before all tests in the block })
in preprocessor the name is confusing as it suggests running once.

it would be preferable to change 'Before' to 'BeforeEach' and make 'Before' behave in a way that it only runs once per test run

Before({ tags: "@foo" }, function () { // This hook will be executed once before all scenarios tagged with @foo. });

BeforeEach({ tags: "@foo" }, function () { // This hook will be executed before each scenario tagged with @foo. });

Test code to reproduce

Before({ tags: "@foo" }, function () { // This hook will be executed before scenarios tagged with @foo. });

Versions

  • Cypress version:
  • 9.7.0
  • Preprocessor version:
  • 4.0.1
  • Node version:
    *v16.15.1

Checklist

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions