-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: import-test-from with decorators
- Loading branch information
Showing
6 changed files
with
41 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,4 @@ | ||
Feature: feature 1 | ||
|
||
Scenario: scenario 1 | ||
Given todoPage: step |
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,4 @@ | ||
{ | ||
"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.", | ||
"smoke": true | ||
} |
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,11 @@ | ||
import { defineConfig } from '@playwright/test'; | ||
import { defineBddConfig } from 'playwright-bdd'; | ||
|
||
const testDir = defineBddConfig({ | ||
features: 'features', | ||
steps: 'steps/*.ts', | ||
}); | ||
|
||
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,9 @@ | ||
import { Fixture, Given } from 'playwright-bdd/decorators'; | ||
import { test } from './fixtures'; | ||
|
||
export | ||
@Fixture<typeof test>('todoPage') | ||
class TodoPage { | ||
@Given('todoPage: step') | ||
async step() {} | ||
} |
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 { test as base } from 'playwright-bdd'; | ||
import { TodoPage } from './TodoPage'; | ||
|
||
export const test = base.extend<{ todoPage: TodoPage }>({ | ||
todoPage: ({}, use) => use(new TodoPage()), | ||
}); |
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,7 @@ | ||
import { test, TestDir, execPlaywrightTest } from '../_helpers/index.mjs'; | ||
|
||
const testDir = new TestDir(import.meta); | ||
|
||
test(testDir.name, () => { | ||
execPlaywrightTest(testDir.name); | ||
}); |