Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/tests/e2e/utils/operator-checkpoint.ts
T

36 lines
1.1 KiB
TypeScript

import type { Page } from "@playwright/test";
export type OperatorCheckpointId = "starter-addon-checkout" | "domain-ownership-txt" | "domain-setup-checkout";
type OperatorCheckpointTestInfo = {
readonly project: {
readonly use: {
readonly headless?: boolean;
};
};
readonly annotations: Array<{ type: string; description?: string }>;
};
export async function pauseForOperatorCheckpoint(
page: Pick<Page, "pause">,
testInfo: OperatorCheckpointTestInfo,
checkpoint: OperatorCheckpointId,
env: NodeJS.ProcessEnv = process.env
): Promise<boolean> {
const configured = env.E2E_OPERATOR_CHECKPOINTS?.trim();
if (!configured || configured === "0") return false;
if (configured !== "1") {
throw new Error("E2E_OPERATOR_CHECKPOINTS must be unset, 0, or 1.");
}
if (env.CI?.trim()) {
throw new Error("E2E_OPERATOR_CHECKPOINTS is forbidden in CI.");
}
if (testInfo.project.use.headless !== false) {
throw new Error("E2E_OPERATOR_CHECKPOINTS requires a headed Playwright run.");
}
testInfo.annotations.push({ type: "operator-checkpoint", description: checkpoint });
await page.pause();
return true;
}