@public-ui/visual-tests 3.0.1-rc.0 → 3.0.2-6ae0104cda0b7b19a5b0d6bbc5f990b9fe544fa0.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 +4 -0
- package/package.json +8 -8
- package/src/index.js +8 -1
- package/tests/axe-snapshots.spec.js +3 -2
- package/tests/sample-app.routes.js +22 -0
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# KoliBri - Visual Tests
|
|
2
2
|
|
|
3
|
+
Utilities for screenshot based regression testing of KoliBri themes.
|
|
4
|
+
|
|
3
5
|
[](https://www.npmjs.com/package/@public-ui/components)
|
|
4
6
|
[](https://github.com/public-ui/kolibri/blob/main/LICENSE)
|
|
5
7
|
[](https://www.npmjs.com/package/@public-ui/visual-tests)
|
|
@@ -59,3 +61,5 @@ Run the tests with `npm test`. The first time, this will create a new folder `sn
|
|
|
59
61
|
In the following runs, new screenshots will be compared to this reference.
|
|
60
62
|
|
|
61
63
|
To update the reference screenshots call `npm run test-update`.
|
|
64
|
+
|
|
65
|
+
For details on theming see the [default theme README](../../themes/default/README.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@public-ui/visual-tests",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2-6ae0104cda0b7b19a5b0d6bbc5f990b9fe544fa0.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
|
-
"portfinder": "1.0.
|
|
30
|
+
"portfinder": "1.0.37",
|
|
31
31
|
"serve": "14.2.4",
|
|
32
|
-
"@public-ui/sample-react": "3.0.
|
|
32
|
+
"@public-ui/sample-react": "3.0.2-6ae0104cda0b7b19a5b0d6bbc5f990b9fe544fa0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@babel/eslint-parser": "7.
|
|
36
|
-
"@babel/plugin-syntax-import-attributes": "7.
|
|
37
|
-
"@babel/preset-env": "7.
|
|
35
|
+
"@babel/eslint-parser": "7.27.5",
|
|
36
|
+
"@babel/plugin-syntax-import-attributes": "7.27.1",
|
|
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": [
|
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 () => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { test } from '@playwright/test';
|
|
2
2
|
import { checkA11y, injectAxe } from 'axe-playwright';
|
|
3
3
|
import { ROUTES } from './sample-app.routes.js';
|
|
4
|
+
import process from 'process';
|
|
4
5
|
|
|
5
6
|
const themeName = (process.env.THEME_EXPORT || 'default').toLocaleLowerCase();
|
|
6
7
|
const rename = (snapshotName) => {
|
|
@@ -38,7 +39,7 @@ test.use({
|
|
|
38
39
|
|
|
39
40
|
ROUTES.forEach((options, route) => {
|
|
40
41
|
// Skip unnecessary axe tests
|
|
41
|
-
if (options?.axe?.skip === true) {
|
|
42
|
+
if (options?.axe?.skip === true || process.argv.includes('--update-snapshots')) {
|
|
42
43
|
return;
|
|
43
44
|
}
|
|
44
45
|
test(`snapshot for ${route}`, async ({ page }, testInfo) => {
|
|
@@ -82,7 +83,7 @@ ROUTES.forEach((options, route) => {
|
|
|
82
83
|
{
|
|
83
84
|
outputDirPath: outputPath.replace(/\/[^/]+$/, ''),
|
|
84
85
|
outputDir: `axe-${themeName}`,
|
|
85
|
-
reportFileName: `${route.replace(
|
|
86
|
+
reportFileName: `${route.replace(/[/?]/g, '-')}.html`,
|
|
86
87
|
},
|
|
87
88
|
);
|
|
88
89
|
});
|
|
@@ -213,6 +213,17 @@ ROUTES.set('drawer/basic?align=bottom', {
|
|
|
213
213
|
},
|
|
214
214
|
},
|
|
215
215
|
});
|
|
216
|
+
ROUTES.set('drawer/basic?align=left&closer=true', {
|
|
217
|
+
snapshot: {
|
|
218
|
+
viewportSize: {
|
|
219
|
+
width: 600,
|
|
220
|
+
height: 400,
|
|
221
|
+
},
|
|
222
|
+
zoom: {
|
|
223
|
+
skip: true,
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
});
|
|
216
227
|
ROUTES.set('form/basic', {
|
|
217
228
|
snapshot: {
|
|
218
229
|
skip: true,
|
|
@@ -251,6 +262,7 @@ ROUTES.set('heading/basic', {
|
|
|
251
262
|
},
|
|
252
263
|
},
|
|
253
264
|
});
|
|
265
|
+
ROUTES.set('heading/secondary');
|
|
254
266
|
ROUTES.set('heading/paragraph', {
|
|
255
267
|
snapshot: {
|
|
256
268
|
skip: true,
|
|
@@ -739,6 +751,16 @@ ROUTES.set('tabs/basic', {
|
|
|
739
751
|
},
|
|
740
752
|
},
|
|
741
753
|
});
|
|
754
|
+
ROUTES.set('tabs/create-button', {
|
|
755
|
+
axe: {
|
|
756
|
+
skipFailures: true,
|
|
757
|
+
},
|
|
758
|
+
snapshot: {
|
|
759
|
+
zoom: {
|
|
760
|
+
skip: true,
|
|
761
|
+
},
|
|
762
|
+
},
|
|
763
|
+
});
|
|
742
764
|
ROUTES.set('tabs/icons-only', {
|
|
743
765
|
snapshot: {
|
|
744
766
|
viewportSize: {
|