@public-ui/visual-tests 2.2.11 → 2.2.13-41ee611a95447f6b98a9420d37280eb13f78bd4c.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 +9 -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-41ee611a95447f6b98a9420d37280eb13f78bd4c.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-41ee611a95447f6b98a9420d37280eb13f78bd4c.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,
|
|
@@ -256,6 +251,7 @@ ROUTES.set('heading/basic', {
|
|
|
256
251
|
},
|
|
257
252
|
},
|
|
258
253
|
});
|
|
254
|
+
ROUTES.set('heading/secondary');
|
|
259
255
|
ROUTES.set('heading/paragraph', {
|
|
260
256
|
snapshot: {
|
|
261
257
|
skip: true,
|
|
@@ -281,7 +277,7 @@ ROUTES.set('image/basic', {
|
|
|
281
277
|
zoom: {
|
|
282
278
|
skip: true,
|
|
283
279
|
},
|
|
284
|
-
},
|
|
280
|
+
},
|
|
285
281
|
});
|
|
286
282
|
ROUTES.set('indented-text/basic', {
|
|
287
283
|
snapshot: {
|
|
@@ -471,9 +467,6 @@ ROUTES.set('input-text/basic', {
|
|
|
471
467
|
},
|
|
472
468
|
});
|
|
473
469
|
ROUTES.set('input-text/focus', {
|
|
474
|
-
|
|
475
|
-
});
|
|
476
|
-
ROUTES.set('kolibri/basic', {
|
|
477
470
|
snapshot: {
|
|
478
471
|
skip: true,
|
|
479
472
|
zoom: {
|
|
@@ -481,17 +474,15 @@ ROUTES.set('kolibri/basic', {
|
|
|
481
474
|
},
|
|
482
475
|
},
|
|
483
476
|
});
|
|
484
|
-
ROUTES.set('
|
|
477
|
+
ROUTES.set('kolibri/basic', {
|
|
485
478
|
snapshot: {
|
|
486
479
|
skip: true,
|
|
480
|
+
zoom: {
|
|
481
|
+
skip: true,
|
|
482
|
+
},
|
|
487
483
|
},
|
|
488
484
|
});
|
|
489
|
-
ROUTES.set('link-
|
|
490
|
-
snapshot: {
|
|
491
|
-
skip: true,
|
|
492
|
-
},
|
|
493
|
-
});
|
|
494
|
-
ROUTES.set('link-group/horizontal', {
|
|
485
|
+
ROUTES.set('link-button/basic', {
|
|
495
486
|
snapshot: {
|
|
496
487
|
skip: true,
|
|
497
488
|
},
|
|
@@ -946,7 +937,7 @@ ROUTES.set('toast/basic?type=error&variant=msg', {
|
|
|
946
937
|
ROUTES.set('toolbar/basic', {
|
|
947
938
|
snapshot: {
|
|
948
939
|
viewportSize: {
|
|
949
|
-
width:
|
|
940
|
+
width: 600,
|
|
950
941
|
height: 100,
|
|
951
942
|
},
|
|
952
943
|
zoom: {
|
|
@@ -982,7 +973,7 @@ ROUTES.set('tree/basic/home', {
|
|
|
982
973
|
ROUTES.set('version/basic', {
|
|
983
974
|
snapshot: {
|
|
984
975
|
viewportSize: {
|
|
985
|
-
width:
|
|
976
|
+
width: 150,
|
|
986
977
|
height: 100,
|
|
987
978
|
},
|
|
988
979
|
zoom: {
|