Custom flow in pick/ban (#2923)
Some checks are pending
E2E Tests / e2e (push) Waiting to run
Tests and checks on push / run-checks-and-tests (push) Waiting to run
Updates translation progress / update-translation-progress-issue (push) Waiting to run

This commit is contained in:
Kalle
2026-03-29 18:00:15 +03:00
committed by GitHub
parent a1788ba89b
commit 7300693ba9
51 changed files with 4146 additions and 180 deletions

View File

@@ -118,10 +118,21 @@ export async function expectIsHydrated(page: Page) {
await expect(page.getByTestId("hydrated")).toHaveCount(1);
}
export function seed(page: Page, variation?: SeedVariation) {
return page.request.post("/seed", {
form: { variation: variation ?? "DEFAULT", source: "e2e" },
});
export async function seed(page: Page, variation?: SeedVariation) {
const MAX_ATTEMPTS = 3;
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
try {
return await page.request.post("/seed", {
form: { variation: variation ?? "DEFAULT", source: "e2e" },
timeout: 7_500,
});
} catch (error) {
if (attempt === MAX_ATTEMPTS) throw error;
}
}
throw new Error("seed: unreachable");
}
export function impersonate(page: Page, userId = ADMIN_ID) {

View File

@@ -7,6 +7,15 @@ export function errorIsSqliteForeignKeyConstraintFailure(
);
}
export function errorIsSqliteUniqueConstraintFailure(
error: unknown,
): error is Error {
return (
error instanceof Error &&
error?.message?.includes("UNIQUE constraint failed")
);
}
export function parseDBJsonArray(value: any) {
const parsed = JSON.parse(value);