File tree Expand file tree Collapse file tree 10 files changed +107
-5
lines changed Expand file tree Collapse file tree 10 files changed +107
-5
lines changed Original file line number Diff line number Diff line change
1
+ Before submitting this PR, please ensure that you have completed the following:
2
+
3
+ - [ ] Updated the CHANGELOG.md.
4
+ - [ ] Checked that there aren't other open pull requests for the same issue/update.
5
+ - [ ] Checked that your contribution follows the project's contribution guidelines.
6
+ - [ ] Added corresponding unit/E2E tests
7
+
8
+ ## Description
9
+
10
+ Please describe your changes and any new features you're introducing, or issues you're fixing.
11
+
12
+ ### Related Issues
13
+
14
+ Please link any related issues or bug reports that this PR will address.
Original file line number Diff line number Diff line change
1
+ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3
+
4
+ name : Node.js Package
5
+
6
+ on :
7
+ release :
8
+ types : [created]
9
+
10
+ jobs :
11
+ publish-npm :
12
+ runs-on : ubuntu-latest
13
+ steps :
14
+ - uses : actions/checkout@v4
15
+ - uses : actions/setup-node@v4
16
+ with :
17
+ node-version : 18
18
+ registry-url : https://registry.npmjs.org/
19
+ - run : npm ci
20
+ - run : npm run build
21
+ - run : npm publish --access public
22
+ env :
23
+ NODE_AUTH_TOKEN : ${{secrets.npm_token}}
Original file line number Diff line number Diff line change
1
+ name : Test
2
+
3
+ on :
4
+ pull_request :
5
+ branches :
6
+ - main
7
+
8
+ jobs :
9
+ test :
10
+ strategy :
11
+ matrix :
12
+ version : [ 18, 20 ]
13
+ runs-on : ubuntu-latest
14
+ steps :
15
+ - uses : actions/checkout@v4
16
+ - uses : actions/setup-node@v4
17
+ with :
18
+ node-version : ${{ matrix.version }}
19
+ - run : npm ci
20
+ - run : npm run build
21
+ - run : npm run test:e2e
22
+ - name : junit report
23
+ uses : mikepenz/action-junit-report@v4
24
+ if : always()
25
+ with :
26
+ report_paths : ' ./test/results.xml'
27
+ fail_on_failure : true
Original file line number Diff line number Diff line change 1
1
node_modules /
2
2
adapter /
3
+ playwright-report /
4
+ test-results /
Original file line number Diff line number Diff line change 1
1
test /
2
+ .github /
Original file line number Diff line number Diff line change @@ -11,6 +11,4 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
11
11
:microscope : - experimental
12
12
13
13
## [ 0.1.0]
14
- - :pencil : cleaned up dependencies
15
- - :rocket : added value wait and validation
16
- -
14
+ - :rocket : initial implementation
Original file line number Diff line number Diff line change @@ -33,5 +33,38 @@ PROFILE=default
33
33
34
34
## Advanced Configuration
35
35
### Customizing test instance
36
+ Custom test instance can be passed to world constructor as _ test_ property.
37
+ And then fixtures can be connected with world instance via _ init_ property.
38
+ ``` typescript
39
+ import { test as base } from ' @playwright/test' ;
40
+ import { SettingsPage } from ' ./settings-page' ;
41
+ import { setWorldConstructor } from ' @cucumber/cucumber' ;
42
+ import { PlaywrightWorld } from ' @qavajs/playwright-runner-adapter/PlaywrightWorld' ;
43
+
44
+ type MyFixtures = {
45
+ settingsPage: SettingsPage ;
46
+ };
47
+
48
+ const customTest = base .extend <MyFixtures >({
49
+ settingsPage : async ({ page }, use ) => {
50
+ await use (new SettingsPage (page ));
51
+ },
52
+ });
53
+
54
+ class ExtendedPlaywrightWorld extends PlaywrightWorld {
55
+ settingsPage: SettingsPage ;
56
+ constructor (options : any ) {
57
+ super (options );
58
+ }
59
+
60
+ test = customTest ;
61
+
62
+ // init arrow function connects fixtures with Cucumber world instance
63
+ init = ({ settingsPage }) => {
64
+ this .settingsPage = settingsPage ;
65
+ }
66
+
67
+ }
68
+ ```
36
69
37
70
Original file line number Diff line number Diff line change
1
+ export { PlaywrightWorld } from './src/PlaywrightWorld' ;
Original file line number Diff line number Diff line change
1
+ const { PlaywrightWorld } = require ( './adapter/PlaywrightWorld' ) ;
2
+ module . exports = {
3
+ PlaywrightWorld
4
+ }
Original file line number Diff line number Diff line change 2
2
"name" : " @qavajs/playwright-runner-adapter" ,
3
3
"version" : " 0.1.0" ,
4
4
"description" : " adapter for playwright test runner" ,
5
- "main" : " index.js" ,
6
5
"scripts" : {
7
6
"build" : " tsc" ,
8
7
"test:ui" : " playwright test --config test/playwright.config.ts --ui" ,
9
8
"test:e2e" : " playwright test --config test/playwright-e2e.config.ts"
10
9
},
11
10
"author" : " Alexandr Galichenko" ,
12
- "license" : " ISC " ,
11
+ "license" : " MIT " ,
13
12
"dependencies" : {
14
13
"@cucumber/gherkin" : " ^28.0.0" ,
15
14
"@cucumber/messages" : " ^24.1.0" ,
You can’t perform that action at this time.
0 commit comments