@piwitests/reporter 0.63.0 → 0.65.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 +2 -2
- package/dist/cli/index.js +532 -118
- package/dist/global-setup-module.js +342 -155
- package/dist/index.d.ts +98 -24
- package/dist/index.js +3856 -1286
- package/dist/internal/capture/attachments.d.ts +3 -2
- package/dist/internal/capture/attachments.js +1 -0
- package/dist/internal/capture/capture-fixtures.d.ts +142 -7
- package/dist/internal/capture/capture-fixtures.js +2238 -744
- package/dist/internal/capture/inspect-on-failure.d.ts +3 -5
- package/dist/internal/capture/inspect-on-failure.js +11 -7
- package/dist/internal/capture/locator-healing.d.ts +212 -4
- package/dist/internal/capture/pick-on-failure.d.ts +184 -6
- package/dist/types-CGr9jJZ_.d.ts +87 -0
- package/dist/wire-7zsqlBoY.d.ts +48 -0
- package/package.json +2 -2
- package/templates/skills/setup-piwi/SKILL.md +3 -3
- package/templates/skills/write-the-missing-test/SKILL.md +6 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { FullConfig, Suite, TestCase, TestResult, FullResult } from '@playwright/test/reporter';
|
|
1
|
+
import { FullConfig, Suite, TestCase, TestResult, TestError, FullResult } from '@playwright/test/reporter';
|
|
2
2
|
import { PlaywrightTestConfig, Locator, TestType, Page, Fixtures, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions } from '@playwright/test';
|
|
3
3
|
export { PlaywrightTestConfig } from '@playwright/test';
|
|
4
4
|
export { PiwiFixtures, PiwiWorkerFixtures, extendPiwiFixtures, piwiFixtures } from './internal/capture/capture-fixtures.js';
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
7
|
-
import '@piwitests/core/wire';
|
|
8
|
-
import '@piwitests/core/run-channel';
|
|
9
|
-
import '@piwitests/core/code-reach';
|
|
5
|
+
import './types-CGr9jJZ_.js';
|
|
6
|
+
import './wire-7zsqlBoY.js';
|
|
10
7
|
|
|
11
8
|
/**
|
|
12
9
|
* Options for configuring the Piwi Dashboard reporter.
|
|
@@ -18,7 +15,10 @@ import '@piwitests/core/code-reach';
|
|
|
18
15
|
interface PiwiDashboardOptions {
|
|
19
16
|
/** Explicitly enable or disable the reporter. Defaults to `true` when `serverUrl` is set. Set to `false` to disable even if `serverUrl` is provided. */
|
|
20
17
|
enabled?: boolean;
|
|
21
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* URL of the Piwi Dashboard server: a whole `http://` or `https://` address. Any other value leaves the reporter
|
|
20
|
+
* off, with a warning.
|
|
21
|
+
*/
|
|
22
22
|
serverUrl?: string;
|
|
23
23
|
/**
|
|
24
24
|
* When results go to the Piwi desktop app running on this machine instead.
|
|
@@ -39,15 +39,21 @@ interface PiwiDashboardOptions {
|
|
|
39
39
|
/**
|
|
40
40
|
* Time budget (ms) for the reporter's end-of-run work: delivering the last
|
|
41
41
|
* live events, uploading the remaining traces and attachments, and submitting
|
|
42
|
-
* the run.
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* for
|
|
42
|
+
* the run. The uploads stop a minute before it ends (a quarter of a shorter
|
|
43
|
+
* budget), so a streamed run is still finished. When it runs out, the
|
|
44
|
+
* reporter stops waiting for the dashboard and saves the run's results
|
|
45
|
+
* locally; the next run for the project uploads them, without traces or
|
|
46
|
+
* attachments. Defaults to `900000` (15 minutes). Set to `0` for no limit.
|
|
47
|
+
* Can also be set with `PIWI_SUBMIT_TIMEOUT`, in milliseconds too: a value
|
|
48
|
+
* that is not a number (`15m`) is ignored, with a warning.
|
|
46
49
|
*/
|
|
47
50
|
submitTimeout?: number;
|
|
48
51
|
/** Upload trace files to the dashboard. Defaults to `true`. */
|
|
49
52
|
uploadTraces?: boolean;
|
|
50
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Upload the HTML report Playwright's `html` reporter writes during the run, from its `outputFolder` (or
|
|
55
|
+
* `PLAYWRIGHT_HTML_OUTPUT_DIR`); a report an earlier run left there is never uploaded. Defaults to `true`.
|
|
56
|
+
*/
|
|
51
57
|
uploadReport?: boolean;
|
|
52
58
|
/** Upload each test's trace and attachments as soon as the test finishes (streaming mode only). Defaults to `true`. */
|
|
53
59
|
liveFileUploads?: boolean;
|
|
@@ -59,8 +65,9 @@ interface PiwiDashboardOptions {
|
|
|
59
65
|
collectPerformanceMetrics?: boolean;
|
|
60
66
|
/**
|
|
61
67
|
* Capture per-action locator snapshots that power failure-time healing
|
|
62
|
-
* suggestions. Adds a small per-action cost (one DOM read,
|
|
63
|
-
* snapshot)
|
|
68
|
+
* suggestions. Adds a small per-action cost (one DOM read, rarely two,
|
|
69
|
+
* sometimes an ARIA snapshot) and one DOM read per new document in the test
|
|
70
|
+
* worker. Defaults to `true`; automatically disabled
|
|
64
71
|
* when `collectPerformanceMetrics` is `false` (the reporter discards the data
|
|
65
72
|
* in that case anyway). Can also be forced off with `PIWI_CAPTURE_LOCATORS=false`.
|
|
66
73
|
*/
|
|
@@ -123,11 +130,14 @@ interface PiwiDashboardOptions {
|
|
|
123
130
|
* functions ran, from Chromium's JavaScript coverage, which is what
|
|
124
131
|
* `captureCodeReach: true` records; `'functions'` adds the start and end
|
|
125
132
|
* line of each function that ran, read through the dev server's modules or
|
|
126
|
-
* the bundle's source maps; `'
|
|
127
|
-
*
|
|
128
|
-
*
|
|
133
|
+
* the bundle's source maps; `'lines'` also adds the lines that ran and the
|
|
134
|
+
* executable lines of each file, from V8's block coverage, which slows the
|
|
135
|
+
* page's script down more than function coverage does; `'off'` records
|
|
136
|
+
* nothing. Paths, and line numbers with `'functions'` and `'lines'`, are
|
|
137
|
+
* sent, never source code or hit counts. Defaults to `'off'`. Can also be set
|
|
138
|
+
* with `PIWI_COVERAGE_BROWSER`.
|
|
129
139
|
*/
|
|
130
|
-
browser?: 'off' | 'files' | 'functions';
|
|
140
|
+
browser?: 'off' | 'files' | 'functions' | 'lines';
|
|
131
141
|
/**
|
|
132
142
|
* What the server side records, from a backend built with Piwi's coverage
|
|
133
143
|
* instrumentation (ASP.NET Core: `-p:PiwiCoverage=true`), which names each
|
|
@@ -301,7 +311,14 @@ interface PiwiDashboardOptions {
|
|
|
301
311
|
* with `PIWI_PICK_LOCATOR_ON_FAIL=true`.
|
|
302
312
|
*/
|
|
303
313
|
pickLocatorOnFailure?: boolean;
|
|
304
|
-
/**
|
|
314
|
+
/**
|
|
315
|
+
* Enable live streaming of results (falls back to batch if unsupported). An
|
|
316
|
+
* interrupted stream is retried until it catches up. Live events the
|
|
317
|
+
* dashboard refuses, or has not taken two and a half minutes after they first
|
|
318
|
+
* failed, leave the live view so the later ones flow; when test results are
|
|
319
|
+
* among the events the dashboard never took, the run is sent again as a batch
|
|
320
|
+
* at its end. Defaults to `true`.
|
|
321
|
+
*/
|
|
305
322
|
streaming?: boolean;
|
|
306
323
|
/**
|
|
307
324
|
* Number of queued events that triggers a send during streaming: test starts
|
|
@@ -324,7 +341,7 @@ interface PiwiDashboardOptions {
|
|
|
324
341
|
*/
|
|
325
342
|
maxStreamBufferBytes?: number;
|
|
326
343
|
/**
|
|
327
|
-
* Fail the run when any test was flaky (
|
|
344
|
+
* Fail the run when any test was flaky (one attempt failed and another passed). Forwarded
|
|
328
345
|
* to Playwright's native `failOnFlakyTests` config option (Playwright 1.52+)
|
|
329
346
|
* when the reporter is installed via `wrapConfig`, so a flaky-only run exits
|
|
330
347
|
* non-zero without any server round-trip. Defaults to `false`. Can also be
|
|
@@ -492,6 +509,8 @@ declare function wrapConfig<T extends PlaywrightTestConfig>(config: T, piwiOptio
|
|
|
492
509
|
declare class PiwiDashboardReporter {
|
|
493
510
|
private options;
|
|
494
511
|
private testCases;
|
|
512
|
+
/** The failed and timed-out attempts collected so far: the blockers a `describe.serial` cascade links to. */
|
|
513
|
+
private readonly failedCases;
|
|
495
514
|
private startTime;
|
|
496
515
|
private playwrightVersion;
|
|
497
516
|
private readonly reporterVersion;
|
|
@@ -501,14 +520,30 @@ declare class PiwiDashboardReporter {
|
|
|
501
520
|
private skippedTests;
|
|
502
521
|
private timedOutTests;
|
|
503
522
|
private didNotRunTests;
|
|
523
|
+
/**
|
|
524
|
+
* Tests whose attempts read as Playwright's `unexpected` outcome (`failedEveryAttempt`), counted once their last
|
|
525
|
+
* attempt ended: what `maxFailures` counts.
|
|
526
|
+
*/
|
|
527
|
+
private failedTestCount;
|
|
504
528
|
/** Full set of tests Playwright planned to run this shard (captured in `onBegin`). */
|
|
505
529
|
private plannedTests;
|
|
506
530
|
/** Ids of tests that actually reported via `onTestEnd`, to find the ones that never ran. */
|
|
507
531
|
private reportedTestIds;
|
|
532
|
+
/** The spec files said to have run without the capture fixtures in a run that can stop (`noteUncaptured`). */
|
|
533
|
+
private uncapturedSpecs;
|
|
534
|
+
/** The live steps begun and not ended, by step, sent again when someone opens the run (`onWatched`). */
|
|
535
|
+
private openSteps;
|
|
536
|
+
/**
|
|
537
|
+
* The failed attempts with retries left, by `test.id`: each is its test's last failure when no later attempt has a
|
|
538
|
+
* say in its outcome (`decidesOutcome`), the run stopping before the retry or the retry not running.
|
|
539
|
+
*/
|
|
540
|
+
private failuresAwaitingRetry;
|
|
508
541
|
/** Per-test attempt history, keyed by `test.id`; snapshotted onto every attempt's payload. */
|
|
509
542
|
private attemptsByTest;
|
|
510
543
|
/** The folder test files are named relative to: the Playwright config's, set in `onBegin`. */
|
|
511
544
|
private testPathBase;
|
|
545
|
+
/** The folder the run's html reporter writes its report to, set in `onBegin`; null when the run has none. */
|
|
546
|
+
private htmlReport;
|
|
512
547
|
/** Derived in `onBegin`, once the shard is known. */
|
|
513
548
|
private instanceId;
|
|
514
549
|
private shardInfo;
|
|
@@ -516,6 +551,8 @@ declare class PiwiDashboardReporter {
|
|
|
516
551
|
/** Each planned test's external ID and the IDs two tests share, settled in `onBegin`. */
|
|
517
552
|
private externalIds;
|
|
518
553
|
private enabled;
|
|
554
|
+
/** Why the configured `serverUrl` cannot be used, which leaves the reporter off; null when it can. */
|
|
555
|
+
private readonly serverUrlProblem;
|
|
519
556
|
/**
|
|
520
557
|
* True under `playwright test --list`, where Playwright still constructs this
|
|
521
558
|
* reporter and fires `onBegin`/`onEnd` but runs no tests. Registering and
|
|
@@ -528,10 +565,14 @@ declare class PiwiDashboardReporter {
|
|
|
528
565
|
private readonly desktopReplaced;
|
|
529
566
|
/** The config folder's `.env` file and the connection variables taken from it, if any. */
|
|
530
567
|
private readonly viaDotEnv;
|
|
568
|
+
/** The `PIWI_*` variables whose values could not be read, so their options kept their defaults. */
|
|
569
|
+
private readonly ignoredEnv;
|
|
531
570
|
private isFullRun;
|
|
532
571
|
private filterDetails;
|
|
533
572
|
/** Configured `maxFailures` (0 = unlimited) — disambiguates an interrupted run's unrun reason. */
|
|
534
573
|
private maxFailures;
|
|
574
|
+
/** Each Playwright project's `dependencies`, by project name, set in `onBegin`. */
|
|
575
|
+
private projectDependencies;
|
|
535
576
|
/** The resource censuses the capture fixtures attached, one per test attempt. */
|
|
536
577
|
private resourceCensuses;
|
|
537
578
|
/** Lifecycle steps of the tests that ran without the fixtures. */
|
|
@@ -558,6 +599,8 @@ declare class PiwiDashboardReporter {
|
|
|
558
599
|
private manifests;
|
|
559
600
|
/** Result events that stream once their test's server coverage is in. */
|
|
560
601
|
private coverageSends;
|
|
602
|
+
/** The errors Playwright reported outside any test (`onError`), the first `MAX_RUN_ERRORS` of them. */
|
|
603
|
+
private readonly runErrors;
|
|
561
604
|
private httpClient;
|
|
562
605
|
private uploader;
|
|
563
606
|
private fileHandler;
|
|
@@ -583,8 +626,8 @@ declare class PiwiDashboardReporter {
|
|
|
583
626
|
* Name the run's live view on the instance for the workers, which Playwright starts after this hook with this
|
|
584
627
|
* environment: the key the instance gave the global setup, for a project that turned its live view on, for this run
|
|
585
628
|
* alone. A CI run's workers stream with it at once; a run outside CI's hold it until a person shares the run (Share
|
|
586
|
-
* live), and such a run without a key names why instead, for the surfaces that would share it
|
|
587
|
-
* stream starts, which takes the setup file.
|
|
629
|
+
* live), and such a run without a key names why instead, for the surfaces that would share it; a CI run without one
|
|
630
|
+
* says why in its log (`ciLiveViewNote`). Read before the stream starts, which takes the setup file.
|
|
588
631
|
*/
|
|
589
632
|
private shareLiveView;
|
|
590
633
|
/**
|
|
@@ -596,7 +639,18 @@ declare class PiwiDashboardReporter {
|
|
|
596
639
|
private externalIdFields;
|
|
597
640
|
/** Playwright reporter hook: called when an individual test begins */
|
|
598
641
|
onTestBegin(test: TestCase, result: TestResult): void;
|
|
599
|
-
/**
|
|
642
|
+
/**
|
|
643
|
+
* Playwright reporter hook: an error outside any test, such as a global setup that threw, a spec file that did not
|
|
644
|
+
* load (`No tests found` and a web server that did not start come the same way, before any test), or a worker
|
|
645
|
+
* fixture whose teardown threw. The run keeps the first `MAX_RUN_ERRORS`, with what may be a secret hidden, and sends
|
|
646
|
+
* them with its end.
|
|
647
|
+
*/
|
|
648
|
+
onError(error: TestError): void;
|
|
649
|
+
/**
|
|
650
|
+
* The steps outside any test, for the run's timeline. Playwright 1.59 and later, the oldest the reporter supports,
|
|
651
|
+
* give every hook step to a test, `beforeAll` and `afterAll` hooks and worker fixture setup included, so it stays
|
|
652
|
+
* empty.
|
|
653
|
+
*/
|
|
600
654
|
private setupSteps;
|
|
601
655
|
/** Step categories streamed live while the run executes. */
|
|
602
656
|
private static readonly LIVE_STEP_CATEGORIES;
|
|
@@ -607,6 +661,15 @@ declare class PiwiDashboardReporter {
|
|
|
607
661
|
* human watches; the meaningful readout is the assertion around them.
|
|
608
662
|
*/
|
|
609
663
|
private static isLiveStep;
|
|
664
|
+
/**
|
|
665
|
+
* In a run that can stop (breakpoints, or a run channel to an editor or the desktop app), say of the first spec file
|
|
666
|
+
* whose test made Playwright calls without the capture fixtures, where the stops happen, that it never stops at a
|
|
667
|
+
* breakpoint nor at Pause, which nothing else says; the others are named in one line as the run ends
|
|
668
|
+
* (`noteOtherUncaptured`).
|
|
669
|
+
*/
|
|
670
|
+
private noteUncaptured;
|
|
671
|
+
/** The spec files past the first that ran without the capture fixtures, in one line (`noteUncaptured`). */
|
|
672
|
+
private noteOtherUncaptured;
|
|
610
673
|
/** Playwright reporter hook: called when a step (including hook/fixture) begins */
|
|
611
674
|
onStepBegin(test: TestCase | undefined, _result: TestResult | undefined, step: any): void;
|
|
612
675
|
/** Playwright reporter hook: called when a step (including hook/fixture) ends */
|
|
@@ -630,9 +693,20 @@ declare class PiwiDashboardReporter {
|
|
|
630
693
|
* carry no result, so they're emitted with zero duration and no error. In
|
|
631
694
|
* streaming mode they're queued as complete events so the pre-finish drain
|
|
632
695
|
* sends them alongside the rest. The `reason` (global timeout / max failures /
|
|
633
|
-
* interrupted) is resolved once from the overall run status by the caller.
|
|
696
|
+
* interrupted) is resolved once from the overall run status by the caller. A
|
|
697
|
+
* test declared skipped (`test.skip()`, `test.fixme()`, a skipped describe)
|
|
698
|
+
* is sent as `skipped`: it is a skip whether the run reached it or not. A test
|
|
699
|
+
* of a project whose dependency failed is a `dependency-failure`, blocked by
|
|
700
|
+
* that failure (`dependencyBlocker`).
|
|
634
701
|
*/
|
|
635
702
|
private materializeUnrunTests;
|
|
703
|
+
/**
|
|
704
|
+
* The failure that kept a test from running when a project its project depends on failed: the first test that failed
|
|
705
|
+
* every attempt with a say in its outcome (`failedEveryAttempt`) in a project of its project's `dependencies`,
|
|
706
|
+
* directly or through another project. Playwright runs no test of a project one of whose dependencies failed. Null
|
|
707
|
+
* for a test whose dependencies had no such failure.
|
|
708
|
+
*/
|
|
709
|
+
private dependencyBlocker;
|
|
636
710
|
/**
|
|
637
711
|
* Playwright reporter hook: called when the full test run finishes. Fails the run when two tests share an external
|
|
638
712
|
* ID and `externalId.onDuplicate` is `'fail'`.
|