@flakiness/playwright 1.3.3 → 1.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/README.md
CHANGED
|
@@ -17,6 +17,7 @@ A custom Playwright test reporter that generates Flakiness Reports from your Pla
|
|
|
17
17
|
- [CI Integration](#ci-integration)
|
|
18
18
|
- [Configuration Options](#configuration-options)
|
|
19
19
|
- [`flakinessProject?: string`](#flakinessproject-string)
|
|
20
|
+
- [`title?: string`](#title-string)
|
|
20
21
|
- [`endpoint?: string`](#endpoint-string)
|
|
21
22
|
- [`token?: string`](#token-string)
|
|
22
23
|
- [`outputFolder?: string`](#outputfolder-string)
|
|
@@ -145,6 +146,16 @@ reporter: [
|
|
|
145
146
|
]
|
|
146
147
|
```
|
|
147
148
|
|
|
149
|
+
### `title?: string`
|
|
150
|
+
|
|
151
|
+
Optional human-readable report title. Typically used to name a CI run, matrix shard, or other execution group. Defaults to the `FLAKINESS_TITLE` environment variable if set, or is auto-detected from the CI environment (e.g. GitHub Actions workflow name).
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
reporter: [
|
|
155
|
+
['@flakiness/playwright', { title: 'Shard 1/4 — Linux Chrome' }]
|
|
156
|
+
]
|
|
157
|
+
```
|
|
158
|
+
|
|
148
159
|
### `endpoint?: string`
|
|
149
160
|
|
|
150
161
|
Custom Flakiness.io endpoint URL for uploading reports. Defaults to the `FLAKINESS_ENDPOINT` environment variable, or `https://flakiness.io` if not set.
|
|
@@ -222,6 +233,7 @@ The reporter respects the following environment variables:
|
|
|
222
233
|
- **`FLAKINESS_ACCESS_TOKEN`**: Access token for Flakiness.io uploads (equivalent to `token` option)
|
|
223
234
|
- **`FLAKINESS_ENDPOINT`**: Custom Flakiness.io endpoint URL (equivalent to `endpoint` option)
|
|
224
235
|
- **`FLAKINESS_OUTPUT_DIR`**: Output directory for reports (equivalent to `outputFolder` option)
|
|
236
|
+
- **`FLAKINESS_TITLE`**: Report title (equivalent to `title` option)
|
|
225
237
|
- **`FLAKINESS_DISABLE_UPLOAD`**: When set, disables report upload (equivalent to `disableUpload` option)
|
|
226
238
|
|
|
227
239
|
|
|
@@ -237,6 +249,7 @@ export default defineConfig({
|
|
|
237
249
|
reporter: [
|
|
238
250
|
['@flakiness/playwright', {
|
|
239
251
|
flakinessProject: 'my-org/my-project',
|
|
252
|
+
title: 'My Test Run',
|
|
240
253
|
endpoint: process.env.FLAKINESS_ENDPOINT,
|
|
241
254
|
token: process.env.FLAKINESS_ACCESS_TOKEN,
|
|
242
255
|
outputFolder: './flakiness-report',
|
|
@@ -248,4 +261,3 @@ export default defineConfig({
|
|
|
248
261
|
// ... rest of your config
|
|
249
262
|
});
|
|
250
263
|
```
|
|
251
|
-
|
package/lib/playwright-test.js
CHANGED
|
@@ -3,16 +3,18 @@ import {
|
|
|
3
3
|
GitWorktree,
|
|
4
4
|
ReportUtils,
|
|
5
5
|
showReport,
|
|
6
|
+
showReportCommand,
|
|
6
7
|
CPUUtilization,
|
|
7
8
|
RAMUtilization,
|
|
8
9
|
uploadReport,
|
|
9
10
|
writeReport
|
|
10
11
|
} from "@flakiness/sdk";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
const
|
|
15
|
-
const
|
|
12
|
+
import fs from "node:fs";
|
|
13
|
+
import path from "node:path";
|
|
14
|
+
import * as nodeUtil from "node:util";
|
|
15
|
+
const styleText = (format, text) => nodeUtil.styleText?.(format, text) ?? text;
|
|
16
|
+
const warn = (txt) => console.warn(styleText("yellow", `[flakiness.io] ${txt}`));
|
|
17
|
+
const err = (txt) => console.error(styleText("red", `[flakiness.io] ${txt}`));
|
|
16
18
|
const log = (txt) => console.log(`[flakiness.io] ${txt}`);
|
|
17
19
|
function parseDurationMS(value) {
|
|
18
20
|
if (isNaN(value))
|
|
@@ -228,8 +230,10 @@ class FlakinessReporter {
|
|
|
228
230
|
const environments = [...environmentsMap.values()];
|
|
229
231
|
for (let envIdx = 0; envIdx < environments.length; ++envIdx)
|
|
230
232
|
context.project2environmentIdx.set(this._config.projects[envIdx], envIdx);
|
|
233
|
+
const title = this._options.title ?? process.env.FLAKINESS_TITLE ?? CIUtils.runTitle();
|
|
231
234
|
const report = ReportUtils.normalizeReport({
|
|
232
235
|
flakinessProject: this._options.flakinessProject,
|
|
236
|
+
title,
|
|
233
237
|
category: "playwright",
|
|
234
238
|
commitId,
|
|
235
239
|
relatedCommitIds: [],
|
|
@@ -265,12 +269,11 @@ class FlakinessReporter {
|
|
|
265
269
|
if (shouldOpen) {
|
|
266
270
|
await showReport(this._outputFolder);
|
|
267
271
|
} else {
|
|
268
|
-
const
|
|
269
|
-
const folder = defaultOutputFolder === this._outputFolder ? "" : path.relative(process.cwd(), this._outputFolder);
|
|
272
|
+
const command = showReportCommand(this._outputFolder);
|
|
270
273
|
console.log(`
|
|
271
274
|
To open last Flakiness report, run:
|
|
272
275
|
|
|
273
|
-
${
|
|
276
|
+
${styleText("cyan", command)}
|
|
274
277
|
`);
|
|
275
278
|
}
|
|
276
279
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flakiness/playwright",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,9 +37,8 @@
|
|
|
37
37
|
"typescript": "^5.9.3"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@flakiness/flakiness-report": "^0.
|
|
41
|
-
"@flakiness/sdk": "2.
|
|
42
|
-
"chalk": "^5.6.2"
|
|
40
|
+
"@flakiness/flakiness-report": "^0.29.0",
|
|
41
|
+
"@flakiness/sdk": "2.5.0"
|
|
43
42
|
},
|
|
44
43
|
"scripts": {
|
|
45
44
|
"build": "kubik build.mts",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright-test.d.ts","sourceRoot":"","sources":["../../src/playwright-test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playwright-test.d.ts","sourceRoot":"","sources":["../../src/playwright-test.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,UAAU,EAEV,UAAU,EAEV,QAAQ,EACR,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAEvC,MAAM,2BAA2B,CAAC;AAgCnC,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,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,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;QACjC,aAAa,CAAC,EAAE,OAAO,CAAC;KACpB;IAON,OAAO,CAAC,aAAa;IAMrB,aAAa,IAAI,OAAO;IAIxB,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK;IAKxC,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAI/B,WAAW,CAAC,IAAI,EAAE,QAAQ;IAG1B,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;YAM9B,WAAW;YAsBX,SAAS;YAWT,eAAe;IAmD7B,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,cAAc;IAUhB,KAAK,CAAC,MAAM,EAAE,UAAU;IAoGxB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CA4B9B"}
|