@gate-forge/pack-playwright 0.13.10 → 0.15.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.
Files changed (90) hide show
  1. package/dist/discovery/config-locations.d.ts +4 -0
  2. package/dist/discovery/config-locations.d.ts.map +1 -1
  3. package/dist/discovery/config-locations.js +9 -0
  4. package/dist/discovery/config-locations.js.map +1 -1
  5. package/dist/discovery/cypress-runner-adapter.d.ts +1 -1
  6. package/dist/discovery/cypress-runner-adapter.d.ts.map +1 -1
  7. package/dist/discovery/cypress-runner-adapter.js +9 -7
  8. package/dist/discovery/cypress-runner-adapter.js.map +1 -1
  9. package/dist/discovery/discover.d.ts +10 -0
  10. package/dist/discovery/discover.d.ts.map +1 -1
  11. package/dist/discovery/discover.js +123 -6
  12. package/dist/discovery/discover.js.map +1 -1
  13. package/dist/discovery/index.d.ts +1 -1
  14. package/dist/discovery/index.d.ts.map +1 -1
  15. package/dist/discovery/index.js +1 -1
  16. package/dist/discovery/index.js.map +1 -1
  17. package/dist/discovery/playwright-runner-adapter.d.ts.map +1 -1
  18. package/dist/discovery/playwright-runner-adapter.js +4 -1
  19. package/dist/discovery/playwright-runner-adapter.js.map +1 -1
  20. package/dist/discovery/prepare-barrier.d.ts +2 -1
  21. package/dist/discovery/prepare-barrier.d.ts.map +1 -1
  22. package/dist/discovery/prepare-barrier.js +2 -1
  23. package/dist/discovery/prepare-barrier.js.map +1 -1
  24. package/dist/discovery/pytest-runner-adapter.d.ts.map +1 -1
  25. package/dist/discovery/pytest-runner-adapter.js +11 -14
  26. package/dist/discovery/pytest-runner-adapter.js.map +1 -1
  27. package/dist/discovery/reconcile.d.ts +7 -7
  28. package/dist/discovery/reconcile.d.ts.map +1 -1
  29. package/dist/discovery/reconcile.js +36 -29
  30. package/dist/discovery/reconcile.js.map +1 -1
  31. package/dist/discovery/runner-config-paths.d.ts.map +1 -1
  32. package/dist/discovery/runner-config-paths.js +3 -4
  33. package/dist/discovery/runner-config-paths.js.map +1 -1
  34. package/dist/discovery/runner-env.d.ts +12 -0
  35. package/dist/discovery/runner-env.d.ts.map +1 -1
  36. package/dist/discovery/runner-env.js +36 -2
  37. package/dist/discovery/runner-env.js.map +1 -1
  38. package/dist/discovery/runner-file-scope.d.ts.map +1 -1
  39. package/dist/discovery/runner-file-scope.js +8 -0
  40. package/dist/discovery/runner-file-scope.js.map +1 -1
  41. package/dist/discovery/supervised-run.d.ts +11 -1
  42. package/dist/discovery/supervised-run.d.ts.map +1 -1
  43. package/dist/discovery/supervised-run.js +32 -12
  44. package/dist/discovery/supervised-run.js.map +1 -1
  45. package/dist/discovery/vitest-runner-adapter.d.ts +8 -1
  46. package/dist/discovery/vitest-runner-adapter.d.ts.map +1 -1
  47. package/dist/discovery/vitest-runner-adapter.js +28 -21
  48. package/dist/discovery/vitest-runner-adapter.js.map +1 -1
  49. package/dist/fixture/api-request.d.ts +11 -18
  50. package/dist/fixture/api-request.d.ts.map +1 -1
  51. package/dist/fixture/api-request.js +91 -32
  52. package/dist/fixture/api-request.js.map +1 -1
  53. package/dist/fixture/auto-session-env.d.ts +3 -0
  54. package/dist/fixture/auto-session-env.d.ts.map +1 -0
  55. package/dist/fixture/auto-session-env.js +7 -0
  56. package/dist/fixture/auto-session-env.js.map +1 -0
  57. package/dist/fixture/auto-session-loader.mjs +20 -0
  58. package/dist/fixture/auto-session-playwright-wrapper.mjs +6 -0
  59. package/dist/fixture/auto-session-root.cjs +14 -0
  60. package/dist/fixture/auto-session-wrapper.cjs +8 -0
  61. package/dist/fixture/auto-session-wrapper.mjs +6 -0
  62. package/dist/fixture/auto-session.cjs +36 -0
  63. package/dist/fixture/fixture.d.ts +45 -34
  64. package/dist/fixture/fixture.d.ts.map +1 -1
  65. package/dist/fixture/fixture.js +362 -245
  66. package/dist/fixture/fixture.js.map +1 -1
  67. package/dist/index.d.ts +2 -1
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +2 -1
  70. package/dist/index.js.map +1 -1
  71. package/dist/reporter/reporter.cjs +4 -0
  72. package/dist/reporter/reporter.cjs.map +1 -1
  73. package/dist/reporter/reporter.d.ts +8 -0
  74. package/dist/reporter/reporter.d.ts.map +1 -1
  75. package/dist/reporter/reporter.js +40 -0
  76. package/dist/reporter/reporter.js.map +1 -1
  77. package/dist/supervisor/drain.d.ts.map +1 -1
  78. package/dist/supervisor/drain.js +27 -0
  79. package/dist/supervisor/drain.js.map +1 -1
  80. package/dist/supervisor/spool.d.ts +5 -0
  81. package/dist/supervisor/spool.d.ts.map +1 -1
  82. package/dist/supervisor/spool.js +20 -1
  83. package/dist/supervisor/spool.js.map +1 -1
  84. package/dist/vitest/index.d.ts.map +1 -1
  85. package/dist/vitest/index.js +2 -1
  86. package/dist/vitest/index.js.map +1 -1
  87. package/dist/vitest/reporter.d.ts.map +1 -1
  88. package/dist/vitest/reporter.js +2 -1
  89. package/dist/vitest/reporter.js.map +1 -1
  90. package/package.json +4 -4
