@public-ui/visual-tests 2.1.7-rc.1 → 2.1.7-rc.2
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/package.json +4 -3
- package/playwright.config.js +3 -2
- package/src/index.js +17 -10
- package/tests/sample-app.routes.js +26 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@public-ui/visual-tests",
|
|
3
|
-
"version": "2.1.7-rc.
|
|
3
|
+
"version": "2.1.7-rc.2",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"homepage": "https://public-ui.github.io",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"axe-playwright": "2.0.1",
|
|
27
27
|
"portfinder": "1.0.32",
|
|
28
28
|
"serve": "14.2.3",
|
|
29
|
-
"@public-ui/sample-react": "2.1.7-rc.
|
|
29
|
+
"@public-ui/sample-react": "2.1.7-rc.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/eslint-parser": "7.25.1",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"scripts": {
|
|
46
46
|
"format": "prettier --check src",
|
|
47
47
|
"lint": "eslint src",
|
|
48
|
-
"unused": "knip"
|
|
48
|
+
"unused": "knip",
|
|
49
|
+
"postinstall": "pnpm exec playwright install"
|
|
49
50
|
}
|
|
50
51
|
}
|
package/playwright.config.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as path from 'path';
|
|
|
3
3
|
import * as process from 'process';
|
|
4
4
|
|
|
5
5
|
const PORT = Number(process.env.KOLIBRI_VISUAL_TEST_PORT);
|
|
6
|
-
const URL = `http://
|
|
6
|
+
const URL = `http://localhost:${PORT}`;
|
|
7
7
|
|
|
8
8
|
console.log('Serving React Sample app:', URL);
|
|
9
9
|
|
|
@@ -52,7 +52,8 @@ export default defineConfig({
|
|
|
52
52
|
|
|
53
53
|
/* Run your local dev server before starting the tests */
|
|
54
54
|
webServer: {
|
|
55
|
-
command: `serve
|
|
55
|
+
command: `npx serve -p ${PORT}`,
|
|
56
|
+
cwd: path.resolve(process.env.KOLIBRI_VISUAL_TESTS_BUILD_PATH),
|
|
56
57
|
url: URL,
|
|
57
58
|
reuseExistingServer: false,
|
|
58
59
|
},
|
package/src/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import child_process from 'node:child_process';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from 'url';
|
|
4
4
|
import * as crypto from 'crypto';
|
|
5
5
|
import * as fs from 'fs';
|
|
6
6
|
import portfinder from 'portfinder';
|
|
7
7
|
import * as process from 'process';
|
|
8
8
|
|
|
9
|
-
process.env.KOLIBRI_CWD = process.cwd();
|
|
10
9
|
const tempDir = process.env.RUNNER_TEMP || process.env.TMPDIR; // TODO: Check on Windows
|
|
11
10
|
|
|
12
11
|
if (!process.env.THEME_MODULE) {
|
|
@@ -34,26 +33,34 @@ if (!fs.existsSync(workingDir)) {
|
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
const buildPath = path.join(tempDir, `kolibri-visual-testing-build-${crypto.randomUUID()}`);
|
|
37
|
-
const
|
|
36
|
+
const rawPackageJsonPath = new URL(path.join(workingDir, 'package.json'), import.meta.url).href;
|
|
37
|
+
const packageJsonPath = process.platform === 'win32' ? pathToFileURL(rawPackageJsonPath) : rawPackageJsonPath;
|
|
38
|
+
const packageJson = await import(packageJsonPath, {
|
|
38
39
|
assert: { type: 'json' },
|
|
39
40
|
});
|
|
40
41
|
|
|
41
|
-
process.env.KOLIBRI_VISUAL_TESTS_BUILD_PATH = buildPath;
|
|
42
|
-
|
|
43
42
|
console.log(`
|
|
44
|
-
Building React Sample App (v${
|
|
45
|
-
|
|
43
|
+
Building React Sample App (v${packageJson?.default?.version ?? '#.#.#'}) …`);
|
|
44
|
+
|
|
45
|
+
child_process.spawnSync('pnpm', ['run', 'build', '--', `--output-path="${buildPath}"`], {
|
|
46
46
|
cwd: workingDir,
|
|
47
47
|
encoding: 'utf-8',
|
|
48
|
+
shell: true,
|
|
48
49
|
});
|
|
49
50
|
|
|
50
51
|
console.log(`React Sample App build finished. Directory:`, buildPath);
|
|
51
52
|
|
|
52
53
|
void (async () => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const playwright = child_process.spawn(path.join(binaryPath, 'playwright'), ['test', ...process.argv.slice(2)], {
|
|
54
|
+
const playwright = child_process.spawn(`"${path.join(binaryPath, 'playwright')}"`, ['test', ...process.argv.slice(2)], {
|
|
56
55
|
cwd: visualsTestModulePath,
|
|
56
|
+
shell: true,
|
|
57
|
+
env: {
|
|
58
|
+
...process.env,
|
|
59
|
+
KOLIBRI_CWD: process.cwd(),
|
|
60
|
+
KOLIBRI_VISUAL_TESTS_BUILD_PATH: buildPath,
|
|
61
|
+
KOLIBRI_VISUAL_TEST_PORT: String(await portfinder.getPortPromise()),
|
|
62
|
+
NO_PROXY: 'localhost',
|
|
63
|
+
},
|
|
57
64
|
});
|
|
58
65
|
|
|
59
66
|
playwright.stdout.on('data', (data) => {
|
|
@@ -287,6 +287,11 @@ ROUTES.set('spin/basic', {
|
|
|
287
287
|
skipFailures: false,
|
|
288
288
|
},
|
|
289
289
|
});
|
|
290
|
+
ROUTES.set('single-select/basic', {
|
|
291
|
+
axe: {
|
|
292
|
+
skipFailures: false,
|
|
293
|
+
},
|
|
294
|
+
});
|
|
290
295
|
ROUTES.set('spin/custom', {
|
|
291
296
|
axe: {
|
|
292
297
|
skipFailures: false,
|
|
@@ -332,6 +337,26 @@ ROUTES.set('table/complex-headers', {
|
|
|
332
337
|
skipFailures: false,
|
|
333
338
|
},
|
|
334
339
|
});
|
|
340
|
+
ROUTES.set('table/stateful-with-selection', {
|
|
341
|
+
axe: {
|
|
342
|
+
skipFailures: false,
|
|
343
|
+
},
|
|
344
|
+
});
|
|
345
|
+
ROUTES.set('table/stateful-with-single-selection', {
|
|
346
|
+
axe: {
|
|
347
|
+
skipFailures: false,
|
|
348
|
+
},
|
|
349
|
+
});
|
|
350
|
+
ROUTES.set('table/stateless-with-single-selection', {
|
|
351
|
+
axe: {
|
|
352
|
+
skipFailures: false,
|
|
353
|
+
},
|
|
354
|
+
});
|
|
355
|
+
ROUTES.set('table/stateless-with-selection', {
|
|
356
|
+
axe: {
|
|
357
|
+
skipFailures: false,
|
|
358
|
+
},
|
|
359
|
+
});
|
|
335
360
|
ROUTES.set('table/stateless', {
|
|
336
361
|
axe: {
|
|
337
362
|
skipFailures: false,
|
|
@@ -435,4 +460,5 @@ ROUTES.set('scenarios/focus-elements?component=link');
|
|
|
435
460
|
ROUTES.set('scenarios/focus-elements?component=linkButton');
|
|
436
461
|
ROUTES.set('scenarios/focus-elements?component=select');
|
|
437
462
|
ROUTES.set('scenarios/focus-elements?component=selectMultiple');
|
|
463
|
+
ROUTES.set('scenarios/focus-elements?component=singleSelect');
|
|
438
464
|
ROUTES.set('scenarios/focus-elements?component=textarea');
|