Files
template-app/e2e/support/global-setup.ts
T

21 lines
941 B
TypeScript

// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
// Starts the stack once for the whole run and stops it after (Playwright's global setup returns the
// teardown). The OCR the fake platform answers with is the documents module's own fixture: a three-page
// document with four labelled lines and a drawing page the extraction leaves out, which is what the specs review.
import { readFileSync } from "node:fs"
import { join } from "node:path"
import { APP_ROOT, startStack } from "./stack"
export default async function globalSetup(): Promise<() => Promise<void>> {
const document = JSON.parse(
readFileSync(join(APP_ROOT, "modules", "documents", "__tests__", "fixtures", "ocr-document.json"), "utf8"),
) as Record<string, unknown>
const stack = await startStack(document)
process.env.E2E_BASE_URL = stack.baseUrl
process.env.E2E_PLATFORM_URL = stack.platformUrl
return async () => {
await stack.stop()
}
}