reporting-labs 0.6.20 → 0.6.22
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 +9 -2
- package/dist/cypress/index.d.ts +3 -0
- package/dist/cypress/index.js +16 -1
- package/dist/mask.js +1 -1
- package/dist/reporter.d.ts +8 -0
- package/dist/reporter.js +32 -0
- package/dist/star.d.ts +2 -0
- package/dist/star.js +64 -0
- package/dist/template.html +68 -2
- package/dist/template.js +68 -2
- package/dist/types.d.ts +10 -0
- package/dist/wdio/finalize.d.ts +2 -0
- package/dist/wdio/finalize.js +14 -1
- package/dist/write-report.d.ts +3 -1
- package/dist/write-report.js +8 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -298,6 +298,7 @@ are right; data tables and the steps left unrun need 8+.
|
|
|
298
298
|
### Overview: the whole run on one screen
|
|
299
299
|
|
|
300
300
|
- **Tiles**: pass rate with a ring and the change from the last run, then passed / failed / flaky / skipped. Click a tile to see those tests.
|
|
301
|
+
- **Since last run**: one line under the tiles with what changed against the previous run: new failures, fixed, still failing, got slower, new tests. Click a number to see those tests. **Copy re-run command** on the same line copies one command for every failed test.
|
|
301
302
|
- **Run strip**: every test as one small cell, in run order. Hover for the name, click to open.
|
|
302
303
|
- **Needs attention**: failures sorted by priority and severity, with the spec file, the owner, and whether the failure is new or has been failing for a while.
|
|
303
304
|
- **Failure clusters**: failures grouped by error message. 30 red tests with one cause read as one problem.
|
|
@@ -311,6 +312,7 @@ are right; data tables and the steps left unrun need 8+.
|
|
|
311
312
|
### Failures: everything you need to triage
|
|
312
313
|
|
|
313
314
|
- **Bug report** button on every failed test: a ready-to-paste ticket with priority, owner, story, environment, test data, steps to reproduce (taken from the test's own steps, the failing one marked), expected vs actual, the error, API calls and attachment names. Pick Markdown, Jira or plain text, edit if you like, copy or download.
|
|
315
|
+
- **Run again**: every test shows the command that runs just that test, with a Copy button, e.g. `npx playwright test tests/checkout.spec.ts:12 --project=chromium`. **Copy re-run command** on the Failures tab does the same for all failed tests at once. With playwright-bdd it runs `npx bddgen` first; Cypress and WebdriverIO re-run the spec file (`--spec`).
|
|
314
316
|
- **By owner**: who to ping, with failed and flaky counts. Click an owner to filter.
|
|
315
317
|
- **Download CSV / JSON**: all failed and flaky tests with title, spec, project, priority, owner, ticket, attempts, duration, first error line and new/known status. Ready for Jira or a sheet.
|
|
316
318
|
- **Copy summary**: a Slack or Teams message with the top failures, owners and ticket keys.
|
|
@@ -341,6 +343,7 @@ The reporter keeps a small file, `reporting-labs.history.json`, next to your con
|
|
|
341
343
|
| Did this break just now, or has it been red for days? | `new this run` or `failing since #1838` on every failure |
|
|
342
344
|
| Which tests are flaky? | Last-10-runs dots on every failure, plus the Flakiest tests card |
|
|
343
345
|
| What got slower? | Got slower tab on the Slowest card |
|
|
346
|
+
| What changed since the last run? | The Since last run line: new failures, fixed, still failing, got slower, new tests |
|
|
344
347
|
| Are we getting better or worse? | Trend chart with pass rate, fail rate and duration per run |
|
|
345
348
|
|
|
346
349
|
The first run has nothing to compare with. These cards fill in from the second run.
|
|
@@ -445,7 +448,7 @@ Every option is optional. `npx reporting-labs init` writes them all, with commen
|
|
|
445
448
|
| `jsonFile` | `'report.json'` | File name of the JSON blob |
|
|
446
449
|
| `pdf` | `true` | Also write `report.pdf` (light theme, print-ready), printed by Playwright's Chromium or an installed Chrome / Edge, whatever browser the tests ran on. `false` turns it off; `{ file: 'run.pdf' }` renames it; `{ chromePath }` (or `CHROME_PATH`) names the browser. The Export PDF button in the report works either way |
|
|
447
450
|
| `embedFonts` | `true` | Bundle the fonts (~140 KB) so it looks the same offline |
|
|
448
|
-
| `announce` | `true` | Print the report path after the run |
|
|
451
|
+
| `announce` | `true` | Print the report path after the run. On a developer's machine (never in CI) it also asks for a GitHub star, at most once a week; `REPORTING_LABS_NO_STAR=1` turns only that off |
|
|
449
452
|
| `open` | `'on-failure'` | Open the report in the browser after the run: `'on-failure'`, `'always'` or `'never'`. Never opens in CI |
|
|
450
453
|
| `commentMeta` | `true` | Also read meta from the comment above a test or `describe` (`/** @priority P0 @owner naveen */`). `meta()` wins when both are there. `false` reads no comments |
|
|
451
454
|
| `warnMissingMeta` | `true` | After the run, list the tests that have no meta (no `meta()` and no comment) in the console, so nobody on the team forgets |
|
|
@@ -872,4 +875,8 @@ Full details for security reviewers and client projects, including what is read,
|
|
|
872
875
|
|
|
873
876
|
## License
|
|
874
877
|
|
|
875
|
-
MIT © Naveen Automation Labs
|
|
878
|
+
MIT © 2026 Naveen Khunteta (Naveen Automation Labs), first released in September 2026. See [LICENSE](./LICENSE).
|
|
879
|
+
|
|
880
|
+
**Name and logo.** The code is MIT-licensed. The reportingLabs name and logo are not: forks and derived projects are welcome, but please don't use them in a way that suggests your project is reportingLabs or endorsed by it.
|
|
881
|
+
|
|
882
|
+
**Building on reportingLabs?** You're welcome to. If your project uses its code or is modelled on its report, a link back to [reportingLabs](https://github.com/naveenautomationlabs/reporting-labs) is appreciated.
|
package/dist/cypress/index.d.ts
CHANGED
|
@@ -143,6 +143,9 @@ export declare class CypressCollector {
|
|
|
143
143
|
private prepareAssets;
|
|
144
144
|
afterSpec(spec?: CySpec, results?: CyRunResult): void;
|
|
145
145
|
afterRun(results?: CyAfterRun): Promise<string | undefined>;
|
|
146
|
+
/** `npx cypress run --spec "a.cy.ts,b.cy.ts"` from the project folder, with the browser (when not the default
|
|
147
|
+
* Electron) and the config file (when not one Cypress finds on its own). */
|
|
148
|
+
private rerunShape;
|
|
146
149
|
/** One Cypress test → one report row. Cypress gives the attempts' states but one duration and one error (the last). */
|
|
147
150
|
toTest(ct: CyTest, abs: string, file: string, startTime: number): TestData;
|
|
148
151
|
/** What the support file sent for this test: real per-attempt times, steps, API calls, each attempt's error, meta(). */
|
package/dist/cypress/index.js
CHANGED
|
@@ -270,6 +270,9 @@ class CypressCollector {
|
|
|
270
270
|
for (const t of this.tests) {
|
|
271
271
|
t.project = project;
|
|
272
272
|
t.key = `${project}::${t.file}::${[...t.path, t.title].join(' › ')}`;
|
|
273
|
+
// Cypress runs a spec, not one test of it: the re-run target is the spec file
|
|
274
|
+
if (t.file)
|
|
275
|
+
t.rerun = [t.file];
|
|
273
276
|
}
|
|
274
277
|
const start = Date.parse(results.startedTestsAt ?? '') || this.startTime || Date.now();
|
|
275
278
|
const end = Date.parse(results.endedTestsAt ?? '') || this.endTime || Date.now();
|
|
@@ -277,7 +280,19 @@ class CypressCollector {
|
|
|
277
280
|
const version = this.cypressVersion || results.cypressVersion || '';
|
|
278
281
|
const bver = results.browserVersion ? ` ${results.browserVersion}` : '';
|
|
279
282
|
const envRows = version ? [{ k: 'Cypress', v: version + (project ? ` · ${project}${bver}` : '') }] : [];
|
|
280
|
-
return (0, write_report_1.writeReport)(this.tests, { startTime: start, endTime: Math.max(end, start), runStatus: failed ? 'failed' : 'passed', workers: 1, envRows }, { ...this.options, outputFolder: this.outDir, logo: this.resolveLogo(this.options.logo), bdd: this.options.bdd });
|
|
283
|
+
return (0, write_report_1.writeReport)(this.tests, { startTime: start, endTime: Math.max(end, start), runStatus: failed ? 'failed' : 'passed', workers: 1, envRows, rerun: this.rerunShape(project) }, { ...this.options, outputFolder: this.outDir, logo: this.resolveLogo(this.options.logo), bdd: this.options.bdd });
|
|
284
|
+
}
|
|
285
|
+
/** `npx cypress run --spec "a.cy.ts,b.cy.ts"` from the project folder, with the browser (when not the default
|
|
286
|
+
* Electron) and the config file (when not one Cypress finds on its own). */
|
|
287
|
+
rerunShape(browser) {
|
|
288
|
+
let pre = 'npx cypress run';
|
|
289
|
+
const cfg = typeof this.config.configFile === 'string' ? this.config.configFile : '';
|
|
290
|
+
if (cfg && (path.dirname(path.resolve(this.base, cfg)) !== this.base || !/^cypress\.config\.[mc]?[jt]s$/.test(path.basename(cfg)))) {
|
|
291
|
+
pre += ' --config-file ' + (0, reporter_2.shellArg)(path.relative(this.base, path.resolve(this.base, cfg)).split(path.sep).join('/'));
|
|
292
|
+
}
|
|
293
|
+
if (browser && browser !== 'electron')
|
|
294
|
+
pre += ' --browser ' + (0, reporter_2.shellArg)(browser);
|
|
295
|
+
return { pre: pre + ' --spec "', sep: ',', post: '"' };
|
|
281
296
|
}
|
|
282
297
|
/** One Cypress test → one report row. Cypress gives the attempts' states but one duration and one error (the last). */
|
|
283
298
|
toTest(ct, abs, file, startTime) {
|
package/dist/mask.js
CHANGED
|
@@ -123,7 +123,7 @@ function makeMasker(extraKeys = [], opts = {}) {
|
|
|
123
123
|
const v = raw.replace(/[)\]},;:.]+$/, '');
|
|
124
124
|
return CODE_WORDS.has(v.toLowerCase())
|
|
125
125
|
|| /^`?\$\{/.test(v)
|
|
126
|
-
|| /^\{
|
|
126
|
+
|| /^\{(?:[a-z_][A-Za-z_]*)?\}?$/.test(v) // a placeholder: password {string}, password={password}, password={}
|
|
127
127
|
|| /^`?(Bearer|Basic|Digest|Token)$/i.test(v)
|
|
128
128
|
|| /^(process\.env|import\.meta\.env|os\.environ|os\.getenv|System\.getenv|ENV)\b/.test(v);
|
|
129
129
|
};
|
package/dist/reporter.d.ts
CHANGED
|
@@ -50,6 +50,12 @@ export default class ReportingLabsReporter implements Reporter {
|
|
|
50
50
|
private extractMeta;
|
|
51
51
|
/** A local image file (path relative to the config) is embedded as a data URI so the report stays self-contained. URLs and data URIs pass through. */
|
|
52
52
|
private resolveLogo;
|
|
53
|
+
/** A test's re-run target: its spec file and line from where the command runs (the working folder), and its
|
|
54
|
+
* project when the config has more than one. A playwright-bdd scenario is its generated spec. */
|
|
55
|
+
private rerunTarget;
|
|
56
|
+
/** `npx playwright test`, with -c when the config is not the one Playwright finds on its own, and `npx bddgen &&`
|
|
57
|
+
* first for playwright-bdd (the generated specs are rebuilt from the feature files). */
|
|
58
|
+
private rerunShape;
|
|
53
59
|
private bddRoots;
|
|
54
60
|
private rel;
|
|
55
61
|
private serializeError;
|
|
@@ -59,6 +65,8 @@ export default class ReportingLabsReporter implements Reporter {
|
|
|
59
65
|
private serializeStep;
|
|
60
66
|
private serializeAttachment;
|
|
61
67
|
}
|
|
68
|
+
/** Quotes a command-line argument when it needs it (spaces, quotes, shell characters). */
|
|
69
|
+
export declare function shellArg(s: string): string;
|
|
62
70
|
/**
|
|
63
71
|
* The environment name the run was pointed at, from the process environment: the variable named
|
|
64
72
|
* by `envVar` if given, else the usual names (ENV, TEST_ENV, APP_ENV, TARGET_ENV, …), else any
|
package/dist/reporter.js
CHANGED
|
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.shellArg = shellArg;
|
|
36
37
|
exports.detectEnvName = detectEnvName;
|
|
37
38
|
exports.ciRunLabel = ciRunLabel;
|
|
38
39
|
exports.ciLink = ciLink;
|
|
@@ -46,6 +47,7 @@ const mask_1 = require("./mask");
|
|
|
46
47
|
const explain_1 = require("./explain");
|
|
47
48
|
const pdf_1 = require("./pdf");
|
|
48
49
|
const bdd_1 = require("./bdd");
|
|
50
|
+
const star_1 = require("./star");
|
|
49
51
|
const comments_1 = require("./comments");
|
|
50
52
|
const DEFAULT_EMBED_LIMIT = 2 * 1024 * 1024;
|
|
51
53
|
/** Attach steps created by log() and the automatic API capture; the data shows in its own section, so hide the step. */
|
|
@@ -145,6 +147,7 @@ class ReportingLabsReporter {
|
|
|
145
147
|
const tests = [];
|
|
146
148
|
const projects = new Set();
|
|
147
149
|
let workers = 0;
|
|
150
|
+
let bddSpecs = false;
|
|
148
151
|
for (const test of this.suite.allTests()) {
|
|
149
152
|
const project = test.parent.project()?.name ?? '';
|
|
150
153
|
projects.add(project);
|
|
@@ -181,9 +184,11 @@ class ReportingLabsReporter {
|
|
|
181
184
|
retries: test.retries,
|
|
182
185
|
duration: results.reduce((a, r) => a + r.duration, 0),
|
|
183
186
|
results,
|
|
187
|
+
rerun: this.rerunTarget(test.location.file, test.location.line, project),
|
|
184
188
|
};
|
|
185
189
|
// playwright-bdd: the scenario at its .feature file and line, Gherkin details from the generated spec
|
|
186
190
|
if ((0, bdd_1.applyBdd)(t, test.location.file, this.bddRoots(), f => this.rel(f), this.masker)) {
|
|
191
|
+
bddSpecs = true;
|
|
187
192
|
t.key = `${project}::${t.file}::${[...t.path, t.title].join(' › ')}${test.repeatEachIndex ? ' #' + (test.repeatEachIndex + 1) : ''}`;
|
|
188
193
|
}
|
|
189
194
|
tests.push(t);
|
|
@@ -228,6 +233,7 @@ class ReportingLabsReporter {
|
|
|
228
233
|
globalErrors: this.globalErrors,
|
|
229
234
|
globalOutput: this.globalOutput,
|
|
230
235
|
shard: this.config.shard ? { current: this.config.shard.current, total: this.config.shard.total } : undefined,
|
|
236
|
+
rerun: this.rerunShape(bddSpecs),
|
|
231
237
|
options: {
|
|
232
238
|
logo: this.resolveLogo(this.options.logo),
|
|
233
239
|
accent: this.options.accent,
|
|
@@ -248,6 +254,7 @@ class ReportingLabsReporter {
|
|
|
248
254
|
flaky: this.options.widgets?.flaky ?? true,
|
|
249
255
|
environment: this.options.widgets?.environment ?? true,
|
|
250
256
|
skipped: this.options.widgets?.skipped ?? true,
|
|
257
|
+
changes: this.options.widgets?.changes ?? true,
|
|
251
258
|
},
|
|
252
259
|
dimensions: this.dimensions(),
|
|
253
260
|
dimensionOrder: {
|
|
@@ -276,6 +283,11 @@ class ReportingLabsReporter {
|
|
|
276
283
|
}
|
|
277
284
|
if (this.options.pdf !== false)
|
|
278
285
|
await this.writePdf(file);
|
|
286
|
+
if (this.options.announce !== false) {
|
|
287
|
+
const star = (0, star_1.starLine)();
|
|
288
|
+
if (star)
|
|
289
|
+
console.log(star + '\n');
|
|
290
|
+
}
|
|
279
291
|
this.maybeOpen(file, result);
|
|
280
292
|
}
|
|
281
293
|
/** report.pdf next to the HTML; see writeReportPdf for which browser prints it. Never fails the run. */
|
|
@@ -537,6 +549,22 @@ class ReportingLabsReporter {
|
|
|
537
549
|
}
|
|
538
550
|
return `data:${type};base64,${fs.readFileSync(file).toString('base64')}`;
|
|
539
551
|
}
|
|
552
|
+
/** A test's re-run target: its spec file and line from where the command runs (the working folder), and its
|
|
553
|
+
* project when the config has more than one. A playwright-bdd scenario is its generated spec. */
|
|
554
|
+
rerunTarget(file, line, project) {
|
|
555
|
+
const out = [shellArg(path.relative(process.cwd(), file).split(path.sep).join('/') + ':' + line)];
|
|
556
|
+
if (this.config.projects.length > 1 && project)
|
|
557
|
+
out.push('--project=' + shellArg(project));
|
|
558
|
+
return out;
|
|
559
|
+
}
|
|
560
|
+
/** `npx playwright test`, with -c when the config is not the one Playwright finds on its own, and `npx bddgen &&`
|
|
561
|
+
* first for playwright-bdd (the generated specs are rebuilt from the feature files). */
|
|
562
|
+
rerunShape(bdd) {
|
|
563
|
+
const cfg = this.config.configFile;
|
|
564
|
+
const own = cfg && (path.dirname(cfg) !== process.cwd() || !/^playwright\.config\.[mc]?[jt]s$/.test(path.basename(cfg)));
|
|
565
|
+
const c = own ? ' -c ' + shellArg(path.relative(process.cwd(), cfg).split(path.sep).join('/')) : '';
|
|
566
|
+
return { pre: (bdd ? 'npx bddgen && ' : '') + 'npx playwright test' + c + ' ', sep: ' ' };
|
|
567
|
+
}
|
|
540
568
|
bddRoots() {
|
|
541
569
|
return [...new Set([this.config.configFile ? path.dirname(this.config.configFile) : '', this.config.rootDir, process.cwd()].filter(Boolean))];
|
|
542
570
|
}
|
|
@@ -698,6 +726,10 @@ class ReportingLabsReporter {
|
|
|
698
726
|
}
|
|
699
727
|
}
|
|
700
728
|
exports.default = ReportingLabsReporter;
|
|
729
|
+
/** Quotes a command-line argument when it needs it (spaces, quotes, shell characters). */
|
|
730
|
+
function shellArg(s) {
|
|
731
|
+
return /^[\w@%+=:,./-]+$/.test(s) ? s : '"' + s.replace(/(["\\$`])/g, '\\$1') + '"';
|
|
732
|
+
}
|
|
701
733
|
/** Run number from the CI system, used to label history entries when metadata.build is not set. */
|
|
702
734
|
/** Variables whose name ends in ENV but never hold an environment name. */
|
|
703
735
|
const NOT_AN_ENV_VAR = new Set(['GITHUB_ENV', 'NODE_ENV', 'BASH_ENV', 'VIRTUAL_ENV', 'CONDA_DEFAULT_ENV', 'RUNNER_ENVIRONMENT', 'PIPENV_ACTIVE', 'ZSH_ENV', 'JAVA_ENV', 'DOTNET_ENVIRONMENT', 'ASPNETCORE_ENVIRONMENT', 'HOSTING_ENVIRONMENT']);
|
package/dist/star.d.ts
ADDED
package/dist/star.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.STAR_URL = void 0;
|
|
37
|
+
exports.starLine = starLine;
|
|
38
|
+
/**
|
|
39
|
+
* At most once a week, on a developer's machine, one line after the report asking for a GitHub star: most people
|
|
40
|
+
* who use the reporter never see the repository. Never in CI. Off with announce: false or REPORTING_LABS_NO_STAR=1.
|
|
41
|
+
*/
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const os = __importStar(require("os"));
|
|
44
|
+
const path = __importStar(require("path"));
|
|
45
|
+
const CI_VARS = ['CI', 'TF_BUILD', 'JENKINS_URL', 'GITLAB_CI', 'BUILDKITE', 'CIRCLECI', 'TEAMCITY_VERSION', 'CODEBUILD_BUILD_ID', 'BITBUCKET_BUILD_NUMBER'];
|
|
46
|
+
const WEEK = 7 * 24 * 3600 * 1000;
|
|
47
|
+
exports.STAR_URL = 'https://github.com/naveenautomationlabs/reporting-labs';
|
|
48
|
+
function starLine(env = process.env, mark = path.join(os.tmpdir(), 'reporting-labs-star')) {
|
|
49
|
+
if (env.REPORTING_LABS_NO_STAR || CI_VARS.some(k => env[k]))
|
|
50
|
+
return undefined;
|
|
51
|
+
try {
|
|
52
|
+
if (Date.now() - fs.statSync(mark).mtimeMs < WEEK)
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
catch { /* never shown on this machine */ }
|
|
56
|
+
// the time it was shown is what keeps it to once a week: if it cannot be kept, stay quiet
|
|
57
|
+
try {
|
|
58
|
+
fs.writeFileSync(mark, '');
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
return ` ★ If reportingLabs helps you, a GitHub star helps other testers find it: ${exports.STAR_URL}`;
|
|
64
|
+
}
|
package/dist/template.html
CHANGED
|
@@ -201,6 +201,9 @@ a{color:var(--accent)}
|
|
|
201
201
|
|
|
202
202
|
/* ---------- detail ---------- */
|
|
203
203
|
.detail{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:22px;min-width:0}
|
|
204
|
+
/* a long URL, path or token with no spaces (an OAuth redirect in a step error) breaks instead of widening the page */
|
|
205
|
+
.detail :is(.e,.crumb,.loc,.errloc,.txt,.logs,.note,.err,.kv dd,.kv2 dd){overflow-wrap:anywhere}
|
|
206
|
+
.detail .kv{grid-template-columns:auto minmax(0,1fr)} .detail .kv2{grid-template-columns:max-content minmax(0,1fr)}
|
|
204
207
|
.crumb{font-size:12px;color:var(--ink-3)} .crumb span+span::before{content:" / ";color:var(--line)}
|
|
205
208
|
.detail h3{font-size:20px;font-weight:600;margin:6px 0 10px;letter-spacing:-.01em;overflow-wrap:anywhere;min-width:0}
|
|
206
209
|
.badges{display:flex;gap:6px;flex-wrap:wrap;align-items:center;margin-bottom:18px}
|
|
@@ -567,6 +570,19 @@ html,body{-webkit-font-smoothing:antialiased}
|
|
|
567
570
|
/* ---------- run status, errors outside tests, snippets ---------- */
|
|
568
571
|
.att-err{padding:12px 14px;background:var(--fail-bg);color:var(--ink);border-radius:8px 8px 0 0;line-height:1.5} .att-err code{font:12px var(--mono);background:var(--surface);padding:1px 5px;border-radius:4px}
|
|
569
572
|
.runbanner{margin-bottom:14px;padding:10px 14px;border-radius:10px;background:var(--flaky-bg);color:var(--flaky-ink);border:1px solid color-mix(in srgb,var(--flaky) 40%,transparent)}
|
|
573
|
+
/* ---------- since last run, run again ---------- */
|
|
574
|
+
.chg{display:flex;align-items:center;flex-wrap:wrap;gap:6px 16px;margin-top:16px;padding:10px 12px 10px 16px;background:var(--surface);border:1px solid var(--line);border-radius:8px;color:var(--ink-2)}
|
|
575
|
+
.chg .lead{font-weight:600;color:var(--ink)} .chg .lead small{font-weight:400;color:var(--ink-3);margin-left:6px}
|
|
576
|
+
.chg .seg{font:inherit;color:inherit;padding:2px 0;border-bottom:1px dashed transparent;cursor:pointer} .chg .seg b{font-weight:600}
|
|
577
|
+
.chg .seg:hover,.chg .seg[aria-expanded=true]{border-bottom-color:currentColor}
|
|
578
|
+
.chg .seg.nf{color:var(--fail)} .chg .seg.fx{color:var(--pass)} .chg .seg.sf{color:var(--ink)} .chg .seg.sl{color:var(--flaky-ink)} .chg .seg.nt{color:var(--accent-2)}
|
|
579
|
+
.chg .same{color:var(--ink-3)} .chg .spacer{flex:1}
|
|
580
|
+
.chg-list[hidden]{display:none} .chg-list{flex-basis:100%;list-style:none;margin:2px 0 0;padding:8px 0 0;border-top:1px solid var(--line);display:grid;gap:2px}
|
|
581
|
+
.chg-list button{display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:4px 6px;border-radius:6px;color:var(--ink);font:inherit;cursor:pointer;min-width:0} .chg-list button:hover{background:var(--surface-2)}
|
|
582
|
+
.chg-list .st{width:8px;height:8px;border-radius:50%;flex:none} .chg-list .n{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} .chg-list .f{margin-left:auto;flex:none;color:var(--ink-3);font-size:12px} .chg-list .more{color:var(--ink-3);font-size:12px;padding:4px 6px}
|
|
583
|
+
.rerun{display:flex;align-items:center;gap:10px;margin:12px 0;padding:5px 5px 5px 12px;background:var(--surface-2);border-radius:6px;min-width:0}
|
|
584
|
+
.rerun .k{flex:none;font-size:12px;color:var(--ink-3)} .rerun code{flex:1;min-width:0;font:12px var(--mono);color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis} .rerun .btn{flex:none;background:var(--surface)}
|
|
585
|
+
@media print{.chg,.rerun{display:none}}
|
|
570
586
|
.note{padding:10px 14px;border-radius:8px;margin-bottom:10px;border:1px solid var(--line)} .note.ok{background:var(--pass-bg);color:var(--ink)} .note.warn{background:var(--flaky-bg);color:var(--flaky-ink)}
|
|
571
587
|
.badge.xfail{background:var(--flaky-bg);color:var(--flaky-ink)}
|
|
572
588
|
.xp{font-weight:500} .xp.all{color:var(--ink)} .xp.some{color:var(--flaky-ink)}
|
|
@@ -665,6 +681,7 @@ html,body{font-size:var(--fs)}
|
|
|
665
681
|
.rl-foot-mark{width:22px;height:22px;display:inline-flex;flex:none}
|
|
666
682
|
.rl-foot-mark svg{width:22px;height:22px;display:block;border-radius:6px}
|
|
667
683
|
.rl-foot-txt b{color:var(--ink-2);font-weight:600}
|
|
684
|
+
.rl-star{color:var(--ink-2);text-decoration:none} .rl-star:hover{color:var(--accent-2);text-decoration:underline}
|
|
668
685
|
@media print{ .rl-foot{display:none} }
|
|
669
686
|
|
|
670
687
|
/* ---------- print / PDF: a clean, client-shareable executive report ----------
|
|
@@ -834,6 +851,7 @@ function failuresView(){
|
|
|
834
851
|
const cl=failureClusters();
|
|
835
852
|
const grid=h('div',{class:'grid'});
|
|
836
853
|
grid.append(h('div',{class:'w12 fx-tools'}, h('span',{class:'fx-sum'}, bad.length+' failed or flaky', PREV.length? ' · '+bad.filter(t=>isFail(t.outcome)&&sinceInfo(t).kind==='new').length+' new since '+runLabel(PREV[PREV.length-1]) : ''), h('span',{class:'spacer'}),
|
|
854
|
+
(()=>{ const c=rerunCmd(data.tests.filter(t=>isFail(t.outcome))); return c? h('button',{class:'btn',title:c,onclick:e=>copyText(c,e.currentTarget,'Command copied')},'Copy re-run command') : null; })(),
|
|
837
855
|
h('button',{class:'btn',onclick:exportCsv,title:'Failures as CSV for Jira or a sheet'},'Download CSV'), h('button',{class:'btn',onclick:exportJson,title:'Failures as JSON'},'Download JSON'), h('button',{class:'btn primary',onclick:e=>copyText(summaryMarkdown(),e.currentTarget,'Copied for Slack')},'Copy summary')));
|
|
838
856
|
if(cl.length) grid.append(h('div',{class:'card w6 fail-rail'}, h('h2',{},'Failure clusters', h('span',{class:'hint'},cl.length+' distinct error'+(cl.length>1?'s':''))), clustersView(cl)));
|
|
839
857
|
if(DIMS.length) grid.append(h('div',{class:'card w6 fail-rail'}, h('h2',{},'Needs attention', h('span',{class:'hint'},'ranked by priority and severity')), attention()));
|
|
@@ -1146,7 +1164,8 @@ function rlFooter(){
|
|
|
1146
1164
|
return h('footer',{class:'rl-foot'},
|
|
1147
1165
|
h('span',{class:'rl-foot-mark',html:svg}),
|
|
1148
1166
|
h('span',{class:'rl-foot-txt'}, 'Generated by ', h('b',{},'reportingLabs'),
|
|
1149
|
-
data.generatedAt? ' · '+new Date(data.generatedAt).toLocaleString() : null
|
|
1167
|
+
data.generatedAt? ' · '+new Date(data.generatedAt).toLocaleString() : null,
|
|
1168
|
+
' · ', h('a',{class:'rl-star',href:'https://github.com/naveenautomationlabs/reporting-labs',target:'_blank',rel:'noopener'},'\u2605 Star on GitHub')));
|
|
1150
1169
|
}
|
|
1151
1170
|
|
|
1152
1171
|
/* ---------- summary ---------- */
|
|
@@ -1167,7 +1186,8 @@ function summary(){
|
|
|
1167
1186
|
pill('passed','Passed',s.passed,'var(--pass)', ok&&s.passed? 'Every test on first attempt' : 'On first attempt', '', hseries(e=>e.passed)),
|
|
1168
1187
|
pill('failed','Failed',failed,'var(--fail)', failed? (nNew!=null? nNew+' new · '+(failed-nNew)+' known' : nClu+' root cause'+(nClu===1?'':'s')) : 'Nothing broke', failed?'down':'', hseries(e=>e.failed)),
|
|
1169
1188
|
pill('flaky','Flaky',s.flaky,'var(--flaky)', s.flaky? 'Passed on retry' : 'No retries needed', '', hseries(e=>e.flaky)),
|
|
1170
|
-
pill('skipped','Skipped',s.skipped,'var(--skip)', s.skipped? 'Not executed' : 'Everything ran', '', hseries(e=>e.skipped)))
|
|
1189
|
+
pill('skipped','Skipped',s.skipped,'var(--skip)', s.skipped? 'Not executed' : 'Everything ran', '', hseries(e=>e.skipped))),
|
|
1190
|
+
data.options.widgets.changes!==false? changesLine() : null);
|
|
1171
1191
|
if(data.options.widgets.runStrip && data.tests.length){
|
|
1172
1192
|
const strip = h('div',{class:'strip',id:'strip'}, data.tests.map(t=>h('button',{class:'cell '+t.outcome,'data-id':t.id,title:t.title+' · '+label[t.outcome]+' · '+ms(t.duration),'aria-label':t.title,onclick:()=>select(t.id)})));
|
|
1173
1193
|
el.append(strip, h('div',{class:'strip-cap'}, 'Every test in run order. Hover for details, click to open.'));
|
|
@@ -1206,6 +1226,51 @@ function prevRun(){
|
|
|
1206
1226
|
return fallback;
|
|
1207
1227
|
}
|
|
1208
1228
|
|
|
1229
|
+
/* ---------- since last run, and the command to run tests again ---------- */
|
|
1230
|
+
/* The command that runs these tests again. The runner gives the shape in data.rerun ({pre, sep, post}) and each test
|
|
1231
|
+
its target first, then options it needs (Playwright: file:line, then --project=...). Targets and options are
|
|
1232
|
+
de-duplicated, so a spec that failed twice is listed once. */
|
|
1233
|
+
function rerunCmd(ts){
|
|
1234
|
+
const R=data.rerun; if(!R) return '';
|
|
1235
|
+
const ok=ts.filter(t=>t.rerun&&t.rerun.length); if(!ok.length) return '';
|
|
1236
|
+
const uniq=a=>[...new Set(a)];
|
|
1237
|
+
return R.pre+uniq(ok.map(t=>t.rerun[0])).join(R.sep)+(R.post||'')+uniq(ok.flatMap(t=>t.rerun.slice(1))).map(o=>' '+o).join('');
|
|
1238
|
+
}
|
|
1239
|
+
/* One line under the cards: what changed against the previous comparable run, each part opens its tests.
|
|
1240
|
+
Without history it still offers the command for the failed tests. */
|
|
1241
|
+
function changesLine(){
|
|
1242
|
+
const p=prevRun(), base=p&&p.tests? p : null;
|
|
1243
|
+
const failed=data.tests.filter(t=>isFail(t.outcome)), cmd=rerunCmd(failed);
|
|
1244
|
+
if(!base&&!cmd) return null;
|
|
1245
|
+
const segs=[];
|
|
1246
|
+
if(base){
|
|
1247
|
+
const was=t=>{ const r=base.tests[t.key]; return r? r[0] : null; };
|
|
1248
|
+
const nf=[], fx=[], sf=[], nt=[];
|
|
1249
|
+
for(const t of data.tests){ const w=was(t), f=isFail(t.outcome);
|
|
1250
|
+
if(!w) nt.push(t);
|
|
1251
|
+
if(f&&w!=='f') nf.push(t); else if(f) sf.push(t); else if(w==='f'&&(t.outcome==='passed'||t.outcome==='flaky')) fx.push(t); }
|
|
1252
|
+
const sl=regressions().map(r=>r.t).filter(t=>!isFail(t.outcome)), pl=(n,a,b)=>n===1?a:b;
|
|
1253
|
+
segs.push(['nf',nf,pl(nf.length,'new failure','new failures')], ['fx',fx,'fixed'], ['sf',sf,'still failing'], ['sl',sl,'got slower'], ['nt',nt,pl(nt.length,'new test','new tests')]);
|
|
1254
|
+
}
|
|
1255
|
+
const shown=segs.filter(x=>x[1].length);
|
|
1256
|
+
const el=h('div',{class:'chg'}), list=h('ul',{class:'chg-list',hidden:''});
|
|
1257
|
+
let open=null;
|
|
1258
|
+
const toggle=(k,ts,btn)=>{ el.querySelectorAll('.seg').forEach(b=>b.setAttribute('aria-expanded','false'));
|
|
1259
|
+
if(open===k){ open=null; list.hidden=true; return; }
|
|
1260
|
+
open=k; btn.setAttribute('aria-expanded','true'); list.hidden=false; list.innerHTML='';
|
|
1261
|
+
list.append(...ts.slice(0,12).map(t=>h('li',{}, h('button',{onclick:()=>select(t.id)}, h('span',{class:'st '+t.outcome}), h('span',{class:'n'},t.title), h('span',{class:'f'},t.file.split('/').pop()+(data.projects.length>1&&t.project?' · '+t.project:''))))));
|
|
1262
|
+
if(ts.length>12) list.append(h('li',{class:'more'},'and '+(ts.length-12)+' more'));
|
|
1263
|
+
};
|
|
1264
|
+
if(base) el.append(h('span',{class:'lead'},'Since last run', h('small',{},runLabel(base))));
|
|
1265
|
+
else el.append(h('span',{class:'lead'}, failed.length+' failed'));
|
|
1266
|
+
if(base&&!shown.length) el.append(h('span',{class:'same'},'Same results, nothing changed.'));
|
|
1267
|
+
for(const [k,ts,txt] of shown){ const b=h('button',{class:'seg '+k,'aria-expanded':'false',onclick:()=>toggle(k,ts,b)}, h('b',{},ts.length),' '+txt); el.append(b); }
|
|
1268
|
+
el.append(h('span',{class:'spacer'}));
|
|
1269
|
+
if(cmd) el.append(h('button',{class:'btn',title:cmd,onclick:e=>copyText(cmd,e.currentTarget,'Command copied')},'Copy re-run command'+(failed.length>1?' ('+failed.length+' failed)':'')));
|
|
1270
|
+
el.append(list);
|
|
1271
|
+
return el;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1209
1274
|
/* ---------- run history per test ---------- */
|
|
1210
1275
|
function runsOf(t){ return HRUNS.map(e=>({e, r:(t.key&&e.tests[t.key])||null})); }
|
|
1211
1276
|
/* new vs known: walk back through earlier runs while the test kept failing */
|
|
@@ -1718,6 +1783,7 @@ function renderDetail(t, d, retryIdx){
|
|
|
1718
1783
|
(()=>{ const r=t.results[t.results.length-1]; const e=r&&r.errors[0]; return e? [h('button',{class:'btn',onclick:ev=>copyText(t.title+'\n'+t.file+':'+t.line+'\n\n'+e.message,ev.currentTarget,'Error copied')},'Copy error'), h('button',{class:'btn primary',onclick:()=>openBugReport(t)},'Bug report')] : null; })(),
|
|
1719
1784
|
editorLink(t))),
|
|
1720
1785
|
h('div',{class:'badges'}, h('span',{class:'badge '+t.outcome},label[t.outcome]), t.expectedFailure? h('span',{class:'badge xfail',title:'Marked test.fail(): failing is the expected result'},'Expected failure') : null, sinceBadge(t), dots(t,10), data.bdd?h('span',{class:'badge scenario'},'Scenario'):null, t.tags.map(g=>h('span',{class:'badge tag'},g)), data.projects.length>1?h('span',{class:'badge tag'},t.project):null, (()=>{ const xp=isFail(t.outcome)&&xproj(t); return xp? xpTag(xp,'badge') : null; })(), h('span',{class:'loc'}, t.file+':'+t.line+' · '+ms(t.duration)+(t.outcome==='timedOut'&&t.timeout?' · timeout '+ms(t.timeout):'')+(t.retries?' · retries '+t.retries:''))));
|
|
1786
|
+
const rc=rerunCmd([t]); if(rc) d.append(h('div',{class:'rerun'}, h('span',{class:'k'},'Run again'), h('code',{title:rc},rc), h('button',{class:'btn',onclick:e=>copyText(rc,e.currentTarget,'Copied')},'Copy')));
|
|
1721
1787
|
const metaKeys=Object.keys(t.meta);
|
|
1722
1788
|
const linkFor=(k,v)=>{ if(t.links&&t.links[k]) return t.links[k]; const tpl=data.options.links[k]||data.options.links['*']; if(tpl) return tpl.replace('{id}',encodeURIComponent(v)); if(/^https?:\/\//.test(v)) return v; return null; };
|
|
1723
1789
|
if(metaKeys.length) d.append(h('div',{class:'metas'}, metaKeys.map(k=>{ const v=t.meta[k], low=/^(P[3-4]|low|minor|trivial|normal|medium)$/i.test(v); const parts=(t.links&&t.links[k])||!data.options.links[k]&&!data.options.links['*']?[v]:v.split(/,\s+/); const nodes=[]; parts.forEach((part,i)=>{ const href=linkFor(k,part); if(i) nodes.push(', '); nodes.push(href? h('a',{href,target:'_blank',rel:'noopener'},part) : h('span',{class:'v'},part)); }); return h('span',{class:'meta '+k+(low?' low':'')}, h('span',{class:'k'},k), ...nodes); })));
|
package/dist/template.js
CHANGED
|
@@ -272,6 +272,9 @@ a{color:var(--accent)}
|
|
|
272
272
|
|
|
273
273
|
/* ---------- detail ---------- */
|
|
274
274
|
.detail{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:22px;min-width:0}
|
|
275
|
+
/* a long URL, path or token with no spaces (an OAuth redirect in a step error) breaks instead of widening the page */
|
|
276
|
+
.detail :is(.e,.crumb,.loc,.errloc,.txt,.logs,.note,.err,.kv dd,.kv2 dd){overflow-wrap:anywhere}
|
|
277
|
+
.detail .kv{grid-template-columns:auto minmax(0,1fr)} .detail .kv2{grid-template-columns:max-content minmax(0,1fr)}
|
|
275
278
|
.crumb{font-size:12px;color:var(--ink-3)} .crumb span+span::before{content:" / ";color:var(--line)}
|
|
276
279
|
.detail h3{font-size:20px;font-weight:600;margin:6px 0 10px;letter-spacing:-.01em;overflow-wrap:anywhere;min-width:0}
|
|
277
280
|
.badges{display:flex;gap:6px;flex-wrap:wrap;align-items:center;margin-bottom:18px}
|
|
@@ -638,6 +641,19 @@ html,body{-webkit-font-smoothing:antialiased}
|
|
|
638
641
|
/* ---------- run status, errors outside tests, snippets ---------- */
|
|
639
642
|
.att-err{padding:12px 14px;background:var(--fail-bg);color:var(--ink);border-radius:8px 8px 0 0;line-height:1.5} .att-err code{font:12px var(--mono);background:var(--surface);padding:1px 5px;border-radius:4px}
|
|
640
643
|
.runbanner{margin-bottom:14px;padding:10px 14px;border-radius:10px;background:var(--flaky-bg);color:var(--flaky-ink);border:1px solid color-mix(in srgb,var(--flaky) 40%,transparent)}
|
|
644
|
+
/* ---------- since last run, run again ---------- */
|
|
645
|
+
.chg{display:flex;align-items:center;flex-wrap:wrap;gap:6px 16px;margin-top:16px;padding:10px 12px 10px 16px;background:var(--surface);border:1px solid var(--line);border-radius:8px;color:var(--ink-2)}
|
|
646
|
+
.chg .lead{font-weight:600;color:var(--ink)} .chg .lead small{font-weight:400;color:var(--ink-3);margin-left:6px}
|
|
647
|
+
.chg .seg{font:inherit;color:inherit;padding:2px 0;border-bottom:1px dashed transparent;cursor:pointer} .chg .seg b{font-weight:600}
|
|
648
|
+
.chg .seg:hover,.chg .seg[aria-expanded=true]{border-bottom-color:currentColor}
|
|
649
|
+
.chg .seg.nf{color:var(--fail)} .chg .seg.fx{color:var(--pass)} .chg .seg.sf{color:var(--ink)} .chg .seg.sl{color:var(--flaky-ink)} .chg .seg.nt{color:var(--accent-2)}
|
|
650
|
+
.chg .same{color:var(--ink-3)} .chg .spacer{flex:1}
|
|
651
|
+
.chg-list[hidden]{display:none} .chg-list{flex-basis:100%;list-style:none;margin:2px 0 0;padding:8px 0 0;border-top:1px solid var(--line);display:grid;gap:2px}
|
|
652
|
+
.chg-list button{display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:4px 6px;border-radius:6px;color:var(--ink);font:inherit;cursor:pointer;min-width:0} .chg-list button:hover{background:var(--surface-2)}
|
|
653
|
+
.chg-list .st{width:8px;height:8px;border-radius:50%;flex:none} .chg-list .n{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} .chg-list .f{margin-left:auto;flex:none;color:var(--ink-3);font-size:12px} .chg-list .more{color:var(--ink-3);font-size:12px;padding:4px 6px}
|
|
654
|
+
.rerun{display:flex;align-items:center;gap:10px;margin:12px 0;padding:5px 5px 5px 12px;background:var(--surface-2);border-radius:6px;min-width:0}
|
|
655
|
+
.rerun .k{flex:none;font-size:12px;color:var(--ink-3)} .rerun code{flex:1;min-width:0;font:12px var(--mono);color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis} .rerun .btn{flex:none;background:var(--surface)}
|
|
656
|
+
@media print{.chg,.rerun{display:none}}
|
|
641
657
|
.note{padding:10px 14px;border-radius:8px;margin-bottom:10px;border:1px solid var(--line)} .note.ok{background:var(--pass-bg);color:var(--ink)} .note.warn{background:var(--flaky-bg);color:var(--flaky-ink)}
|
|
642
658
|
.badge.xfail{background:var(--flaky-bg);color:var(--flaky-ink)}
|
|
643
659
|
.xp{font-weight:500} .xp.all{color:var(--ink)} .xp.some{color:var(--flaky-ink)}
|
|
@@ -736,6 +752,7 @@ html,body{font-size:var(--fs)}
|
|
|
736
752
|
.rl-foot-mark{width:22px;height:22px;display:inline-flex;flex:none}
|
|
737
753
|
.rl-foot-mark svg{width:22px;height:22px;display:block;border-radius:6px}
|
|
738
754
|
.rl-foot-txt b{color:var(--ink-2);font-weight:600}
|
|
755
|
+
.rl-star{color:var(--ink-2);text-decoration:none} .rl-star:hover{color:var(--accent-2);text-decoration:underline}
|
|
739
756
|
@media print{ .rl-foot{display:none} }
|
|
740
757
|
|
|
741
758
|
/* ---------- print / PDF: a clean, client-shareable executive report ----------
|
|
@@ -900,6 +917,7 @@ function failuresView(){
|
|
|
900
917
|
const cl=failureClusters();
|
|
901
918
|
const grid=h('div',{class:'grid'});
|
|
902
919
|
grid.append(h('div',{class:'w12 fx-tools'}, h('span',{class:'fx-sum'}, bad.length+' failed or flaky', PREV.length? ' · '+bad.filter(t=>isFail(t.outcome)&&sinceInfo(t).kind==='new').length+' new since '+runLabel(PREV[PREV.length-1]) : ''), h('span',{class:'spacer'}),
|
|
920
|
+
(()=>{ const c=rerunCmd(data.tests.filter(t=>isFail(t.outcome))); return c? h('button',{class:'btn',title:c,onclick:e=>copyText(c,e.currentTarget,'Command copied')},'Copy re-run command') : null; })(),
|
|
903
921
|
h('button',{class:'btn',onclick:exportCsv,title:'Failures as CSV for Jira or a sheet'},'Download CSV'), h('button',{class:'btn',onclick:exportJson,title:'Failures as JSON'},'Download JSON'), h('button',{class:'btn primary',onclick:e=>copyText(summaryMarkdown(),e.currentTarget,'Copied for Slack')},'Copy summary')));
|
|
904
922
|
if(cl.length) grid.append(h('div',{class:'card w6 fail-rail'}, h('h2',{},'Failure clusters', h('span',{class:'hint'},cl.length+' distinct error'+(cl.length>1?'s':''))), clustersView(cl)));
|
|
905
923
|
if(DIMS.length) grid.append(h('div',{class:'card w6 fail-rail'}, h('h2',{},'Needs attention', h('span',{class:'hint'},'ranked by priority and severity')), attention()));
|
|
@@ -1212,7 +1230,8 @@ function rlFooter(){
|
|
|
1212
1230
|
return h('footer',{class:'rl-foot'},
|
|
1213
1231
|
h('span',{class:'rl-foot-mark',html:svg}),
|
|
1214
1232
|
h('span',{class:'rl-foot-txt'}, 'Generated by ', h('b',{},'reportingLabs'),
|
|
1215
|
-
data.generatedAt? ' · '+new Date(data.generatedAt).toLocaleString() : null
|
|
1233
|
+
data.generatedAt? ' · '+new Date(data.generatedAt).toLocaleString() : null,
|
|
1234
|
+
' · ', h('a',{class:'rl-star',href:'https://github.com/naveenautomationlabs/reporting-labs',target:'_blank',rel:'noopener'},'\u2605 Star on GitHub')));
|
|
1216
1235
|
}
|
|
1217
1236
|
|
|
1218
1237
|
/* ---------- summary ---------- */
|
|
@@ -1233,7 +1252,8 @@ function summary(){
|
|
|
1233
1252
|
pill('passed','Passed',s.passed,'var(--pass)', ok&&s.passed? 'Every test on first attempt' : 'On first attempt', '', hseries(e=>e.passed)),
|
|
1234
1253
|
pill('failed','Failed',failed,'var(--fail)', failed? (nNew!=null? nNew+' new · '+(failed-nNew)+' known' : nClu+' root cause'+(nClu===1?'':'s')) : 'Nothing broke', failed?'down':'', hseries(e=>e.failed)),
|
|
1235
1254
|
pill('flaky','Flaky',s.flaky,'var(--flaky)', s.flaky? 'Passed on retry' : 'No retries needed', '', hseries(e=>e.flaky)),
|
|
1236
|
-
pill('skipped','Skipped',s.skipped,'var(--skip)', s.skipped? 'Not executed' : 'Everything ran', '', hseries(e=>e.skipped)))
|
|
1255
|
+
pill('skipped','Skipped',s.skipped,'var(--skip)', s.skipped? 'Not executed' : 'Everything ran', '', hseries(e=>e.skipped))),
|
|
1256
|
+
data.options.widgets.changes!==false? changesLine() : null);
|
|
1237
1257
|
if(data.options.widgets.runStrip && data.tests.length){
|
|
1238
1258
|
const strip = h('div',{class:'strip',id:'strip'}, data.tests.map(t=>h('button',{class:'cell '+t.outcome,'data-id':t.id,title:t.title+' · '+label[t.outcome]+' · '+ms(t.duration),'aria-label':t.title,onclick:()=>select(t.id)})));
|
|
1239
1259
|
el.append(strip, h('div',{class:'strip-cap'}, 'Every test in run order. Hover for details, click to open.'));
|
|
@@ -1272,6 +1292,51 @@ function prevRun(){
|
|
|
1272
1292
|
return fallback;
|
|
1273
1293
|
}
|
|
1274
1294
|
|
|
1295
|
+
/* ---------- since last run, and the command to run tests again ---------- */
|
|
1296
|
+
/* The command that runs these tests again. The runner gives the shape in data.rerun ({pre, sep, post}) and each test
|
|
1297
|
+
its target first, then options it needs (Playwright: file:line, then --project=...). Targets and options are
|
|
1298
|
+
de-duplicated, so a spec that failed twice is listed once. */
|
|
1299
|
+
function rerunCmd(ts){
|
|
1300
|
+
const R=data.rerun; if(!R) return '';
|
|
1301
|
+
const ok=ts.filter(t=>t.rerun&&t.rerun.length); if(!ok.length) return '';
|
|
1302
|
+
const uniq=a=>[...new Set(a)];
|
|
1303
|
+
return R.pre+uniq(ok.map(t=>t.rerun[0])).join(R.sep)+(R.post||'')+uniq(ok.flatMap(t=>t.rerun.slice(1))).map(o=>' '+o).join('');
|
|
1304
|
+
}
|
|
1305
|
+
/* One line under the cards: what changed against the previous comparable run, each part opens its tests.
|
|
1306
|
+
Without history it still offers the command for the failed tests. */
|
|
1307
|
+
function changesLine(){
|
|
1308
|
+
const p=prevRun(), base=p&&p.tests? p : null;
|
|
1309
|
+
const failed=data.tests.filter(t=>isFail(t.outcome)), cmd=rerunCmd(failed);
|
|
1310
|
+
if(!base&&!cmd) return null;
|
|
1311
|
+
const segs=[];
|
|
1312
|
+
if(base){
|
|
1313
|
+
const was=t=>{ const r=base.tests[t.key]; return r? r[0] : null; };
|
|
1314
|
+
const nf=[], fx=[], sf=[], nt=[];
|
|
1315
|
+
for(const t of data.tests){ const w=was(t), f=isFail(t.outcome);
|
|
1316
|
+
if(!w) nt.push(t);
|
|
1317
|
+
if(f&&w!=='f') nf.push(t); else if(f) sf.push(t); else if(w==='f'&&(t.outcome==='passed'||t.outcome==='flaky')) fx.push(t); }
|
|
1318
|
+
const sl=regressions().map(r=>r.t).filter(t=>!isFail(t.outcome)), pl=(n,a,b)=>n===1?a:b;
|
|
1319
|
+
segs.push(['nf',nf,pl(nf.length,'new failure','new failures')], ['fx',fx,'fixed'], ['sf',sf,'still failing'], ['sl',sl,'got slower'], ['nt',nt,pl(nt.length,'new test','new tests')]);
|
|
1320
|
+
}
|
|
1321
|
+
const shown=segs.filter(x=>x[1].length);
|
|
1322
|
+
const el=h('div',{class:'chg'}), list=h('ul',{class:'chg-list',hidden:''});
|
|
1323
|
+
let open=null;
|
|
1324
|
+
const toggle=(k,ts,btn)=>{ el.querySelectorAll('.seg').forEach(b=>b.setAttribute('aria-expanded','false'));
|
|
1325
|
+
if(open===k){ open=null; list.hidden=true; return; }
|
|
1326
|
+
open=k; btn.setAttribute('aria-expanded','true'); list.hidden=false; list.innerHTML='';
|
|
1327
|
+
list.append(...ts.slice(0,12).map(t=>h('li',{}, h('button',{onclick:()=>select(t.id)}, h('span',{class:'st '+t.outcome}), h('span',{class:'n'},t.title), h('span',{class:'f'},t.file.split('/').pop()+(data.projects.length>1&&t.project?' · '+t.project:''))))));
|
|
1328
|
+
if(ts.length>12) list.append(h('li',{class:'more'},'and '+(ts.length-12)+' more'));
|
|
1329
|
+
};
|
|
1330
|
+
if(base) el.append(h('span',{class:'lead'},'Since last run', h('small',{},runLabel(base))));
|
|
1331
|
+
else el.append(h('span',{class:'lead'}, failed.length+' failed'));
|
|
1332
|
+
if(base&&!shown.length) el.append(h('span',{class:'same'},'Same results, nothing changed.'));
|
|
1333
|
+
for(const [k,ts,txt] of shown){ const b=h('button',{class:'seg '+k,'aria-expanded':'false',onclick:()=>toggle(k,ts,b)}, h('b',{},ts.length),' '+txt); el.append(b); }
|
|
1334
|
+
el.append(h('span',{class:'spacer'}));
|
|
1335
|
+
if(cmd) el.append(h('button',{class:'btn',title:cmd,onclick:e=>copyText(cmd,e.currentTarget,'Command copied')},'Copy re-run command'+(failed.length>1?' ('+failed.length+' failed)':'')));
|
|
1336
|
+
el.append(list);
|
|
1337
|
+
return el;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1275
1340
|
/* ---------- run history per test ---------- */
|
|
1276
1341
|
function runsOf(t){ return HRUNS.map(e=>({e, r:(t.key&&e.tests[t.key])||null})); }
|
|
1277
1342
|
/* new vs known: walk back through earlier runs while the test kept failing */
|
|
@@ -1784,6 +1849,7 @@ function renderDetail(t, d, retryIdx){
|
|
|
1784
1849
|
(()=>{ const r=t.results[t.results.length-1]; const e=r&&r.errors[0]; return e? [h('button',{class:'btn',onclick:ev=>copyText(t.title+'\n'+t.file+':'+t.line+'\n\n'+e.message,ev.currentTarget,'Error copied')},'Copy error'), h('button',{class:'btn primary',onclick:()=>openBugReport(t)},'Bug report')] : null; })(),
|
|
1785
1850
|
editorLink(t))),
|
|
1786
1851
|
h('div',{class:'badges'}, h('span',{class:'badge '+t.outcome},label[t.outcome]), t.expectedFailure? h('span',{class:'badge xfail',title:'Marked test.fail(): failing is the expected result'},'Expected failure') : null, sinceBadge(t), dots(t,10), data.bdd?h('span',{class:'badge scenario'},'Scenario'):null, t.tags.map(g=>h('span',{class:'badge tag'},g)), data.projects.length>1?h('span',{class:'badge tag'},t.project):null, (()=>{ const xp=isFail(t.outcome)&&xproj(t); return xp? xpTag(xp,'badge') : null; })(), h('span',{class:'loc'}, t.file+':'+t.line+' · '+ms(t.duration)+(t.outcome==='timedOut'&&t.timeout?' · timeout '+ms(t.timeout):'')+(t.retries?' · retries '+t.retries:''))));
|
|
1852
|
+
const rc=rerunCmd([t]); if(rc) d.append(h('div',{class:'rerun'}, h('span',{class:'k'},'Run again'), h('code',{title:rc},rc), h('button',{class:'btn',onclick:e=>copyText(rc,e.currentTarget,'Copied')},'Copy')));
|
|
1787
1853
|
const metaKeys=Object.keys(t.meta);
|
|
1788
1854
|
const linkFor=(k,v)=>{ if(t.links&&t.links[k]) return t.links[k]; const tpl=data.options.links[k]||data.options.links['*']; if(tpl) return tpl.replace('{id}',encodeURIComponent(v)); if(/^https?:\/\//.test(v)) return v; return null; };
|
|
1789
1855
|
if(metaKeys.length) d.append(h('div',{class:'metas'}, metaKeys.map(k=>{ const v=t.meta[k], low=/^(P[3-4]|low|minor|trivial|normal|medium)$/i.test(v); const parts=(t.links&&t.links[k])||!data.options.links[k]&&!data.options.links['*']?[v]:v.split(/,\s+/); const nodes=[]; parts.forEach((part,i)=>{ const href=linkFor(k,part); if(i) nodes.push(', '); nodes.push(href? h('a',{href,target:'_blank',rel:'noopener'},part) : h('span',{class:'v'},part)); }); return h('span',{class:'meta '+k+(low?' low':'')}, h('span',{class:'k'},k), ...nodes); })));
|
package/dist/types.d.ts
CHANGED
|
@@ -62,6 +62,8 @@ export interface ReportingLabsOptions {
|
|
|
62
62
|
environment?: boolean;
|
|
63
63
|
/** Skipped tests with their reasons. Default: true */
|
|
64
64
|
skipped?: boolean;
|
|
65
|
+
/** The "Since last run" line under the cards (new failures, fixed, still failing, got slower, new tests) with the command to re-run the failed tests. Default: true */
|
|
66
|
+
changes?: boolean;
|
|
65
67
|
};
|
|
66
68
|
/**
|
|
67
69
|
* Annotation/tag keys treated as chart dimensions (priority, severity, owner...).
|
|
@@ -287,6 +289,8 @@ export interface TestData {
|
|
|
287
289
|
timeout?: number;
|
|
288
290
|
retries?: number;
|
|
289
291
|
column?: number;
|
|
292
|
+
/** What runs this test again: its target (a file:line, a spec), then options it needs. See ReportData.rerun. */
|
|
293
|
+
rerun?: string[];
|
|
290
294
|
}
|
|
291
295
|
export interface ReportData {
|
|
292
296
|
title: string;
|
|
@@ -318,6 +322,12 @@ export interface ReportData {
|
|
|
318
322
|
current: number;
|
|
319
323
|
total: number;
|
|
320
324
|
};
|
|
325
|
+
/** How a re-run command is put together: pre + the tests' targets joined with sep + post, then their options. */
|
|
326
|
+
rerun?: {
|
|
327
|
+
pre: string;
|
|
328
|
+
sep: string;
|
|
329
|
+
post?: string;
|
|
330
|
+
};
|
|
321
331
|
/** Set by `reporting-labs merge`: one lane name per worker (S1·w0, S1·w1, S2·w0 ...) and each shard's size and timing. */
|
|
322
332
|
workerLabels?: string[];
|
|
323
333
|
shardInfo?: Array<{
|
package/dist/wdio/finalize.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { type WriteReportOptions } from '../write-report';
|
|
2
2
|
export type ReportingLabsCompleteOptions = WriteReportOptions;
|
|
3
3
|
export declare function reportingLabsComplete(options?: ReportingLabsCompleteOptions): Promise<string | undefined>;
|
|
4
|
+
/** The config file of this wdio run, from the launcher's command line (`wdio run ./wdio.conf.ts`, or `wdio wdio.conf.js`). */
|
|
5
|
+
export declare function wdioConfigArg(argv: string[]): string | undefined;
|
package/dist/wdio/finalize.js
CHANGED
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.reportingLabsComplete = reportingLabsComplete;
|
|
37
|
+
exports.wdioConfigArg = wdioConfigArg;
|
|
37
38
|
/**
|
|
38
39
|
* Combines the per-runner partials written by the WDIO reporter into the one report —
|
|
39
40
|
* index.html, report.json and (best-effort) report.pdf. Call it from `onComplete` in wdio.conf:
|
|
@@ -47,6 +48,7 @@ exports.reportingLabsComplete = reportingLabsComplete;
|
|
|
47
48
|
const fs = __importStar(require("fs"));
|
|
48
49
|
const path = __importStar(require("path"));
|
|
49
50
|
const write_report_1 = require("../write-report");
|
|
51
|
+
const reporter_1 = require("../reporter");
|
|
50
52
|
async function reportingLabsComplete(options = {}) {
|
|
51
53
|
const outputFolder = options.outputFolder || 'reporting-labs';
|
|
52
54
|
const partsDir = path.join(outputFolder, '.rl-wdio');
|
|
@@ -81,11 +83,22 @@ async function reportingLabsComplete(options = {}) {
|
|
|
81
83
|
startTime = Date.now();
|
|
82
84
|
if (!endTime)
|
|
83
85
|
endTime = Date.now();
|
|
86
|
+
// WDIO runs specs: each test's re-run target is its spec file, run with the config this run used
|
|
87
|
+
const conf = wdioConfigArg(process.argv);
|
|
88
|
+
for (const t of tests)
|
|
89
|
+
if (conf && t.file && !t.rerun)
|
|
90
|
+
t.rerun = [(0, reporter_1.shellArg)(t.file)];
|
|
91
|
+
const rerun = conf ? { pre: `npx wdio run ${(0, reporter_1.shellArg)(conf)} --spec `, sep: ' --spec ' } : undefined;
|
|
84
92
|
// the partials are only needed for this report
|
|
85
|
-
const htmlFile = await (0, write_report_1.writeReport)(tests, { startTime, endTime, runStatus, workers }, options);
|
|
93
|
+
const htmlFile = await (0, write_report_1.writeReport)(tests, { startTime, endTime, runStatus, workers, rerun }, options);
|
|
86
94
|
try {
|
|
87
95
|
fs.rmSync(partsDir, { recursive: true, force: true });
|
|
88
96
|
}
|
|
89
97
|
catch { /* leave them */ }
|
|
90
98
|
return htmlFile;
|
|
91
99
|
}
|
|
100
|
+
/** The config file of this wdio run, from the launcher's command line (`wdio run ./wdio.conf.ts`, or `wdio wdio.conf.js`). */
|
|
101
|
+
function wdioConfigArg(argv) {
|
|
102
|
+
const f = argv.slice(2).find(a => /\.conf(ig)?\.[mc]?[jt]s$/.test(a) || /wdio[^/\\]*\.[mc]?[jt]s$/.test(a));
|
|
103
|
+
return f ? path.relative(process.cwd(), path.resolve(f)).split(path.sep).join('/') : undefined;
|
|
104
|
+
}
|
package/dist/write-report.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TestData, EnvRow } from './types';
|
|
1
|
+
import type { ReportData, TestData, EnvRow } from './types';
|
|
2
2
|
export interface WriteReportOptions {
|
|
3
3
|
outputFolder?: string;
|
|
4
4
|
outputFile?: string;
|
|
@@ -46,6 +46,8 @@ export interface RunInfo {
|
|
|
46
46
|
workers: number;
|
|
47
47
|
/** Rows shown first on the Environment card, e.g. the Cypress version and browser. */
|
|
48
48
|
envRows?: EnvRow[];
|
|
49
|
+
/** How the runner's re-run command is put together (each test carries its own target in TestData.rerun). */
|
|
50
|
+
rerun?: ReportData['rerun'];
|
|
49
51
|
}
|
|
50
52
|
/** Writes the report into options.outputFolder (default reporting-labs) and returns the HTML path. */
|
|
51
53
|
export declare function writeReport(tests: TestData[], run: RunInfo, options?: WriteReportOptions): Promise<string>;
|
package/dist/write-report.js
CHANGED
|
@@ -44,6 +44,7 @@ const template_1 = require("./template");
|
|
|
44
44
|
const mask_1 = require("./mask");
|
|
45
45
|
const pdf_1 = require("./pdf");
|
|
46
46
|
const env_1 = require("./wdio/env");
|
|
47
|
+
const star_1 = require("./star");
|
|
47
48
|
/** Writes the report into options.outputFolder (default reporting-labs) and returns the HTML path. */
|
|
48
49
|
async function writeReport(tests, run, options = {}) {
|
|
49
50
|
const outputFolder = options.outputFolder || 'reporting-labs';
|
|
@@ -102,6 +103,7 @@ async function writeReport(tests, run, options = {}) {
|
|
|
102
103
|
runStatus,
|
|
103
104
|
globalErrors: [],
|
|
104
105
|
globalOutput: [],
|
|
106
|
+
rerun: run.rerun,
|
|
105
107
|
options: {
|
|
106
108
|
logo: options.logo,
|
|
107
109
|
accent: options.accent,
|
|
@@ -109,7 +111,7 @@ async function writeReport(tests, run, options = {}) {
|
|
|
109
111
|
palette: options.palette ?? 'lab',
|
|
110
112
|
embedFonts: options.embedFonts ?? true,
|
|
111
113
|
sections: options.sections ?? [],
|
|
112
|
-
widgets: { runStrip: true, outcome: true, attention: true, dimensions: true, timeline: true, durations: true, tags: true, slowest: true, projects: true, flaky: true, environment: true, skipped: true },
|
|
114
|
+
widgets: { runStrip: true, outcome: true, attention: true, dimensions: true, timeline: true, durations: true, tags: true, slowest: true, projects: true, flaky: true, environment: true, skipped: true, changes: true },
|
|
113
115
|
dimensions: dims,
|
|
114
116
|
dimensionOrder: {
|
|
115
117
|
priority: ['P0', 'P1', 'P2', 'P3', 'P4'],
|
|
@@ -133,8 +135,12 @@ async function writeReport(tests, run, options = {}) {
|
|
|
133
135
|
}
|
|
134
136
|
if (options.pdf !== false)
|
|
135
137
|
await writePdf(htmlFile, outputFolder, options);
|
|
136
|
-
if (options.announce !== false)
|
|
138
|
+
if (options.announce !== false) {
|
|
139
|
+
const star = (0, star_1.starLine)();
|
|
140
|
+
if (star)
|
|
141
|
+
console.log(star);
|
|
137
142
|
console.log('');
|
|
143
|
+
}
|
|
138
144
|
return htmlFile;
|
|
139
145
|
}
|
|
140
146
|
/** report.pdf next to the HTML; see writeReportPdf for which browser prints it (an installed Chrome or
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reporting-labs",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.22",
|
|
4
4
|
"description": "reportingLabs – beautiful, customizable single-file HTML test reports. One line of config. Playwright adapter included, more runners on the way.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"test-report",
|