@@ -10,14 +10,13 @@
10
10
  * API. Tests that use engine-driven UI must extend this runner with a
11
11
  * declarative `surface` descriptor (`test.extend({ surface })`) — the
12
12
  * pack carries no application-specific selectors. Tests must
13
- * import `{ test, expect }` FROM A RUNNER EXTENDED LIKE THIS — importing
14
- * raw `playwright/test` bypasses the fixture and produces claims with no
15
- * records (the engine grades the obligation `missing`; GF-24).
13
+ * import `{ test, expect }` FROM A RUNNER EXTENDED LIKE THIS. Witnessed
14
+ * runs automatically redirect consumer `@playwright/test` and `playwright/test`
15
+ * imports here too; an uninstrumented test produces no browser records.
16
16
  *
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.
17
+ * API requests made from test code are never E2E evidence. Test-owned
18
+ * `request` contexts ride the session proxy with a test-code marker for
19
+ * the HTTP ledger; owned `page.request`/`context.request` stay direct.
21
20
  */
22
21
  import { request as playwrightRequest } from 'playwright';
23
22
  import type { Page } from 'playwright/test';
@@ -33,26 +32,41 @@ import { WitnessClient, type SessionPageObserverFlushRequest } from './witness-c
33
32
  */
34
33
  export declare function flushPageObserverEvidence(witness: Pick<WitnessClient, 'flushPageObserver'>, request: SessionPageObserverFlushRequest): Promise<void>;
