@argos-ci/playwright 1.0.1 → 1.1.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 +2 -1
- package/dist/reporter.mjs +18 -2
- package/package.json +5 -5
package/dist/reporter.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ type ArgosReporterOptions = Omit<UploadParameters, "files" | "root">;
|
|
|
5
5
|
declare class ArgosReporter implements Reporter {
|
|
6
6
|
uploadDir: string;
|
|
7
7
|
config: ArgosReporterOptions;
|
|
8
|
+
playwrightConfig: FullConfig;
|
|
8
9
|
constructor(config: ArgosReporterOptions);
|
|
9
10
|
writeFile(path: string, body: Buffer | string): Promise<void>;
|
|
10
|
-
onBegin(
|
|
11
|
+
onBegin(config: FullConfig, _suite: Suite): Promise<void>;
|
|
11
12
|
onTestEnd(test: TestCase, result: TestResult): Promise<void>;
|
|
12
13
|
onEnd(_result: FullResult): Promise<{
|
|
13
14
|
status: "failed";
|
package/dist/reporter.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { upload } from '@argos-ci/core';
|
|
1
|
+
import { upload, readConfig } from '@argos-ci/core';
|
|
2
2
|
import { randomBytes } from 'node:crypto';
|
|
3
3
|
import { mkdir, writeFile, copyFile } from 'node:fs/promises';
|
|
4
4
|
import { tmpdir } from 'node:os';
|
|
@@ -96,9 +96,22 @@ async function createTempDirectory() {
|
|
|
96
96
|
});
|
|
97
97
|
return path;
|
|
98
98
|
}
|
|
99
|
+
const getParallelFromConfig = (config)=>{
|
|
100
|
+
if (!config.shard) return null;
|
|
101
|
+
if (config.shard.total === 1) return null;
|
|
102
|
+
const argosConfig = readConfig();
|
|
103
|
+
if (!argosConfig.parallelNonce) {
|
|
104
|
+
throw new Error("Playwright shard mode detected. Please specify ARGOS_PARALLEL_NONCE env variable. Read https://argos-ci.com/docs/parallel-testing");
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
total: config.shard.total,
|
|
108
|
+
nonce: argosConfig.parallelNonce
|
|
109
|
+
};
|
|
110
|
+
};
|
|
99
111
|
class ArgosReporter {
|
|
100
112
|
uploadDir;
|
|
101
113
|
config;
|
|
114
|
+
playwrightConfig;
|
|
102
115
|
constructor(config){
|
|
103
116
|
this.config = config;
|
|
104
117
|
}
|
|
@@ -111,7 +124,8 @@ class ArgosReporter {
|
|
|
111
124
|
}
|
|
112
125
|
await writeFile(path, body);
|
|
113
126
|
}
|
|
114
|
-
async onBegin(
|
|
127
|
+
async onBegin(config, _suite) {
|
|
128
|
+
this.playwrightConfig = config;
|
|
115
129
|
this.uploadDir = await createTempDirectory();
|
|
116
130
|
}
|
|
117
131
|
async onTestEnd(test, result) {
|
|
@@ -137,12 +151,14 @@ class ArgosReporter {
|
|
|
137
151
|
}));
|
|
138
152
|
}
|
|
139
153
|
async onEnd(_result) {
|
|
154
|
+
const parallel = getParallelFromConfig(this.playwrightConfig);
|
|
140
155
|
try {
|
|
141
156
|
await upload({
|
|
142
157
|
files: [
|
|
143
158
|
"**/*.png"
|
|
144
159
|
],
|
|
145
160
|
root: this.uploadDir,
|
|
161
|
+
parallel: parallel ?? undefined,
|
|
146
162
|
...this.config
|
|
147
163
|
});
|
|
148
164
|
} catch (error) {
|
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.0
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@argos-ci/browser": "1.0.0",
|
|
46
|
-
"@argos-ci/core": "1.
|
|
46
|
+
"@argos-ci/core": "1.1.0",
|
|
47
47
|
"@argos-ci/util": "1.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@argos-ci/cli": "1.0.
|
|
50
|
+
"@argos-ci/cli": "1.0.1",
|
|
51
51
|
"@argos-ci/playwright": "workspace:.",
|
|
52
52
|
"@playwright/test": "^1.38.1",
|
|
53
53
|
"@types/node": "^16.0.0"
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"scripts": {
|
|
56
56
|
"prebuild": "rm -rf dist",
|
|
57
57
|
"build": "rollup -c",
|
|
58
|
-
"test": "pnpm exec playwright test",
|
|
58
|
+
"test": "pnpm exec playwright test --shard=2/4",
|
|
59
59
|
"e2e": "WITH_ARGOS_REPORTER=true pnpm run test"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "08246344886ff258fab097c370b4ff29cb1121b0"
|
|
62
62
|
}
|