@piwitests/reporter 0.67.0 → 0.68.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/cli/index.js +448 -295
- package/dist/global-setup-module.js +297 -72
- package/dist/index.d.ts +33 -2
- package/dist/index.js +4715 -2376
- package/dist/internal/capture/attachments.d.ts +1 -0
- package/dist/internal/capture/attachments.js +2 -1
- package/dist/internal/capture/capture-fixtures.d.ts +100 -11
- package/dist/internal/capture/capture-fixtures.js +3295 -2303
- package/package.json +1 -1
|
@@ -31,6 +31,7 @@ declare const ATTACHMENT_NAMES: {
|
|
|
31
31
|
readonly aiMeta: "piwi-ai-meta";
|
|
32
32
|
readonly resources: "piwi-resources";
|
|
33
33
|
readonly pauses: "piwi-pauses";
|
|
34
|
+
readonly environment: "piwi-environment";
|
|
34
35
|
};
|
|
35
36
|
/** Set of every internal attachment name — used to skip them when collecting user attachments. */
|
|
36
37
|
declare const INTERNAL_ATTACHMENT_NAMES: ReadonlySet<string>;
|
|
@@ -58,7 +58,8 @@ var ATTACHMENT_NAMES = {
|
|
|
58
58
|
aiUsage: "piwi-ai-usage",
|
|
59
59
|
aiMeta: "piwi-ai-meta",
|
|
60
60
|
resources: "piwi-resources",
|
|
61
|
-
pauses: "piwi-pauses"
|
|
61
|
+
pauses: "piwi-pauses",
|
|
62
|
+
environment: "piwi-environment"
|
|
62
63
|
};
|
|
63
64
|
var INTERNAL_ATTACHMENT_NAMES = new Set(Object.values(ATTACHMENT_NAMES));
|
|
64
65
|
var ARIA_SNAPSHOT_CONTENT_TYPE = "text/plain; charset=utf-8";
|
|
@@ -93,7 +93,9 @@ declare class LocatorPageLog {
|
|
|
93
93
|
* element** and a region's ARIA snapshot, started from outside the page; at any stop, the responses the test kept (an
|
|
94
94
|
* interactive run keeps the text bodies of its pages' fetch and XHR answers), one of them to mock, and a locator's
|
|
95
95
|
* matches; and, for a viewer outside the page, the stopped page's live view (`@piwitests/core/run-view`: its frames,
|
|
96
|
-
* the input played on it) and the locator of the element under a point of an image of it;
|
|
96
|
+
* the input played on it) and the locator of the element under a point of an image of it; for a viewer of the
|
|
97
|
+
* worker's lane, its running test's page live, through its tests and stops (`view-lane`, a feature beyond `takes`);
|
|
98
|
+
* and, for an agent (the
|
|
97
99
|
* editor's MCP server), the stopped page's ARIA snapshot in AI mode, an action on one of its elements by its ref, that
|
|
98
100
|
* element's ranked locators, what the run does as it goes (`events`), and its browser bound for Playwright's own tools
|
|
99
101
|
* on request (`bind`). A worker holds a failure for the editor only once the service said it shows and answers one
|
|
@@ -183,8 +185,8 @@ declare function internalCall<T>(owner: unknown, run: () => Promise<T>): Promise
|
|
|
183
185
|
* At line granularity, V8's block coverage tells which code ran inside a
|
|
184
186
|
* function: at each offset, the innermost range around it (a function or a
|
|
185
187
|
* block) gives its count. A source line is executable when a source map
|
|
186
|
-
* segment maps to it, and it ran when one of those segments
|
|
187
|
-
*
|
|
188
|
+
* segment holding code maps to it, and it ran when one of those segments ran
|
|
189
|
+
* at its first character of code ({@link scriptLines}). A script with no map counts the lines holding code inside
|
|
188
190
|
* the functions V8 lists, its top level left out, and one of them ran when
|
|
189
191
|
* code on it ran.
|
|
190
192
|
*
|
|
@@ -431,6 +433,19 @@ interface ResourceTestRef {
|
|
|
431
433
|
/** Set on the test a census closes when it failed: Playwright shuts its worker down right after it. */
|
|
432
434
|
failed?: boolean;
|
|
433
435
|
}
|
|
436
|
+
/** The last call a test made on an object, or on anything under it (a page's frames and elements, a context's pages). */
|
|
437
|
+
interface ResourceUse {
|
|
438
|
+
at: number;
|
|
439
|
+
/** The line that made it, `file:line`. */
|
|
440
|
+
site: string | null;
|
|
441
|
+
/** The test that made it. */
|
|
442
|
+
test?: string;
|
|
443
|
+
}
|
|
444
|
+
/** The fixture being set up or torn down: its title, and its location for a fixture of the suite's own. */
|
|
445
|
+
interface ResourceFixture {
|
|
446
|
+
title: string;
|
|
447
|
+
location: string | null;
|
|
448
|
+
}
|
|
434
449
|
interface ResourceBirth {
|
|
435
450
|
id: number;
|
|
436
451
|
kind: ResourceKind;
|
|
@@ -438,12 +453,16 @@ interface ResourceBirth {
|
|
|
438
453
|
parent: number | null;
|
|
439
454
|
at: number;
|
|
440
455
|
phase: ResourcePhase;
|
|
441
|
-
/**
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
456
|
+
/**
|
|
457
|
+
* The fixture being set up when the object was opened. `worker` when it ran
|
|
458
|
+
* with a timeout slot, which Playwright gives a worker-scoped fixture and any
|
|
459
|
+
* fixture with a `timeout` of its own; `timed` for the second case, whose
|
|
460
|
+
* scope the slot does not tell.
|
|
461
|
+
*/
|
|
462
|
+
fixture: (ResourceFixture & {
|
|
445
463
|
worker: boolean;
|
|
446
|
-
|
|
464
|
+
timed?: boolean;
|
|
465
|
+
}) | null;
|
|
447
466
|
/** The test it was opened during; for a `beforeAll`, the test that ran the hook. */
|
|
448
467
|
test: ResourceTestRef | null;
|
|
449
468
|
/** The line that opened it, `file:line`. */
|
|
@@ -452,7 +471,7 @@ interface ResourceBirth {
|
|
|
452
471
|
opener?: number;
|
|
453
472
|
/** A popup: the call that was running or last ran when it appeared. */
|
|
454
473
|
trigger?: string;
|
|
455
|
-
/** A context `browser.newPage()` opened for its page. */
|
|
474
|
+
/** A context `browser.newPage()` opened for its page, or the browser `launchPersistentContext` opened for its context. */
|
|
456
475
|
implicit?: boolean;
|
|
457
476
|
/** A context Playwright reuses across tests on purpose (UI mode, `--reuse-context`). */
|
|
458
477
|
reused?: boolean;
|
|
@@ -462,8 +481,18 @@ interface ResourceClose {
|
|
|
462
481
|
at: number;
|
|
463
482
|
phase: ResourcePhase;
|
|
464
483
|
test: ResourceTestRef | null;
|
|
484
|
+
/** The fixture tearing down when it closed. */
|
|
485
|
+
fixture?: ResourceFixture;
|
|
465
486
|
/** Pages: whether anything ever ran on it. */
|
|
466
487
|
used?: boolean;
|
|
488
|
+
/** The last call a test made on it before it closed. */
|
|
489
|
+
lastUse?: ResourceUse;
|
|
490
|
+
/**
|
|
491
|
+
* When its close began, or its context's or browser's: before the work a
|
|
492
|
+
* close does first (Piwi's reads of its pages, Playwright saving its trace).
|
|
493
|
+
* Set when it began before `at`.
|
|
494
|
+
*/
|
|
495
|
+
closingAt?: number;
|
|
467
496
|
/** Closed by `PIWI_LEAK_CHECK=close`. */
|
|
468
497
|
byPiwi?: boolean;
|
|
469
498
|
}
|
|
@@ -473,7 +502,9 @@ interface ResourceOpen {
|
|
|
473
502
|
used?: boolean;
|
|
474
503
|
/** Pages: the current URL, without query or hash. */
|
|
475
504
|
url?: string;
|
|
476
|
-
/**
|
|
505
|
+
/** The last call a test made on it so far. */
|
|
506
|
+
lastUse?: ResourceUse;
|
|
507
|
+
/** Listeners on Playwright's events of the page, the context or the browser. */
|
|
477
508
|
listeners?: number;
|
|
478
509
|
/** Pages and contexts: `route()` handlers. */
|
|
479
510
|
routes?: number;
|
|
@@ -491,6 +522,8 @@ interface ResourceCensus {
|
|
|
491
522
|
at: number;
|
|
492
523
|
/** The test this census closes; null for the census a worker takes as it shuts down. */
|
|
493
524
|
test: ResourceTestRef | null;
|
|
525
|
+
/** When the test this census closes started, before its test-scoped fixtures were set up. */
|
|
526
|
+
startedAt?: number;
|
|
494
527
|
born: ResourceBirth[];
|
|
495
528
|
closed: ResourceClose[];
|
|
496
529
|
open: ResourceOpen[];
|
|
@@ -536,14 +569,21 @@ interface LeakedResource {
|
|
|
536
569
|
implicit: boolean;
|
|
537
570
|
/** A popup: the call that opened it. */
|
|
538
571
|
trigger?: string;
|
|
572
|
+
/** The line of the last call the test made on it, where its close belongs. */
|
|
573
|
+
lastUse?: string | null;
|
|
539
574
|
}
|
|
540
575
|
interface Instrumentation {
|
|
541
576
|
addListener?: (listener: object) => void;
|
|
542
577
|
removeListener?: (listener: object) => void;
|
|
543
578
|
}
|
|
579
|
+
/** A connection to Playwright (internal): every call of the objects it carries goes through it. */
|
|
580
|
+
interface ConnectionLike {
|
|
581
|
+
sendMessageToServer?: (object: unknown, method: unknown, params: unknown, options: unknown) => unknown;
|
|
582
|
+
}
|
|
544
583
|
type BrowserTypeLike = Record<string, unknown>;
|
|
545
584
|
interface PlaywrightLike {
|
|
546
585
|
_instrumentation?: Instrumentation;
|
|
586
|
+
_connection?: ConnectionLike;
|
|
547
587
|
chromium?: BrowserTypeLike;
|
|
548
588
|
firefox?: BrowserTypeLike;
|
|
549
589
|
webkit?: BrowserTypeLike;
|
|
@@ -556,6 +596,9 @@ interface TestInfoLike {
|
|
|
556
596
|
titlePath?: string[];
|
|
557
597
|
status?: string;
|
|
558
598
|
expectedStatus?: string;
|
|
599
|
+
project?: {
|
|
600
|
+
timeout?: number;
|
|
601
|
+
};
|
|
559
602
|
_timeoutManager?: {
|
|
560
603
|
_running?: {
|
|
561
604
|
runnable?: {
|
|
@@ -566,7 +609,9 @@ interface TestInfoLike {
|
|
|
566
609
|
file?: string;
|
|
567
610
|
line?: number;
|
|
568
611
|
};
|
|
569
|
-
slot?:
|
|
612
|
+
slot?: {
|
|
613
|
+
timeout?: number;
|
|
614
|
+
} | null;
|
|
570
615
|
};
|
|
571
616
|
};
|
|
572
617
|
} | null;
|
|
@@ -589,6 +634,14 @@ declare class ResourceLedger {
|
|
|
589
634
|
private lastCall;
|
|
590
635
|
/** The page a wrapped page method is calling into: its first reported API call marks it used. */
|
|
591
636
|
private usingPage;
|
|
637
|
+
/**
|
|
638
|
+
* The connections the ledger follows, each with what puts it back: every call a test makes through one marks what
|
|
639
|
+
* it lands on used.
|
|
640
|
+
*/
|
|
641
|
+
private readonly followed;
|
|
642
|
+
/** The client-side waits a test began, by their id, with the object each waits on and the line that began it. */
|
|
643
|
+
private readonly waits;
|
|
644
|
+
private windowStartedAt;
|
|
592
645
|
private born;
|
|
593
646
|
private closed;
|
|
594
647
|
private handlesAtStart;
|
|
@@ -611,6 +664,39 @@ declare class ResourceLedger {
|
|
|
611
664
|
nodeHandles?: boolean);
|
|
612
665
|
/** Listen to the worker's Playwright and wrap its browser types. False when the instrumentation is missing. */
|
|
613
666
|
install(): boolean;
|
|
667
|
+
/**
|
|
668
|
+
* Follow every call made through a connection to Playwright
|
|
669
|
+
* (`sendMessageToServer`, internal): the worker's own, and that of each
|
|
670
|
+
* browser it connects to. A call a test made (with its frames, not
|
|
671
|
+
* `internal` like Piwi's own reads and Playwright's artifacts) marks the
|
|
672
|
+
* object it lands on used, and the page, context and browser it belongs to
|
|
673
|
+
* (its `_parent` chain), with when and from which line. A long call (an
|
|
674
|
+
* assertion, a wait on the browser) keeps it in use until it returns, and a
|
|
675
|
+
* wait on the client (`waitForEvent` and its kin) until its internal end. A
|
|
676
|
+
* close marks when the object's close began; a `route()` handler's answers to
|
|
677
|
+
* the page's own traffic are no use. The pages of a connection it does not
|
|
678
|
+
* follow keep being marked used by their page methods and locators.
|
|
679
|
+
*/
|
|
680
|
+
private followCalls;
|
|
681
|
+
/** Stop following a connection, and let it go: a browser the worker connected to and has left. */
|
|
682
|
+
private unfollow;
|
|
683
|
+
/** Whether the ledger follows the calls of an object's connection. */
|
|
684
|
+
private follows;
|
|
685
|
+
private onCall;
|
|
686
|
+
/**
|
|
687
|
+
* A wait on the client begins with a call of the test's (with its frames)
|
|
688
|
+
* and ends with an internal one of the same id: the object it waited on was
|
|
689
|
+
* in use until then.
|
|
690
|
+
*/
|
|
691
|
+
private onWait;
|
|
692
|
+
/**
|
|
693
|
+
* Mark an object, and the page, context and browser it belongs to, used now
|
|
694
|
+
* by the call at `site`. A close that began before it did not end: the
|
|
695
|
+
* object is in use again.
|
|
696
|
+
*/
|
|
697
|
+
private touch;
|
|
698
|
+
/** Mark when an object's close began, the first time it begins. */
|
|
699
|
+
noteClosing(object: object): void;
|
|
614
700
|
/** Stop listening, and put Node's `listen` and `spawn` back; the objects already tracked stay in the ledger. */
|
|
615
701
|
uninstall(): void;
|
|
616
702
|
/**
|
|
@@ -658,6 +744,8 @@ declare class ResourceLedger {
|
|
|
658
744
|
/** `initial` is set for a page that came with its context (a persistent context's), which is no popup. */
|
|
659
745
|
private onPage;
|
|
660
746
|
private onClosed;
|
|
747
|
+
/** When the close of an object, or of the context or browser it belongs to, began first; null when none did. */
|
|
748
|
+
private closingOf;
|
|
661
749
|
private latestPendingCall;
|
|
662
750
|
private openEntries;
|
|
663
751
|
/**
|
|
@@ -668,6 +756,7 @@ declare class ResourceLedger {
|
|
|
668
756
|
private leaksOf;
|
|
669
757
|
/** Open pages under a context, or under any context of a browser. */
|
|
670
758
|
private pagesUnder;
|
|
759
|
+
/** A context `browser.newPage()` opened for its page, or a browser `launchPersistentContext` opened for its context. */
|
|
671
760
|
private isImplicit;
|
|
672
761
|
private openPagesOf;
|
|
673
762
|
private closeLeaks;
|