-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { test as base } from 'playwright-bdd'; | ||
|
||
export const test = base.extend<{ world1: string; world2: string }>({ | ||
world1: async ({}, use) => use('world1'), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Feature: feature | ||
|
||
Scenario: scenario | ||
Given step with world1 | ||
Given step with world2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { createBdd } from 'playwright-bdd'; | ||
import { test } from './fixtures'; | ||
|
||
const { Given } = createBdd(test, { worldFixture: 'world1' }); | ||
|
||
Given('step with world1', async function () {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { createBdd } from 'playwright-bdd'; | ||
import { test } from './fixtures'; | ||
|
||
const { Given } = createBdd(test, { worldFixture: 'world2' }); | ||
|
||
Given('step with world2', async function () {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"description": "This file is required for Playwright to consider this dir as a <package-json dir>. It ensures to load 'playwright-bdd' from './test/node_modules/playwright-bdd' and output './test-results' here to avoid conflicts." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineConfig } from '@playwright/test'; | ||
import { defineBddConfig } from 'playwright-bdd'; | ||
|
||
const testDir = defineBddConfig({ | ||
featuresRoot: 'only-steps', | ||
}); | ||
|
||
export default defineConfig({ | ||
testDir, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { test, TestDir, execPlaywrightTestWithError } from '../_helpers/index.mjs'; | ||
|
||
const testDir = new TestDir(import.meta); | ||
|
||
test(testDir.name, () => { | ||
execPlaywrightTestWithError(testDir.name, [ | ||
'All steps in a feature file should have the same worldFixture', | ||
'Found fixtures: world1, world2', | ||
]); | ||
}); |