// 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> { const document = JSON.parse( readFileSync(join(APP_ROOT, "modules", "documents", "__tests__", "fixtures", "ocr-document.json"), "utf8"), ) as Record const stack = await startStack(document) process.env.E2E_BASE_URL = stack.baseUrl process.env.E2E_PLATFORM_URL = stack.platformUrl return async () => { await stack.stop() } }