Skip to content

Commit

Permalink
Some cleanup after #1128
Browse files Browse the repository at this point in the history
Primarily introducing scenario outlines as a shorter alternative.
  • Loading branch information
badeball committed Nov 26, 2023
1 parent c6358a7 commit 1e3643a
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 555 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## Unreleased

- Add order option to all hooks, fixes [#481](https://github.com/badeball/cypress-cucumber-preprocessor/issues/481).

## v19.1.1

- Mock and imitate Cypress globals during diagnostics / dry run, fixes [#1120](https://github.com/badeball/cypress-cucumber-preprocessor/issues/1120).
Expand Down
13 changes: 13 additions & 0 deletions docs/cucumber-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [Run hooks](#run-hooks)
- [Scenario hooks](#scenario-hooks)
- [Step hooks](#step-hooks)
- [Hook ordering](#hook-ordering)
- [Named hooks](#named-hooks)

# Step definitions
Expand Down Expand Up @@ -220,6 +221,18 @@ BeforeStep(function ({ pickle, pickleStep, gherkinDocument, testCaseStartedId, t

[^1]: This discrepancy between the preprocessor and cucumber-js is currently considered to be unsolvable, as explained [here](https://github.com/badeball/cypress-cucumber-preprocessor/issues/824#issuecomment-1561492281).

## Hook ordering

You can specify an explicit order for hooks if you need to. The default order is 10000. Before-type hooks are executed in ascending order, while After-type hooks are executed in descending order.

```ts
import { Before, BeforeStep, After, AfterStep } from "@badeball/cypress-cucumber-preprocessor";

BeforeAll({ order: 10 }, function () {});
Before({ order: 10 }, function () {});
BeforeStep({ order: 10 }, function () {});
```

## Named hooks

Both scenario hooks and step hooks can optionally be named. Names are displayed in the command log, as well as in [messages reports](messages-report.md).
Expand Down
Loading

0 comments on commit 1e3643a

Please sign in to comment.