Skip to content

Commit da1e0c3

Browse files
authored
Use playwright test for better validation (#382)
1 parent a6bc205 commit da1e0c3

34 files changed

+1440
-1238
lines changed

.github/workflows/test-javascript.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ jobs:
4949
working-directory: javascript
5050
- run: npm run lint
5151
working-directory: javascript
52+
- name: Setup browsers
53+
run: npx playwright install --with-deps
5254
- name: Acceptance tests
5355
working-directory: javascript
54-
run: npm run validate
56+
run: npm run acceptance

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,15 @@ Once you have Node.js installed, you can use:
2222
make prepare
2323

2424
This will build the Javascript package and copy the required artifacts to the Java and Ruby packages.
25+
26+
### Screenshots
27+
28+
In the JavaScript package, we use fixtures from the [Compatibility Kit](https://github.com/cucumber/compatibility-kit) (CCK) to generate sample reports, render them in a browser and check them against reference screenshots [with Playwright](https://playwright.dev/docs/test-snapshots).
29+
30+
If the tests fail, you can see actual vs expected screenshots plus a visual diff for each affected test in the `test-results` directory.
31+
32+
If fixtures are added or changed in the CCK, the screenshots will have to be updated accordingly. To do that, run:
33+
34+
```shell
35+
npx playwright test --update-snapshots
36+
```

javascript/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
test/__output__/*.html
2+
test-results/
13
dist/
24
.idea/
35
.nyc_output/
@@ -10,7 +12,6 @@ node_modules/
1012
.built*
1113
.compared
1214
.codegen
13-
acceptance/
1415
storybook-static
1516
*-go
1617
*.iml

javascript/.mocharc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"ts-node/register",
44
"source-map-support/register"
55
],
6+
"spec": "src/**/*.spec.ts",
67
"extension": [
78
"ts",
89
"tsx"

0 commit comments

Comments
 (0)