@entifix/testing-e2e 0.12.1 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -77,7 +77,7 @@ const entityLinks = (key, id)=>[
|
|
|
77
77
|
} catch (error) {
|
|
78
78
|
// The same 400 the service answers: an unparseable expression, or a
|
|
79
79
|
// member the entity never declared filterable/sortable. The codec only
|
|
80
|
-
// ever throws `
|
|
80
|
+
// ever throws an `Error` here, so there is no second case to
|
|
81
81
|
// discriminate — anything else would be a bug in the codec, and
|
|
82
82
|
// reporting it verbatim is more useful than hiding it behind a 500.
|
|
83
83
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/fixtures/entity-backend.ts"],"sourcesContent":["import {\n EntityFacetCounterTag,\n EntityIdTag,\n EntityLoadRequestTag,\n EntityRepositoryTag,\n facetCountsUCFactory,\n getUCFactory,\n loadUCFactory,\n} from '@entifix/business';\nimport {\n type EntifixEnvelopeLink,\n type Entity,\n type EntityConstructor,\n type EntityId,\n type EntityLoadRequest,\n envelopeEntityName,\n Internal,\n InvalidQuery,\n makeEntityEnvelope,\n makeEntityFacetsEnvelope,\n makeEntityPageEnvelope,\n NotFound,\n parseFacetQueryParams,\n parseLoadRequestParams,\n problemOf,\n} from '@entifix/core';\nimport { makeMongoFacetCounter, makeMongoRepository } from '@entifix/mongo';\nimport {\n type FakeMongoDb,\n makeFakeMongoDb,\n} from '@entifix/testing-unit/drivers';\nimport { Effect } from 'effect';\n\n/**\n * A response as an HTTP transport would send it. `body` is an entifix envelope\n * or an error record; it stays `unknown` here so the backend is not coupled to\n * one transport's body type.\n */\nexport interface BackendResponse {\n readonly status: number;\n readonly body: unknown;\n}\n\n/** Rows as they are stored — the entity wire shape, exactly like the seed. */\nexport type BackendRow = Record<string, unknown>;\n\nexport interface EntityBackendOptions {\n /** Initial documents, in the entity wire shape. */\n seed?: ReadonlyArray<BackendRow>;\n}\n\nexport interface EntityBackend {\n /** The entity `key` — collection name and REST path segment alike. */\n readonly key: string;\n /** `GET /api/<key>?<search>` — filtering, sorting and paging included. */\n list(search: URLSearchParams): Promise<BackendResponse>;\n /** `GET /api/<key>/$facets?<search>` — the counts beside a listing's filters. */\n facets(search: URLSearchParams): Promise<BackendResponse>;\n /** `GET /api/<key>/:id`. */\n get(id: EntityId): Promise<BackendResponse>;\n /** Replaces the stored rows, so one fixture can serve several journeys. */\n seed(rows: ReadonlyArray<BackendRow>): void;\n /** The rows currently stored, for assertions about what a write did. */\n rows(): BackendRow[];\n /** The underlying driver fake, for failure injection. */\n readonly db: FakeMongoDb;\n}\n\nconst collectionLinks = (key: string): EntifixEnvelopeLink[] => [\n { rel: 'self', href: `/api/${key}`, method: 'GET' },\n { rel: 'create', href: `/api/${key}`, method: 'POST' },\n];\n\nconst entityLinks = (key: string, id: EntityId): EntifixEnvelopeLink[] => [\n { rel: 'self', href: `/api/${key}/${String(id)}`, method: 'GET' },\n { rel: 'list', href: `/api/${key}`, method: 'GET' },\n { rel: 'update', href: `/api/${key}/${String(id)}`, method: 'PUT' },\n { rel: 'delete', href: `/api/${key}/${String(id)}`, method: 'DELETE' },\n];\n\n/**\n * A read backend for one entity, assembled from the PRODUCTION query pipeline:\n *\n * ```\n * parseLoadRequestParams → loadUCFactory → makeMongoRepository → fake driver\n * (core: RSQL + the (business: (mongo-client: (testing-unit)\n * filterable/sortable the use-case) filter translation)\n * allowlist)\n * ```\n *\n * Nothing here re-implements query semantics. That is the whole point: a mock\n * backend that answers a filter with \"all the rows\" makes a green `mock` run\n * meaningless, and a mock backend that implements its *own* RSQL makes the two\n * profiles disagree the first time an operator is added. Because the real\n * pipeline runs, `mock` and `live` agree on filtering, sorting, paging, and on\n * the `400 invalid query` the metadata allowlist produces.\n *\n * Writes are deliberately absent: a `POST` in the admin service is a\n * *transaction* answering `202`, and a fixture that answered `201` instead\n * would be a lie about the protocol rather than a stand-in for it.\n */\nexport const makeEntityBackend = <TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n { seed = [] }: EntityBackendOptions = {},\n): EntityBackend => {\n const key = envelopeEntityName(entityConstructor);\n const db = makeFakeMongoDb({ [key]: seed.map(row => ({ ...row })) });\n const repository = makeMongoRepository(\n // The driver fake is typed `unknown` so `testing-unit` need not depend on\n // the mongodb types; the cast is the documented way to hand it over.\n db.db as Parameters<typeof makeMongoRepository>[0],\n entityConstructor,\n );\n\n const counter = makeMongoFacetCounter(\n db.db as Parameters<typeof makeMongoFacetCounter>[0],\n entityConstructor,\n );\n\n const run = <TValue, TError>(\n effect: Effect.Effect<TValue, TError, never>,\n ): Promise<TValue> => Effect.runPromise(effect);\n\n return {\n key,\n\n list: async search => {\n let request: EntityLoadRequest;\n try {\n request = parseLoadRequestParams(\n entityConstructor,\n search,\n ) as unknown as EntityLoadRequest;\n } catch (error) {\n // The same 400 the service answers: an unparseable expression, or a\n // member the entity never declared filterable/sortable. The codec only\n // ever throws `EntifixBuildError` here, so there is no second case to\n // discriminate — anything else would be a bug in the codec, and\n // reporting it verbatim is more useful than hiding it behind a 500.\n return {\n status: 400,\n body: problemOf(\n new InvalidQuery({ reason: (error as Error).message }),\n ),\n };\n }\n\n try {\n const page = await run(\n loadUCFactory<TEntity>().pipe(\n Effect.provideService(EntityRepositoryTag, repository),\n Effect.provideService(EntityLoadRequestTag, request),\n ),\n );\n\n return {\n status: 200,\n body: makeEntityPageEnvelope(\n entityConstructor,\n page,\n collectionLinks(key),\n ),\n };\n } catch (error) {\n // A repository that fails is a 500, exactly as in the service: the\n // request was valid, the store was not reachable.\n return {\n status: 500,\n body: problemOf(new Internal()),\n };\n }\n },\n\n // The same production pipeline as `list`: the protocol's parser and its\n // allowlist, the use case, and the Mongo counter over the fake driver.\n facets: async search => {\n let queries;\n try {\n queries = parseFacetQueryParams(entityConstructor, search);\n } catch (error) {\n return {\n status: 400,\n body: problemOf(\n new InvalidQuery({ reason: (error as Error).message }),\n ),\n };\n }\n\n try {\n const counts = await run(\n facetCountsUCFactory(queries).pipe(\n Effect.provideService(EntityFacetCounterTag, counter),\n ),\n );\n return {\n status: 200,\n body: makeEntityFacetsEnvelope(entityConstructor, counts),\n };\n } catch (error) {\n return {\n status: 500,\n body: problemOf(new Internal()),\n };\n }\n },\n\n get: async id => {\n const entity = await run(\n getUCFactory<TEntity>().pipe(\n Effect.provideService(EntityRepositoryTag, repository),\n Effect.provideService(EntityIdTag, id),\n Effect.option,\n ),\n );\n\n return entity._tag === 'None'\n ? { status: 404, body: problemOf(new NotFound({ entity: key })) }\n : {\n status: 200,\n body: makeEntityEnvelope(\n entityConstructor,\n entity.value,\n entityLinks(key, id),\n ),\n };\n },\n\n seed: rows => {\n db.seed(\n key,\n rows.map(row => ({ ...row })),\n );\n },\n\n rows: () => db.read(key),\n\n db,\n };\n};\n"],"names":["EntityFacetCounterTag","EntityIdTag","EntityLoadRequestTag","EntityRepositoryTag","facetCountsUCFactory","getUCFactory","loadUCFactory","envelopeEntityName","Internal","InvalidQuery","makeEntityEnvelope","makeEntityFacetsEnvelope","makeEntityPageEnvelope","NotFound","parseFacetQueryParams","parseLoadRequestParams","problemOf","makeMongoFacetCounter","makeMongoRepository","makeFakeMongoDb","Effect","collectionLinks","key","rel","href","method","entityLinks","id","String","makeEntityBackend","entityConstructor","seed","db","map","row","repository","counter","run","effect","runPromise","list","search","request","error","status","body","reason","message","page","pipe","provideService","facets","queries","counts","get","entity","option","_tag","value","rows","read"],"mappings":";AAAA,SACEA,qBAAqB,EACrBC,WAAW,EACXC,oBAAoB,EACpBC,mBAAmB,EACnBC,oBAAoB,EACpBC,YAAY,EACZC,aAAa,QACR,oBAAoB;AAC3B,SAMEC,kBAAkB,EAClBC,QAAQ,EACRC,YAAY,EACZC,kBAAkB,EAClBC,wBAAwB,EACxBC,sBAAsB,EACtBC,QAAQ,EACRC,qBAAqB,EACrBC,sBAAsB,EACtBC,SAAS,QACJ,gBAAgB;AACvB,SAASC,qBAAqB,EAAEC,mBAAmB,QAAQ,i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AAC/C,qBAAqBgC,aAC3Cf,OAAO8B,cAAc,CAACjD,aAAa0B,KACnCP,OAAOoC,MAAM;YAIjB,OAAOD,OAAOE,IAAI,KAAK,SACnB;gBAAEb,QAAQ;gBAAKC,MAAM7B,UAAU,IAAIH,SAAS;oBAAE0C,QAAQjC;gBAAI;YAAI,IAC9D;gBACEsB,QAAQ;gBACRC,MAAMnC,mBACJoB,mBACAyB,OAAOG,KAAK,EACZhC,YAAYJ,KAAKK;YAErB;QACN;QAEAI,MAAM4B,CAAAA;YACJ3B,GAAGD,IAAI,CACLT,KACAqC,KAAK1B,GAAG,CAACC,CAAAA,MAAQ,aAAKA;QAE1B;QAEAyB,MAAM,IAAM3B,GAAG4B,IAAI,CAACtC;QAEpBU;IACF;AACF,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../src/fixtures/entity-backend.ts"],"sourcesContent":["import {\n EntityFacetCounterTag,\n EntityIdTag,\n EntityLoadRequestTag,\n EntityRepositoryTag,\n facetCountsUCFactory,\n getUCFactory,\n loadUCFactory,\n} from '@entifix/business';\nimport {\n type EntifixEnvelopeLink,\n type Entity,\n type EntityConstructor,\n type EntityId,\n type EntityLoadRequest,\n envelopeEntityName,\n Internal,\n InvalidQuery,\n makeEntityEnvelope,\n makeEntityFacetsEnvelope,\n makeEntityPageEnvelope,\n NotFound,\n parseFacetQueryParams,\n parseLoadRequestParams,\n problemOf,\n} from '@entifix/core';\nimport { makeMongoFacetCounter, makeMongoRepository } from '@entifix/mongo';\nimport {\n type FakeMongoDb,\n makeFakeMongoDb,\n} from '@entifix/testing-unit/drivers';\nimport { Effect } from 'effect';\n\n/**\n * A response as an HTTP transport would send it. `body` is an entifix envelope\n * or an error record; it stays `unknown` here so the backend is not coupled to\n * one transport's body type.\n */\nexport interface BackendResponse {\n readonly status: number;\n readonly body: unknown;\n}\n\n/** Rows as they are stored — the entity wire shape, exactly like the seed. */\nexport type BackendRow = Record<string, unknown>;\n\nexport interface EntityBackendOptions {\n /** Initial documents, in the entity wire shape. */\n seed?: ReadonlyArray<BackendRow>;\n}\n\nexport interface EntityBackend {\n /** The entity `key` — collection name and REST path segment alike. */\n readonly key: string;\n /** `GET /api/<key>?<search>` — filtering, sorting and paging included. */\n list(search: URLSearchParams): Promise<BackendResponse>;\n /** `GET /api/<key>/$facets?<search>` — the counts beside a listing's filters. */\n facets(search: URLSearchParams): Promise<BackendResponse>;\n /** `GET /api/<key>/:id`. */\n get(id: EntityId): Promise<BackendResponse>;\n /** Replaces the stored rows, so one fixture can serve several journeys. */\n seed(rows: ReadonlyArray<BackendRow>): void;\n /** The rows currently stored, for assertions about what a write did. */\n rows(): BackendRow[];\n /** The underlying driver fake, for failure injection. */\n readonly db: FakeMongoDb;\n}\n\nconst collectionLinks = (key: string): EntifixEnvelopeLink[] => [\n { rel: 'self', href: `/api/${key}`, method: 'GET' },\n { rel: 'create', href: `/api/${key}`, method: 'POST' },\n];\n\nconst entityLinks = (key: string, id: EntityId): EntifixEnvelopeLink[] => [\n { rel: 'self', href: `/api/${key}/${String(id)}`, method: 'GET' },\n { rel: 'list', href: `/api/${key}`, method: 'GET' },\n { rel: 'update', href: `/api/${key}/${String(id)}`, method: 'PUT' },\n { rel: 'delete', href: `/api/${key}/${String(id)}`, method: 'DELETE' },\n];\n\n/**\n * A read backend for one entity, assembled from the PRODUCTION query pipeline:\n *\n * ```\n * parseLoadRequestParams → loadUCFactory → makeMongoRepository → fake driver\n * (core: RSQL + the (business: (mongo-client: (testing-unit)\n * filterable/sortable the use-case) filter translation)\n * allowlist)\n * ```\n *\n * Nothing here re-implements query semantics. That is the whole point: a mock\n * backend that answers a filter with \"all the rows\" makes a green `mock` run\n * meaningless, and a mock backend that implements its *own* RSQL makes the two\n * profiles disagree the first time an operator is added. Because the real\n * pipeline runs, `mock` and `live` agree on filtering, sorting, paging, and on\n * the `400 invalid query` the metadata allowlist produces.\n *\n * Writes are deliberately absent: a `POST` in the admin service is a\n * *transaction* answering `202`, and a fixture that answered `201` instead\n * would be a lie about the protocol rather than a stand-in for it.\n */\nexport const makeEntityBackend = <TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n { seed = [] }: EntityBackendOptions = {},\n): EntityBackend => {\n const key = envelopeEntityName(entityConstructor);\n const db = makeFakeMongoDb({ [key]: seed.map(row => ({ ...row })) });\n const repository = makeMongoRepository(\n // The driver fake is typed `unknown` so `testing-unit` need not depend on\n // the mongodb types; the cast is the documented way to hand it over.\n db.db as Parameters<typeof makeMongoRepository>[0],\n entityConstructor,\n );\n\n const counter = makeMongoFacetCounter(\n db.db as Parameters<typeof makeMongoFacetCounter>[0],\n entityConstructor,\n );\n\n const run = <TValue, TError>(\n effect: Effect.Effect<TValue, TError, never>,\n ): Promise<TValue> => Effect.runPromise(effect);\n\n return {\n key,\n\n list: async search => {\n let request: EntityLoadRequest;\n try {\n request = parseLoadRequestParams(\n entityConstructor,\n search,\n ) as unknown as EntityLoadRequest;\n } catch (error) {\n // The same 400 the service answers: an unparseable expression, or a\n // member the entity never declared filterable/sortable. The codec only\n // ever throws an `Error` here, so there is no second case to\n // discriminate — anything else would be a bug in the codec, and\n // reporting it verbatim is more useful than hiding it behind a 500.\n return {\n status: 400,\n body: problemOf(\n new InvalidQuery({ reason: (error as Error).message }),\n ),\n };\n }\n\n try {\n const page = await run(\n loadUCFactory<TEntity>().pipe(\n Effect.provideService(EntityRepositoryTag, repository),\n Effect.provideService(EntityLoadRequestTag, request),\n ),\n );\n\n return {\n status: 200,\n body: makeEntityPageEnvelope(\n entityConstructor,\n page,\n collectionLinks(key),\n ),\n };\n } catch (error) {\n // A repository that fails is a 500, exactly as in the service: the\n // request was valid, the store was not reachable.\n return {\n status: 500,\n body: problemOf(new Internal()),\n };\n }\n },\n\n // The same production pipeline as `list`: the protocol's parser and its\n // allowlist, the use case, and the Mongo counter over the fake driver.\n facets: async search => {\n let queries;\n try {\n queries = parseFacetQueryParams(entityConstructor, search);\n } catch (error) {\n return {\n status: 400,\n body: problemOf(\n new InvalidQuery({ reason: (error as Error).message }),\n ),\n };\n }\n\n try {\n const counts = await run(\n facetCountsUCFactory(queries).pipe(\n Effect.provideService(EntityFacetCounterTag, counter),\n ),\n );\n return {\n status: 200,\n body: makeEntityFacetsEnvelope(entityConstructor, counts),\n };\n } catch (error) {\n return {\n status: 500,\n body: problemOf(new Internal()),\n };\n }\n },\n\n get: async id => {\n const entity = await run(\n getUCFactory<TEntity>().pipe(\n Effect.provideService(EntityRepositoryTag, repository),\n Effect.provideService(EntityIdTag, id),\n Effect.option,\n ),\n );\n\n return entity._tag === 'None'\n ? { status: 404, body: problemOf(new NotFound({ entity: key })) }\n : {\n status: 200,\n body: makeEntityEnvelope(\n entityConstructor,\n entity.value,\n entityLinks(key, id),\n ),\n };\n },\n\n seed: rows => {\n db.seed(\n key,\n rows.map(row => ({ ...row })),\n );\n },\n\n rows: () => db.read(key),\n\n db,\n };\n};\n"],"names":["EntityFacetCounterTag","EntityIdTag","EntityLoadRequestTag","EntityRepositoryTag","facetCountsUCFactory","getUCFactory","loadUCFactory","envelopeEntityName","Internal","InvalidQuery","makeEntityEnvelope","makeEntityFacetsEnvelope","makeEntityPageEnvelope","NotFound","parseFacetQueryParams","parseLoadRequestParams","problemOf","makeMongoFacetCounter","makeMongoRepository","makeFakeMongoDb","Effect","collectionLinks","key","rel","href","method","entityLinks","id","String","makeEntityBackend","entityConstructor","seed","db","map","row","repository","counter","run","effect","runPromise","list","search","request","error","status","body","reason","message","page","pipe","provideService","facets","queries","counts","get","entity","option","_tag","value","rows","read"],"mappings":";AAAA,SACEA,qBAAqB,EACrBC,WAAW,EACXC,oBAAoB,EACpBC,mBAAmB,EACnBC,oBAAoB,EACpBC,YAAY,EACZC,aAAa,QACR,oBAAoB;AAC3B,SAMEC,kBAAkB,EAClBC,QAAQ,EACRC,YAAY,EACZC,kBAAkB,EAClBC,wBAAwB,EACxBC,sBAAsB,EACtBC,QAAQ,EACRC,qBAAqB,EACrBC,sBAAsB,EACtBC,SAAS,QACJ,gBAA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IACnBhC,eAAwB4C,IAAI,CAC1B7B,OAAO8B,cAAc,CAAC/C,qBAAqBgC,aAC3Cf,OAAO8B,cAAc,CAACjD,aAAa0B,KACnCP,OAAOoC,MAAM;YAIjB,OAAOD,OAAOE,IAAI,KAAK,SACnB;gBAAEb,QAAQ;gBAAKC,MAAM7B,UAAU,IAAIH,SAAS;oBAAE0C,QAAQjC;gBAAI;YAAI,IAC9D;gBACEsB,QAAQ;gBACRC,MAAMnC,mBACJoB,mBACAyB,OAAOG,KAAK,EACZhC,YAAYJ,KAAKK;YAErB;QACN;QAEAI,MAAM4B,CAAAA;YACJ3B,GAAGD,IAAI,CACLT,KACAqC,KAAK1B,GAAG,CAACC,CAAAA,MAAQ,aAAKA;QAE1B;QAEAyB,MAAM,IAAM3B,GAAG4B,IAAI,CAACtC;QAEpBU;IACF;AACF,EAAE"}
|
|
@@ -76,7 +76,7 @@ export interface SeedSessionOptions {
|
|
|
76
76
|
* Profile-aware, because "being signed in" means different things in each:
|
|
77
77
|
* `mock` fabricates the cookie, while `live` performs a **real sign-in** through
|
|
78
78
|
* the provider's hosted page so the token is one auth-service actually minted
|
|
79
|
-
* and the downstream
|
|
79
|
+
* and the downstream endpoint guards are genuinely exercised.
|
|
80
80
|
*
|
|
81
81
|
* Call it before `page.goto` — an app whose middleware protects the route will
|
|
82
82
|
* otherwise redirect away before the spec can assert anything.
|
|
@@ -199,7 +199,7 @@ const base64url = (value)=>Buffer.from(value).toString('base64').replace(/\+/g,
|
|
|
199
199
|
* Profile-aware, because "being signed in" means different things in each:
|
|
200
200
|
* `mock` fabricates the cookie, while `live` performs a **real sign-in** through
|
|
201
201
|
* the provider's hosted page so the token is one auth-service actually minted
|
|
202
|
-
* and the downstream
|
|
202
|
+
* and the downstream endpoint guards are genuinely exercised.
|
|
203
203
|
*
|
|
204
204
|
* Call it before `page.goto` — an app whose middleware protects the route will
|
|
205
205
|
* otherwise redirect away before the spec can assert anything.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/playwright/session.ts"],"sourcesContent":["import type { BrowserContext, Page } from '@playwright/test';\n\nimport { isMockProfile } from '../profile/profile.js';\n\n/**\n * The cookies a signed-in session travels in — the same names\n * `@entifix/core` declares, **written out rather than imported**.\n *\n * ⚠️ **This module must import no built package at runtime.** Nx builds its\n * project graph by loading every e2e project's `playwright.config.ts` in plain\n * Node — no source condition, nothing built — and that config reaches this\n * file. An `import … from '@entifix/core'` here resolves core's `dist`, which a\n * CI job that only lints never builds, and the whole graph fails with\n * `Cannot find module …/entifix-ts-core/dist/index.js`. It passed locally only\n * because a developer machine always has `dist` from a previous build.\n *\n * `session-cookies.spec.ts` imports core and fails if these drift, so the\n * duplication is checked rather than trusted.\n */\nexport const ACCESS_COOKIE = 'entifix_at';\nexport const SESSION_COOKIE = 'entifix_sid';\nexport const LOCALE_COOKIE = 'entifix_locale';\n\n/** Give a hosted-UI component time to hydrate before its input is retyped. */\nconst STEP_SETTLE_MS = 1_000;\n\n/**\n * Ceiling for a single hosted-UI action. Short on purpose: an action that cannot\n * complete has lost a race with a navigation, and the step machine wants to look\n * again rather than sit on it until the test's own timeout fires.\n */\nconst ACTION_TIMEOUT_MS = 10_000;\n\n/** How long a step waits for the next screen: 40 × 250ms = 10s. */\nconst STEP_POLLS = 40;\nconst STEP_POLL_MS = 250;\n\nexport interface SeedSessionOptions {\n /** Roles the seeded principal should carry. */\n roles?: readonly string[];\n /**\n * The organization the seeded session acts for. Tenant-plane routes resolve\n * their storage from this claim, so a spec that exercises one and omits it\n * gets `409 noActiveOrganization` rather than data. Pass `null` to seed a\n * session with no tenant scope on purpose — an operator, or a buyer.\n */\n activeOrganizationId?: string | null;\n /**\n * Which population the seeded principal belongs to — `customer`, `vendor` or\n * `operator`. Defaults to `vendor`, matching the default organization: a\n * session that acts for one is a vendor member's. A spec exercising platform\n * staff passes `operator` together with `activeOrganizationId: null`.\n */\n partyRole?: string;\n /**\n * The party the seeded principal is — the `Individual` id a route scoping a\n * read to its caller matches against. Defaults to the seeded vendor party, so\n * the fixture keeps mirroring what a real sign-in produces.\n *\n * Pass `null` to seed an account with no party record, which is the case a\n * scoped read must answer nothing for rather than everything.\n */\n partyId?: string | null;\n /**\n * The domains the seeded organization is provisioned for — the second\n * ceiling beside the role, which the back-office nav reads.\n *\n * Defaults to the one domain `entitlementSeedData` gives the demo\n * organization, so the fixture keeps mirroring what a real sign-in produces.\n * Pass `[]` to seed a member of an organization provisioned for nothing;\n * that is a different principal from one with `activeOrganizationId: null`,\n * who is outside the ceiling rather than refused by it.\n */\n entitlements?: readonly string[];\n /**\n * Locale to pin the run to. Seeded in both profiles so a run does not depend\n * on the CI machine's `Accept-Language` — without it the same spec renders\n * Spanish locally and English on a differently-configured runner.\n */\n locale?: string;\n /**\n * Identifier + password for the `live` profile's real sign-in, performed\n * against Zitadel's hosted login page. The default is the seeded super-admin\n * and the dev password `auth-service` provisions them with.\n */\n identifier?: string;\n password?: string;\n /** Where the sign-in surface is served in `live`. */\n signInAppUrl?: string;\n}\n\nconst base64url = (value: string): string =>\n Buffer.from(value)\n .toString('base64')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/, '');\n\n/**\n * A structurally valid, **deliberately unsigned** access token. It satisfies\n * exactly the two things the mock profile exercises — the middleware's cookie\n * presence check and the server-rendered nav's unverified claim read — and\n * nothing else: no service verifies it, because in `mock` the services are msw\n * fixtures. Signing it would need the private key, which the suite has no\n * business knowing and which is exactly what asymmetric signing exists to keep\n * out of places like this.\n */\nconst fabricateToken = (\n roles: readonly string[],\n activeOrganizationId: string | null,\n partyRole: string,\n partyId: string | null,\n entitlements: readonly string[],\n): string => {\n const header = base64url(\n JSON.stringify({ alg: 'RS256', kid: 'e2e-not-a-real-key', typ: 'JWT' }),\n );\n const payload = base64url(\n JSON.stringify({\n userId: 'e2e-user',\n subject: 'e2e-user',\n sessionId: 'e2e-session',\n roles,\n partyRole,\n ...(partyId === null ? {} : { partyId }),\n ...(activeOrganizationId === null\n ? {}\n : { activeOrganizationId, entitlements }),\n exp: Math.floor(Date.now() / 1000) + 3600,\n }),\n );\n return `${header}.${payload}.e2e-not-a-real-signature`;\n};\n\n/**\n * Fill one field of the hosted login and submit it.\n *\n * The retype is load-bearing, not defensive. v2 disables Continue on\n * `!formState.isValid` — react-hook-form state, not the DOM value — and\n * Playwright can type into the input before Next has hydrated the component.\n * Those keystrokes reach the DOM and never reach the form, so the button never\n * enables, and the failure screenshot shows the value sitting in the field as if\n * nothing were wrong. Typing again once the component is live registers it.\n *\n * `pressSequentially` rather than `fill` for the same reason at a smaller scale,\n * and because it is what the login's own acceptance suite uses.\n *\n * Every action is bounded and nothing here throws: losing a race with a\n * navigation is normal (the screen this was called for is already gone), and the\n * caller re-reads the route and decides what to do next. An unbounded action\n * would instead hang until the whole test times out, and report the wrong step.\n */\nconst submitHostedField = async (\n page: Page,\n testId: string,\n value: string,\n): Promise<void> => {\n const input = page.getByTestId(testId);\n const submit = page.getByTestId('submit-button');\n try {\n for (let attempt = 0; attempt < 4; attempt += 1) {\n await input.pressSequentially(value, { timeout: ACTION_TIMEOUT_MS });\n if (await submit.isEnabled()) break;\n // The keystrokes went to a component that was not listening yet. Clear\n // what the DOM kept and type it again into the hydrated one.\n await page.waitForTimeout(STEP_SETTLE_MS);\n await input.fill('', { timeout: ACTION_TIMEOUT_MS });\n }\n await submit.click({ timeout: ACTION_TIMEOUT_MS });\n } catch {\n // Deliberately swallowed — see above.\n }\n};\n\n/**\n * Wait for the hosted login to actually move on.\n *\n * A fixed sleep after each step is a race, not a wait: when the redirect is slow\n * the loop re-reads the same route and acts on a screen that is mid-navigation,\n * and when it is fast the sleep is wasted. This returns as soon as the route\n * changes or the session lands, whichever comes first.\n */\nconst waitForNextStep = async (\n context: BrowserContext,\n page: Page,\n fromPath: string,\n): Promise<void> => {\n for (let i = 0; i < STEP_POLLS; i += 1) {\n if ((await context.cookies()).some(c => c.name === ACCESS_COOKIE)) return;\n if (new URL(page.url()).pathname !== fromPath) return;\n await page.waitForTimeout(STEP_POLL_MS);\n }\n};\n\n/**\n * Sign in for real, through Zitadel's hosted login page.\n *\n * There is no API shortcut left and that is by design: no host endpoint accepts\n * a password, because a host that delegates authentication holds none.\n * The only way to obtain a real session is the flow a person performs, so the\n * `live` profile performs it — which also means this fixture exercises the\n * redirect, the PKCE exchange and the callback rather than skipping them.\n *\n * Written against the **v2** hosted login (`ghcr.io/zitadel/zitadel-login`,\n * `infra/local/zitadel-login`). Screens are told apart by their **route**, not by\n * what is on them: v2 gives each step its own path under `/ui/v2/login`, while\n * its `data-testid`s are reused across screens (`reset-button` is \"Reset\n * password\" on one and \"Skip\" on another). Routes are also what the login app's\n * own acceptance suite drives, so they are the part of its surface most likely\n * to survive a release.\n */\nconst signInThroughHostedUi = async (\n context: BrowserContext,\n options: {\n readonly signInAppUrl: string;\n readonly identifier: string;\n readonly password: string;\n },\n): Promise<void> => {\n const page = await context.newPage();\n try {\n await page.goto(`${options.signInAppUrl}/api/auth/oidc/start`);\n\n // A step machine rather than a fixed sequence, because the hosted UI's path\n // is not fixed. Four shapes a scripted login/password pair walks into:\n //\n // - **`/loginname`**, the identifier screen, where a cold run starts.\n // - **`/password`**, after it.\n // - **`/mfa/set`**, offered after the password to anyone with no enrolled\n // factor. `forceMfa` is off, so it is a prompt with a skip.\n // - **`/accounts`**, when the browser still holds a provider session from an\n // earlier spec. There is no login field on it at all.\n // - **no screen at all**, when the provider session is still live and the\n // authorization completes on the redirect.\n //\n // The loop's exit condition is the access cookie rather than the URL,\n // because that is what \"signed in\" actually means here and it is the only\n // one of the three that a landing origin does not lie about — the callback\n // lands on whichever app the redirect names.\n for (let step = 0; step < 8; step += 1) {\n if ((await context.cookies()).some(c => c.name === ACCESS_COOKIE)) break;\n\n const path = new URL(page.url()).pathname;\n\n if (path.endsWith('/accounts')) {\n await page\n .getByRole('link', { name: /add another account/i })\n .click({ timeout: ACTION_TIMEOUT_MS });\n await waitForNextStep(context, page, path);\n continue;\n }\n\n // Skipping the enrolment offer, not declining MFA: a user who HAS a\n // factor is challenged at `/otp/...` or `/u2f` instead, and those screens\n // have no skip — which is why a spec needing an enrolled user must seed\n // its own code.\n if (path.includes('/mfa/set')) {\n await page\n .getByTestId('reset-button')\n .click({ timeout: ACTION_TIMEOUT_MS });\n await waitForNextStep(context, page, path);\n continue;\n }\n\n if (path.endsWith('/loginname')) {\n await submitHostedField(\n page,\n 'username-text-input',\n options.identifier,\n );\n await waitForNextStep(context, page, path);\n continue;\n }\n\n if (path.endsWith('/password')) {\n await submitHostedField(page, 'password-text-input', options.password);\n await waitForNextStep(context, page, path);\n continue;\n }\n\n // No cookie yet and on a route this fixture has not been taught — an MFA\n // challenge, a password change demand, or a screen v2 grew since. Name the\n // route, because a bare timeout would send the reader looking in the wrong\n // place.\n throw new Error(\n `seedSession: stuck on the hosted login at ${page.url()} (\"${await page.title()}\"). ` +\n `Route \"${path}\" is not one this fixture handles — a second factor, most likely.`,\n );\n }\n\n if (!(await context.cookies()).some(c => c.name === ACCESS_COOKIE)) {\n throw new Error(\n `seedSession: finished the hosted login but no ${ACCESS_COOKIE} cookie was set. Is auth-service running and seeded into Zitadel?`,\n );\n }\n } finally {\n await page.close();\n }\n};\n\n/**\n * Give the browser context a signed-in session before the first navigation.\n *\n * Profile-aware, because \"being signed in\" means different things in each:\n * `mock` fabricates the cookie, while `live` performs a **real sign-in** through\n * the provider's hosted page so the token is one auth-service actually minted\n * and the downstream `requirePermission` checks are genuinely exercised.\n *\n * Call it before `page.goto` — an app whose middleware protects the route will\n * otherwise redirect away before the spec can assert anything.\n */\nexport const seedSession = async (\n context: BrowserContext,\n {\n roles = ['user'],\n activeOrganizationId = 'e2e-organization',\n partyRole = 'vendor',\n partyId = 'party-user-2',\n entitlements = ['product-configuration-management'],\n locale = 'es',\n identifier = 'ada@example.com',\n password = 'Password123!',\n signInAppUrl = process.env['BACK_OFFICE_APP_URL'] ??\n 'http://localhost:3001',\n }: SeedSessionOptions = {},\n): Promise<void> => {\n if (!isMockProfile()) {\n await signInThroughHostedUi(context, {\n signInAppUrl,\n identifier,\n password,\n });\n await context.addCookies([\n { name: LOCALE_COOKIE, value: locale, domain: 'localhost', path: '/' },\n ]);\n return;\n }\n\n await context.addCookies([\n {\n name: ACCESS_COOKIE,\n value: fabricateToken(\n roles,\n activeOrganizationId,\n partyRole,\n partyId,\n entitlements,\n ),\n domain: 'localhost',\n path: '/',\n },\n {\n name: SESSION_COOKIE,\n value: 'e2e-session',\n domain: 'localhost',\n path: '/',\n },\n {\n name: LOCALE_COOKIE,\n value: locale,\n domain: 'localhost',\n path: '/',\n },\n ]);\n};\n"],"names":["process","isMockProfile","ACCESS_COOKIE","SESSION_COOKIE","LOCALE_COOKIE","STEP_SETTLE_MS","ACTION_TIMEOUT_MS","STEP_POLLS","STEP_POLL_MS","base64url","value","Buffer","from","toString","replace","fabricateToken","roles","activeOrganizationId","partyRole","partyId","entitlements","header","JSON","stringify","alg","kid","typ","payload","userId","subject","sessionId","exp","Math","floor","Date","now","submitHostedField","page","testId","input","getByTestId","submit","attempt","pressSequentially","timeout","isEnabled","waitForTimeout","fill","click","waitForNextStep","context","fromPath","i","cookies","some","c","name","URL","url","pathname","signInThroughHostedUi","options","newPage","goto","signInAppUrl","step","path","endsWith","getByRole","includes","identifier","password","Error","title","close","seedSession","locale","env","addCookies","domain"],"mappings":";IAkUmBA;AAhUnB,SAASC,aAAa,QAAQ,wBAAwB;AAEtD;;;;;;;;;;;;;;CAcC,GACD,OAAO,MAAMC,gBAAgB,aAAa;AAC1C,OAAO,MAAMC,iBAAiB,cAAc;AAC5C,OAAO,MAAMC,gBAAgB,iBAAiB;AAE9C,4EAA4E,GAC5E,MAAMC,iBAAiB;AAEvB;;;;CAIC,GACD,MAAMC,oBAAoB;AAE1B,iEAAiE,GACjE,MAAMC,aAAa;AACnB,MAAMC,eAAe;AAwDrB,MAAMC,YAAY,CAACC,QACjBC,OAAOC,IAAI,CAACF,OACTG,QAAQ,CAAC,UACTC,OAAO,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C,iBAAiB;QACpB,MAAM2D,sBAAsBV,SAAS;YACnCc;YACAM;YACAC;QACF;QACA,MAAMrB,QAAQ4B,UAAU,CAAC;YACvB;gBAAEtB,MAAMpD;gBAAeM,OAAOkE;gBAAQG,QAAQ;gBAAab,MAAM;YAAI;SACtE;QACD;IACF;IAEA,MAAMhB,QAAQ4B,UAAU,CAAC;QACvB;YACEtB,MAAMtD;YACNQ,OAAOK,eACLC,OACAC,sBACAC,WACAC,SACAC;YAEF2D,QAAQ;YACRb,MAAM;QACR;QACA;YACEV,MAAMrD;YACNO,OAAO;YACPqE,QAAQ;YACRb,MAAM;QACR;QACA;YACEV,MAAMpD;YACNM,OAAOkE;YACPG,QAAQ;YACRb,MAAM;QACR;KACD;AACH,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../src/playwright/session.ts"],"sourcesContent":["import type { BrowserContext, Page } from '@playwright/test';\n\nimport { isMockProfile } from '../profile/profile.js';\n\n/**\n * The cookies a signed-in session travels in — the same names\n * `@entifix/core` declares, **written out rather than imported**.\n *\n * ⚠️ **This module must import no built package at runtime.** Nx builds its\n * project graph by loading every e2e project's `playwright.config.ts` in plain\n * Node — no source condition, nothing built — and that config reaches this\n * file. An `import … from '@entifix/core'` here resolves core's `dist`, which a\n * CI job that only lints never builds, and the whole graph fails with\n * `Cannot find module …/entifix-ts-core/dist/index.js`. It passed locally only\n * because a developer machine always has `dist` from a previous build.\n *\n * `session-cookies.spec.ts` imports core and fails if these drift, so the\n * duplication is checked rather than trusted.\n */\nexport const ACCESS_COOKIE = 'entifix_at';\nexport const SESSION_COOKIE = 'entifix_sid';\nexport const LOCALE_COOKIE = 'entifix_locale';\n\n/** Give a hosted-UI component time to hydrate before its input is retyped. */\nconst STEP_SETTLE_MS = 1_000;\n\n/**\n * Ceiling for a single hosted-UI action. Short on purpose: an action that cannot\n * complete has lost a race with a navigation, and the step machine wants to look\n * again rather than sit on it until the test's own timeout fires.\n */\nconst ACTION_TIMEOUT_MS = 10_000;\n\n/** How long a step waits for the next screen: 40 × 250ms = 10s. */\nconst STEP_POLLS = 40;\nconst STEP_POLL_MS = 250;\n\nexport interface SeedSessionOptions {\n /** Roles the seeded principal should carry. */\n roles?: readonly string[];\n /**\n * The organization the seeded session acts for. Tenant-plane routes resolve\n * their storage from this claim, so a spec that exercises one and omits it\n * gets `409 noActiveOrganization` rather than data. Pass `null` to seed a\n * session with no tenant scope on purpose — an operator, or a buyer.\n */\n activeOrganizationId?: string | null;\n /**\n * Which population the seeded principal belongs to — `customer`, `vendor` or\n * `operator`. Defaults to `vendor`, matching the default organization: a\n * session that acts for one is a vendor member's. A spec exercising platform\n * staff passes `operator` together with `activeOrganizationId: null`.\n */\n partyRole?: string;\n /**\n * The party the seeded principal is — the `Individual` id a route scoping a\n * read to its caller matches against. Defaults to the seeded vendor party, so\n * the fixture keeps mirroring what a real sign-in produces.\n *\n * Pass `null` to seed an account with no party record, which is the case a\n * scoped read must answer nothing for rather than everything.\n */\n partyId?: string | null;\n /**\n * The domains the seeded organization is provisioned for — the second\n * ceiling beside the role, which the back-office nav reads.\n *\n * Defaults to the one domain `entitlementSeedData` gives the demo\n * organization, so the fixture keeps mirroring what a real sign-in produces.\n * Pass `[]` to seed a member of an organization provisioned for nothing;\n * that is a different principal from one with `activeOrganizationId: null`,\n * who is outside the ceiling rather than refused by it.\n */\n entitlements?: readonly string[];\n /**\n * Locale to pin the run to. Seeded in both profiles so a run does not depend\n * on the CI machine's `Accept-Language` — without it the same spec renders\n * Spanish locally and English on a differently-configured runner.\n */\n locale?: string;\n /**\n * Identifier + password for the `live` profile's real sign-in, performed\n * against Zitadel's hosted login page. The default is the seeded super-admin\n * and the dev password `auth-service` provisions them with.\n */\n identifier?: string;\n password?: string;\n /** Where the sign-in surface is served in `live`. */\n signInAppUrl?: string;\n}\n\nconst base64url = (value: string): string =>\n Buffer.from(value)\n .toString('base64')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/, '');\n\n/**\n * A structurally valid, **deliberately unsigned** access token. It satisfies\n * exactly the two things the mock profile exercises — the middleware's cookie\n * presence check and the server-rendered nav's unverified claim read — and\n * nothing else: no service verifies it, because in `mock` the services are msw\n * fixtures. Signing it would need the private key, which the suite has no\n * business knowing and which is exactly what asymmetric signing exists to keep\n * out of places like this.\n */\nconst fabricateToken = (\n roles: readonly string[],\n activeOrganizationId: string | null,\n partyRole: string,\n partyId: string | null,\n entitlements: readonly string[],\n): string => {\n const header = base64url(\n JSON.stringify({ alg: 'RS256', kid: 'e2e-not-a-real-key', typ: 'JWT' }),\n );\n const payload = base64url(\n JSON.stringify({\n userId: 'e2e-user',\n subject: 'e2e-user',\n sessionId: 'e2e-session',\n roles,\n partyRole,\n ...(partyId === null ? {} : { partyId }),\n ...(activeOrganizationId === null\n ? {}\n : { activeOrganizationId, entitlements }),\n exp: Math.floor(Date.now() / 1000) + 3600,\n }),\n );\n return `${header}.${payload}.e2e-not-a-real-signature`;\n};\n\n/**\n * Fill one field of the hosted login and submit it.\n *\n * The retype is load-bearing, not defensive. v2 disables Continue on\n * `!formState.isValid` — react-hook-form state, not the DOM value — and\n * Playwright can type into the input before Next has hydrated the component.\n * Those keystrokes reach the DOM and never reach the form, so the button never\n * enables, and the failure screenshot shows the value sitting in the field as if\n * nothing were wrong. Typing again once the component is live registers it.\n *\n * `pressSequentially` rather than `fill` for the same reason at a smaller scale,\n * and because it is what the login's own acceptance suite uses.\n *\n * Every action is bounded and nothing here throws: losing a race with a\n * navigation is normal (the screen this was called for is already gone), and the\n * caller re-reads the route and decides what to do next. An unbounded action\n * would instead hang until the whole test times out, and report the wrong step.\n */\nconst submitHostedField = async (\n page: Page,\n testId: string,\n value: string,\n): Promise<void> => {\n const input = page.getByTestId(testId);\n const submit = page.getByTestId('submit-button');\n try {\n for (let attempt = 0; attempt < 4; attempt += 1) {\n await input.pressSequentially(value, { timeout: ACTION_TIMEOUT_MS });\n if (await submit.isEnabled()) break;\n // The keystrokes went to a component that was not listening yet. Clear\n // what the DOM kept and type it again into the hydrated one.\n await page.waitForTimeout(STEP_SETTLE_MS);\n await input.fill('', { timeout: ACTION_TIMEOUT_MS });\n }\n await submit.click({ timeout: ACTION_TIMEOUT_MS });\n } catch {\n // Deliberately swallowed — see above.\n }\n};\n\n/**\n * Wait for the hosted login to actually move on.\n *\n * A fixed sleep after each step is a race, not a wait: when the redirect is slow\n * the loop re-reads the same route and acts on a screen that is mid-navigation,\n * and when it is fast the sleep is wasted. This returns as soon as the route\n * changes or the session lands, whichever comes first.\n */\nconst waitForNextStep = async (\n context: BrowserContext,\n page: Page,\n fromPath: string,\n): Promise<void> => {\n for (let i = 0; i < STEP_POLLS; i += 1) {\n if ((await context.cookies()).some(c => c.name === ACCESS_COOKIE)) return;\n if (new URL(page.url()).pathname !== fromPath) return;\n await page.waitForTimeout(STEP_POLL_MS);\n }\n};\n\n/**\n * Sign in for real, through Zitadel's hosted login page.\n *\n * There is no API shortcut left and that is by design: no host endpoint accepts\n * a password, because a host that delegates authentication holds none.\n * The only way to obtain a real session is the flow a person performs, so the\n * `live` profile performs it — which also means this fixture exercises the\n * redirect, the PKCE exchange and the callback rather than skipping them.\n *\n * Written against the **v2** hosted login (`ghcr.io/zitadel/zitadel-login`,\n * `infra/local/zitadel-login`). Screens are told apart by their **route**, not by\n * what is on them: v2 gives each step its own path under `/ui/v2/login`, while\n * its `data-testid`s are reused across screens (`reset-button` is \"Reset\n * password\" on one and \"Skip\" on another). Routes are also what the login app's\n * own acceptance suite drives, so they are the part of its surface most likely\n * to survive a release.\n */\nconst signInThroughHostedUi = async (\n context: BrowserContext,\n options: {\n readonly signInAppUrl: string;\n readonly identifier: string;\n readonly password: string;\n },\n): Promise<void> => {\n const page = await context.newPage();\n try {\n await page.goto(`${options.signInAppUrl}/api/auth/oidc/start`);\n\n // A step machine rather than a fixed sequence, because the hosted UI's path\n // is not fixed. Four shapes a scripted login/password pair walks into:\n //\n // - **`/loginname`**, the identifier screen, where a cold run starts.\n // - **`/password`**, after it.\n // - **`/mfa/set`**, offered after the password to anyone with no enrolled\n // factor. `forceMfa` is off, so it is a prompt with a skip.\n // - **`/accounts`**, when the browser still holds a provider session from an\n // earlier spec. There is no login field on it at all.\n // - **no screen at all**, when the provider session is still live and the\n // authorization completes on the redirect.\n //\n // The loop's exit condition is the access cookie rather than the URL,\n // because that is what \"signed in\" actually means here and it is the only\n // one of the three that a landing origin does not lie about — the callback\n // lands on whichever app the redirect names.\n for (let step = 0; step < 8; step += 1) {\n if ((await context.cookies()).some(c => c.name === ACCESS_COOKIE)) break;\n\n const path = new URL(page.url()).pathname;\n\n if (path.endsWith('/accounts')) {\n await page\n .getByRole('link', { name: /add another account/i })\n .click({ timeout: ACTION_TIMEOUT_MS });\n await waitForNextStep(context, page, path);\n continue;\n }\n\n // Skipping the enrolment offer, not declining MFA: a user who HAS a\n // factor is challenged at `/otp/...` or `/u2f` instead, and those screens\n // have no skip — which is why a spec needing an enrolled user must seed\n // its own code.\n if (path.includes('/mfa/set')) {\n await page\n .getByTestId('reset-button')\n .click({ timeout: ACTION_TIMEOUT_MS });\n await waitForNextStep(context, page, path);\n continue;\n }\n\n if (path.endsWith('/loginname')) {\n await submitHostedField(\n page,\n 'username-text-input',\n options.identifier,\n );\n await waitForNextStep(context, page, path);\n continue;\n }\n\n if (path.endsWith('/password')) {\n await submitHostedField(page, 'password-text-input', options.password);\n await waitForNextStep(context, page, path);\n continue;\n }\n\n // No cookie yet and on a route this fixture has not been taught — an MFA\n // challenge, a password change demand, or a screen v2 grew since. Name the\n // route, because a bare timeout would send the reader looking in the wrong\n // place.\n throw new Error(\n `seedSession: stuck on the hosted login at ${page.url()} (\"${await page.title()}\"). ` +\n `Route \"${path}\" is not one this fixture handles — a second factor, most likely.`,\n );\n }\n\n if (!(await context.cookies()).some(c => c.name === ACCESS_COOKIE)) {\n throw new Error(\n `seedSession: finished the hosted login but no ${ACCESS_COOKIE} cookie was set. Is auth-service running and seeded into Zitadel?`,\n );\n }\n } finally {\n await page.close();\n }\n};\n\n/**\n * Give the browser context a signed-in session before the first navigation.\n *\n * Profile-aware, because \"being signed in\" means different things in each:\n * `mock` fabricates the cookie, while `live` performs a **real sign-in** through\n * the provider's hosted page so the token is one auth-service actually minted\n * and the downstream endpoint guards are genuinely exercised.\n *\n * Call it before `page.goto` — an app whose middleware protects the route will\n * otherwise redirect away before the spec can assert anything.\n */\nexport const seedSession = async (\n context: BrowserContext,\n {\n roles = ['user'],\n activeOrganizationId = 'e2e-organization',\n partyRole = 'vendor',\n partyId = 'party-user-2',\n entitlements = ['product-configuration-management'],\n locale = 'es',\n identifier = 'ada@example.com',\n password = 'Password123!',\n signInAppUrl = process.env['BACK_OFFICE_APP_URL'] ??\n 'http://localhost:3001',\n }: SeedSessionOptions = {},\n): Promise<void> => {\n if (!isMockProfile()) {\n await signInThroughHostedUi(context, {\n signInAppUrl,\n identifier,\n password,\n });\n await context.addCookies([\n { name: LOCALE_COOKIE, value: locale, domain: 'localhost', path: '/' },\n ]);\n return;\n }\n\n await context.addCookies([\n {\n name: ACCESS_COOKIE,\n value: fabricateToken(\n roles,\n activeOrganizationId,\n partyRole,\n partyId,\n entitlements,\n ),\n domain: 'localhost',\n path: '/',\n },\n {\n name: SESSION_COOKIE,\n value: 'e2e-session',\n domain: 'localhost',\n path: '/',\n },\n {\n name: LOCALE_COOKIE,\n value: locale,\n domain: 'localhost',\n path: '/',\n },\n ]);\n};\n"],"names":["process","isMockProfile","ACCESS_COOKIE","SESSION_COOKIE","LOCALE_COOKIE","STEP_SETTLE_MS","ACTION_TIMEOUT_MS","STEP_POLLS","STEP_POLL_MS","base64url","value","Buffer","from","toString","replace","fabricateToken","roles","activeOrganizationId","partyRole","partyId","entitlements","header","JSON","stringify","alg","kid","typ","payload","userId","subject","sessionId","exp","Math","floor","Date","now","submitHostedField","page","testId","input","getByTestId","submit","attempt","pressSequentially","timeout","isEnabled","waitForTimeout","fill","click","waitForNextStep","context","fromPath","i","cookies","some","c","name","URL","url","pathname","signInThroughHostedUi","options","newPage","goto","signInAppUrl","step","path","endsWith","getByRole","includes","identifier","password","Error","title","close","seedSession","locale","env","addCookies","domain"],"mappings":";IAkUmBA;AAhUnB,SAASC,aAAa,QAAQ,wBAAwB;AAEtD;;;;;;;;;;;;;;CAcC,GACD,OAAO,MAAMC,gBAAgB,aAAa;AAC1C,OAAO,MAAMC,iBAAiB,cAAc;AAC5C,OAAO,MAAMC,gBAAgB,iBAAiB;AAE9C,4EAA4E,GAC5E,MAAMC,iBAAiB;AAEvB;;;;CAIC,GACD,MAAMC,oBAAoB;AAE1B,iEAAiE,GACjE,MAAMC,aAAa;AACnB,MAAMC,eAAe;AAwDrB,MAAMC,YAAY,CAACC,QACjBC,OAAOC,IAAI,CAACF,OACTG,QAAQ,CAAC,UACTC,OAAO,CAAC,OAAO,KACfA,OAAO,CAAC,OAAO,KACfA,OAAO,CAAC,OAAO;AAEpB;;;;;;;;CAQC,GACD,MAAMC,iBAAiB,CACrBC,OACAC,sBACAC,WACAC,SACAC;IAEA,MAAMC,SAASZ,UACba,KAAKC,SAAS,CAAC;QAAEC,KAAK;QAASC,KAAK;QAAsBC,KAAK;IAAM;IAEvE,MAAMC,UAAUlB,UACda,KAAKC,SAAS,CAAC;QACbK,QAAQ;QACRC,SAAS;QACTC,WAAW;QACXd;QACAE;OACIC,YAAY,OAAO,CAAC,IAAI;QAAEA;IAAQ,GAClCF,yBAAyB,OACzB,CAAC,IACD;QAAEA;QAAsBG;IAAa;QACzCW,KAAKC,KAAKC,KAAK,CAACC,KAAKC,GAAG,KAAK,QAAQ;;IAGzC,OAAO,GAAGd,OAAO,CAAC,EAAEM,QAAQ,yBAAyB,CAAC;AACxD;AAEA;;;;;;;;;;;;;;;;;CAiBC,GACD,MAAMS,oBAAoB,OACxBC,MACAC,QACA5B;IAEA,MAAM6B,QAAQF,KAAKG,WAAW,CAACF;IAC/B,MAAMG,SAASJ,KAAKG,WAAW,CAAC;IAChC,IAAI;QACF,IAAK,IAAIE,UAAU,GAAGA,UAAU,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YAClE,MAAM,IAAIsE,MACR,CAAC,8CAA8C,EAAEtE,cAAc,iEAAiE,CAAC;QAErI;IACF,SAAU;QACR,MAAMmC,KAAKqC,KAAK;IAClB;AACF;AAEA;;;;;;;;;;CAUC,GACD,OAAO,MAAMC,cAAc,OACzBzB,SACA,EACElC,QAAQ;IAAC;CAAO,EAChBC,uBAAuB,kBAAkB,EACzCC,YAAY,QAAQ,EACpBC,UAAU,cAAc,EACxBC,eAAe;IAAC;CAAmC,EACnDwD,SAAS,IAAI,EACbN,aAAa,iBAAiB,EAC9BC,WAAW,cAAc,EACzBP,gBAAehE,mCAAAA,QAAQ6E,GAAG,CAAC,sBAAsB,YAAlC7E,mCACb,uBAAuB,EACN,GAAG,CAAC,CAAC;IAE1B,IAAI,CAACC,iBAAiB;QACpB,MAAM2D,sBAAsBV,SAAS;YACnCc;YACAM;YACAC;QACF;QACA,MAAMrB,QAAQ4B,UAAU,CAAC;YACvB;gBAAEtB,MAAMpD;gBAAeM,OAAOkE;gBAAQG,QAAQ;gBAAab,MAAM;YAAI;SACtE;QACD;IACF;IAEA,MAAMhB,QAAQ4B,UAAU,CAAC;QACvB;YACEtB,MAAMtD;YACNQ,OAAOK,eACLC,OACAC,sBACAC,WACAC,SACAC;YAEF2D,QAAQ;YACRb,MAAM;QACR;QACA;YACEV,MAAMrD;YACNO,OAAO;YACPqE,QAAQ;YACRb,MAAM;QACR;QACA;YACEV,MAAMpD;YACNM,OAAOkE;YACPG,QAAQ;YACRb,MAAM;QACR;KACD;AACH,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entifix/testing-e2e",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "End-to-end testing with one set of journeys and two profiles: mocked backends by default, real infrastructure on demand.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -67,22 +67,22 @@
|
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@swc/helpers": "0.5.23",
|
|
70
|
-
"@entifix/business": "0.
|
|
71
|
-
"@entifix/
|
|
72
|
-
"@entifix/
|
|
70
|
+
"@entifix/business": "0.14.0",
|
|
71
|
+
"@entifix/core": "0.14.0",
|
|
72
|
+
"@entifix/testing-unit": "0.14.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@
|
|
76
|
-
"@nx/
|
|
75
|
+
"@msw/playwright": ">=0.7",
|
|
76
|
+
"@nx/devkit": ">=24 <25",
|
|
77
|
+
"@nx/playwright": ">=24 <25",
|
|
77
78
|
"@playwright/test": "*",
|
|
78
79
|
"axios": "*",
|
|
79
|
-
"effect": "^4.0.
|
|
80
|
+
"effect": "^4.0.7",
|
|
80
81
|
"msw": ">=3",
|
|
81
|
-
"@msw/playwright": ">=0.7",
|
|
82
82
|
"vitest": "*",
|
|
83
|
-
"@entifix/
|
|
84
|
-
"@entifix/
|
|
85
|
-
"@entifix/mongo": "0.
|
|
83
|
+
"@entifix/amqp": "0.14.0",
|
|
84
|
+
"@entifix/redis": "0.14.0",
|
|
85
|
+
"@entifix/mongo": "0.14.0"
|
|
86
86
|
},
|
|
87
87
|
"peerDependenciesMeta": {
|
|
88
88
|
"@msw/playwright": {
|
|
@@ -117,11 +117,11 @@
|
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
119
|
"devDependencies": {
|
|
120
|
-
"@nx/devkit": "
|
|
121
|
-
"@nx/playwright": "
|
|
122
|
-
"effect": "4.0.
|
|
123
|
-
"@entifix/
|
|
124
|
-
"@entifix/
|
|
125
|
-
"@entifix/redis": "0.
|
|
120
|
+
"@nx/devkit": "24.0.3",
|
|
121
|
+
"@nx/playwright": "24.0.3",
|
|
122
|
+
"effect": "4.0.7",
|
|
123
|
+
"@entifix/mongo": "0.14.0",
|
|
124
|
+
"@entifix/amqp": "0.14.0",
|
|
125
|
+
"@entifix/redis": "0.14.0"
|
|
126
126
|
}
|
|
127
127
|
}
|