35
34
  /**
36
- * Routes browser requests for the configured app origin through the
37
- * supervisor-issued session proxy, preserving the app URL and path.
35
+ * Routes browser requests for every CONFIGURED app origin through the
36
+ * supervisor-issued session proxy of that origin, preserving the app URL
37
+ * and path.
38
38
  *
39
- * Every OTHER origin the page requests is continued untouched — that is
40
- * what a third-party asset needs. When such an origin is on the app's
41
- * own host (or loopback) it is also a silent ORIGIN MISMATCH: the page
42
- * is talking to an app origin Gateforge never configured, so nothing it
43
- * fetches can reach the session proxy. `onUnroutedOrigin` reports those
44
- * origins so the witness's zero-traffic note can name the real cause
45
- * (plan 0.9.2 item F). It is diagnostic text: no record, no verdict.
39
+ * A run may declare more than one app origin (`.gateforge.yml`
40
+ * `additionalAppOrigins`): a consumer whose tests drive a platform admin
41
+ * console beside the tenant app loads both, and traffic on the second one
42
+ * used to pass unwitnessed — the test passed and earned nothing. Each
43
+ * origin rewrites onto ITS OWN session proxy, and both land on the same
44
+ * session, so attribution and claims are unchanged.
45
+ *
46
+ * Every OTHER origin the page requests is passed to remaining routes
47
+ * untouched, preserving the consumer's handlers for third-party assets.
48
+ * When an origin is on a routed app's own host (or loopback) it is also a
49
+ * silent ORIGIN MISMATCH: the page is talking to an app origin Gateforge
50
+ * never configured, so nothing it fetches can reach the session proxy.
51
+ * `onUnroutedOrigin` reports those origins so the witness's zero-traffic
52
+ * note can name the real cause (plan 0.9.2 item F). It is diagnostic text:
53
+ * no record, no verdict.
46
54
  *
47
55
  * Args:
48
56
  * page: Playwright page used by the current test.
49
- * appBaseURL: shared observation-proxy origin from the operator.
50
- * sessionProxyURL: dedicated observation-proxy origin for this test.
57
+ * appBaseURL: the primary app origin from the operator.
58
+ * sessionProxyURL: that origin's dedicated session-proxy origin.
51
59
  * onUnroutedOrigin: optional sink for unrouted same-host origins.
60
+ * initiatorForRequest: optional UI-vs-test-code classifier.
61
+ * additionalProxies: the DECLARED further origins and their proxies
62
+ * (from the session credential), when the run declares any.
52
63
  */
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>;
64
+ export declare function routePageThroughSessionProxy(page: Page, appBaseURL: string, sessionProxyURL: string, onUnroutedOrigin?: (origin: string) => void, initiatorForRequest?: (method: string, url: string) => Promise<'page' | 'test-code' | 'unknown'>, additionalProxies?: readonly {
65
+ appOrigin: string;
66
+ proxyUrl: string;
67
+ }[]): Promise<void>;
54
68
  /**
55
- * The diagnostic sink the page fixture hands to
69
+ * The diagnostic sink the browser routing fixture hands to
56
70
  * {@link routePageThroughSessionProxy}: it hands each distinct unrouted
57
71
  * origin to the witness for THIS session, which quotes it in the
58
72
  * zero-traffic note.
@@ -75,8 +89,10 @@ export interface UnroutedOriginReporter {
75
89
  * Args:
76
90
  * witness: the session's witness client.
77
91
  * session: the session the report belongs to (its own, never another's).
78
- * appBaseURL: the base URL the fixture routes — the origin the page
79
- * was supposed to load.
92
+ * appBaseURL: the primary base URL the fixture routes.
93
+ * additionalAppOrigins: the run's DECLARED further app origins. They are
94
+ * routed too, so a report naming one would be the fixture accusing
95
+ * itself of a mismatch it does not have.
80
96
  *
81
97
  * Returns:
82
98
  * UnroutedOriginReporter: the bounded, non-blocking reporter.
@@ -88,11 +104,12 @@ export declare function createUnroutedOriginReporter(options: {
88
104
  sessionToken: string;
89
105
  };
90
106
  appBaseURL: string;
107
+ additionalAppOrigins?: readonly string[];
91
108
  }): UnroutedOriginReporter;
92
109
  /** Fixture map this pack adds to every test. */
93
110
  export type EvidenceFixtures = {
94
- /** Pending diagnostic-only direct API reports, settled before test teardown. */
95
- directApiReports: void;
111
+ /** Test-scoped routing for every page, including consumer-owned contexts. */
112
+ browserPages: void;
96
113
  surface: SurfaceDescriptor | undefined;
97
114
  /** The trusted evidence primitive surface for the running test. */
98
115
  evidence: EvidenceApi;
@@ -106,16 +123,10 @@ declare const extended: import("playwright/test").TestType<import("playwright/te
106
123
  export declare const test: typeof extended;
107
124
  export { expect };
108
125
  /**
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.
115
- *
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.
126
+ * Test-created standalone API contexts use the CURRENT test's session.
127
+ * base.info() throwing detects module/global scope; workerHookDepth detects
128
+ * beforeAll/afterAll even when Playwright already exposes the first test.
129
+ * Contexts created there remain native/direct and never acquire attribution.
119
130
  */
120
131
  export declare const request: {
121
132
  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,EAAuB,MAAM,iBAAiB,CAAC;AAE9E,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;AAK1F;;;;;GAKG;AAC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