@flakiness/playwright 1.3.2 → 1.3.3
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/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
[](https://flakiness.io/flakiness/playwright)
|
|
2
|
+
|
|
1
3
|
# Flakiness.io Playwright Reporter
|
|
2
4
|
|
|
3
5
|
A custom Playwright test reporter that generates Flakiness Reports from your Playwright test runs. The reporter automatically converts Playwright test results into the standardized [Flakiness JSON format](https://github.com/flakiness/flakiness-report), capturing test outcomes, attachments, system utilization, and environment information.
|
|
@@ -20,6 +22,7 @@ A custom Playwright test reporter that generates Flakiness Reports from your Pla
|
|
|
20
22
|
- [`outputFolder?: string`](#outputfolder-string)
|
|
21
23
|
- [`open?: 'always' | 'never' | 'on-failure'`](#open-always--never--on-failure)
|
|
22
24
|
- [`collectBrowserVersions?: boolean`](#collectbrowserversions-boolean)
|
|
25
|
+
- [`disableUpload?: boolean`](#disableupload-boolean)
|
|
23
26
|
- [Environment Variables](#environment-variables)
|
|
24
27
|
- [Example Configuration](#example-configuration)
|
|
25
28
|
|
|
@@ -202,6 +205,16 @@ reporter: [
|
|
|
202
205
|
]
|
|
203
206
|
```
|
|
204
207
|
|
|
208
|
+
### `disableUpload?: boolean`
|
|
209
|
+
|
|
210
|
+
When set to `true`, the reporter will skip uploading the report to Flakiness.io. The report is still generated locally in the output folder. This is useful for local development or testing the reporter itself. Can also be enabled via the `FLAKINESS_DISABLE_UPLOAD` environment variable.
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
reporter: [
|
|
214
|
+
['@flakiness/playwright', { disableUpload: true }]
|
|
215
|
+
]
|
|
216
|
+
```
|
|
217
|
+
|
|
205
218
|
## Environment Variables
|
|
206
219
|
|
|
207
220
|
The reporter respects the following environment variables:
|
|
@@ -209,6 +222,7 @@ The reporter respects the following environment variables:
|
|
|
209
222
|
- **`FLAKINESS_ACCESS_TOKEN`**: Access token for Flakiness.io uploads (equivalent to `token` option)
|
|
210
223
|
- **`FLAKINESS_ENDPOINT`**: Custom Flakiness.io endpoint URL (equivalent to `endpoint` option)
|
|
211
224
|
- **`FLAKINESS_OUTPUT_DIR`**: Output directory for reports (equivalent to `outputFolder` option)
|
|
225
|
+
- **`FLAKINESS_DISABLE_UPLOAD`**: When set, disables report upload (equivalent to `disableUpload` option)
|
|
212
226
|
|
|
213
227
|
|
|
214
228
|
|
|
@@ -228,6 +242,7 @@ export default defineConfig({
|
|
|
228
242
|
outputFolder: './flakiness-report',
|
|
229
243
|
open: 'on-failure',
|
|
230
244
|
collectBrowserVersions: false,
|
|
245
|
+
disableUpload: false,
|
|
231
246
|
}]
|
|
232
247
|
],
|
|
233
248
|
// ... rest of your config
|
package/lib/playwright-test.js
CHANGED
|
@@ -27,7 +27,7 @@ async function existsAsync(aPath) {
|
|
|
27
27
|
class FlakinessReporter {
|
|
28
28
|
constructor(_options = {}) {
|
|
29
29
|
this._options = _options;
|
|
30
|
-
this._outputFolder = path.
|
|
30
|
+
this._outputFolder = path.resolve(process.cwd(), this._options.outputFolder ?? process.env.FLAKINESS_OUTPUT_DIR ?? "flakiness-report");
|
|
31
31
|
this._sampleSystem = this._sampleSystem.bind(this);
|
|
32
32
|
this._sampleSystem();
|
|
33
33
|
}
|
|
@@ -253,10 +253,13 @@ class FlakinessReporter {
|
|
|
253
253
|
async onExit() {
|
|
254
254
|
if (!this._report)
|
|
255
255
|
return;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
256
|
+
const disableUpload = this._options.disableUpload ?? envBool("FLAKINESS_DISABLE_UPLOAD");
|
|
257
|
+
if (!disableUpload) {
|
|
258
|
+
await uploadReport(this._report, this._attachments, {
|
|
259
|
+
flakinessAccessToken: this._options.token,
|
|
260
|
+
flakinessEndpoint: this._options.endpoint
|
|
261
|
+
});
|
|
262
|
+
}
|
|
260
263
|
const openMode = this._options.open ?? "on-failure";
|
|
261
264
|
const shouldOpen = process.stdin.isTTY && !process.env.CI && (openMode === "always" || openMode === "on-failure" && this._result?.status === "failed");
|
|
262
265
|
if (shouldOpen) {
|
|
@@ -272,6 +275,9 @@ To open last Flakiness report, run:
|
|
|
272
275
|
}
|
|
273
276
|
}
|
|
274
277
|
}
|
|
278
|
+
function envBool(name) {
|
|
279
|
+
return ["1", "true"].includes(process.env[name]?.toLowerCase() ?? "");
|
|
280
|
+
}
|
|
275
281
|
function toSTDIOEntry(data) {
|
|
276
282
|
if (Buffer.isBuffer(data))
|
|
277
283
|
return { buffer: data.toString("base64") };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flakiness/playwright",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"author": "Degu Labs, Inc",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"devDependencies": {
|
|
31
|
+
"@flakiness/playwright": "^1.3.2",
|
|
31
32
|
"@playwright/test": "^1.57.0",
|
|
32
33
|
"@types/node": "^25.0.3",
|
|
33
34
|
"esbuild": "^0.27.2",
|
|
@@ -36,12 +37,13 @@
|
|
|
36
37
|
"typescript": "^5.9.3"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
|
-
"@flakiness/flakiness-report": "^0.
|
|
40
|
-
"@flakiness/sdk": "2.2.
|
|
40
|
+
"@flakiness/flakiness-report": "^0.28.0",
|
|
41
|
+
"@flakiness/sdk": "2.2.2",
|
|
41
42
|
"chalk": "^5.6.2"
|
|
42
43
|
},
|
|
43
44
|
"scripts": {
|
|
44
45
|
"build": "kubik build.mts",
|
|
45
|
-
"watch": "kubik build.mts -w"
|
|
46
|
+
"watch": "kubik build.mts -w",
|
|
47
|
+
"test": "playwright test"
|
|
46
48
|
}
|
|
47
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright-test.d.ts","sourceRoot":"","sources":["../../src/playwright-test.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,UAAU,EAEV,UAAU,EAEV,QAAQ,EACR,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAEvC,MAAM,2BAA2B,CAAC;AA6BnC,KAAK,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,CAAC;AAElD,MAAM,CAAC,OAAO,OAAO,iBAAkB,YAAW,QAAQ;IAgB5C,OAAO,CAAC,QAAQ;IAf5B,OAAO,CAAC,OAAO,CAAC,CAAa;IAC7B,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,QAAQ,CAAwC;IACxD,OAAO,CAAC,mBAAmB,CAAmB;IAE9C,OAAO,CAAC,eAAe,CAAyC;IAChE,OAAO,CAAC,eAAe,CAAyC;IAChE,OAAO,CAAC,OAAO,CAAC,CAAY;IAC5B,OAAO,CAAC,YAAY,CAAgC;IACpD,OAAO,CAAC,aAAa,CAAS;IAE9B,OAAO,CAAC,OAAO,CAAC,CAAa;IAE7B,OAAO,CAAC,eAAe,CAAC,CAAiB;gBAErB,QAAQ,GAAE;QAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,IAAI,CAAC,EAAE,QAAQ,CAAC;QAChB,sBAAsB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"playwright-test.d.ts","sourceRoot":"","sources":["../../src/playwright-test.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,UAAU,EAEV,UAAU,EAEV,QAAQ,EACR,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAEvC,MAAM,2BAA2B,CAAC;AA6BnC,KAAK,Q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