Skip to content

After hook and Before hooks are not running if a failure occrursΒ #824

@dmbartle

Description

@dmbartle

Current behavior

The Before and After hooks will only run when tests pass.

Desired behavior

We want to be able to use the cucumber style After hook to run some test cleanup, even when tests fail. But currently the After hook will only run when the test passes.

Using the cypress afterEach hook is an option but it would be nice to use the cucumber After hook as it supports @tags

Test code to reproduce

Here is a link to an older test feature file from the cypress repo which illustrates the issue. The scenarios that illustrate this problem are commented out as they cause steps to fail, (Scenario: With Untagged After having test errors in steps part 1 & 2). The steps file only needed a minor tweak to pull { Given, Then, After, Before } from the right place.

https://github.com/badeball/cypress-cucumber-preprocessor/blob/77dbacb65741d559ae0eedd461f02970249f75d8/cypress/integration/BeforeAndAfterSteps.feature

Versions

Checklist

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions