Skip to content

Commit 40df4b3

Browse files
author
Oleksandr_Halichenko
committed
prepare publish
1 parent 46d6722 commit 40df4b3

File tree

10 files changed

+107
-5
lines changed

10 files changed

+107
-5
lines changed

.github/pull_request_template.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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.

.github/workflows/npm-publish.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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}}

.github/workflows/pull-request.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
node_modules/
22
adapter/
3+
playwright-report/
4+
test-results/

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
test/
2+
.github/

CHANGELOG.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
1111
:microscope: - experimental
1212

1313
## [0.1.0]
14-
- :pencil: cleaned up dependencies
15-
- :rocket: added value wait and validation
16-
-
14+
- :rocket: initial implementation

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,38 @@ PROFILE=default
3333

3434
## Advanced Configuration
3535
### 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+
```
3669

3770

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { PlaywrightWorld } from './src/PlaywrightWorld';

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const { PlaywrightWorld } = require('./adapter/PlaywrightWorld');
2+
module.exports = {
3+
PlaywrightWorld
4+
}

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
"name": "@qavajs/playwright-runner-adapter",
33
"version": "0.1.0",
44
"description": "adapter for playwright test runner",
5-
"main": "index.js",
65
"scripts": {
76
"build": "tsc",
87
"test:ui": "playwright test --config test/playwright.config.ts --ui",
98
"test:e2e": "playwright test --config test/playwright-e2e.config.ts"
109
},
1110
"author": "Alexandr Galichenko",
12-
"license": "ISC",
11+
"license": "MIT",
1312
"dependencies": {
1413
"@cucumber/gherkin": "^28.0.0",
1514
"@cucumber/messages": "^24.1.0",

0 commit comments

Comments
 (0)