@argos-ci/playwright 3.4.2-alpha.7 → 3.5.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/dist/index.d.ts +5 -1
- package/dist/index.mjs +13 -5
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -48,4 +48,8 @@ name: string,
|
|
|
48
48
|
* Options for the screenshot.
|
|
49
49
|
*/
|
|
50
50
|
options?: ArgosScreenshotOptions): Promise<void>;
|
|
51
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Get the CSP script hash.
|
|
53
|
+
*/
|
|
54
|
+
declare function getCSPScriptHash(): string;
|
|
55
|
+
export { ArgosScreenshotOptions, argosScreenshot, getCSPScriptHash };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mkdir } from 'node:fs/promises';
|
|
2
2
|
import { relative, resolve, dirname } from 'node:path';
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
3
4
|
import { resolveViewport, getGlobalScript } from '@argos-ci/browser';
|
|
4
5
|
import { getGitRepositoryPath, readVersionFromPackage, getScreenshotName, validateThreshold, writeMetadata, getMetadataPath } from '@argos-ci/util';
|
|
5
6
|
import { createRequire } from 'node:module';
|
|
@@ -81,10 +82,11 @@ const screenshotFolder = "./screenshots";
|
|
|
81
82
|
* Inject Argos script into the page.
|
|
82
83
|
*/ async function injectArgos(page) {
|
|
83
84
|
const injected = await page.evaluate(()=>typeof window.__ARGOS__ !== "undefined");
|
|
84
|
-
if (injected)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
if (!injected) {
|
|
86
|
+
await page.addScriptTag({
|
|
87
|
+
content: getGlobalScript()
|
|
88
|
+
});
|
|
89
|
+
}
|
|
88
90
|
}
|
|
89
91
|
async function getTestInfo() {
|
|
90
92
|
try {
|
|
@@ -274,5 +276,11 @@ function getViewportSize(page) {
|
|
|
274
276
|
}
|
|
275
277
|
await teardown();
|
|
276
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* Get the CSP script hash.
|
|
281
|
+
*/ function getCSPScriptHash() {
|
|
282
|
+
const hash = createHash("sha256").update(getGlobalScript()).digest("base64");
|
|
283
|
+
return `'sha256-${hash}'`;
|
|
284
|
+
}
|
|
277
285
|
|
|
278
|
-
export { argosScreenshot };
|
|
286
|
+
export { argosScreenshot, getCSPScriptHash };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/playwright",
|
|
3
3
|
"description": "Visual testing solution to avoid visual regression. Playwright commands and utilities for Argos visual testing.",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.5.0",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"node": ">=18.0.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@argos-ci/browser": "2.1.3
|
|
46
|
-
"@argos-ci/core": "2.
|
|
47
|
-
"@argos-ci/util": "2.1.1
|
|
45
|
+
"@argos-ci/browser": "2.1.3",
|
|
46
|
+
"@argos-ci/core": "2.5.0",
|
|
47
|
+
"@argos-ci/util": "2.1.1",
|
|
48
48
|
"chalk": "^5.3.0",
|
|
49
49
|
"debug": "^4.3.6"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@argos-ci/cli": "2.3.2
|
|
52
|
+
"@argos-ci/cli": "2.3.2",
|
|
53
53
|
"@argos-ci/playwright": "workspace:.",
|
|
54
54
|
"@playwright/test": "^1.46.1",
|
|
55
55
|
"@types/debug": "^4.1.12",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"test": "pnpm exec -- playwright test",
|
|
62
62
|
"e2e": "UPLOAD_TO_ARGOS=true pnpm run test"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "7043d16620c7941f85e20ddf8135f72fb61bb42d"
|
|
65
65
|
}
|