Skip to content

Commit

Permalink
feat: skip tests with cucumber tags
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkenos committed Aug 24, 2024
1 parent 88fcba8 commit 2102d47
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- multiple locale support
- web components support
- internal polling and retries
- skip tests using cucumber tags
- reporters:
- [built-in cucumber reporter plugins](https://cucumber.io/docs/cucumber/reporting/?sbsearch=reporting&lang=javascript)
- [allure](https://allurereport.org/docs/cucumberjs/)
Expand Down
13 changes: 10 additions & 3 deletions src/core/gherkin/hooks/world.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ import chalk from "chalk";
setDefaultTimeout(process.env.DEBUG === "true" ? -1 : undefined);
setWorldConstructor(World);

/** Dont run tests but still show these in the formatter */
Before({ tags: "@SKIP or @skip or @IGNORE or @ignore" }, () => Status.SKIPPED.toLowerCase());

Before({ tags: "@PENDING or @pending" }, () => Status.PENDING.toLowerCase());

Before({}, async function(this: World) {
this.context = await this.createBrowserContext();
this.page = await this.context.newPage();
Expand All @@ -42,9 +47,11 @@ AfterStep({}, async function(this: This, params: ITestStepHookParameter) {
});

After({}, async function(this: This) {
await this.page.close();
await this.page.context().close();
await this.page.context().browser().close();
if (this.page) {
await this.page.close();
await this.page.context().close();
await this.page.context().browser().close();
}
});

/** [CucumberExpressions](https://cucumber.github.io/try-cucumber-expressions/) */
Expand Down

0 comments on commit 2102d47

Please sign in to comment.