@gate-forge/pack-playwright 0.13.7 → 0.13.9

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.
Files changed (47) hide show
  1. package/dist/discovery/discover.d.ts.map +1 -1
  2. package/dist/discovery/discover.js +141 -39
  3. package/dist/discovery/discover.js.map +1 -1
  4. package/dist/discovery/index.d.ts +1 -0
  5. package/dist/discovery/index.d.ts.map +1 -1
  6. package/dist/discovery/index.js +1 -0
  7. package/dist/discovery/index.js.map +1 -1
  8. package/dist/discovery/inference.d.ts.map +1 -1
  9. package/dist/discovery/inference.js +2 -9
  10. package/dist/discovery/inference.js.map +1 -1
  11. package/dist/discovery/reconcile.d.ts +8 -0
  12. package/dist/discovery/reconcile.d.ts.map +1 -1
  13. package/dist/discovery/reconcile.js +11 -0
  14. package/dist/discovery/reconcile.js.map +1 -1
  15. package/dist/discovery/serial-scopes.d.ts +76 -0
  16. package/dist/discovery/serial-scopes.d.ts.map +1 -0
  17. package/dist/discovery/serial-scopes.js +244 -0
  18. package/dist/discovery/serial-scopes.js.map +1 -0
  19. package/dist/discovery/static-discovery.d.ts +34 -16
  20. package/dist/discovery/static-discovery.d.ts.map +1 -1
  21. package/dist/discovery/static-discovery.js +1025 -78
  22. package/dist/discovery/static-discovery.js.map +1 -1
  23. package/dist/discovery/supervised-run.d.ts +6 -0
  24. package/dist/discovery/supervised-run.d.ts.map +1 -1
  25. package/dist/discovery/supervised-run.js +1 -0
  26. package/dist/discovery/supervised-run.js.map +1 -1
  27. package/dist/discovery/trusted-config.d.ts +6 -0
  28. package/dist/discovery/trusted-config.d.ts.map +1 -1
  29. package/dist/discovery/trusted-config.js +5 -1
  30. package/dist/discovery/trusted-config.js.map +1 -1
  31. package/dist/fixture/api-request.d.ts +15 -102
  32. package/dist/fixture/api-request.d.ts.map +1 -1
  33. package/dist/fixture/api-request.js +27 -101
  34. package/dist/fixture/api-request.js.map +1 -1
  35. package/dist/fixture/fixture.d.ts +16 -25
  36. package/dist/fixture/fixture.d.ts.map +1 -1
  37. package/dist/fixture/fixture.js +184 -66
  38. package/dist/fixture/fixture.js.map +1 -1
  39. package/dist/index.d.ts +2 -2
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +1 -1
  42. package/dist/index.js.map +1 -1
  43. package/dist/reporter/project-graph-reporter.d.ts +11 -1
  44. package/dist/reporter/project-graph-reporter.d.ts.map +1 -1
  45. package/dist/reporter/project-graph-reporter.js +16 -0
  46. package/dist/reporter/project-graph-reporter.js.map +1 -1
  47. package/package.json +3 -3
@@ -1,111 +1,24 @@
1
1
  /**
2
- * The witnessed API request channel.
3
- *
4
- * API tests that use Playwright's APIRequestContext — the `request`
5
- * fixture, `page.request`/`context.request`, or `request.newContext()`
6
- * imported from this pack — never pass `page.route`, so the session
7
- * proxy never sees their exchanges and their endpoint traffic could
8
- * never be witnessed. This module wraps an APIRequestContext so every
9
- * call whose resolved URL carries the app origin is rehosted onto the
10
- * test's session proxy: the SAME host swap `routePageThroughSessionProxy`
11
- * performs (path, query, headers and body untouched). Every other origin
12
- * passes through raw; a non-app origin that is still plausibly the app
13
- * (the app base's own host, or loopback) is reported through the same
14
- * unrouted-origin reporter the page channel uses.
15
- *
16
- * The wrapper is an explicit object implementing APIRequestContext's
17
- * request methods with `dispose`/`storageState` passthrough — no Proxy,
18
- * so types stay honest. One honest limitation: a `Request` OBJECT target
19
- * (`context.fetch(request)`) cannot be rehosted (no public constructor);
20
- * it passes through untouched, exactly like a foreign origin.
2
+ * Request-fixture and `request.newContext()` calls go directly to the app
3
+ * and are reported only as run-scoped diagnostics; they never pass through
4
+ * the session proxy or satisfy E2E claims. `page.request` and
5
+ * `context.request` stay untouched because Playwright's `Route.fetch` uses
6
+ * the context request internally to forward browser traffic.
21
7
  */
