@zitadel/testing 1.0.0-alpha.25 → 1.0.0-alpha.28

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 CHANGED
@@ -14,7 +14,7 @@ the real login journey immediately.
14
14
 
15
15
  The repo previously had two extremes: the demo e2e suites run against
16
16
  `@zitadel/api-mock` (fast, but fake — no user store, no real crypto), and
17
- `cli-journey-e2e` runs the real packaged product but creates users by clicking
17
+ the CLI journey (`e2e/journey`) runs the real packaged product but creates users by clicking
18
18
  through the registration UI, serialized per suite. This kit fills the middle:
19
19
  **real server, programmatic seeding, parallel-safe per-test users.**
20
20
 
@@ -92,7 +92,14 @@ export default defineConfig({
92
92
 
93
93
  Most app tests don't want to re-test login. `authenticatedPage` seeds a user,
94
94
  drives the real login flow headlessly (the same Flow API the login UI renders),
95
- and injects the resulting session cookie into a dedicated browser context:
95
+ and injects the resulting session cookie into a dedicated browser context. It
96
+ injects it under both names a session cookie can have on an app's origin, so it
97
+ works for any app. Behind a server SDK (Next.js, Nuxt, SvelteKit, SolidStart,
98
+ TanStack Start, Qwik Router), and behind the dev proxy `zitadel setup` writes for
99
+ an SPA, the session is in `sessionCookieName(projectId)`,
100
+ `__nextgen_session_<projectId>`, so that the apps and the Console on one host
101
+ each keep their own. Behind a proxy that passes the server's cookie through, it
102
+ is the server's `SESSION_COOKIE_NAME`:
96
103
 
97
104
  ```ts
98
105
  test("member sees the dashboard", async ({ authenticatedPage }) => {
@@ -104,12 +111,15 @@ test("member sees the dashboard", async ({ authenticatedPage }) => {
104
111
  Underneath sits `seed.session()`, whose `sessionToken` also drives session
105
112
  APIs without any browser — backend tests call the instance directly with the
106
113
  cookie header (`cookie: __nextgen_session=<sessionToken>`, the SDK
107
- middleware's own headless pattern). Scope: password flows (the shipped
108
- `password-first` presets). A flow step demanding anything beyond the user's
109
- email and password — a challenge, another factor — fails with the step name;
110
- log in through the UI for those. `seed.identity()` complements registration
111
- specs: an unused email+password that creates nothing, so the flow under test
112
- must create the user.
114
+ middleware's own headless pattern; `SESSION_COOKIE_NAME` holds the name, which
115
+ is the server's).
116
+ Scope: password flows (the shipped `password-first` presets). A flow step
117
+ demanding anything beyond the user's email and password — a challenge,
118
+ another factor — fails with the step name; log in through the UI for those.
119
+ `seed.identity()` complements registration specs: an unused email+password
120
+ that creates nothing, so the flow under test must create the user. It needs
121
+ no instance, so a spec without `withZitadel()` — against an app you started
122
+ yourself — imports it as `identity()`.
113
123
 
114
124
  ### Drive the login flow
115
125
 
@@ -170,9 +180,9 @@ for local tests; raw IP origins like `127.0.0.1` are invalid. The default
170
180
  step; boot `preset: "passkey-first"` for one-tap discoverable-credential
171
181
  login flows.
172
182
 
173
- The two in-repo consumers are `apps/demo-next-e2e/playwright.real.config.mts`
174
- and `apps/console-e2e/playwright.real.config.mts` — run them with
175
- `moon run demo-next-e2e:e2e-real` / `moon run console-e2e:e2e-real`.
183
+ The two in-repo consumers are `e2e/demo-next/playwright.real.config.mts`
184
+ and `e2e/console/playwright.real.config.mts` — run them with
185
+ `moon run e2e:demo-next-real` / `moon run e2e:console-real`.
176
186
 
177
187
  ### Composable pieces
178
188
 
@@ -191,12 +201,15 @@ import {
191
201
  startLocalZitadel, // boot + bootstrap an ephemeral instance
192
202
  connectZitadel, // attach to an existing instance via its handle
193
203
  writeHandshake, readHandshakeSync, waitForHandshake,
204
+ identity, // unused { email, password }, no instance needed
205
+ SESSION_COOKIE_NAME, // "__nextgen_session", the server's name
206
+ sessionCookieName, // (projectId) => "__nextgen_session_<projectId>", an app's
194
207
  } from "@zitadel/testing";
195
208
 
196
209
  const z = await startLocalZitadel({
197
210
  port, // default: free port
198
211
  dir, // default: temp dir, removed on stop (caller dirs are kept)
199
- appOrigins, // registered as the project's preview_origins
212
+ appOrigins, // registered as the project's origins
200
213
  useCase, // "minimal" (default) | "consumer" | "business"
201
214
  preset, // "password-first" (default)
202
215
  serverBinary, // ZITADEL_SERVER_BINARY override (path to a built server binary)
@@ -225,7 +238,8 @@ per test, `zitadel` per worker, `passkey` on demand), the flow ceremonies
225
238
  `withZitadel(options)` returning `{ webServer }` for the config,
226
239
  `enableVirtualPasskey(page)` for non-fixture pages, and
227
240
  `nextAppEnv`/`applyAppEnvTemplate` for the env-template mechanism described
228
- above.
241
+ above. `identity()`, `SESSION_COOKIE_NAME` and `sessionCookieName` are on
242
+ both entry points, so a Playwright spec imports everything from this one.
229
243
 
230
244
  ## How it works
231
245
 
@@ -286,7 +300,7 @@ or export.
286
300
  **One instance per suite, one fresh user per test.** Emails are unique per
287
301
  project, so per-test `seed.user()` calls are isolation enough for login-flow
288
302
  tests, and tests run fully parallel against the shared instance
289
- (demonstrated by `demo-next-e2e:e2e-real`, 2 workers).
303
+ (demonstrated by `e2e:demo-next-real`, 2 workers).
290
304
 
291
305
  Typical timings with the SQLite local default (dated estimates from a July 2026 dev build — orders of magnitude, not a benchmark; remeasure locally before relying on them):
292
306
 
@@ -297,7 +311,7 @@ Typical timings with the SQLite local default (dated estimates from a July 2026
297
311
  | Stop | typically under a second |
298
312
  | Bootstrap (project + schema + flow) | ~100ms |
299
313
  | Seed one user (create + password) | ~50ms |
300
- | Full `e2e-real` suite (boot + Next dev + 2 browser tests) | ~25s |
314
+ | Full `e2e:demo-next-real` suite (boot + Next dev + 2 browser tests) | ~25s |
301
315
 
302
316
  **Instance-per-worker is not worth it for browser e2e**: the app dev server
303
317
  boots once with one project's env, and every extra worker would pay the full
@@ -321,7 +335,7 @@ own suites run `moon run server:build` and point the kit at the result via
321
335
  `serverBinaryHint` exists for this). Most in-repo moon tasks set
322
336
  `NEXTGEN_SERVER_LOGIN_ENABLED=false` / `NEXTGEN_SERVER_CONSOLE_ENABLED=false`
323
337
  because they drive the app-embedded login, not the server-hosted `/ui/*`; the
324
- exception is `console-e2e:e2e-embedded`, which keeps both surfaces on and
338
+ exception is `e2e:console-embedded`, which keeps both surfaces on and
325
339
  omits `app` — the binary-served `/ui/*` pages are its subject. Customer
326
340
  installs need none of this.
327
341
 
@@ -342,8 +356,8 @@ Zitadel" when the app under test and Playwright share one machine. The layers
342
356
  on top, in intended order:
343
357
 
344
358
  1. **Registration fixtures.** Landed: `zitadel.identity()` plus the
345
- demo-next-e2e registration spec driving the real registration UI and
346
- verifying the created user through the API. `cli-journey-e2e` keeps the
359
+ demo-next real-lane registration spec driving the real registration UI and
360
+ verifying the created user through the API. The CLI journey keeps the
347
361
  packaged-product registration coverage.
348
362
  2. **Email/OTP capture.** `zitadel.email.waitForCode(address)` for
349
363
  verification flows. Blocked on a server-side story (dev SMTP sink or
@@ -1,4 +1,4 @@
1
- const require_handshake = require("./handshake-Cds_mGAO.cjs");
1
+ const require_handshake = require("./handshake-D6MXSUcd.cjs");
2
2
  const require_orchestration = require("./orchestration-gIDANMcF.cjs");
3
3
  let node_child_process = require("node:child_process");
4
4
  //#region src/app-runner.ts
@@ -1,4 +1,4 @@
1
- import { i as applyAppEnvTemplate, n as waitForHandshake } from "./handshake-BBrTG-5P.mjs";
1
+ import { i as applyAppEnvTemplate, n as waitForHandshake } from "./handshake-CwlxMjW0.mjs";
2
2
  import { i as parseAppRunnerConfig, o as requireHandshakePath, t as APP_RUNNER_CONFIG_ENV } from "./orchestration-Clldecyr.mjs";
3
3
  import { spawn } from "node:child_process";
4
4
  //#region src/app-runner.ts
@@ -4,12 +4,15 @@ import { readFileSync } from "node:fs";
4
4
  import { setTimeout } from "node:timers/promises";
5
5
  //#region src/app-env.ts
6
6
  /**
7
- * The env shape `@zitadel/sdk-next` apps read. Other frameworks pass their own
8
- * template — the console maps the same handle fields to `VITE_*`/`CONSOLE_*`
9
- * names, for example.
7
+ * The env shape `@zitadel/sdk-next` apps read, as `zitadel setup` writes it.
8
+ * The server reads `ZITADEL_PROJECT_ID` to hold sessions to the project, the
9
+ * widgets the public copy. Other frameworks pass their own template — the
10
+ * console maps the same handle fields to `VITE_*`/`CONSOLE_*` names, for
11
+ * example.
10
12
  */
11
13
  const nextAppEnv = {
12
14
  ZITADEL_URL: "baseUrl",
15
+ ZITADEL_PROJECT_ID: "projectId",
13
16
  NEXT_PUBLIC_ZITADEL_PROJECT_ID: "projectId",
14
17
  ZITADEL_PROJECT_SECRET: "projectSecret"
15
18
  };
@@ -80,4 +83,4 @@ function validatePlatform(value, source) {
80
83
  //#endregion
81
84
  export { nextAppEnv as a, applyAppEnvTemplate as i, waitForHandshake as n, writeHandshake as r, readHandshakeSync as t };
82
85
 
83
- //# sourceMappingURL=handshake-BBrTG-5P.mjs.map
86
+ //# sourceMappingURL=handshake-CwlxMjW0.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handshake-CwlxMjW0.mjs","names":["sleep"],"sources":["../src/app-env.ts","../src/handshake.ts"],"sourcesContent":["import type { InstanceHandle } from \"./types\";\n\n/**\n * Handle fields a template may reference: the flat string facts. Structured\n * fields (e.g. `platform`) are not env-var material — consumers read those\n * from the handle directly.\n */\ntype StringHandleField = {\n [K in keyof InstanceHandle]-?: InstanceHandle[K] extends string | undefined ? K : never;\n}[keyof InstanceHandle];\n\n/**\n * Declarative mapping from an app's env var names to InstanceHandle fields.\n * A template (not a function) so it can cross process boundaries: the\n * Playwright config serializes it into the app-runner's environment, where it\n * is applied to the handle read from the handshake file.\n */\nexport type AppEnvTemplate = Record<string, StringHandleField>;\n\n/**\n * The env shape `@zitadel/sdk-next` apps read, as `zitadel setup` writes it.\n * The server reads `ZITADEL_PROJECT_ID` to hold sessions to the project, the\n * widgets the public copy. Other frameworks pass their own template — the\n * console maps the same handle fields to `VITE_*`/`CONSOLE_*` names, for\n * example.\n */\nexport const nextAppEnv: AppEnvTemplate = {\n ZITADEL_URL: \"baseUrl\",\n ZITADEL_PROJECT_ID: \"projectId\",\n NEXT_PUBLIC_ZITADEL_PROJECT_ID: \"projectId\",\n ZITADEL_PROJECT_SECRET: \"projectSecret\",\n};\n\nexport function applyAppEnvTemplate(\n template: AppEnvTemplate,\n handle: InstanceHandle,\n): Record<string, string> {\n const env: Record<string, string> = {};\n for (const [name, field] of Object.entries(template)) {\n const value = handle[field];\n if (typeof value !== \"string\" || value.length === 0) {\n // Fail instead of silently dropping the var: an app booted without one\n // of its env vars produces a much harder-to-read failure downstream.\n throw new Error(\n `app env template maps \"${name}\" to handle field \"${field}\", which the instance handle does not carry`,\n );\n }\n env[name] = value;\n }\n return env;\n}\n","import { readFileSync } from \"node:fs\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport { setTimeout as sleep } from \"node:timers/promises\";\n\nimport type { InstanceHandle, PlatformCredentials } from \"./types\";\n\n/**\n * The handshake file carries an InstanceHandle across process boundaries:\n * written by the script that boots + bootstraps the instance, read by\n * Playwright workers (fixtures) and the app dev-server wrapper.\n */\nexport async function writeHandshake(path: string, handle: InstanceHandle): Promise<void> {\n await mkdir(dirname(path), { recursive: true });\n await writeFile(path, `${JSON.stringify(handle, null, 2)}\\n`, { mode: 0o600 });\n}\n\nexport function readHandshakeSync(path: string): InstanceHandle {\n const contents = readFileSync(path, \"utf8\");\n let value: unknown;\n try {\n value = JSON.parse(contents);\n } catch (error) {\n throw new Error(`handshake file ${path} contains invalid JSON: ${(error as Error).message}`, {\n cause: error,\n });\n }\n return validateHandle(value, path);\n}\n\nexport async function waitForHandshake(path: string, timeoutMs = 60_000): Promise<InstanceHandle> {\n const deadline = Date.now() + timeoutMs;\n for (;;) {\n try {\n return validateHandle(JSON.parse(await readFile(path, \"utf8\")), path);\n } catch (error) {\n if (Date.now() >= deadline) {\n throw new Error(\n `handshake file not readable within ${timeoutMs}ms: ${path} (${(error as Error).message})`,\n { cause: error },\n );\n }\n await sleep(250);\n }\n }\n}\n\nfunction validateHandle(value: unknown, source: string): InstanceHandle {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new Error(`handshake file ${source} is not an object`);\n }\n const handle = value as Partial<InstanceHandle>;\n for (const field of [\"baseUrl\", \"projectId\", \"projectSecret\", \"schemaId\"] as const) {\n if (typeof handle[field] !== \"string\" || handle[field].length === 0) {\n throw new Error(`handshake file ${source} is missing \"${field}\"`);\n }\n }\n if (!URL.canParse(handle.baseUrl as string)) {\n throw new Error(`handshake file ${source} has a malformed \"baseUrl\": ${handle.baseUrl}`);\n }\n if (handle.platform !== undefined) {\n validatePlatform(handle.platform, source);\n }\n return handle as InstanceHandle;\n}\n\n/**\n * The handshake is the cross-process contract, so a malformed platform block\n * must fail here with the field name, not later with a less actionable error.\n */\nfunction validatePlatform(value: unknown, source: string): void {\n const fail = (detail: string): never => {\n throw new Error(`handshake file ${source} has a malformed \"platform\" block: ${detail}`);\n };\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n fail(\"not an object\");\n }\n const platform = value as Partial<PlatformCredentials>;\n for (const field of [\"projectId\", \"publishableKey\"] as const) {\n if (typeof platform[field] !== \"string\" || platform[field].length === 0) {\n fail(`\"${field}\" is required`);\n }\n }\n // Unknown extra fields pass through on purpose: future platform\n // credentials join additively, and an older reader must not reject a\n // newer producer's handle.\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,MAAa,aAA6B;CACxC,aAAa;CACb,oBAAoB;CACpB,gCAAgC;CAChC,wBAAwB;AAC1B;AAEA,SAAgB,oBACd,UACA,QACwB;CACxB,MAAM,MAA8B,CAAC;CACrC,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,QAAQ,GAAG;EACpD,MAAM,QAAQ,OAAO;EACrB,IAAI,OAAO,UAAU,YAAY,MAAM,WAAW,GAGhD,MAAM,IAAI,MACR,0BAA0B,KAAK,qBAAqB,MAAM,4CAC5D;EAEF,IAAI,QAAQ;CACd;CACA,OAAO;AACT;;;;;;;;ACtCA,eAAsB,eAAe,MAAc,QAAuC;CACxF,MAAM,MAAM,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;CAC9C,MAAM,UAAU,MAAM,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,IAAM,CAAC;AAC/E;AAEA,SAAgB,kB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QAAQ;CACxF;CACA,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GACpE,KAAK,eAAe;CAEtB,MAAM,WAAW;CACjB,KAAK,MAAM,SAAS,CAAC,aAAa,gBAAgB,GAChD,IAAI,OAAO,SAAS,WAAW,YAAY,SAAS,MAAM,CAAC,WAAW,GACpE,KAAK,IAAI,MAAM,cAAc;AAMnC"}
@@ -4,12 +4,15 @@ let node_path = require("node:path");
4
4
  let node_timers_promises = require("node:timers/promises");
5
5
  //#region src/app-env.ts
6
6
  /**
7
- * The env shape `@zitadel/sdk-next` apps read. Other frameworks pass their own
8
- * template — the console maps the same handle fields to `VITE_*`/`CONSOLE_*`
9
- * names, for example.
7
+ * The env shape `@zitadel/sdk-next` apps read, as `zitadel setup` writes it.
8
+ * The server reads `ZITADEL_PROJECT_ID` to hold sessions to the project, the
9
+ * widgets the public copy. Other frameworks pass their own template — the
10
+ * console maps the same handle fields to `VITE_*`/`CONSOLE_*` names, for
11
+ * example.
10
12
  */
11
13
  const nextAppEnv = {
12
14
  ZITADEL_URL: "baseUrl",
15
+ ZITADEL_PROJECT_ID: "projectId",
13
16
  NEXT_PUBLIC_ZITADEL_PROJECT_ID: "projectId",
14
17
  ZITADEL_PROJECT_SECRET: "projectSecret"
15
18
  };
@@ -109,4 +112,4 @@ Object.defineProperty(exports, "writeHandshake", {
109
112
  }
110
113
  });
111
114
 
112
- //# sourceMappingURL=handshake-Cds_mGAO.cjs.map
115
+ //# sourceMappingURL=handshake-D6MXSUcd.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handshake-D6MXSUcd.cjs","names":["mkdir","dirname","writeFile","readFileSync","readFile","sleep"],"sources":["../src/app-env.ts","../src/handshake.ts"],"sourcesContent":["import type { InstanceHandle } from \"./types\";\n\n/**\n * Handle fields a template may reference: the flat string facts. Structured\n * fields (e.g. `platform`) are not env-var material — consumers read those\n * from the handle directly.\n */\ntype StringHandleField = {\n [K in keyof InstanceHandle]-?: InstanceHandle[K] extends string | undefined ? K : never;\n}[keyof InstanceHandle];\n\n/**\n * Declarative mapping from an app's env var names to InstanceHandle fields.\n * A template (not a function) so it can cross process boundaries: the\n * Playwright config serializes it into the app-runner's environment, where it\n * is applied to the handle read from the handshake file.\n */\nexport type AppEnvTemplate = Record<string, StringHandleField>;\n\n/**\n * The env shape `@zitadel/sdk-next` apps read, as `zitadel setup` writes it.\n * The server reads `ZITADEL_PROJECT_ID` to hold sessions to the project, the\n * widgets the public copy. Other frameworks pass their own template — the\n * console maps the same handle fields to `VITE_*`/`CONSOLE_*` names, for\n * example.\n */\nexport const nextAppEnv: AppEnvTemplate = {\n ZITADEL_URL: \"baseUrl\",\n ZITADEL_PROJECT_ID: \"projectId\",\n NEXT_PUBLIC_ZITADEL_PROJECT_ID: \"projectId\",\n ZITADEL_PROJECT_SECRET: \"projectSecret\",\n};\n\nexport function applyAppEnvTemplate(\n template: AppEnvTemplate,\n handle: InstanceHandle,\n): Record<string, string> {\n const env: Record<string, string> = {};\n for (const [name, field] of Object.entries(template)) {\n const value = handle[field];\n if (typeof value !== \"string\" || value.length === 0) {\n // Fail instead of silently dropping the var: an app booted without one\n // of its env vars produces a much harder-to-read failure downstream.\n throw new Error(\n `app env template maps \"${name}\" to handle field \"${field}\", which the instance handle does not carry`,\n );\n }\n env[name] = value;\n }\n return env;\n}\n","import { readFileSync } from \"node:fs\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport { setTimeout as sleep } from \"node:timers/promises\";\n\nimport type { InstanceHandle, PlatformCredentials } from \"./types\";\n\n/**\n * The handshake file carries an InstanceHandle across process boundaries:\n * written by the script that boots + bootstraps the instance, read by\n * Playwright workers (fixtures) and the app dev-server wrapper.\n */\nexport async function writeHandshake(path: string, handle: InstanceHandle): Promise<void> {\n await mkdir(dirname(path), { recursive: true });\n await writeFile(path, `${JSON.stringify(handle, null, 2)}\\n`, { mode: 0o600 });\n}\n\nexport function readHandshakeSync(path: string): InstanceHandle {\n const contents = readFileSync(path, \"utf8\");\n let value: unknown;\n try {\n value = JSON.parse(contents);\n } catch (error) {\n throw new Error(`handshake file ${path} contains invalid JSON: ${(error as Error).message}`, {\n cause: error,\n });\n }\n return validateHandle(value, path);\n}\n\nexport async function waitForHandshake(path: string, timeoutMs = 60_000): Promise<InstanceHandle> {\n const deadline = Date.now() + timeoutMs;\n for (;;) {\n try {\n return validateHandle(JSON.parse(await readFile(path, \"utf8\")), path);\n } catch (error) {\n if (Date.now() >= deadline) {\n throw new Error(\n `handshake file not readable within ${timeoutMs}ms: ${path} (${(error as Error).message})`,\n { cause: error },\n );\n }\n await sleep(250);\n }\n }\n}\n\nfunction validateHandle(value: unknown, source: string): InstanceHandle {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new Error(`handshake file ${source} is not an object`);\n }\n const handle = value as Partial<InstanceHandle>;\n for (const field of [\"baseUrl\", \"projectId\", \"projectSecret\", \"schemaId\"] as const) {\n if (typeof handle[field] !== \"string\" || handle[field].length === 0) {\n throw new Error(`handshake file ${source} is missing \"${field}\"`);\n }\n }\n if (!URL.canParse(handle.baseUrl as string)) {\n throw new Error(`handshake file ${source} has a malformed \"baseUrl\": ${handle.baseUrl}`);\n }\n if (handle.platform !== undefined) {\n validatePlatform(handle.platform, source);\n }\n return handle as InstanceHandle;\n}\n\n/**\n * The handshake is the cross-process contract, so a malformed platform block\n * must fail here with the field name, not later with a less actionable error.\n */\nfunction validatePlatform(value: unknown, source: string): void {\n const fail = (detail: string): never => {\n throw new Error(`handshake file ${source} has a malformed \"platform\" block: ${detail}`);\n };\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n fail(\"not an object\");\n }\n const platform = value as Partial<PlatformCredentials>;\n for (const field of [\"projectId\", \"publishableKey\"] as const) {\n if (typeof platform[field] !== \"string\" || platform[field].length === 0) {\n fail(`\"${field}\" is required`);\n }\n }\n // Unknown extra fields pass through on purpose: future platform\n // credentials join additively, and an older reader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I,MACR,sCAAsC,UAAU,MAAM,KAAK,IAAK,MAAgB,QAAQ,IACxF,EAAE,OAAO,MAAM,CACjB;EAEF,OAAA,GAAMC,qBAAAA,WAAAA,CAAM,GAAG;CACjB;AAEJ;AAEA,SAAS,eAAe,OAAgB,QAAgC;CACtE,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GACpE,MAAM,IAAI,MAAM,kBAAkB,OAAO,kBAAkB;CAE7D,MAAM,SAAS;CACf,KAAK,MAAM,SAAS;EAAC;EAAW;EAAa;EAAiB;CAAU,GACtE,IAAI,OAAO,OAAO,WAAW,YAAY,OAAO,MAAM,CAAC,WAAW,GAChE,MAAM,IAAI,MAAM,kBAAkB,OAAO,eAAe,MAAM,EAAE;CAGpE,IAAI,CAAC,IAAI,SAAS,OAAO,OAAiB,GACxC,MAAM,IAAI,MAAM,kBAAkB,OAAO,8BAA8B,OAAO,SAAS;CAEzF,IAAI,OAAO,aAAa,KAAA,GACtB,iBAAiB,OAAO,UAAU,MAAM;CAE1C,OAAO;AACT;;;;;AAMA,SAAS,iBAAiB,OAAgB,QAAsB;CAC9D,MAAM,QAAQ,WAA0B;EACtC,MAAM,IAAI,MAAM,kBAAkB,OAAO,qCAAqC,QAAQ;CACxF;CACA,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GACpE,KAAK,eAAe;CAEtB,MAAM,WAAW;CACjB,KAAK,MAAM,SAAS,CAAC,aAAa,gBAAgB,GAChD,IAAI,OAAO,SAAS,WAAW,YAAY,SAAS,MAAM,CAAC,WAAW,GACpE,KAAK,IAAI,MAAM,cAAc;AAMnC"}
package/dist/index.cjs CHANGED
@@ -1,13 +1,15 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-CXX_iT7z.cjs");
3
- const require_handshake = require("./handshake-Cds_mGAO.cjs");
2
+ const require_src = require("./src-BbHs0YmP.cjs");
3
+ const require_handshake = require("./handshake-D6MXSUcd.cjs");
4
4
  exports.SESSION_COOKIE_NAME = require_src.SESSION_COOKIE_NAME;
5
5
  exports.applyAppEnvTemplate = require_handshake.applyAppEnvTemplate;
6
6
  exports.bootLocalServer = require_src.bootLocalServer;
7
7
  exports.bootstrapProject = require_src.bootstrapProject;
8
8
  exports.connectZitadel = require_src.connectZitadel;
9
+ exports.identity = require_src.identity;
9
10
  exports.nextAppEnv = require_handshake.nextAppEnv;
10
11
  exports.readHandshakeSync = require_handshake.readHandshakeSync;
12
+ exports.sessionCookieName = require_src.sessionCookieName;
11
13
  exports.startLocalZitadel = require_src.startLocalZitadel;
12
14
  exports.waitForHandshake = require_handshake.waitForHandshake;
13
15
  exports.writeHandshake = require_handshake.writeHandshake;
package/dist/index.d.mts CHANGED
@@ -1,5 +1,4 @@
1
- import { a as Identity, c as LocalZitadelRuntime, d as SeedSessionInput, f as SeedUserInput, h as SessionCookie, i as ConnectedZitadel, l as MintedSession, m as SeededUser, n as applyAppEnvTemplate, o as InstanceHandle, p as SeedUsersTemplate, r as nextAppEnv, s as LocalZitadel, t as AppEnvTemplate, u as PlatformCredentials } from "./app-env-CAfV3fk_.mjs";
2
- import { ZitadelClient } from "@zitadel/api/client";
1
+ import { _ as SeededUser, a as applyAppEnvTemplate, c as Identity, d as LocalZitadelRuntime, f as MintedSession, g as SeedUsersTemplate, h as SeedUserInput, i as AppEnvTemplate, l as InstanceHandle, m as SeedSessionInput, n as sessionCookieName, o as nextAppEnv, p as PlatformCredentials, r as identity, s as ConnectedZitadel, t as SESSION_COOKIE_NAME, u as LocalZitadel, v as SessionCookie } from "./session-BrSkzPpy.mjs";
3
2
  import { SetupPreset, SetupUseCase } from "@zitadel/config/defaults";
4
3
  //#region src/bootstrap.d.ts
5
4
  interface BootstrapProjectOptions {
@@ -68,10 +67,6 @@ export declare function writeHandshake(path: string, handle: InstanceHandle): Pr
68
67
  export declare function readHandshakeSync(path: string): InstanceHandle;
69
68
  export declare function waitForHandshake(path: string, timeoutMs?: number): Promise<InstanceHandle>;
70
69
  //#endregion
71
- //#region src/session.d.ts
72
- /** Mirrors the server's session cookie (internal/api/session.go). */
73
- export declare const SESSION_COOKIE_NAME = "__nextgen_session";
74
- //#endregion
75
70
  //#region src/index.d.ts
76
71
  export type StartLocalZitadelOptions = BootServerOptions & Omit<BootstrapProjectOptions, "baseUrl">;
77
72
  /**
@@ -87,5 +82,5 @@ export declare function connectZitadel(handle: InstanceHandle): ConnectedZitadel
87
82
  */
88
83
  export declare function startLocalZitadel(options?: StartLocalZitadelOptions): Promise<LocalZitadel>;
89
84
  //#endregion
90
- export { type AppEnvTemplate, type BootServerOptions, type BootedServer, type BootstrapProjectOptions, type BootstrappedProject, type ConnectedZitadel, type Identity, type InstanceHandle, type LocalZitadel, type LocalZitadelRuntime, type MintedSession, type PlatformCredentials, type SeedSessionInput, type SeedUserInput, type SeedUsersTemplate, type SeededUser, type SessionCookie, applyAppEnvTemplate, nextAppEnv };
85
+ export { type AppEnvTemplate, type BootServerOptions, type BootedServer, type BootstrapProjectOptions, type BootstrappedProject, type ConnectedZitadel, type Identity, type InstanceHandle, type LocalZitadel, type LocalZitadelRuntime, type MintedSession, type PlatformCredentials, SESSION_COOKIE_NAME, type SeedSessionInput, type SeedUserInput, type SeedUsersTemplate, type SeededUser, type SessionCookie, applyAppEnvTemplate, identity, nextAppEnv, sessionCookieName };
91
86
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/bootstrap.ts","../src/lifecycle.ts","../src/handshake.ts","../src/session.ts","../src/index.ts"],"mappings":";;;;UASiB;EACf;EACA;;;;;EAKA;EACA,SAAS;EACT,UAAU;;UAGK;EACf;EACA;EACA;EACA;EACA;;;;;;;;wBAWoB,iBACpB,SAAS,0BACR,QAAQ;;;UCzBM;;EAEf;;;;;EAKA;;EAEA;;EAEA;;EAEA;EACA;;UAGe;EACf;EACA,SAAS;EACT,QAAQ;;;;;;;;wBASY,gBAAgB,UAAS,oBAAyB,QAAQ;;;;;;;;wBC/B1D,eAAe,cAAc,QAAQ,iBAAiB;wBAK5D,kBAAkB,eAAe;wBAa3B,iBAAiB,cAAc,qBAAqB,QAAQ;;;;qBCvBrE;;;YCED,2BAA2B,oBAAoB,KAAK;;;;;;wBAOhD,eAAe,QAAQ,iBAAiB;;;;;;wBA6BlC,kBACpB,UAAS,2BACR,QAAQ"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/bootstrap.ts","../src/lifecycle.ts","../src/handshake.ts","../src/index.ts"],"mappings":";;;UASiB;EACf;EACA;;;;;EAKA;EACA,SAAS;EACT,UAAU;;UAGK;EACf;EACA;EACA;EACA;EACA;;;;;;;;wBAWoB,iBACpB,SAAS,0BACR,QAAQ;;;UCzBM;;EAEf;;;;;EAKA;;EAEA;;EAEA;;EAEA;EACA;;UAGe;EACf;EACA,SAAS;EACT,QAAQ;;;;;;;;wBASY,gBAAgB,UAAS,oBAAyB,QAAQ;;;;;;;;wBC/B1D,eAAe,cAAc,QAAQ,iBAAiB;wBAK5D,kBAAkB,eAAe;wBAa3B,iBAAiB,cAAc,qBAAqB,QAAQ;;;YCrBtE,2BAA2B,oBAAoB,KAAK;;;;;;wBAOhD,eAAe,QAAQ,iBAAiB;;;;;;wBA6BlC,kBACpB,UAAS,2BACR,QAAQ"}
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { a as nextAppEnv, i as applyAppEnvTemplate, n as waitForHandshake, r as writeHandshake, t as readHandshakeSync } from "./handshake-BBrTG-5P.mjs";
2
- import { a as bootstrapProject, i as bootLocalServer, n as startLocalZitadel, r as SESSION_COOKIE_NAME, t as connectZitadel } from "./src-DhQK55R7.mjs";
3
- export { SESSION_COOKIE_NAME, applyAppEnvTemplate, bootLocalServer, bootstrapProject, connectZitadel, nextAppEnv, readHandshakeSync, startLocalZitadel, waitForHandshake, writeHandshake };
1
+ import { a as nextAppEnv, i as applyAppEnvTemplate, n as waitForHandshake, r as writeHandshake, t as readHandshakeSync } from "./handshake-CwlxMjW0.mjs";
2
+ import { a as identity, i as sessionCookieName, n as startLocalZitadel, o as bootLocalServer, r as SESSION_COOKIE_NAME, s as bootstrapProject, t as connectZitadel } from "./src-DKJ1hMV8.mjs";
3
+ export { SESSION_COOKIE_NAME, applyAppEnvTemplate, bootLocalServer, bootstrapProject, connectZitadel, identity, nextAppEnv, readHandshakeSync, sessionCookieName, startLocalZitadel, waitForHandshake, writeHandshake };
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-CXX_iT7z.cjs");
3
- const require_handshake = require("./handshake-Cds_mGAO.cjs");
2
+ const require_src = require("./src-BbHs0YmP.cjs");
3
+ const require_handshake = require("./handshake-D6MXSUcd.cjs");
4
4
  const require_orchestration = require("./orchestration-gIDANMcF.cjs");
5
5
  let node_fs = require("node:fs");
6
6
  let node_url = require("node:url");
@@ -111,7 +111,7 @@ function flowAction(page, action, options = {}) {
111
111
  */
112
112
  function flowField(page, field, options = {}) {
113
113
  let candidates = page.getByTestId(`zitadel-input-${field}`).or(page.getByTestId(`zitadel-field-${field}`).locator("input"));
114
- if (options.label) candidates = candidates.or(widgetRoot(page).getByLabel(options.label));
114
+ if (options.label) candidates = candidates.or(widgetRoot(page).getByRole("textbox", { name: options.label }));
115
115
  return candidates.first();
116
116
  }
117
117
  /** Click a flow action (auto-waits like any locator click). */
@@ -381,6 +381,10 @@ const test = _playwright_test.test.extend({
381
381
  await context.addCookies([{
382
382
  ...cookie,
383
383
  url: baseURL
384
+ }, {
385
+ ...cookie,
386
+ name: require_src.sessionCookieName(zitadel.handle.projectId),
387
+ url: baseURL
384
388
  }]);
385
389
  await use({
386
390
  page: await context.newPage(),
@@ -391,6 +395,7 @@ const test = _playwright_test.test.extend({
391
395
  }
392
396
  });
393
397
  //#endregion
398
+ exports.SESSION_COOKIE_NAME = require_src.SESSION_COOKIE_NAME;
394
399
  exports.applyAppEnvTemplate = require_handshake.applyAppEnvTemplate;
395
400
  exports.clickFlowAction = clickFlowAction;
396
401
  exports.enableVirtualPasskey = enableVirtualPasskey;
@@ -403,11 +408,13 @@ Object.defineProperty(exports, "expect", {
403
408
  exports.fillFlowField = fillFlowField;
404
409
  exports.flowAction = flowAction;
405
410
  exports.flowField = flowField;
411
+ exports.identity = require_src.identity;
406
412
  exports.loginWithPasskey = loginWithPasskey;
407
413
  exports.loginWithPassword = loginWithPassword;
408
414
  exports.nextAppEnv = require_handshake.nextAppEnv;
409
415
  exports.registerWithPasskey = registerWithPasskey;
410
416
  exports.registerWithPassword = registerWithPassword;
417
+ exports.sessionCookieName = require_src.sessionCookieName;
411
418
  exports.test = test;
412
419
  exports.withZitadel = withZitadel;
413
420
 
@@ -1 +1 @@
1
- {"version":3,"file":"playwright.cjs","names":["isAbsolute","join","HANDSHAKE_ENV","SUPERVISOR_CONFIG_ENV","APP_RUNNER_CONFIG_ENV","fileURLToPath","extname","existsSync","base","connectZitadel","waitForHandshake"],"sources":["../src/passkey.ts","../src/flows.ts","../src/playwright-config.ts","../src/playwright.ts"],"sourcesContent":["import type { CDPSession, Page } from \"@playwright/test\";\n\n/**\n * A virtual WebAuthn authenticator attached to one page. Ceremonies started\n * from that page (passkey registration, passkey login) complete automatically\n * — no OS authenticator dialog, no touch.\n */\nexport interface VirtualPasskey {\n /** CDP id of the virtual authenticator, for advanced raw-protocol use. */\n authenticatorId: string;\n /** Number of credentials the authenticator currently stores. */\n credentialCount(): Promise<number>;\n /** Remove the authenticator and detach the CDP session. */\n dispose(): Promise<void>;\n}\n\n/**\n * Attach a virtual passkey authenticator to the page via the Chrome DevTools\n * Protocol. The options mirror a platform authenticator with discoverable\n * credentials and automatic user presence — the profile the consumer journey\n * has run in CI since passkey coverage became mandatory there.\n *\n * Chromium only: the CDP WebAuthn domain does not exist in WebKit or Firefox.\n * The authenticator is bound to this page — drive registration and the later\n * login from the same page, or the credential is gone. Serve the app under\n * test on an origin WebAuthn accepts as a relying-party ID: HTTPS on a real\n * domain, or `http://localhost` for local runs — raw IP origins such as\n * `http://127.0.0.1` are invalid RP IDs.\n */\nexport async function enableVirtualPasskey(page: Page): Promise<VirtualPasskey> {\n let client: CDPSession;\n try {\n client = await page.context().newCDPSession(page);\n } catch (error) {\n throw new Error(\n \"enableVirtualPasskey: could not open a CDP session — passkey testing \" +\n \"needs Chromium's virtual authenticator, so run passkey specs in a \" +\n \"Chromium project.\",\n { cause: error },\n );\n }\n let authenticatorId: string;\n try {\n await client.send(\"WebAuthn.enable\");\n ({ authenticatorId } = await client.send(\"WebAuthn.addVirtualAuthenticator\", {\n options: {\n protocol: \"ctap2\",\n transport: \"internal\",\n hasResidentKey: true,\n hasUserVerification: true,\n isUserVerified: true,\n automaticPresenceSimulation: true,\n },\n }));\n } catch (error) {\n // Don't leave a half-initialized CDP session attached behind a throw.\n await client.detach().catch(() => undefined);\n throw error;\n }\n\n return {\n authenticatorId,\n async credentialCount() {\n const { credentials } = await client.send(\"WebAuthn.getCredentials\", {\n authenticatorId,\n });\n return credentials.length;\n },\n async dispose() {\n // Best-effort: the page (and with it the CDP target) may already be\n // gone when teardown runs after a failed test; never mask that failure.\n // Detach even when the removal fails, so the session never outlives it.\n try {\n await client.send(\"WebAuthn.removeVirtualAuthenticator\", { authenticatorId });\n } catch {\n // ignore\n } finally {\n await client.detach().catch(() => undefined);\n }\n },\n };\n}\n","import type { Locator, Page } from \"@playwright/test\";\n\n/**\n * Helpers that drive the `<zitadel-login>` widget through complete auth\n * ceremonies, built on the widget's documented automation hooks\n * (`zitadel-field-*` / `zitadel-input-*` on fields, `zitadel-action-*` on\n * actions — see packages/components/README.md). Field names use the\n * normalised hook token: the flow engine names credential fields\n * `x-auth-methods#password`, but the hook (and this API) says `password`.\n *\n * The ceremony helpers assume the default flow vocabulary — steps that\n * declare `submit` / `passkey` / `passkey_register` actions and `email` /\n * password fields, as `default-login.json` does. They branch only on\n * widget-observable state (which fields and actions the flow renders),\n * because customer flow configurations legitimately vary; they never\n * assert app state. Callers navigate to the widget first and assert their\n * own signed-in surface afterwards. Flows with renamed actions or custom\n * steps drive the widget directly via `flowAction` / `flowField`.\n */\n\nexport interface FlowActionOptions {\n /**\n * Accessible-name fallback for templates that do not emit the documented\n * `data-testid` hooks: adds role-based button/link candidates.\n */\n name?: RegExp;\n}\n\nexport interface FlowFieldOptions {\n /** Label fallback for templates that do not emit the documented hooks. */\n label?: RegExp;\n}\n\n/**\n * One optional registration field, filled only when the flow renders it.\n * The value's type picks the control: a boolean drives a checkbox\n * (`zl-checkbox`), a string first tries a select (`zl-select`) and falls\n * back to filling a text-like input.\n */\nexport interface ProfileEntry {\n /** Normalised field hook token, e.g. `givenName`. */\n field: string;\n value: string | boolean;\n /** Label fallback for text-like inputs on templates without hooks. */\n label?: RegExp;\n}\n\nexport interface LoginCredentials {\n email: string;\n password: string;\n}\n\nexport interface RegistrationDetails {\n email: string;\n /** Extra fields some flows require at registration, filled if rendered. */\n profile?: ProfileEntry[];\n}\n\nexport interface PasswordRegistrationDetails extends RegistrationDetails {\n password: string;\n}\n\n/**\n * A union locator resolves in DOM order across the whole page, so every\n * candidate built from a broad selector — accessible names, labels, the\n * generic `data-action` attribute — is scoped to the `<zitadel-login>`\n * host; otherwise a same-named control in the app's own chrome (header\n * nav, footer forms) could win the union. The host element exists no\n * matter what the tenant's template renders, so these fallbacks keep\n * working for custom templates that emit no automation hooks — the case\n * they exist for. The `zitadel-*` testid hooks and the `zl-button` atom\n * are namespaced and stay page-global.\n */\nfunction widgetRoot(page: Page): Locator {\n return page.locator(\"zitadel-login\");\n}\n\n/**\n * Escape a value for use inside a double-quoted CSS attribute selector,\n * per the CSSOM \"serialize a string\" rules: NUL becomes U+FFFD, control\n * characters become hex code-point escapes, quote and backslash are\n * backslash-escaped. C1 controls (U+0080–U+009F) are escaped too — CSSOM\n * itself leaves them literal, but the escaped form is equivalent and\n * survives stricter-than-spec selector parsers. Anything the flow schema\n * accepts as an action name yields a parseable selector.\n */\nfunction cssAttributeValue(value: string): string {\n let out = \"\";\n for (const ch of value) {\n const code = ch.codePointAt(0) ?? 0;\n if (code === 0) {\n out += \"�\";\n } else if (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) {\n out += `\\\\${code.toString(16)} `;\n } else if (ch === '\"' || ch === \"\\\\\") {\n out += `\\\\${ch}`;\n } else {\n out += ch;\n }\n }\n return out;\n}\n\n/**\n * Locator for a flow action control by its declared action name. Matches\n * every hook shape the default template emits — host testid, native\n * shadow button/link testids, and the raw `action`/`data-action`\n * attributes (the recover link carries only `data-action`).\n */\nexport function flowAction(page: Page, action: string, options: FlowActionOptions = {}): Locator {\n // Action names are free-form in the flow schema; escape them before\n // interpolating into attribute selectors so an exotic name cannot break\n // the whole union's parsing.\n const attributeSafe = cssAttributeValue(action);\n let candidates = page\n .getByTestId(`zitadel-action-${action}`)\n .or(page.getByTestId(`zitadel-action-${action}-button`))\n .or(page.getByTestId(`zitadel-action-${action}-link`))\n .or(page.locator(`zl-button[action=\"${attributeSafe}\"]`))\n .or(widgetRoot(page).locator(`[data-action=\"${attributeSafe}\"]`));\n if (options.name) {\n candidates = candidates\n .or(widgetRoot(page).getByRole(\"button\", { name: options.name }))\n .or(widgetRoot(page).getByRole(\"link\", { name: options.name }));\n }\n return candidates.first();\n}\n\n/**\n * Locator for a flow field's input by its normalised hook token\n * (`email`, `password`, a user-schema property name).\n */\nexport function flowField(page: Page, field: string, options: FlowFieldOptions = {}): Locator {\n let candidates = page\n .getByTestId(`zitadel-input-${field}`)\n .or(page.getByTestId(`zitadel-field-${field}`).locator(\"input\"));\n if (options.label) {\n candidates = candidates.or(widgetRoot(page).getByLabel(options.label));\n }\n return candidates.first();\n}\n\n/** Click a flow action (auto-waits like any locator click). */\nexport async function clickFlowAction(\n page: Page,\n action: string,\n options?: FlowActionOptions,\n): Promise<void> {\n await flowAction(page, action, options).click();\n}\n\n/** Fill a flow field (auto-waits like any locator fill). */\nexport async function fillFlowField(\n page: Page,\n field: string,\n value: string,\n options?: FlowFieldOptions,\n): Promise<void> {\n await flowField(page, field, options).fill(value);\n}\n\n/**\n * Sign in with email and password from the flow's entry step. Handles both\n * the default split shape (identifier → password) and flows that render\n * the password field on the entry step.\n */\nexport async function loginWithPassword(\n page: Page,\n { email, password }: LoginCredentials,\n): Promise<void> {\n await emailField(page).fill(email);\n const password_ = passwordField(page);\n if (!(await password_.isVisible().catch(() => false))) {\n await flowAction(page, \"submit\").click();\n }\n await password_.fill(password);\n await flowAction(page, \"submit\").click();\n}\n\n/**\n * Sign in with a passkey. With `email`, fills the identifier and takes the\n * step's passkey action; without, taps the entry step's passkey action\n * directly (discoverable-credential one-tap, e.g. the passkey-first\n * preset). Pair with `enableVirtualPasskey` / the `passkey` fixture in\n * headless runs — the ceremony completes automatically once the widget\n * issues the WebAuthn challenge.\n */\nexport async function loginWithPasskey(\n page: Page,\n options: { email?: string } = {},\n): Promise<void> {\n if (options.email !== undefined) {\n await emailField(page).fill(options.email);\n }\n await flowAction(page, \"passkey\").click();\n}\n\n/**\n * Register a new user with a password: enter the (unknown) identifier,\n * advance into the registration step, continue on the password path, and\n * submit the password. Ends when the final submit is clicked — assert your\n * app's signed-in surface afterwards. Flows that route through steps the\n * default flow does not (e.g. a passkey upsell) need caller-side handling\n * after this returns.\n */\nexport async function registerWithPassword(\n page: Page,\n { email, password, profile }: PasswordRegistrationDetails,\n): Promise<void> {\n await advanceToRegistration(page, email, profile);\n // Continue with password unless this flow renders the password field on\n // the registration step itself.\n const password_ = passwordField(page);\n if (!(await password_.isVisible().catch(() => false))) {\n await flowAction(page, \"submit\").click();\n }\n await password_.fill(password);\n await flowAction(page, \"submit\").click();\n}\n\n/**\n * Register a new user with a passkey: enter the (unknown) identifier,\n * advance into the registration step, and take its `passkey_register`\n * action. Requires an authenticator (see `loginWithPasskey`). The default\n * flow completes registration from the ceremony directly.\n */\nexport async function registerWithPasskey(\n page: Page,\n { email, profile }: RegistrationDetails,\n): Promise<void> {\n await advanceToRegistration(page, email, profile);\n await flowAction(page, \"passkey_register\").click();\n}\n\nfunction emailField(page: Page): Locator {\n return flowField(page, \"email\", { label: /email/i });\n}\n\nfunction passwordField(page: Page): Locator {\n return flowField(page, \"password\", { label: /password/i });\n}\n\n/**\n * From the entry step: submit the unknown identifier (the default flow's\n * `user_not_found` transition routes to registration), or take an explicit\n * `register` navigate action when the entry step is a combined\n * email+password step — there, submitting would attempt a password sign-in\n * instead. Then wait for the registration step and fill what it renders.\n */\nasync function advanceToRegistration(\n page: Page,\n email: string,\n profile: ProfileEntry[] | undefined,\n): Promise<void> {\n await emailField(page).fill(email);\n if (\n await passwordField(page)\n .isVisible()\n .catch(() => false)\n ) {\n await flowAction(page, \"register\").click();\n } else {\n await flowAction(page, \"submit\").click();\n }\n await expectRegistrationStep(page);\n // The engine echoes the attempted identifier into the registration step's\n // email field; refill defensively for flows that render it empty.\n await fillIfVisible(emailField(page), email);\n for (const entry of profile ?? []) {\n await fillProfileEntry(page, entry);\n }\n}\n\n/**\n * Fill one registration field with the verb its control needs: booleans\n * check the `zl-checkbox` native input, strings prefer the `zl-select`\n * native select (option matched by value, falling back to label) and\n * otherwise fill a text-like input. The select/checkbox natives carry the\n * name-first testids the atoms document (`zitadel-select-*`,\n * `zitadel-checkbox-*`); templates without those hooks drive such fields\n * via their own locators.\n */\nasync function fillProfileEntry(page: Page, entry: ProfileEntry): Promise<void> {\n if (typeof entry.value === \"boolean\") {\n const checkbox = page.getByTestId(`zitadel-checkbox-${entry.field}`).first();\n if (await checkbox.isVisible().catch(() => false)) {\n await checkbox.setChecked(entry.value);\n }\n return;\n }\n const select = page.getByTestId(`zitadel-select-${entry.field}`).first();\n if (await select.isVisible().catch(() => false)) {\n await select.selectOption(entry.value);\n return;\n }\n await fillIfVisible(flowField(page, entry.field, { label: entry.label }), entry.value);\n}\n\n/**\n * Barrier between the entry submit and probing the registration step's\n * fields: without it, optional-field probes race the re-render and read\n * the outgoing step. The default flow's registration step declares\n * `passkey_register` — a structural, locale-independent signal; the\n * heading regex covers password-only flows on the default English\n * template.\n */\nasync function expectRegistrationStep(page: Page): Promise<void> {\n await flowAction(page, \"passkey_register\")\n .or(widgetRoot(page).getByRole(\"heading\", { name: /create|register|sign up|no-account/i }))\n .first()\n .waitFor({ state: \"visible\", timeout: 30_000 });\n}\n\nasync function fillIfVisible(field: Locator, value: string): Promise<void> {\n if (await field.isVisible().catch(() => false)) {\n await field.fill(value);\n }\n}\n","import { existsSync } from \"node:fs\";\nimport { extname, isAbsolute, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport type { PlaywrightTestConfig } from \"@playwright/test\";\n\nimport type { AppEnvTemplate } from \"./app-env\";\nimport {\n APP_RUNNER_CONFIG_ENV,\n HANDSHAKE_ENV,\n SUPERVISOR_CONFIG_ENV,\n type AppRunnerConfig,\n type SupervisorConfig,\n} from \"./orchestration\";\n\ntype WebServerEntry = Extract<\n NonNullable<PlaywrightTestConfig[\"webServer\"]>,\n readonly unknown[]\n>[number];\n\nexport interface WithZitadelOptions {\n /**\n * The Playwright config's directory (`import.meta.dirname`). Anchors the\n * default handshake location and the working directory of the generated\n * webServer entries.\n */\n configDir: string;\n /**\n * Fixed TCP port for the instance. Required (unlike `startLocalZitadel`,\n * which defaults to a free port) because Playwright's readiness URL must be\n * known while the config is evaluated, before anything boots.\n */\n port: number;\n /**\n * Origin the browser will use for the app under test. Registered as the\n * project's preview origin (the backend's origin check rejects forwarded\n * requests from unregistered origins) and the base of `app.readyPath`.\n */\n appOrigin: string;\n /** Boot/bootstrap options forwarded to the instance supervisor. */\n zitadel?: {\n /** Absolute path to the server binary. */\n serverBinary?: string;\n /** Appended to the missing-binary error, e.g. \"run `moon run server:build` first.\" */\n serverBinaryHint?: string;\n projectName?: string;\n preset?: SupervisorConfig[\"preset\"];\n useCase?: SupervisorConfig[\"useCase\"];\n /** Absolute state directory; defaults to a fresh temp dir removed on stop. */\n dir?: string;\n /** Keep the owned temp dir after stop (debugging). */\n keep?: boolean;\n /** webServer readiness timeout for the boot; cold boot dominates it. */\n bootTimeoutMs?: number;\n };\n /**\n * The app dev server to run against the instance.\n *\n * Omit it when the **instance itself serves the app** — the Zitadel binary\n * embeds the console and hosted login shells at `/ui/console/` and\n * `/ui/login/`, so there is no second server to boot and no env to hand it.\n * Only the supervisor entry is generated, and `appOrigin` must then be the\n * instance's own local origin — `http://localhost:<port>` (or another\n * loopback alias); nothing else is served in this mode. This is the only\n * configuration that exercises the production path — under a dev server,\n * the app's proxy rewrites API requests that the binary would serve\n * directly.\n */\n app?: {\n /** Spawn argv (no shell), e.g. [\"corepack\", \"pnpm\", \"--filter\", \"my-app\", \"dev\"]. */\n command: string[];\n /** Working directory for the app command. */\n cwd: string;\n /** Path on `appOrigin` Playwright polls for readiness, e.g. \"/login\". */\n readyPath: string;\n /**\n * Env vars the app needs, as a template mapping env names to\n * InstanceHandle fields — see `nextAppEnv` for the `@zitadel/sdk-next`\n * shape. A template (not a callback) because it crosses into the app\n * runner process.\n */\n env: AppEnvTemplate;\n readyTimeoutMs?: number;\n /** How long SIGTERM gets before the app is killed on teardown. */\n gracefulShutdownMs?: number;\n };\n /** Absolute path; defaults to `<configDir>/.zitadel-testing/handshake.json`. */\n handshakePath?: string;\n}\n\n/**\n * Generate the Playwright `webServer` entries that boot an ephemeral seeded\n * Zitadel and run the app against it, replacing the per-suite wrapper\n * scripts. Spread the result into `defineConfig`:\n *\n * ```ts\n * export default defineConfig({\n * ...withZitadel({ configDir: import.meta.dirname, port: 8092, ... }),\n * testDir: \"./src-real\",\n * });\n * ```\n *\n * Omit `app` when the instance serves the app itself (the binary's embedded\n * `/ui/console/` and `/ui/login/` surfaces): only the boot entry is\n * generated, and `appOrigin` must be the instance's own origin.\n *\n * Also points ZITADEL_TESTING_HANDSHAKE at the handshake file so the\n * `@zitadel/testing/playwright` fixtures resolve the instance — Playwright\n * workers re-evaluate the config, which re-applies this for every process\n * that needs it. The returned value is plain data; append your own entries\n * to `webServer` if the suite needs additional servers.\n */\nexport function withZitadel(\n options: WithZitadelOptions,\n /** Test seam: alternative executable resolution. */\n resolveEntry: (name: \"supervisor\" | \"app-runner\") => string = entryPoint,\n): { webServer: WebServerEntry[] } {\n const { configDir, port, appOrigin, app } = options;\n if (!isAbsolute(configDir)) {\n throw new Error(`withZitadel: configDir must be absolute, got \"${configDir}\"`);\n }\n if (!Number.isInteger(port) || port <= 0) {\n throw new Error(`withZitadel: port must be a positive integer, got ${port}`);\n }\n const origin = URL.canParse(appOrigin) ? new URL(appOrigin) : undefined;\n if (\n !origin ||\n (origin.protocol !== \"http:\" && origin.protocol !== \"https:\") ||\n origin.pathname !== \"/\" ||\n origin.search !== \"\" ||\n origin.hash !== \"\"\n ) {\n throw new Error(\n `withZitadel: appOrigin must be an origin like \"http://localhost:3002\", got \"${appOrigin}\"`,\n );\n }\n if (app === undefined) {\n // Nothing else will bind appOrigin in this mode: the instance is the app\n // server, and it listens on plain HTTP at localhost:<port>. Anything\n // else — another port, a real hostname, https — is an origin nobody\n // serves, so Playwright's readiness wait would hang (or, worse, pass\n // against an unrelated stale server). Loopback aliases are the only\n // freedom; the scheme and port are the instance's.\n const loopbackHosts = new Set([\"localhost\", \"127.0.0.1\", \"[::1]\"]);\n if (\n origin.protocol !== \"http:\" ||\n !loopbackHosts.has(origin.hostname) ||\n (origin.port || \"80\") !== String(port)\n ) {\n throw new Error(\n `withZitadel: with no \\`app\\`, the instance itself serves the app, so appOrigin ` +\n `must be its local origin (http://localhost:${port}); got \"${appOrigin}\".`,\n );\n }\n } else {\n if (!app.readyPath.startsWith(\"/\")) {\n throw new Error(`withZitadel: app.readyPath must start with \"/\", got \"${app.readyPath}\"`);\n }\n if (app.command.length === 0) {\n throw new Error(\"withZitadel: app.command must not be empty\");\n }\n if (!isAbsolute(app.cwd)) {\n throw new Error(`withZitadel: app.cwd must be absolute, got \"${app.cwd}\"`);\n }\n }\n // Path options are consumed by the executables, whose cwd is configDir —\n // a relative path would silently resolve against that, not the project.\n for (const [label, value] of [\n [\"zitadel.serverBinary\", options.zitadel?.serverBinary],\n [\"zitadel.dir\", options.zitadel?.dir],\n [\"handshakePath\", options.handshakePath],\n ] as const) {\n if (value !== undefined && !isAbsolute(value)) {\n throw new Error(`withZitadel: ${label} must be an absolute path, got \"${value}\"`);\n }\n }\n\n const handshakePath =\n options.handshakePath ?? join(configDir, \".zitadel-testing\", \"handshake.json\");\n // Workers inherit the runner's env; the fixtures resolve the instance from it.\n process.env[HANDSHAKE_ENV] = handshakePath;\n\n const supervisorConfig: SupervisorConfig = {\n port,\n appOrigins: [appOrigin],\n serverBinary: options.zitadel?.serverBinary,\n serverBinaryHint: options.zitadel?.serverBinaryHint,\n dir: options.zitadel?.dir,\n keep: options.zitadel?.keep,\n projectName: options.zitadel?.projectName,\n preset: options.zitadel?.preset,\n useCase: options.zitadel?.useCase,\n };\n const supervisorEntry: WebServerEntry = {\n command: `node ${JSON.stringify(resolveEntry(\"supervisor\"))}`,\n url: `http://localhost:${port}/healthz`,\n reuseExistingServer: false,\n cwd: configDir,\n stdout: \"pipe\",\n stderr: \"pipe\",\n // Cold boot (fresh data dir: migrations + health wait) dominates.\n timeout: options.zitadel?.bootTimeoutMs ?? 120_000,\n env: {\n [HANDSHAKE_ENV]: handshakePath,\n [SUPERVISOR_CONFIG_ENV]: JSON.stringify(supervisorConfig),\n },\n // SIGTERM first so the supervisor can stop the instance; the default\n // hard kill would orphan the server process group.\n gracefulShutdown: { signal: \"SIGTERM\", timeout: 30_000 },\n };\n\n if (app === undefined) {\n return { webServer: [supervisorEntry] };\n }\n\n const appRunnerConfig: AppRunnerConfig = {\n command: app.command,\n cwd: app.cwd,\n env: app.env,\n handshakeTimeoutMs: app.readyTimeoutMs ?? 180_000,\n };\n\n return {\n webServer: [\n supervisorEntry,\n {\n command: `node ${JSON.stringify(resolveEntry(\"app-runner\"))}`,\n url: new URL(app.readyPath, appOrigin).toString(),\n reuseExistingServer: false,\n cwd: configDir,\n stdout: \"pipe\",\n stderr: \"pipe\",\n timeout: app.readyTimeoutMs ?? 180_000,\n env: {\n [HANDSHAKE_ENV]: handshakePath,\n [APP_RUNNER_CONFIG_ENV]: JSON.stringify(appRunnerConfig),\n },\n gracefulShutdown: {\n signal: \"SIGTERM\",\n timeout: app.gracefulShutdownMs ?? 15_000,\n },\n },\n ],\n };\n}\n\n/**\n * Resolve a sibling dist entry in the same module format this file was loaded\n * as (dist/supervisor.mjs next to dist/playwright.mjs, .cjs next to .cjs), so\n * the spawned process needs no package-manager bin plumbing.\n */\nfunction entryPoint(name: \"supervisor\" | \"app-runner\"): string {\n const self = fileURLToPath(import.meta.url);\n const ext = extname(self);\n if (ext !== \".mjs\" && ext !== \".cjs\") {\n throw new Error(\n `withZitadel: expected to run from the built package (got ${self}); ` +\n \"build @zitadel/testing first (in-repo: `moon run testing:build`).\",\n );\n }\n const path = fileURLToPath(new URL(`./${name}${ext}`, import.meta.url));\n if (!existsSync(path)) {\n throw new Error(\n `withZitadel: missing ${path}; rebuild @zitadel/testing (in-repo: \\`moon run testing:build\\`).`,\n );\n }\n return path;\n}\n","import { test as base, type Page } from \"@playwright/test\";\n\nimport { waitForHandshake } from \"./handshake\";\nimport { connectZitadel } from \"./index\";\nimport { enableVirtualPasskey, type VirtualPasskey } from \"./passkey\";\nimport type {\n ConnectedZitadel,\n Identity,\n MintedSession,\n SeededUser,\n SeedSessionInput,\n SeedUserInput,\n SeedUsersTemplate,\n} from \"./types\";\n\nexport interface AuthenticatedPage {\n /** A page in its own context, already carrying the session cookie. */\n page: Page;\n user: SeededUser;\n session: MintedSession;\n}\n\nexport interface ZitadelTestFixtures {\n /** Per-test seeding; each call mints unique data on the shared instance. */\n seed: {\n user(input?: SeedUserInput): Promise<SeededUser>;\n users(count: number, template?: SeedUsersTemplate): Promise<SeededUser[]>;\n /** Unused email+password for registration flows — creates nothing. */\n identity(): Identity;\n /** Seeded user + headless real-flow login; password flows only. */\n session(input?: SeedSessionInput): Promise<MintedSession>;\n };\n /**\n * Start the test authenticated: a fresh user, a real session minted through\n * the flow API, and the cookie injected into a dedicated browser context —\n * the default `page` stays signed out for login-flow tests. Requires\n * `use.baseURL` (every withZitadel consumer sets it).\n */\n authenticatedPage: AuthenticatedPage;\n /**\n * Virtual passkey authenticator attached to the default `page`, disposed on\n * teardown. On-demand: tests that don't request it pay nothing. Chromium\n * only — see `enableVirtualPasskey` for the constraints.\n */\n passkey: VirtualPasskey;\n}\n\nexport interface ZitadelWorkerFixtures {\n /** Connection to the suite's instance, resolved once per worker. */\n zitadel: ConnectedZitadel;\n}\n\nexport const test = base.extend<ZitadelTestFixtures, ZitadelWorkerFixtures>({\n zitadel: [\n // Playwright derives fixture dependencies from the destructuring pattern,\n // so the empty pattern is required here.\n // biome-ignore lint/correctness/noEmptyPattern: Playwright fixture signature requires the destructuring pattern\n async ({}, use) => {\n const handshakePath = process.env.ZITADEL_TESTING_HANDSHAKE;\n if (!handshakePath) {\n throw new Error(\n \"ZITADEL_TESTING_HANDSHAKE is not set. Point it at the handshake file \" +\n \"written by the script that boots the instance (see @zitadel/testing docs).\",\n );\n }\n // Wait, don't read-once: the supervisor's Playwright readiness URL is\n // the instance's /healthz, which answers as soon as the *server* is up\n // — the handshake lands only after *bootstrap* (project, schema,\n // flows) completes a moment later. Suites with an `app` entry never\n // see the gap (the app runner waits for the handshake before the app\n // reports ready), but in app-less mode the first worker can get here\n // first. Bootstrap after health is seconds at most, so the default\n // wait is generous; a bootstrap failure surfaces as this timeout.\n await use(connectZitadel(await waitForHandshake(handshakePath)));\n },\n // `auto`: every worker waits for the bootstrapped instance before its\n // first test, including tests that use no fixture. Without it, a\n // `page`-only test in an app-less suite can navigate during the\n // bootstrap window and observe a project-less deployment — truthful,\n // rendered as the setup hint, and not what any suite means to test.\n // For app-ful suites this is a one-time handshake file read per worker.\n { scope: \"worker\", auto: true },\n ],\n seed: async ({ zitadel, baseURL }, use) => {\n await use({\n user: (input) => zitadel.seedUser(input),\n users: (count, template) => zitadel.seedUsers(count, template),\n identity: () => zitadel.identity(),\n // The suite's baseURL is the app origin the project allowlists.\n session: (input) => zitadel.seedSession({ origin: baseURL, ...input }),\n });\n },\n passkey: async ({ page }, use) => {\n const passkey = await enableVirtualPasskey(page);\n await use(passkey);\n await passkey.dispose();\n },\n authenticatedPage: async ({ browser, zitadel, baseURL }, use) => {\n if (!baseURL) {\n throw new Error(\n \"authenticatedPage requires `use.baseURL` so the session cookie can be \" +\n \"scoped to the app under test.\",\n );\n }\n const session = await zitadel.seedSession({ origin: baseURL });\n const context = await browser.newContext({ baseURL });\n // `addCookies` takes either url or domain/path; url derives the rest.\n const { path: _path, ...cookie } = session.cookie;\n await context.addCookies([{ ...cookie, url: baseURL }]);\n const page = await context.newPage();\n await use({ page, user: session.user, session });\n await context.close();\n },\n});\n\nexport { expect } from \"@playwright/test\";\nexport { applyAppEnvTemplate, nextAppEnv } from \"./app-env\";\nexport type { AppEnvTemplate } from \"./app-env\";\nexport {\n clickFlowAction,\n fillFlowField,\n flowAction,\n flowField,\n loginWithPassword,\n loginWithPasskey,\n registerWithPassword,\n registerWithPasskey,\n} from \"./flows\";\nexport type {\n FlowActionOptions,\n FlowFieldOptions,\n LoginCredentials,\n PasswordRegistrationDetails,\n ProfileEntry,\n RegistrationDetails,\n} from \"./flows\";\nexport { enableVirtualPasskey } from \"./passkey\";\nexport type { VirtualPasskey } from \"./passkey\";\nexport { withZitadel } from \"./playwright-config\";\nexport type { WithZitadelOptions } from \"./playwright-config\";\nexport type {\n ConnectedZitadel,\n Identity,\n InstanceHandle,\n MintedSession,\n SeededUser,\n SeedSessionInput,\n SeedUserInput,\n SeedUsersTemplate,\n} from \"./types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6BA,eAAsB,qBAAqB,MAAqC;CAC9E,IAAI;CACJ,IAAI;EACF,SAAS,MAAM,KAAK,QAAQ,CAAC,CAAC,cAAc,IAAI;CAClD,SAAS,OAAO;EACd,MAAM,IAAI,MACR,4JAGA,EAAE,OAAO,MAAM,CACjB;CACF;CACA,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EAAE,MAAM,OAAO,GAAG,WAAW,QAAQ;EAC3C,MAAM,QAAQ,WAAW,CAAC;GAAE,GAAG;GAAQ,KAAK;EAAQ,CAAC,CAAC;EAEtD,MAAM,IAAI;GAAE,MAAA,MADO,QAAQ,QAAQ;GACjB,MAAM,QAAQ;GAAM;EAAQ,CAAC;EAC/C,MAAM,QAAQ,MAAM;CACtB;AACF,CAAC"}
1
+ {"version":3,"file":"playwright.cjs","names":["isAbsolute","join","HANDSHAKE_ENV","SUPERVISOR_CONFIG_ENV","APP_RUNNER_CONFIG_ENV","fileURLToPath","extname","existsSync","base","connectZitadel","waitForHandshake","sessionCookieName"],"sources":["../src/passkey.ts","../src/flows.ts","../src/playwright-config.ts","../src/playwright.ts"],"sourcesContent":["import type { CDPSession, Page } from \"@playwright/test\";\n\n/**\n * A virtual WebAuthn authenticator attached to one page. Ceremonies started\n * from that page (passkey registration, passkey login) complete automatically\n * — no OS authenticator dialog, no touch.\n */\nexport interface VirtualPasskey {\n /** CDP id of the virtual authenticator, for advanced raw-protocol use. */\n authenticatorId: string;\n /** Number of credentials the authenticator currently stores. */\n credentialCount(): Promise<number>;\n /** Remove the authenticator and detach the CDP session. */\n dispose(): Promise<void>;\n}\n\n/**\n * Attach a virtual passkey authenticator to the page via the Chrome DevTools\n * Protocol. The options mirror a platform authenticator with discoverable\n * credentials and automatic user presence — the profile the consumer journey\n * has run in CI since passkey coverage became mandatory there.\n *\n * Chromium only: the CDP WebAuthn domain does not exist in WebKit or Firefox.\n * The authenticator is bound to this page — drive registration and the later\n * login from the same page, or the credential is gone. Serve the app under\n * test on an origin WebAuthn accepts as a relying-party ID: HTTPS on a real\n * domain, or `http://localhost` for local runs — raw IP origins such as\n * `http://127.0.0.1` are invalid RP IDs.\n */\nexport async function enableVirtualPasskey(page: Page): Promise<VirtualPasskey> {\n let client: CDPSession;\n try {\n client = await page.context().newCDPSession(page);\n } catch (error) {\n throw new Error(\n \"enableVirtualPasskey: could not open a CDP session — passkey testing \" +\n \"needs Chromium's virtual authenticator, so run passkey specs in a \" +\n \"Chromium project.\",\n { cause: error },\n );\n }\n let authenticatorId: string;\n try {\n await client.send(\"WebAuthn.enable\");\n ({ authenticatorId } = await client.send(\"WebAuthn.addVirtualAuthenticator\", {\n options: {\n protocol: \"ctap2\",\n transport: \"internal\",\n hasResidentKey: true,\n hasUserVerification: true,\n isUserVerified: true,\n automaticPresenceSimulation: true,\n },\n }));\n } catch (error) {\n // Don't leave a half-initialized CDP session attached behind a throw.\n await client.detach().catch(() => undefined);\n throw error;\n }\n\n return {\n authenticatorId,\n async credentialCount() {\n const { credentials } = await client.send(\"WebAuthn.getCredentials\", {\n authenticatorId,\n });\n return credentials.length;\n },\n async dispose() {\n // Best-effort: the page (and with it the CDP target) may already be\n // gone when teardown runs after a failed test; never mask that failure.\n // Detach even when the removal fails, so the session never outlives it.\n try {\n await client.send(\"WebAuthn.removeVirtualAuthenticator\", { authenticatorId });\n } catch {\n // ignore\n } finally {\n await client.detach().catch(() => undefined);\n }\n },\n };\n}\n","import type { Locator, Page } from \"@playwright/test\";\n\n/**\n * Helpers that drive the `<zitadel-login>` widget through complete auth\n * ceremonies, built on the widget's documented automation hooks\n * (`zitadel-field-*` / `zitadel-input-*` on fields, `zitadel-action-*` on\n * actions — see packages/components/README.md). Field names use the\n * normalised hook token: the flow engine names credential fields\n * `x-auth-methods#password`, but the hook (and this API) says `password`.\n *\n * The ceremony helpers assume the default flow vocabulary — steps that\n * declare `submit` / `passkey` / `passkey_register` actions and `email` /\n * password fields, as `default-login.json` does. They branch only on\n * widget-observable state (which fields and actions the flow renders),\n * because customer flow configurations legitimately vary; they never\n * assert app state. Callers navigate to the widget first and assert their\n * own signed-in surface afterwards. Flows with renamed actions or custom\n * steps drive the widget directly via `flowAction` / `flowField`.\n */\n\nexport interface FlowActionOptions {\n /**\n * Accessible-name fallback for templates that do not emit the documented\n * `data-testid` hooks: adds role-based button/link candidates.\n */\n name?: RegExp;\n}\n\nexport interface FlowFieldOptions {\n /** Label fallback for templates that do not emit the documented hooks. */\n label?: RegExp;\n}\n\n/**\n * One optional registration field, filled only when the flow renders it.\n * The value's type picks the control: a boolean drives a checkbox\n * (`zl-checkbox`), a string first tries a select (`zl-select`) and falls\n * back to filling a text-like input.\n */\nexport interface ProfileEntry {\n /** Normalised field hook token, e.g. `givenName`. */\n field: string;\n value: string | boolean;\n /** Label fallback for text-like inputs on templates without hooks. */\n label?: RegExp;\n}\n\nexport interface LoginCredentials {\n email: string;\n password: string;\n}\n\nexport interface RegistrationDetails {\n email: string;\n /** Extra fields some flows require at registration, filled if rendered. */\n profile?: ProfileEntry[];\n}\n\nexport interface PasswordRegistrationDetails extends RegistrationDetails {\n password: string;\n}\n\n/**\n * A union locator resolves in DOM order across the whole page, so every\n * candidate built from a broad selector — accessible names, labels, the\n * generic `data-action` attribute — is scoped to the `<zitadel-login>`\n * host; otherwise a same-named control in the app's own chrome (header\n * nav, footer forms) could win the union. The host element exists no\n * matter what the tenant's template renders, so these fallbacks keep\n * working for custom templates that emit no automation hooks — the case\n * they exist for. The `zitadel-*` testid hooks and the `zl-button` atom\n * are namespaced and stay page-global.\n */\nfunction widgetRoot(page: Page): Locator {\n return page.locator(\"zitadel-login\");\n}\n\n/**\n * Escape a value for use inside a double-quoted CSS attribute selector,\n * per the CSSOM \"serialize a string\" rules: NUL becomes U+FFFD, control\n * characters become hex code-point escapes, quote and backslash are\n * backslash-escaped. C1 controls (U+0080–U+009F) are escaped too — CSSOM\n * itself leaves them literal, but the escaped form is equivalent and\n * survives stricter-than-spec selector parsers. Anything the flow schema\n * accepts as an action name yields a parseable selector.\n */\nfunction cssAttributeValue(value: string): string {\n let out = \"\";\n for (const ch of value) {\n const code = ch.codePointAt(0) ?? 0;\n if (code === 0) {\n out += \"�\";\n } else if (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) {\n out += `\\\\${code.toString(16)} `;\n } else if (ch === '\"' || ch === \"\\\\\") {\n out += `\\\\${ch}`;\n } else {\n out += ch;\n }\n }\n return out;\n}\n\n/**\n * Locator for a flow action control by its declared action name. Matches\n * every hook shape the default template emits — host testid, native\n * shadow button/link testids, and the raw `action`/`data-action`\n * attributes (the recover link carries only `data-action`).\n */\nexport function flowAction(page: Page, action: string, options: FlowActionOptions = {}): Locator {\n // Action names are free-form in the flow schema; escape them before\n // interpolating into attribute selectors so an exotic name cannot break\n // the whole union's parsing.\n const attributeSafe = cssAttributeValue(action);\n let candidates = page\n .getByTestId(`zitadel-action-${action}`)\n .or(page.getByTestId(`zitadel-action-${action}-button`))\n .or(page.getByTestId(`zitadel-action-${action}-link`))\n .or(page.locator(`zl-button[action=\"${attributeSafe}\"]`))\n .or(widgetRoot(page).locator(`[data-action=\"${attributeSafe}\"]`));\n if (options.name) {\n candidates = candidates\n .or(widgetRoot(page).getByRole(\"button\", { name: options.name }))\n .or(widgetRoot(page).getByRole(\"link\", { name: options.name }));\n }\n return candidates.first();\n}\n\n/**\n * Locator for a flow field's input by its normalised hook token\n * (`email`, `password`, a user-schema property name).\n */\nexport function flowField(page: Page, field: string, options: FlowFieldOptions = {}): Locator {\n let candidates = page\n .getByTestId(`zitadel-input-${field}`)\n .or(page.getByTestId(`zitadel-field-${field}`).locator(\"input\"));\n if (options.label) {\n // By role, not `getByLabel`: a label lookup also matches other controls\n // named after the field, such as the password field's \"Show password\"\n // toggle. Every field this fills is a text input.\n candidates = candidates.or(widgetRoot(page).getByRole(\"textbox\", { name: options.label }));\n }\n return candidates.first();\n}\n\n/** Click a flow action (auto-waits like any locator click). */\nexport async function clickFlowAction(\n page: Page,\n action: string,\n options?: FlowActionOptions,\n): Promise<void> {\n await flowAction(page, action, options).click();\n}\n\n/** Fill a flow field (auto-waits like any locator fill). */\nexport async function fillFlowField(\n page: Page,\n field: string,\n value: string,\n options?: FlowFieldOptions,\n): Promise<void> {\n await flowField(page, field, options).fill(value);\n}\n\n/**\n * Sign in with email and password from the flow's entry step. Handles both\n * the default split shape (identifier → password) and flows that render\n * the password field on the entry step.\n */\nexport async function loginWithPassword(\n page: Page,\n { email, password }: LoginCredentials,\n): Promise<void> {\n await emailField(page).fill(email);\n const password_ = passwordField(page);\n if (!(await password_.isVisible().catch(() => false))) {\n await flowAction(page, \"submit\").click();\n }\n await password_.fill(password);\n await flowAction(page, \"submit\").click();\n}\n\n/**\n * Sign in with a passkey. With `email`, fills the identifier and takes the\n * step's passkey action; without, taps the entry step's passkey action\n * directly (discoverable-credential one-tap, e.g. the passkey-first\n * preset). Pair with `enableVirtualPasskey` / the `passkey` fixture in\n * headless runs — the ceremony completes automatically once the widget\n * issues the WebAuthn challenge.\n */\nexport async function loginWithPasskey(\n page: Page,\n options: { email?: string } = {},\n): Promise<void> {\n if (options.email !== undefined) {\n await emailField(page).fill(options.email);\n }\n await flowAction(page, \"passkey\").click();\n}\n\n/**\n * Register a new user with a password: enter the (unknown) identifier,\n * advance into the registration step, continue on the password path, and\n * submit the password. Ends when the final submit is clicked — assert your\n * app's signed-in surface afterwards. Flows that route through steps the\n * default flow does not (e.g. a passkey upsell) need caller-side handling\n * after this returns.\n */\nexport async function registerWithPassword(\n page: Page,\n { email, password, profile }: PasswordRegistrationDetails,\n): Promise<void> {\n await advanceToRegistration(page, email, profile);\n // Continue with password unless this flow renders the password field on\n // the registration step itself.\n const password_ = passwordField(page);\n if (!(await password_.isVisible().catch(() => false))) {\n await flowAction(page, \"submit\").click();\n }\n await password_.fill(password);\n await flowAction(page, \"submit\").click();\n}\n\n/**\n * Register a new user with a passkey: enter the (unknown) identifier,\n * advance into the registration step, and take its `passkey_register`\n * action. Requires an authenticator (see `loginWithPasskey`). The default\n * flow completes registration from the ceremony directly.\n */\nexport async function registerWithPasskey(\n page: Page,\n { email, profile }: RegistrationDetails,\n): Promise<void> {\n await advanceToRegistration(page, email, profile);\n await flowAction(page, \"passkey_register\").click();\n}\n\nfunction emailField(page: Page): Locator {\n return flowField(page, \"email\", { label: /email/i });\n}\n\nfunction passwordField(page: Page): Locator {\n return flowField(page, \"password\", { label: /password/i });\n}\n\n/**\n * From the entry step: submit the unknown identifier (the default flow's\n * `user_not_found` transition routes to registration), or take an explicit\n * `register` navigate action when the entry step is a combined\n * email+password step — there, submitting would attempt a password sign-in\n * instead. Then wait for the registration step and fill what it renders.\n */\nasync function advanceToRegistration(\n page: Page,\n email: string,\n profile: ProfileEntry[] | undefined,\n): Promise<void> {\n await emailField(page).fill(email);\n if (\n await passwordField(page)\n .isVisible()\n .catch(() => false)\n ) {\n await flowAction(page, \"register\").click();\n } else {\n await flowAction(page, \"submit\").click();\n }\n await expectRegistrationStep(page);\n // The engine echoes the attempted identifier into the registration step's\n // email field; refill defensively for flows that render it empty.\n await fillIfVisible(emailField(page), email);\n for (const entry of profile ?? []) {\n await fillProfileEntry(page, entry);\n }\n}\n\n/**\n * Fill one registration field with the verb its control needs: booleans\n * check the `zl-checkbox` native input, strings prefer the `zl-select`\n * native select (option matched by value, falling back to label) and\n * otherwise fill a text-like input. The select/checkbox natives carry the\n * name-first testids the atoms document (`zitadel-select-*`,\n * `zitadel-checkbox-*`); templates without those hooks drive such fields\n * via their own locators.\n */\nasync function fillProfileEntry(page: Page, entry: ProfileEntry): Promise<void> {\n if (typeof entry.value === \"boolean\") {\n const checkbox = page.getByTestId(`zitadel-checkbox-${entry.field}`).first();\n if (await checkbox.isVisible().catch(() => false)) {\n await checkbox.setChecked(entry.value);\n }\n return;\n }\n const select = page.getByTestId(`zitadel-select-${entry.field}`).first();\n if (await select.isVisible().catch(() => false)) {\n await select.selectOption(entry.value);\n return;\n }\n await fillIfVisible(flowField(page, entry.field, { label: entry.label }), entry.value);\n}\n\n/**\n * Barrier between the entry submit and probing the registration step's\n * fields: without it, optional-field probes race the re-render and read\n * the outgoing step. The default flow's registration step declares\n * `passkey_register` — a structural, locale-independent signal; the\n * heading regex covers password-only flows on the default English\n * template.\n */\nasync function expectRegistrationStep(page: Page): Promise<void> {\n await flowAction(page, \"passkey_register\")\n .or(widgetRoot(page).getByRole(\"heading\", { name: /create|register|sign up|no-account/i }))\n .first()\n .waitFor({ state: \"visible\", timeout: 30_000 });\n}\n\nasync function fillIfVisible(field: Locator, value: string): Promise<void> {\n if (await field.isVisible().catch(() => false)) {\n await field.fill(value);\n }\n}\n","import { existsSync } from \"node:fs\";\nimport { extname, isAbsolute, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport type { PlaywrightTestConfig } from \"@playwright/test\";\n\nimport type { AppEnvTemplate } from \"./app-env\";\nimport {\n APP_RUNNER_CONFIG_ENV,\n HANDSHAKE_ENV,\n SUPERVISOR_CONFIG_ENV,\n type AppRunnerConfig,\n type SupervisorConfig,\n} from \"./orchestration\";\n\ntype WebServerEntry = Extract<\n NonNullable<PlaywrightTestConfig[\"webServer\"]>,\n readonly unknown[]\n>[number];\n\nexport interface WithZitadelOptions {\n /**\n * The Playwright config's directory (`import.meta.dirname`). Anchors the\n * default handshake location and the working directory of the generated\n * webServer entries.\n */\n configDir: string;\n /**\n * Fixed TCP port for the instance. Required (unlike `startLocalZitadel`,\n * which defaults to a free port) because Playwright's readiness URL must be\n * known while the config is evaluated, before anything boots.\n */\n port: number;\n /**\n * Origin the browser will use for the app under test. Registered as the\n * project's preview origin (the backend's origin check rejects forwarded\n * requests from unregistered origins) and the base of `app.readyPath`.\n */\n appOrigin: string;\n /** Boot/bootstrap options forwarded to the instance supervisor. */\n zitadel?: {\n /** Absolute path to the server binary. */\n serverBinary?: string;\n /** Appended to the missing-binary error, e.g. \"run `moon run server:build` first.\" */\n serverBinaryHint?: string;\n projectName?: string;\n preset?: SupervisorConfig[\"preset\"];\n useCase?: SupervisorConfig[\"useCase\"];\n /** Absolute state directory; defaults to a fresh temp dir removed on stop. */\n dir?: string;\n /** Keep the owned temp dir after stop (debugging). */\n keep?: boolean;\n /** webServer readiness timeout for the boot; cold boot dominates it. */\n bootTimeoutMs?: number;\n };\n /**\n * The app dev server to run against the instance.\n *\n * Omit it when the **instance itself serves the app** — the Zitadel binary\n * embeds the console and hosted login shells at `/ui/console/` and\n * `/ui/login/`, so there is no second server to boot and no env to hand it.\n * Only the supervisor entry is generated, and `appOrigin` must then be the\n * instance's own local origin — `http://localhost:<port>` (or another\n * loopback alias); nothing else is served in this mode. This is the only\n * configuration that exercises the production path — under a dev server,\n * the app's proxy rewrites API requests that the binary would serve\n * directly.\n */\n app?: {\n /** Spawn argv (no shell), e.g. [\"corepack\", \"pnpm\", \"--filter\", \"my-app\", \"dev\"]. */\n command: string[];\n /** Working directory for the app command. */\n cwd: string;\n /** Path on `appOrigin` Playwright polls for readiness, e.g. \"/login\". */\n readyPath: string;\n /**\n * Env vars the app needs, as a template mapping env names to\n * InstanceHandle fields — see `nextAppEnv` for the `@zitadel/sdk-next`\n * shape. A template (not a callback) because it crosses into the app\n * runner process.\n */\n env: AppEnvTemplate;\n readyTimeoutMs?: number;\n /** How long SIGTERM gets before the app is killed on teardown. */\n gracefulShutdownMs?: number;\n };\n /** Absolute path; defaults to `<configDir>/.zitadel-testing/handshake.json`. */\n handshakePath?: string;\n}\n\n/**\n * Generate the Playwright `webServer` entries that boot an ephemeral seeded\n * Zitadel and run the app against it, replacing the per-suite wrapper\n * scripts. Spread the result into `defineConfig`:\n *\n * ```ts\n * export default defineConfig({\n * ...withZitadel({ configDir: import.meta.dirname, port: 8092, ... }),\n * testDir: \"./src-real\",\n * });\n * ```\n *\n * Omit `app` when the instance serves the app itself (the binary's embedded\n * `/ui/console/` and `/ui/login/` surfaces): only the boot entry is\n * generated, and `appOrigin` must be the instance's own origin.\n *\n * Also points ZITADEL_TESTING_HANDSHAKE at the handshake file so the\n * `@zitadel/testing/playwright` fixtures resolve the instance — Playwright\n * workers re-evaluate the config, which re-applies this for every process\n * that needs it. The returned value is plain data; append your own entries\n * to `webServer` if the suite needs additional servers.\n */\nexport function withZitadel(\n options: WithZitadelOptions,\n /** Test seam: alternative executable resolution. */\n resolveEntry: (name: \"supervisor\" | \"app-runner\") => string = entryPoint,\n): { webServer: WebServerEntry[] } {\n const { configDir, port, appOrigin, app } = options;\n if (!isAbsolute(configDir)) {\n throw new Error(`withZitadel: configDir must be absolute, got \"${configDir}\"`);\n }\n if (!Number.isInteger(port) || port <= 0) {\n throw new Error(`withZitadel: port must be a positive integer, got ${port}`);\n }\n const origin = URL.canParse(appOrigin) ? new URL(appOrigin) : undefined;\n if (\n !origin ||\n (origin.protocol !== \"http:\" && origin.protocol !== \"https:\") ||\n origin.pathname !== \"/\" ||\n origin.search !== \"\" ||\n origin.hash !== \"\"\n ) {\n throw new Error(\n `withZitadel: appOrigin must be an origin like \"http://localhost:3002\", got \"${appOrigin}\"`,\n );\n }\n if (app === undefined) {\n // Nothing else will bind appOrigin in this mode: the instance is the app\n // server, and it listens on plain HTTP at localhost:<port>. Anything\n // else — another port, a real hostname, https — is an origin nobody\n // serves, so Playwright's readiness wait would hang (or, worse, pass\n // against an unrelated stale server). Loopback aliases are the only\n // freedom; the scheme and port are the instance's.\n const loopbackHosts = new Set([\"localhost\", \"127.0.0.1\", \"[::1]\"]);\n if (\n origin.protocol !== \"http:\" ||\n !loopbackHosts.has(origin.hostname) ||\n (origin.port || \"80\") !== String(port)\n ) {\n throw new Error(\n `withZitadel: with no \\`app\\`, the instance itself serves the app, so appOrigin ` +\n `must be its local origin (http://localhost:${port}); got \"${appOrigin}\".`,\n );\n }\n } else {\n if (!app.readyPath.startsWith(\"/\")) {\n throw new Error(`withZitadel: app.readyPath must start with \"/\", got \"${app.readyPath}\"`);\n }\n if (app.command.length === 0) {\n throw new Error(\"withZitadel: app.command must not be empty\");\n }\n if (!isAbsolute(app.cwd)) {\n throw new Error(`withZitadel: app.cwd must be absolute, got \"${app.cwd}\"`);\n }\n }\n // Path options are consumed by the executables, whose cwd is configDir —\n // a relative path would silently resolve against that, not the project.\n for (const [label, value] of [\n [\"zitadel.serverBinary\", options.zitadel?.serverBinary],\n [\"zitadel.dir\", options.zitadel?.dir],\n [\"handshakePath\", options.handshakePath],\n ] as const) {\n if (value !== undefined && !isAbsolute(value)) {\n throw new Error(`withZitadel: ${label} must be an absolute path, got \"${value}\"`);\n }\n }\n\n const handshakePath =\n options.handshakePath ?? join(configDir, \".zitadel-testing\", \"handshake.json\");\n // Workers inherit the runner's env; the fixtures resolve the instance from it.\n process.env[HANDSHAKE_ENV] = handshakePath;\n\n const supervisorConfig: SupervisorConfig = {\n port,\n appOrigins: [appOrigin],\n serverBinary: options.zitadel?.serverBinary,\n serverBinaryHint: options.zitadel?.serverBinaryHint,\n dir: options.zitadel?.dir,\n keep: options.zitadel?.keep,\n projectName: options.zitadel?.projectName,\n preset: options.zitadel?.preset,\n useCase: options.zitadel?.useCase,\n };\n const supervisorEntry: WebServerEntry = {\n command: `node ${JSON.stringify(resolveEntry(\"supervisor\"))}`,\n url: `http://localhost:${port}/healthz`,\n reuseExistingServer: false,\n cwd: configDir,\n stdout: \"pipe\",\n stderr: \"pipe\",\n // Cold boot (fresh data dir: migrations + health wait) dominates.\n timeout: options.zitadel?.bootTimeoutMs ?? 120_000,\n env: {\n [HANDSHAKE_ENV]: handshakePath,\n [SUPERVISOR_CONFIG_ENV]: JSON.stringify(supervisorConfig),\n },\n // SIGTERM first so the supervisor can stop the instance; the default\n // hard kill would orphan the server process group.\n gracefulShutdown: { signal: \"SIGTERM\", timeout: 30_000 },\n };\n\n if (app === undefined) {\n return { webServer: [supervisorEntry] };\n }\n\n const appRunnerConfig: AppRunnerConfig = {\n command: app.command,\n cwd: app.cwd,\n env: app.env,\n handshakeTimeoutMs: app.readyTimeoutMs ?? 180_000,\n };\n\n return {\n webServer: [\n supervisorEntry,\n {\n command: `node ${JSON.stringify(resolveEntry(\"app-runner\"))}`,\n url: new URL(app.readyPath, appOrigin).toString(),\n reuseExistingServer: false,\n cwd: configDir,\n stdout: \"pipe\",\n stderr: \"pipe\",\n timeout: app.readyTimeoutMs ?? 180_000,\n env: {\n [HANDSHAKE_ENV]: handshakePath,\n [APP_RUNNER_CONFIG_ENV]: JSON.stringify(appRunnerConfig),\n },\n gracefulShutdown: {\n signal: \"SIGTERM\",\n timeout: app.gracefulShutdownMs ?? 15_000,\n },\n },\n ],\n };\n}\n\n/**\n * Resolve a sibling dist entry in the same module format this file was loaded\n * as (dist/supervisor.mjs next to dist/playwright.mjs, .cjs next to .cjs), so\n * the spawned process needs no package-manager bin plumbing.\n */\nfunction entryPoint(name: \"supervisor\" | \"app-runner\"): string {\n const self = fileURLToPath(import.meta.url);\n const ext = extname(self);\n if (ext !== \".mjs\" && ext !== \".cjs\") {\n throw new Error(\n `withZitadel: expected to run from the built package (got ${self}); ` +\n \"build @zitadel/testing first (in-repo: `moon run testing:build`).\",\n );\n }\n const path = fileURLToPath(new URL(`./${name}${ext}`, import.meta.url));\n if (!existsSync(path)) {\n throw new Error(\n `withZitadel: missing ${path}; rebuild @zitadel/testing (in-repo: \\`moon run testing:build\\`).`,\n );\n }\n return path;\n}\n","import { test as base, type Page } from \"@playwright/test\";\n\nimport { waitForHandshake } from \"./handshake\";\nimport { connectZitadel } from \"./index\";\nimport { enableVirtualPasskey, type VirtualPasskey } from \"./passkey\";\nimport { sessionCookieName } from \"./session\";\nimport type {\n ConnectedZitadel,\n Identity,\n MintedSession,\n SeededUser,\n SeedSessionInput,\n SeedUserInput,\n SeedUsersTemplate,\n} from \"./types\";\n\nexport interface AuthenticatedPage {\n /** A page in its own context, already carrying the session cookie. */\n page: Page;\n user: SeededUser;\n session: MintedSession;\n}\n\nexport interface ZitadelTestFixtures {\n /** Per-test seeding; each call mints unique data on the shared instance. */\n seed: {\n user(input?: SeedUserInput): Promise<SeededUser>;\n users(count: number, template?: SeedUsersTemplate): Promise<SeededUser[]>;\n /** Unused email+password for registration flows — creates nothing. */\n identity(): Identity;\n /** Seeded user + headless real-flow login; password flows only. */\n session(input?: SeedSessionInput): Promise<MintedSession>;\n };\n /**\n * Start the test authenticated: a fresh user, a real session minted through\n * the flow API, and its cookie injected into a dedicated browser context,\n * under the server's name and under the project's ({@link sessionCookieName}),\n * so it signs the app in whichever cookie its proxy reads. The default `page`\n * stays signed out for login-flow tests. Requires `use.baseURL` (every withZitadel\n * consumer sets it).\n */\n authenticatedPage: AuthenticatedPage;\n /**\n * Virtual passkey authenticator attached to the default `page`, disposed on\n * teardown. On-demand: tests that don't request it pay nothing. Chromium\n * only — see `enableVirtualPasskey` for the constraints.\n */\n passkey: VirtualPasskey;\n}\n\nexport interface ZitadelWorkerFixtures {\n /** Connection to the suite's instance, resolved once per worker. */\n zitadel: ConnectedZitadel;\n}\n\nexport const test = base.extend<ZitadelTestFixtures, ZitadelWorkerFixtures>({\n zitadel: [\n // Playwright derives fixture dependencies from the destructuring pattern,\n // so the empty pattern is required here.\n // biome-ignore lint/correctness/noEmptyPattern: Playwright fixture signature requires the destructuring pattern\n async ({}, use) => {\n const handshakePath = process.env.ZITADEL_TESTING_HANDSHAKE;\n if (!handshakePath) {\n throw new Error(\n \"ZITADEL_TESTING_HANDSHAKE is not set. Point it at the handshake file \" +\n \"written by the script that boots the instance (see @zitadel/testing docs).\",\n );\n }\n // Wait, don't read-once: the supervisor's Playwright readiness URL is\n // the instance's /healthz, which answers as soon as the *server* is up\n // — the handshake lands only after *bootstrap* (project, schema,\n // flows) completes a moment later. Suites with an `app` entry never\n // see the gap (the app runner waits for the handshake before the app\n // reports ready), but in app-less mode the first worker can get here\n // first. Bootstrap after health is seconds at most, so the default\n // wait is generous; a bootstrap failure surfaces as this timeout.\n await use(connectZitadel(await waitForHandshake(handshakePath)));\n },\n // `auto`: every worker waits for the bootstrapped instance before its\n // first test, including tests that use no fixture. Without it, a\n // `page`-only test in an app-less suite can navigate during the\n // bootstrap window and observe a project-less deployment — truthful,\n // rendered as the setup hint, and not what any suite means to test.\n // For app-ful suites this is a one-time handshake file read per worker.\n { scope: \"worker\", auto: true },\n ],\n seed: async ({ zitadel, baseURL }, use) => {\n await use({\n user: (input) => zitadel.seedUser(input),\n users: (count, template) => zitadel.seedUsers(count, template),\n identity: () => zitadel.identity(),\n // The suite's baseURL is the app origin the project allowlists.\n session: (input) => zitadel.seedSession({ origin: baseURL, ...input }),\n });\n },\n passkey: async ({ page }, use) => {\n const passkey = await enableVirtualPasskey(page);\n await use(passkey);\n await passkey.dispose();\n },\n authenticatedPage: async ({ browser, zitadel, baseURL }, use) => {\n if (!baseURL) {\n throw new Error(\n \"authenticatedPage requires `use.baseURL` so the session cookie can be \" +\n \"scoped to the app under test.\",\n );\n }\n const session = await zitadel.seedSession({ origin: baseURL });\n const context = await browser.newContext({ baseURL });\n // `addCookies` takes either url or domain/path; url derives the rest. The\n // session goes in under both names, so it signs the app in whichever its\n // proxy reads: a server SDK and the dev proxy setup writes read the\n // project's cookie (ADR 073), a proxy that passes the server's cookie\n // through reads that one.\n const { path: _path, ...cookie } = session.cookie;\n await context.addCookies([\n { ...cookie, url: baseURL },\n { ...cookie, name: sessionCookieName(zitadel.handle.projectId), url: baseURL },\n ]);\n const page = await context.newPage();\n await use({ page, user: session.user, session });\n await context.close();\n },\n});\n\nexport { expect } from \"@playwright/test\";\nexport { applyAppEnvTemplate, nextAppEnv } from \"./app-env\";\nexport type { AppEnvTemplate } from \"./app-env\";\nexport {\n clickFlowAction,\n fillFlowField,\n flowAction,\n flowField,\n loginWithPassword,\n loginWithPasskey,\n registerWithPassword,\n registerWithPasskey,\n} from \"./flows\";\nexport type {\n FlowActionOptions,\n FlowFieldOptions,\n LoginCredentials,\n PasswordRegistrationDetails,\n ProfileEntry,\n RegistrationDetails,\n} from \"./flows\";\nexport { enableVirtualPasskey } from \"./passkey\";\nexport type { VirtualPasskey } from \"./passkey\";\nexport { withZitadel } from \"./playwright-config\";\nexport type { WithZitadelOptions } from \"./playwright-config\";\nexport { identity } from \"./seed\";\nexport { SESSION_COOKIE_NAME, sessionCookieName } from \"./session\";\nexport type {\n ConnectedZitadel,\n Identity,\n InstanceHandle,\n MintedSession,\n SeededUser,\n SeedSessionInput,\n SeedUserInput,\n SeedUsersTemplate,\n} from \"./types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6BA,eAAsB,qBAAqB,MAAqC;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;EAC/D,IAAI,CAAC,SACH,MAAM,IAAI,MACR,qGAEF;EAEF,MAAM,UAAU,MAAM,QAAQ,YAAY,EAAE,QAAQ,QAAQ,CAAC;EAC7D,MAAM,UAAU,MAAM,QAAQ,WAAW,EAAE,QAAQ,CAAC;EAMpD,MAAM,EAAE,MAAM,OAAO,GAAG,WAAW,QAAQ;EAC3C,MAAM,QAAQ,WAAW,CACvB;GAAE,GAAG;GAAQ,KAAK;EAAQ,GAC1B;GAAE,GAAG;GAAQ,MAAMC,YAAAA,kBAAkB,QAAQ,OAAO,SAAS;GAAG,KAAK;EAAQ,CAC/E,CAAC;EAED,MAAM,IAAI;GAAE,MAAA,MADO,QAAQ,QAAQ;GACjB,MAAM,QAAQ;GAAM;EAAQ,CAAC;EAC/C,MAAM,QAAQ,MAAM;CACtB;AACF,CAAC"}
@@ -1,4 +1,4 @@
1
- import { a as Identity, d as SeedSessionInput, f as SeedUserInput, i as ConnectedZitadel, l as MintedSession, m as SeededUser, n as applyAppEnvTemplate, o as InstanceHandle, p as SeedUsersTemplate, r as nextAppEnv, t as AppEnvTemplate } from "./app-env-CAfV3fk_.mjs";
1
+ import { _ as SeededUser, a as applyAppEnvTemplate, c as Identity, f as MintedSession, g as SeedUsersTemplate, h as SeedUserInput, i as AppEnvTemplate, l as InstanceHandle, m as SeedSessionInput, n as sessionCookieName, o as nextAppEnv, r as identity, s as ConnectedZitadel, t as SESSION_COOKIE_NAME } from "./session-BrSkzPpy.mjs";
2
2
  import { SetupPreset, SetupUseCase } from "@zitadel/config/defaults";
3
3
  import { Locator, Page, PlaywrightTestConfig, expect } from "@playwright/test";
4
4
  //#region src/passkey.d.ts
@@ -268,9 +268,11 @@ export interface ZitadelTestFixtures {
268
268
  };
269
269
  /**
270
270
  * Start the test authenticated: a fresh user, a real session minted through
271
- * the flow API, and the cookie injected into a dedicated browser context —
272
- * the default `page` stays signed out for login-flow tests. Requires
273
- * `use.baseURL` (every withZitadel consumer sets it).
271
+ * the flow API, and its cookie injected into a dedicated browser context,
272
+ * under the server's name and under the project's ({@link sessionCookieName}),
273
+ * so it signs the app in whichever cookie its proxy reads. The default `page`
274
+ * stays signed out for login-flow tests. Requires `use.baseURL` (every withZitadel
275
+ * consumer sets it).
274
276
  */
275
277
  authenticatedPage: AuthenticatedPage;
276
278
  /**
@@ -286,5 +288,5 @@ export interface ZitadelWorkerFixtures {
286
288
  }
287
289
  export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & ZitadelTestFixtures, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & ZitadelWorkerFixtures>;
288
290
  //#endregion
289
- export { type AppEnvTemplate, type ConnectedZitadel, type FlowActionOptions, type FlowFieldOptions, type Identity, type InstanceHandle, type LoginCredentials, type MintedSession, type PasswordRegistrationDetails, type ProfileEntry, type RegistrationDetails, type SeedSessionInput, type SeedUserInput, type SeedUsersTemplate, type SeededUser, type VirtualPasskey, type WithZitadelOptions, applyAppEnvTemplate, expect, nextAppEnv };
291
+ export { type AppEnvTemplate, type ConnectedZitadel, type FlowActionOptions, type FlowFieldOptions, type Identity, type InstanceHandle, type LoginCredentials, type MintedSession, type PasswordRegistrationDetails, type ProfileEntry, type RegistrationDetails, SESSION_COOKIE_NAME, type SeedSessionInput, type SeedUserInput, type SeedUsersTemplate, type SeededUser, type VirtualPasskey, type WithZitadelOptions, applyAppEnvTemplate, expect, identity, nextAppEnv, sessionCookieName };
290
292
  //# sourceMappingURL=playwright.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"playwright.d.mts","names":[],"sources":["../src/passkey.ts","../src/flows.ts","../src/orchestration.ts","../src/playwright-config.ts","../src/playwright.ts"],"mappings":";;;;;;;;;UAOiB;;EAEf;;EAEA,mBAAmB;;EAEnB,WAAW;;;;;;;;;;;;;;;wBAgBS,qBAAqB,MAAM,OAAO,QAAQ;;;;;;;;;;;;;;;;;;;;UCT/C;;;;;EAKf,OA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kDAAA,0BAAA"}
1
+ {"version":3,"file":"playwright.d.mts","names":[],"sources":["../src/passkey.ts","../src/flows.ts","../src/orchestration.ts","../src/playwright-config.ts","../src/playwright.ts"],"mappings":";;;;;;;;;UAOiB;;EAEf;;EAEA,mBAAmB;;EAEnB,WAAW;;;;;;;;;;;;;;;wBAgBS,qBAAqB,MAAM,OAAO,QAAQ;;;;;;;;;;;;;;;;;;;;UCT/C;;;;;EAKf,OAAO;;UAGQ;;EAEf,QAAQ;;;;;;;;UASO;;EAEf;EACA;;EAEA,QAAQ;;UAGO;EACf;EACA;;UAGe;EACf;;EAEA,UAAU;;UAGK,oCAAoC;EACnD;;;;;;;;wBAkDc,WAAW,MAAM,MAAM,gBAAgB,UAAS,oBAAyB;;;;;wBAuBzE,UAAU,MAAM,MAAM,eAAe,UAAS,mBAAwB;;wBAchE,gBACpB,MAAM,MACN,gBACA,UAAU,oBACT;;wBAKmB,cACpB,MAAM,MACN,eACA,eACA,UAAU,mBACT;;;;;;wBASmB,kBACpB,MAAM,QACJ,OAAO,YAAY,mBACpB;;;;;;;;;wBAkBmB,iBACpB,MAAM,MACN;EAAW;IACV;;;;;;;;;wBAemB,qBACpB,MAAM,QACJ,OAAO,UAAU,WAAW,8BAC7B;;;;;;;wBAkBmB,oBACpB,MAAM,QACJ,OAAO,WAAW,sBACnB;;;UCzNc;;EAEf;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA,SAAS;EACT,UAAU;EACV;;;;KCZG,iBAAiB,QACpB,YAAY;UAIG;;;;;;EAMf;;;;;;EAMA;;;;;;EAMA;;EAEA;;IAEE;;IAEA;IACA;IACA,SAAS;IACT,UAAU;;IAEV;;IAEA;;IAEA;;;;;;;;;;;;;;;EAeF;;IAEE;;IAEA;;IAEA;;;;;;;IAOA,KAAK;IACL;;IAEA;;;EAGF;;;;;;;;;;;;;;;;;;;;;;;;wBAyBc,YACd,SAAS,oBAET;;AAAA,gBAAe;EACZ,WAAW;;;;iBCpGC;;EAEf,MAAM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