Delete the flows and users the Playwright specs create

The specs run against a development stack, so every run left a test_flow_*
in someone's flow list. Each spec now tears down what it made in an afterAll,
which runs whether or not the tests passed, and the three copies of the API
helper move into tests/utils/api.ts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H7LwYgJfpkbLCTeiAf8U4A
This commit is contained in:
2026-08-16 16:46:07 +02:00
co-authored by Claude Fable 5
parent a733e0d582
commit 143395358a
6 changed files with 79 additions and 62 deletions
+15
View File
@@ -1,9 +1,24 @@
import { expect, test } from "@playwright/test"
import { firstSuperuser, firstSuperuserPassword } from "./config.ts"
import { api, apiPage } from "./utils/api"
import { createUser } from "./utils/privateApi"
import { randomEmail, randomPassword } from "./utils/random"
import { logInUser } from "./utils/user"
test.afterAll(async ({ browser }) => {
// Every user below is created under a randomEmail(), so the superuser can
// sweep them all up by that shape — including what a run that failed halfway
// left in the shared development database.
const page = await apiPage(browser)
const { data } = await (await api(page, "/users/?limit=1000")).json()
for (const user of data as { id: string; email: string }[]) {
if (/^test_.*@example\.com$/.test(user.email)) {
await api(page, `/users/${user.id}`, { method: "DELETE" })
}
}
await page.close()
})
test("Admin page is accessible and shows correct title", async ({ page }) => {
await page.goto("/admin")
await expect(page.getByRole("heading", { name: "Users" })).toBeVisible()