@argos-ci/playwright 1.6.2 → 1.6.4-alpha.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/reporter.d.ts +1 -0
- package/dist/reporter.mjs +16 -7
- package/package.json +4 -4
package/dist/reporter.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ declare class ArgosReporter implements Reporter {
|
|
|
15
15
|
uploadToArgos: boolean;
|
|
16
16
|
constructor(config: ArgosReporterOptions);
|
|
17
17
|
writeFile(path: string, body: Buffer | string): Promise<void>;
|
|
18
|
+
copyFile(from: string, to: string): Promise<void>;
|
|
18
19
|
getAutomaticScreenshotName(test: TestCase, result: TestResult): string;
|
|
19
20
|
onBegin(config: FullConfig, _suite: Suite): Promise<void>;
|
|
20
21
|
onTestEnd(test: TestCase, result: TestResult): Promise<void>;
|
package/dist/reporter.mjs
CHANGED
|
@@ -111,10 +111,10 @@ async function createTempDirectory() {
|
|
|
111
111
|
});
|
|
112
112
|
return path;
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
async function getParallelFromConfig(config) {
|
|
115
115
|
if (!config.shard) return null;
|
|
116
116
|
if (config.shard.total === 1) return null;
|
|
117
|
-
const argosConfig = readConfig();
|
|
117
|
+
const argosConfig = await readConfig();
|
|
118
118
|
if (!argosConfig.parallelNonce) {
|
|
119
119
|
throw new Error("Playwright shard mode detected. Please specify ARGOS_PARALLEL_NONCE env variable. Read /parallel-testing");
|
|
120
120
|
}
|
|
@@ -122,7 +122,7 @@ const getParallelFromConfig = (config)=>{
|
|
|
122
122
|
total: config.shard.total,
|
|
123
123
|
nonce: argosConfig.parallelNonce
|
|
124
124
|
};
|
|
125
|
-
}
|
|
125
|
+
}
|
|
126
126
|
class ArgosReporter {
|
|
127
127
|
uploadDir;
|
|
128
128
|
config;
|
|
@@ -141,6 +141,15 @@ class ArgosReporter {
|
|
|
141
141
|
}
|
|
142
142
|
await writeFile(path, body);
|
|
143
143
|
}
|
|
144
|
+
async copyFile(from, to) {
|
|
145
|
+
const dir = dirname(to);
|
|
146
|
+
if (dir !== this.uploadDir) {
|
|
147
|
+
await mkdir(dir, {
|
|
148
|
+
recursive: true
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
await copyFile(from, to);
|
|
152
|
+
}
|
|
144
153
|
getAutomaticScreenshotName(test, result) {
|
|
145
154
|
let name = test.titlePath().join(" ");
|
|
146
155
|
name += result.retry > 0 ? ` #${result.retry + 1}` : "";
|
|
@@ -155,7 +164,7 @@ class ArgosReporter {
|
|
|
155
164
|
await Promise.all(result.attachments.map(async (attachment)=>{
|
|
156
165
|
if (checkIsArgosScreenshot(attachment) || checkIsArgosScreenshotMetadata(attachment)) {
|
|
157
166
|
const path = join(this.uploadDir, getAttachmentFilename(attachment.name));
|
|
158
|
-
await copyFile(attachment.path, path);
|
|
167
|
+
await this.copyFile(attachment.path, path);
|
|
159
168
|
return;
|
|
160
169
|
}
|
|
161
170
|
// Error screenshots are sent to Argos
|
|
@@ -166,8 +175,8 @@ class ArgosReporter {
|
|
|
166
175
|
const path = join(this.uploadDir, `${name}.png`);
|
|
167
176
|
await Promise.all([
|
|
168
177
|
this.writeFile(path + ".argos.json", JSON.stringify(metadata)),
|
|
169
|
-
copyFile(attachment.path, path),
|
|
170
|
-
trace ? copyFile(trace.path, path + ".pw-trace.zip") : null
|
|
178
|
+
this.copyFile(attachment.path, path),
|
|
179
|
+
trace ? this.copyFile(trace.path, path + ".pw-trace.zip") : null
|
|
171
180
|
]);
|
|
172
181
|
return;
|
|
173
182
|
}
|
|
@@ -175,7 +184,7 @@ class ArgosReporter {
|
|
|
175
184
|
}
|
|
176
185
|
async onEnd(_result) {
|
|
177
186
|
if (!this.uploadToArgos) return;
|
|
178
|
-
const parallel = getParallelFromConfig(this.playwrightConfig);
|
|
187
|
+
const parallel = await getParallelFromConfig(this.playwrightConfig);
|
|
179
188
|
try {
|
|
180
189
|
const res = await upload({
|
|
181
190
|
files: [
|
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": "1.6.
|
|
4
|
+
"version": "1.6.4-alpha.0+505aabe",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@argos-ci/browser": "1.3.0",
|
|
46
|
-
"@argos-ci/core": "1.4.
|
|
46
|
+
"@argos-ci/core": "1.4.2-alpha.6+505aabe",
|
|
47
47
|
"@argos-ci/util": "1.2.0",
|
|
48
48
|
"chalk": "^5.3.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@argos-ci/cli": "1.0.6",
|
|
51
|
+
"@argos-ci/cli": "1.0.7-alpha.6+505aabe",
|
|
52
52
|
"@argos-ci/playwright": "workspace:.",
|
|
53
53
|
"@playwright/test": "^1.38.1",
|
|
54
54
|
"@types/node": "^16.0.0"
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"test": "pnpm exec playwright test",
|
|
60
60
|
"e2e": "UPLOAD_TO_ARGOS=true pnpm run test"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "505aabe2ed2b8455172e9a8a473bccf683591a7c"
|
|
63
63
|
}
|