@argos-ci/playwright 3.6.3 → 3.7.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 -0
- package/dist/index.mjs +5 -5
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,11 @@ type ArgosScreenshotOptions = {
|
|
|
27
27
|
* @default 0.5
|
|
28
28
|
*/
|
|
29
29
|
threshold?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Folder where the screenshots will be saved if not using the Argos reporter.
|
|
32
|
+
* @default "./screenshots"
|
|
33
|
+
*/
|
|
34
|
+
root?: string;
|
|
30
35
|
} & LocatorOptions & ScreenshotOptions<LocatorScreenshotOptions> & ScreenshotOptions<PageScreenshotOptions>;
|
|
31
36
|
/**
|
|
32
37
|
* Stabilize the UI and takes a screenshot of the application under test.
|
package/dist/index.mjs
CHANGED
|
@@ -77,7 +77,7 @@ function checkIsUsingArgosReporter(testInfo) {
|
|
|
77
77
|
return testInfo.config.reporter.some((reporter)=>reporter[0].includes("@argos-ci/playwright/reporter") || reporter[0] === reporterPath);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
const
|
|
80
|
+
const DEFAULT_SCREENSHOT_ROOT = "./screenshots";
|
|
81
81
|
/**
|
|
82
82
|
* Inject Argos script into the page.
|
|
83
83
|
*/ async function injectArgos(page) {
|
|
@@ -172,7 +172,7 @@ function getViewportSize(page) {
|
|
|
172
172
|
*/ name, /**
|
|
173
173
|
* Options for the screenshot.
|
|
174
174
|
*/ options = {}) {
|
|
175
|
-
const { element, has, hasText, viewports, argosCSS, ...playwrightOptions } = options;
|
|
175
|
+
const { element, has, hasText, viewports, argosCSS, root = DEFAULT_SCREENSHOT_ROOT, ...playwrightOptions } = options;
|
|
176
176
|
if (!page) {
|
|
177
177
|
throw new Error("A Playwright `page` object is required.");
|
|
178
178
|
}
|
|
@@ -187,7 +187,7 @@ function getViewportSize(page) {
|
|
|
187
187
|
const useArgosReporter = Boolean(testInfo && checkIsUsingArgosReporter(testInfo));
|
|
188
188
|
await Promise.all([
|
|
189
189
|
// Create the screenshot folder if it doesn't exist
|
|
190
|
-
useArgosReporter ? null : mkdir(
|
|
190
|
+
useArgosReporter ? null : mkdir(root, {
|
|
191
191
|
recursive: true
|
|
192
192
|
}),
|
|
193
193
|
// Inject Argos script into the page
|
|
@@ -236,9 +236,9 @@ function getViewportSize(page) {
|
|
|
236
236
|
if (names.baseName) {
|
|
237
237
|
metadata.transient.baseName = `${names.baseName}.png`;
|
|
238
238
|
}
|
|
239
|
-
const screenshotPath = useArgosReporter && testInfo ? testInfo.outputPath("argos", `${names.name}.png`) : resolve(
|
|
239
|
+
const screenshotPath = useArgosReporter && testInfo ? testInfo.outputPath("argos", `${names.name}.png`) : resolve(root, `${names.name}.png`);
|
|
240
240
|
const dir = dirname(screenshotPath);
|
|
241
|
-
if (dir !==
|
|
241
|
+
if (dir !== root) {
|
|
242
242
|
await mkdir(dirname(screenshotPath), {
|
|
243
243
|
recursive: true
|
|
244
244
|
});
|
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.7.0",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@argos-ci/browser": "2.1.4",
|
|
46
|
-
"@argos-ci/core": "2.
|
|
46
|
+
"@argos-ci/core": "2.9.0",
|
|
47
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.4.
|
|
52
|
+
"@argos-ci/cli": "2.4.5",
|
|
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": "cae12b0cb7d4e9237cf5973d7911af68bc708773"
|
|
65
65
|
}
|