@public-ui/visual-tests 2.2.11 → 2.2.13-414974dfef358e0b2883d8e781bf77fa726d3b61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/package.json +6 -7
- package/src/index.js +8 -1
- package/tests/axe-snapshots.spec.js +2 -2
- package/tests/sample-app.routes.js +18 -18
- package/tests/theme-snapshots.spec.js +1 -0
package/README.md
CHANGED
|
@@ -48,8 +48,12 @@ Add the following npm scripts to the theme's `package.json`:
|
|
|
48
48
|
}
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
### Environment variables
|
|
52
|
+
|
|
53
|
+
- `THEME_MODULE`: Define the relative path to the TypeScript module containing the theme definitions. Without file extension.
|
|
54
|
+
- `THEME_EXPERT`: Define the name of the export within the module. (e.g., `export const THEME_NAME = {/**/};`) Defaults to `default`.
|
|
55
|
+
- `KOLIBRI_VISUAL_TESTS_TIMEOUT`: Define the Playwright [test timeout](https://playwright.dev/docs/test-timeouts).
|
|
56
|
+
- `KOLIBRI_VISUAL_TESTS_EXPECT_TIMEOUT`: Define the Playwright [expect timeout](https://playwright.dev/docs/test-timeouts).
|
|
53
57
|
|
|
54
58
|
Run the tests with `npm test`. The first time, this will create a new folder `snapshots` which is supposed to be committed to the repository.
|
|
55
59
|
In the following runs, new screenshots will be compared to this reference.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@public-ui/visual-tests",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.13-414974dfef358e0b2883d8e781bf77fa726d3b61.0",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"homepage": "https://public-ui.github.io",
|
|
6
6
|
"repository": {
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
"kolibri-visual-test": "src/index.js"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@playwright/test": "1.
|
|
28
|
+
"@playwright/test": "1.53.0",
|
|
29
29
|
"axe-playwright": "2.1.0",
|
|
30
30
|
"portfinder": "1.0.37",
|
|
31
31
|
"serve": "14.2.4",
|
|
32
|
-
"@public-ui/sample-react": "2.2.
|
|
32
|
+
"@public-ui/sample-react": "2.2.13-414974dfef358e0b2883d8e781bf77fa726d3b61.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@babel/eslint-parser": "7.27.
|
|
35
|
+
"@babel/eslint-parser": "7.27.5",
|
|
36
36
|
"@babel/plugin-syntax-import-attributes": "7.27.1",
|
|
37
37
|
"@babel/preset-env": "7.27.2",
|
|
38
38
|
"eslint": "8.57.1",
|
|
39
|
-
"knip": "5.
|
|
39
|
+
"knip": "5.61.0",
|
|
40
40
|
"prettier": "3.5.3"
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
"format": "prettier --check src",
|
|
49
49
|
"lint": "pnpm lint:eslint",
|
|
50
50
|
"lint:eslint": "eslint src",
|
|
51
|
-
"unused": "knip"
|
|
52
|
-
"postinstall": "pnpm exec playwright install"
|
|
51
|
+
"unused": "knip"
|
|
53
52
|
}
|
|
54
53
|
}
|
package/src/index.js
CHANGED
|
@@ -35,12 +35,19 @@ const packageJson = JSON.parse(packageJsonContent);
|
|
|
35
35
|
console.log(`
|
|
36
36
|
Building React Sample App (v${packageJson?.version ?? '#.#.#'}) …`);
|
|
37
37
|
|
|
38
|
-
child_process.spawnSync('pnpm', ['run', 'build',
|
|
38
|
+
const buildResult = child_process.spawnSync('pnpm', ['run', 'build', `--outDir="${buildPath}"`], {
|
|
39
39
|
cwd: workingDir,
|
|
40
40
|
encoding: 'utf-8',
|
|
41
41
|
shell: true,
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
+
if (buildResult.status !== 0) {
|
|
45
|
+
console.log('Build status:', buildResult.status);
|
|
46
|
+
console.log('Build stdout:', buildResult.stdout);
|
|
47
|
+
console.log('Build stderr:', buildResult.stderr);
|
|
48
|
+
console.log('Build error:', buildResult.error);
|
|
49
|
+
}
|
|
50
|
+
|
|
44
51
|
console.log(`React Sample App build finished. Directory:`, buildPath);
|
|
45
52
|
|
|
46
53
|
void (async () => {
|
|
@@ -38,7 +38,7 @@ test.use({
|
|
|
38
38
|
|
|
39
39
|
ROUTES.forEach((options, route) => {
|
|
40
40
|
// Skip unnecessary axe tests
|
|
41
|
-
if (options?.axe?.skip === true) {
|
|
41
|
+
if (options?.axe?.skip === true || process.argv.includes('--update-snapshots')) {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
test(`snapshot for ${route}`, async ({ page }, testInfo) => {
|
|
@@ -82,7 +82,7 @@ ROUTES.forEach((options, route) => {
|
|
|
82
82
|
{
|
|
83
83
|
outputDirPath: outputPath.replace(/\/[^/]+$/, ''),
|
|
84
84
|
outputDir: `axe-${themeName}`,
|
|
85
|
-
reportFileName: `${route.replace(
|
|
85
|
+
reportFileName: `${route.replace(/[/?]/g, '-')}.html`,
|
|
86
86
|
},
|
|
87
87
|
);
|
|
88
88
|
});
|
|
@@ -89,11 +89,6 @@ ROUTES.set('breadcrumb/basic', {
|
|
|
89
89
|
skip: true,
|
|
90
90
|
},
|
|
91
91
|
});
|
|
92
|
-
ROUTES.set('button-group/basic', {
|
|
93
|
-
snapshot: {
|
|
94
|
-
skip: true,
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
92
|
ROUTES.set('button-link/basic', {
|
|
98
93
|
snapshot: {
|
|
99
94
|
skip: true,
|
|
@@ -238,6 +233,9 @@ ROUTES.set('form/error-list', {
|
|
|
238
233
|
},
|
|
239
234
|
});
|
|
240
235
|
ROUTES.set('heading/badge', {
|
|
236
|
+
axe: {
|
|
237
|
+
skipFailures: true,
|
|
238
|
+
},
|
|
241
239
|
snapshot: {
|
|
242
240
|
skip: true,
|
|
243
241
|
zoom: {
|
|
@@ -246,6 +244,9 @@ ROUTES.set('heading/badge', {
|
|
|
246
244
|
},
|
|
247
245
|
});
|
|
248
246
|
ROUTES.set('heading/basic', {
|
|
247
|
+
axe: {
|
|
248
|
+
skipFailures: true,
|
|
249
|
+
},
|
|
249
250
|
snapshot: {
|
|
250
251
|
viewportSize: {
|
|
251
252
|
width: 250,
|
|
@@ -256,7 +257,11 @@ ROUTES.set('heading/basic', {
|
|
|
256
257
|
},
|
|
257
258
|
},
|
|
258
259
|
});
|
|
260
|
+
ROUTES.set('heading/secondary');
|
|
259
261
|
ROUTES.set('heading/paragraph', {
|
|
262
|
+
axe: {
|
|
263
|
+
skipFailures: true,
|
|
264
|
+
},
|
|
260
265
|
snapshot: {
|
|
261
266
|
skip: true,
|
|
262
267
|
zoom: {
|
|
@@ -281,7 +286,7 @@ ROUTES.set('image/basic', {
|
|
|
281
286
|
zoom: {
|
|
282
287
|
skip: true,
|
|
283
288
|
},
|
|
284
|
-
},
|
|
289
|
+
},
|
|
285
290
|
});
|
|
286
291
|
ROUTES.set('indented-text/basic', {
|
|
287
292
|
snapshot: {
|
|
@@ -471,9 +476,6 @@ ROUTES.set('input-text/basic', {
|
|
|
471
476
|
},
|
|
472
477
|
});
|
|
473
478
|
ROUTES.set('input-text/focus', {
|
|
474
|
-
|
|
475
|
-
});
|
|
476
|
-
ROUTES.set('kolibri/basic', {
|
|
477
479
|
snapshot: {
|
|
478
480
|
skip: true,
|
|
479
481
|
zoom: {
|
|
@@ -481,17 +483,15 @@ ROUTES.set('kolibri/basic', {
|
|
|
481
483
|
},
|
|
482
484
|
},
|
|
483
485
|
});
|
|
484
|
-
ROUTES.set('
|
|
486
|
+
ROUTES.set('kolibri/basic', {
|
|
485
487
|
snapshot: {
|
|
486
488
|
skip: true,
|
|
489
|
+
zoom: {
|
|
490
|
+
skip: true,
|
|
491
|
+
},
|
|
487
492
|
},
|
|
488
493
|
});
|
|
489
|
-
ROUTES.set('link-
|
|
490
|
-
snapshot: {
|
|
491
|
-
skip: true,
|
|
492
|
-
},
|
|
493
|
-
});
|
|
494
|
-
ROUTES.set('link-group/horizontal', {
|
|
494
|
+
ROUTES.set('link-button/basic', {
|
|
495
495
|
snapshot: {
|
|
496
496
|
skip: true,
|
|
497
497
|
},
|
|
@@ -946,7 +946,7 @@ ROUTES.set('toast/basic?type=error&variant=msg', {
|
|
|
946
946
|
ROUTES.set('toolbar/basic', {
|
|
947
947
|
snapshot: {
|
|
948
948
|
viewportSize: {
|
|
949
|
-
width:
|
|
949
|
+
width: 600,
|
|
950
950
|
height: 100,
|
|
951
951
|
},
|
|
952
952
|
zoom: {
|
|
@@ -982,7 +982,7 @@ ROUTES.set('tree/basic/home', {
|
|
|
982
982
|
ROUTES.set('version/basic', {
|
|
983
983
|
snapshot: {
|
|
984
984
|
viewportSize: {
|
|
985
|
-
width:
|
|
985
|
+
width: 150,
|
|
986
986
|
height: 100,
|
|
987
987
|
},
|
|
988
988
|
zoom: {
|