22
- import type { BrowserContext, APIRequestContext } from 'playwright';
23
- /** The validated origin pair one session's API calls route between. */
24
- export interface SessionApiRouting {
25
- appOrigin: string;
26
- sessionOrigin: string;
27
- }
28
- /**
29
- * Validates the origin pair exactly like the page channel's own rule:
30
- * both must be plain http and share the same (loopback) host — the swap
31
- * is a port swap, never a host change.
32
- *
33
- * Args:
34
- * appBaseURL: the configured app origin (GATEFORGE_APP_BASE_URL).
35
- * sessionProxyURL: the supervisor-issued session proxy origin.
36
- *
37
- * Returns:
38
- * SessionApiRouting: the parsed, validated pair.
39
- */
40
- export declare function sessionApiRouting(appBaseURL: string, sessionProxyURL: string): SessionApiRouting;
41
- /** Loopback in the three forms a browser URL can carry it. */
42
- export declare function isLoopbackHostname(hostname: string): boolean;
43
- /** What the wrapper decided about one call URL. */
44
- export interface ApiRewrite {
45
- /** The URL to hand the underlying context (raw for non-app origins). */
8
+ import type { APIRequestContext } from 'playwright';
9
+ /** An app-origin API call made directly from a test-code request context. */
10
+ export interface DirectExchange {
11
+ method: string;
46
12
  url: string;
47
- /** True when the call was rehosted onto the session proxy. */
48
- routed: boolean;
49
- /**
50
- * For a non-app origin that is still plausibly the app (the app base's
51
- * own host or loopback): the origin, for the unrouted-origin report.
52
- * Null for the app origin itself and for foreign origins.
53
- */
54
- mismatchedOrigin: string | null;
13
+ status: number;
55
14
  }
56
- /**
57
- * Resolves one call URL against the context base URL (or the app origin
58
- * when none is known) and rehosts it when it carries the app origin.
59
- * Non-app URLs come back RAW so the underlying context's own base URL
60
- * semantics keep applying to relative foreign paths.
61
- *
62
- * Args:
63
- * rawUrl: the URL exactly as the test passed it.
64
- * baseURL: the context's base URL (project `use.baseURL`), if known.
65
- * routing: the validated session routing.
66
- *
67
- * Returns:
68
- * ApiRewrite: the URL to send, the routing verdict, and any mismatch.
69
- */
70
- export declare function rewriteApiUrl(rawUrl: string, baseURL: string | undefined, routing: SessionApiRouting): ApiRewrite;
71
- /**
72
- * A lazily-resolved routing source. Null sends every call straight to
73
- * the app — that is setup traffic (module scope, worker hooks) or a
74
- * session-less test, which the witness never credits.
75
- */
76
- export type ApiRoutingSource = () => Promise<SessionApiRouting | null>;
77
- export interface WrapApiRequestContextOptions {
78
- /** Resolves relative call URLs when no better base URL is known. */
15
+ export interface WrapDirectRequestContextOptions {
79
16
  baseURL?: string;
80
- routing: ApiRoutingSource;
81
- onUnroutedOrigin?: (origin: string) => void;
17
+ onExchange: (exchange: DirectExchange) => void;
82
18
  }
83
19
  /**
84
- * Wraps an APIRequestContext so app-origin calls ride the session proxy.
85
- * All arguments are passed through untouched; only the URL can change.
86
- *
87
- * Args:
88
- * underlying: the real context (the built-in `request` fixture, the
89
- * page context's request, or a fresh `request.newContext()`).
90
- * options: base URL for relative resolution, the routing source, and
91
- * the optional unrouted-origin reporter.
92
- *
93
- * Returns:
94
- * APIRequestContext: the explicitly wrapped context.
95
- */
96
- export declare function wrapApiRequestContext(underlying: APIRequestContext, options: WrapApiRequestContextOptions): APIRequestContext;
97
- /**
98
- * Rehosts the owned APIRequestContext of a witnessed page's context
99
- * (`page.request` and `context.request` are the SAME lazily-created
100
- * object; shadowing it on the context instance covers both access
101
- * paths). The underlying context is materialized first and delegated to.
102
- *
103
- * Args:
104
- * context: the browser context of the witnessed page.
105
- * options: the same arguments {@link wrapApiRequestContext} takes.
106
- *
107
- * Returns:
108
- * void.
20
+ * Reports direct app-origin API calls made by test contexts. Reporting is
21
+ * best-effort and cannot change the underlying response.
109
22
  */
110
- export declare function rehostContextRequest(context: BrowserContext, options: WrapApiRequestContextOptions): void;
23
+ export declare function wrapDirectRequestContext(underlying: APIRequestContext, options: WrapDirectRequestContextOptions): APIRequestContext;
111
24
  //# sourceMappingURL=api-request.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-request.d.ts","sourceRoot":"","sources":["../../src/fixture/api-request.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAe,MAAM,YAAY,CAAC;AAEjF,uEAAuE;AACvE,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CA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AA6E;AAC7E,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,+BAA+B;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;CAChD;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,iBAAiB,EAC7B,OAAO,EAAE,+BAA+B,GACvC,iBAAiB,CAqCnB"}
@@ -1,114 +1,40 @@
1
- /**
2
- * Validates the origin pair exactly like the page channel's own rule:
3
- * both must be plain http and share the same (loopback) host — the swap
4
- * is a port swap, never a host change.
5
- *
6
- * Args:
7
- * appBaseURL: the configured app origin (GATEFORGE_APP_BASE_URL).
8
- * sessionProxyURL: the supervisor-issued session proxy origin.
9
- *
10
- * Returns:
11
- * SessionApiRouting: the parsed, validated pair.
12
- */
13
- export function sessionApiRouting(appBaseURL, sessionProxyURL) {
14
- const appOrigin = new URL(appBaseURL);
15
- const sessionOrigin = new URL(sessionProxyURL);
16
- if (appOrigin.protocol !== 'http:' ||
17
- sessionOrigin.protocol !== appOrigin.protocol ||
18
- sessionOrigin.hostname !== appOrigin.hostname) {
19
- throw new Error('Gateforge session proxy and app base must share the same loopback HTTP host');
20
- }
21
- return { appOrigin: appOrigin.origin, sessionOrigin: sessionOrigin.origin };
22
- }
23
- /** Loopback in the three forms a browser URL can carry it. */
24
- export function isLoopbackHostname(hostname) {
1
+ function isLoopbackHostname(hostname) {
25
2
  return hostname === 'localhost' || hostname === '::1' || hostname === '[::1]' || /^127\./.test(hostname);
26
3
  }
27
4
  /**
28
- * Resolves one call URL against the context base URL (or the app origin
29
- * when none is known) and rehosts it when it carries the app origin.
30
- * Non-app URLs come back RAW so the underlying context's own base URL
31
- * semantics keep applying to relative foreign paths.
32
- *
33
- * Args:
34
- * rawUrl: the URL exactly as the test passed it.
35
- * baseURL: the context's base URL (project `use.baseURL`), if known.
36
- * routing: the validated session routing.
37
- *
38
- * Returns:
39
- * ApiRewrite: the URL to send, the routing verdict, and any mismatch.
40
- */
41
- export function rewriteApiUrl(rawUrl, baseURL, routing) {
42
- if (routing.appOrigin === routing.sessionOrigin) {
43
- return { url: rawUrl, routed: false, mismatchedOrigin: null };
44
- }
45
- const resolved = new URL(rawUrl, baseURL ?? routing.appOrigin);
46
- if (resolved.origin === routing.appOrigin) {
47
- const rehosted = new URL(resolved.href);
48
- rehosted.host = new URL(routing.sessionOrigin).host;
49
- return { url: rehosted.href, routed: true, mismatchedOrigin: null };
50
- }
51
- const mismatched = resolved.hostname === new URL(routing.appOrigin).hostname || isLoopbackHostname(resolved.hostname)
52
- ? resolved.origin
53
- : null;
54
- return { url: rawUrl, routed: false, mismatchedOrigin: mismatched };
55
- }
56
- /**
57
- * Wraps an APIRequestContext so app-origin calls ride the session proxy.
58
- * All arguments are passed through untouched; only the URL can change.
59
- *
60
- * Args:
61
- * underlying: the real context (the built-in `request` fixture, the
62
- * page context's request, or a fresh `request.newContext()`).
63
- * options: base URL for relative resolution, the routing source, and
64
- * the optional unrouted-origin reporter.
65
- *
66
- * Returns:
67
- * APIRequestContext: the explicitly wrapped context.
5
+ * Reports direct app-origin API calls made by test contexts. Reporting is
6
+ * best-effort and cannot change the underlying response.
68
7
  */
69
- export function wrapApiRequestContext(underlying, options) {
70
- const routed = async (target, verbOptions, call) => {
71
- const routing = await options.routing();
72
- if (routing === null || typeof target !== 'string')
73
- return call(target, verbOptions);
74
- const rewrite = rewriteApiUrl(target, options.baseURL, routing);
75
- if (!rewrite.routed) {
76
- if (rewrite.mismatchedOrigin !== null && options.onUnroutedOrigin !== undefined) {
77
- options.onUnroutedOrigin(rewrite.mismatchedOrigin);
8
+ export function wrapDirectRequestContext(underlying, options) {
9
+ const invoke = async (method, target, call) => {
10
+ const response = await call();
11
+ try {
12
+ const resolved = options.baseURL === undefined ? new URL(target) : new URL(target, options.baseURL);
13
+ const appOrigin = options.baseURL === undefined ? null : new URL(options.baseURL).origin;
14
+ if ((resolved.protocol === 'http:' || resolved.protocol === 'https:') &&
15
+ (appOrigin === null ? isLoopbackHostname(resolved.hostname) : resolved.origin === appOrigin)) {
16
+ options.onExchange({ method, url: resolved.href, status: response.status() });
78
17
  }
79
- return call(target, verbOptions);
80
18
  }
81
- return call(rewrite.url, verbOptions);
19
+ catch {
20
+ // A URL that cannot be resolved is not useful for diagnosis.
21
+ }
22
+ return response;
82
23
  };
83
- const stringCall = (call) => async (url, verbOptions) => routed(url, verbOptions, (target, passed) => call(target, passed));
84
- return {
85
- fetch: (urlOrRequest, verbOptions) => routed(urlOrRequest, verbOptions, (target, passed) => underlying.fetch(target, passed)),
86
- get: stringCall((url, verbOptions) => underlying.get(url, verbOptions)),
87
- post: stringCall((url, verbOptions) => underlying.post(url, verbOptions)),
88
- put: stringCall((url, verbOptions) => underlying.put(url, verbOptions)),
89
- patch: stringCall((url, verbOptions) => underlying.patch(url, verbOptions)),
90
- delete: stringCall((url, verbOptions) => underlying.delete(url, verbOptions)),
91
- head: stringCall((url, verbOptions) => underlying.head(url, verbOptions)),
24
+ const wrapped = {
25
+ fetch: (url, verbOptions) => typeof url === 'string'
26
+ ? invoke('GET', url, () => underlying.fetch(url, verbOptions))
27
+ : underlying.fetch(url, verbOptions),
28
+ get: (url, verbOptions) => invoke('GET', url, () => underlying.get(url, verbOptions)),
29
+ post: (url, verbOptions) => invoke('POST', url, () => underlying.post(url, verbOptions)),
30
+ put: (url, verbOptions) => invoke('PUT', url, () => underlying.put(url, verbOptions)),
31
+ patch: (url, verbOptions) => invoke('PATCH', url, () => underlying.patch(url, verbOptions)),
32
+ delete: (url, verbOptions) => invoke('DELETE', url, () => underlying.delete(url, verbOptions)),
33
+ head: (url, verbOptions) => invoke('HEAD', url, () => underlying.head(url, verbOptions)),
92
34
  dispose: (verbOptions) => underlying.dispose(verbOptions),
93
35
  storageState: (verbOptions) => underlying.storageState(verbOptions),
94
36
  [Symbol.asyncDispose]: () => underlying.dispose(),
95
37
  };
96
- }
97
- /**
98
- * Rehosts the owned APIRequestContext of a witnessed page's context
99
- * (`page.request` and `context.request` are the SAME lazily-created
100
- * object; shadowing it on the context instance covers both access
101
- * paths). The underlying context is materialized first and delegated to.
102
- *
103
- * Args:
104
- * context: the browser context of the witnessed page.
105
- * options: the same arguments {@link wrapApiRequestContext} takes.
106
- *
107
- * Returns:
108
- * void.
109
- */
110
- export function rehostContextRequest(context, options) {
111
- const wrapped = wrapApiRequestContext(context.request, options);
112
- Object.defineProperty(context, 'request', { value: wrapped, configurable: true });
38
+ return wrapped;
113
39
  }
114
40
  //# sourceMappingURL=api-request.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-request.js","sourceRoot":"","sources":["../../src/fixture/api-request.ts"],"names":[],"mappings":"AA6BA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAkB,EAAE,eAAuB;IAC3E,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,CAAC;IAC/C,IACE,SAAS,CAAC,QAAQ,KAAK,OAAO;QAC9B,aAAa,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ;QAC7C,aAAa,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,EAC7C,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,6EAA6E,CAAC,CAAC;IACjG,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;AAC9E,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,OAAO,QAAQ,KAAK,WAAW,IAAI,QAAQ,KAAK,KAAK,IAAI,QAAQ,KAAK,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC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AAC,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;QAChH,OAAO,EAAE,CAAC,WAAwD,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,CAAC;QACtG,YAAY,EAAE,CAAC,WAA6D,EAAE,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,WAAW,CAAC;QACrH,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE;KAClD,CAAC;IACF,OAAO,OAA4B,CAAC;AACtC,CAAC"}
@@ -14,10 +14,10 @@
14
14
  * raw `playwright/test` bypasses the fixture and produces claims with no
15
15
  * records (the engine grades the obligation `missing`; GF-24).
16
16
  *
17
- * API tests are witnessed too: the `request` fixture, the owned
18
- * `page.request`/`context.request`, and the exported `request` factory
19
- * (its `newContext`) rehost app-origin calls onto the test's session
20
- * proxy through {@link ./api-request.ts} — see the module doc there.
17
+ * API requests made directly from test code are never E2E evidence. The
18
+ * `request` fixture, owned `page.request`/`context.request`, and exported
19
+ * `request` factory all go directly to the app; only browser page traffic
20
+ * rides the session proxy.
21
21
  */
22
22
  import { request as playwrightRequest } from 'playwright';
23
23
  import type { Page } from 'playwright/test';
@@ -50,7 +50,7 @@ export declare function flushPageObserverEvidence(witness: Pick<WitnessClient, '
50
50
  * sessionProxyURL: dedicated observation-proxy origin for this test.
51
51
  * onUnroutedOrigin: optional sink for unrouted same-host origins.
52
52
  */
53
- export declare function routePageThroughSessionProxy(page: Page, appBaseURL: string, sessionProxyURL: string, onUnroutedOrigin?: (origin: string) => void): Promise<void>;
53
+ export declare function routePageThroughSessionProxy(page: Page, appBaseURL: string, sessionProxyURL: string, onUnroutedOrigin?: (origin: string) => void, initiatorForRequest?: (method: string, url: string) => Promise<'page' | 'test-code' | 'unknown'>): Promise<void>;
54
54
  /**
55
55
  * The diagnostic sink the page fixture hands to
56
56
  * {@link routePageThroughSessionProxy}: it hands each distinct unrouted
@@ -91,10 +91,8 @@ export declare function createUnroutedOriginReporter(options: {
91
91
  }): UnroutedOriginReporter;
92
92
  /** Fixture map this pack adds to every test. */
93
93
  export type EvidenceFixtures = {
94
- /**
95
- * Optional consumer-declared UI surface. Only tests that call
96
- * `evidence.ui.*` need to declare it.
97
- */
94
+ /** Pending diagnostic-only direct API reports, settled before test teardown. */
95
+ directApiReports: void;
98
96
  surface: SurfaceDescriptor | undefined;
99
97
  /** The trusted evidence primitive surface for the running test. */
100
98
  evidence: EvidenceApi;
@@ -108,23 +106,16 @@ declare const extended: import("playwright/test").TestType<import("playwright/te
108
106
  export declare const test: typeof extended;
109
107
  export { expect };
110
108
  /**
111
- * The module-scope `request` of `@gate-forge/pack-playwright/fixture`:
112
- * `newContext(options)` returns the same witnessed wrapping the
113
- * `request` fixture carries, resolving the session LAZILY (on the first
114
- * call) from the currently running test. Where no test is running
115
- * (module scope), or inside a worker hook (`beforeAll`/`beforeEach`/
116
- * `afterEach`/`afterAll` — Playwright runs a file's `beforeAll` INSIDE
117
- * the first test's session window, so the session being open proves
118
- * nothing), the returned context talks to the app DIRECTLY — setup
119
- * traffic stays uncredited: it never reaches any session proxy, and
120
- * the witness refuses session-attributed evidence outside a bound
121
- * session. INSIDE a test body a session that never answers is a
122
- * failure, not a fallback: the context waits the fixtures' own
123
- * bound and then throws, so in-test traffic can never silently
124
- * bypass the witness.
109
+ * The module-scope `request` of `@gate-forge/pack-playwright/fixture`.
110
+ * `newContext(options)` creates a normal Playwright API context with the
111
+ * supplied options and never rehosts its calls onto the session proxy.
112
+ * App-origin calls made in a test body are reported as direct-API
113
+ * diagnostics only; they can never satisfy an E2E claim. Calls made at
114
+ * module scope have no owning test and are not reported.
125
115
  *
126
- * The underlying context is created with the options exactly as given;
127
- * only app-origin call URLs are rehosted per call.
116
+ * In worker hooks, calls go straight to the app and remain uncredited;
117
+ * the first test's session may already be open, but that does not make
118
+ * hook traffic test-body evidence.
128
119
  */
129
120
  export declare const request: {
130
121
  newContext(options?: Parameters<typeof playwrightRequest.newContext>[0]): Promise<APIRequestContext>;
@@ -1 +1 @@
1
- {"version":3,"file":"fixture.d.ts","sourceRoot":"","sources":["../../src/fixture/fixture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAA6B,OAAO,IAAI,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACrF,OAAO,KAAK,EAAE,IAAI,EAAY,MAAM,iBAAiB,CAAC;AAGtD,OAAO,KAAK,EAAE,iBAAiB,EAAW,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAG5D,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,aAAa,EAAE,KAAK,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAI1F;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,mBAAmB,CAAC,EACjD,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,IAAI,CAAC,CAQf;AAkDD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,EACvB,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAC1C,OAAO,CAAC,IAAI,CAAC,CAwBf;AAmBD;;;;;;;;;GASG;AACH,MAAM,WAAW,sBAAsB;IACrC,8CAA8C;IAC9C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,0DAA0D;IAC1D,OAAO,IAAI,OAAO,CAAC,IAAI,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