29 lines
1.4 KiB
TypeScript
29 lines
1.4 KiB
TypeScript
// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
|
|
// The e2e stack's fake platform serves the deployment's own services, as `pnpm dev` does (scripts/dev.mjs): the
|
|
// business gateway a project administrator binds an organization to, and the e-mail the platform captures on a
|
|
// test install. Without the deployment, every business procedure in a browser journey was refused and no captured
|
|
// e-mail could be read (template lesson proc-5). Fake platform, not Cloud.
|
|
|
|
import { randomUUID } from "node:crypto"
|
|
import { expect, test } from "@playwright/test"
|
|
|
|
test("the e2e stack serves the deployment's business bindings and captured e-mail", async () => {
|
|
const base = process.env.E2E_PLATFORM_URL
|
|
const organization = process.env.E2E_USAGE_ORGANIZATION
|
|
if (!base || !organization) throw new Error("e2e: the global setup sets E2E_PLATFORM_URL and E2E_USAGE_ORGANIZATION")
|
|
|
|
// A binding for an app tenant, as a project administrator provisions it.
|
|
const bound = await fetch(`${base}/__e2e/app-bindings`, {
|
|
method: "POST",
|
|
headers: { "content-type": "application/json" },
|
|
body: JSON.stringify({ app_tenant_id: randomUUID(), grants: { crm: ["crm.parties:read"] } }),
|
|
})
|
|
expect(bound.status).toBe(200)
|
|
|
|
// The deployment's captured e-mail, read with the deployment's own token.
|
|
const emails = await fetch(`${base}/api/v1/orgs/${organization}/emails`, {
|
|
headers: { authorization: "Bearer e2e-token" },
|
|
})
|
|
expect(emails.status).toBe(200)
|
|
})
|