@iqual/playwright-vrt 0.1.3 → 0.1.5
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/dist/tests/vrt.spec.js +10 -2
- package/package.json +1 -1
package/dist/tests/vrt.spec.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { test, expect } from '@playwright/test';
|
|
2
2
|
import { readFileSync, existsSync } from 'fs';
|
|
3
|
-
import { join } from 'path';
|
|
3
|
+
import { join, dirname } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
|
|
6
|
+
// ESM equivalent of __dirname
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = dirname(__filename);
|
|
4
9
|
|
|
5
10
|
// Load URLs from playwright-snapshots/ (shared with snapshots for easy caching)
|
|
6
11
|
const urlsPath = join(process.cwd(), 'playwright-snapshots', 'urls.json');
|
|
7
12
|
|
|
13
|
+
// CSS file is in the same directory as this test file
|
|
14
|
+
const stylePath = join(__dirname, 'vrt.css');
|
|
15
|
+
|
|
8
16
|
if (!existsSync(urlsPath)) {
|
|
9
17
|
throw new Error(`URLs file not found at ${urlsPath}. Did you run URL collection?`);
|
|
10
18
|
}
|
|
@@ -47,7 +55,7 @@ for (const url of urls) {
|
|
|
47
55
|
maxDiffPixels: threshold.maxDiffPixels,
|
|
48
56
|
maxDiffPixelRatio: threshold.maxDiffPixelRatio,
|
|
49
57
|
animations: 'disabled',
|
|
50
|
-
stylePath:
|
|
58
|
+
stylePath: stylePath,
|
|
51
59
|
timeout: 10000
|
|
52
60
|
});
|
|
53
61
|
});
|