/** E2E: Settings → Privacy & Data shows where the data lives and deletes the account. */ import { expect, test } from "@playwright/test"; import { captureScreenshot, completeOnboarding, openUserSettings, signup } from "./helpers"; test("privacy settings delete the account after confirmation", async ({ page }, testInfo) => { const email = `privacy-${Date.now()}@rakazo.test`; await signup(page, email, "password12", "Privacy"); await completeOnboarding(page); const settings = await openUserSettings(page, "privacy"); const panel = settings.getByTestId("privacy-settings"); await expect(panel.getByText("Your data")).toBeVisible(); await page.setViewportSize({ width: 390, height: 844 }); await page.emulateMedia({ colorScheme: "dark" }); await captureScreenshot(page, testInfo, "phone-settings-privacy-dark"); await page.emulateMedia({ colorScheme: "light" }); await captureScreenshot(page, testInfo, "phone-settings-privacy-light"); await panel.getByRole("button", { name: "Delete account" }).click(); const confirm = page.getByRole("alertdialog", { name: "Delete your account?" }); await expect(confirm).toBeVisible(); await confirm.getByRole("button", { name: "Cancel" }).click(); await expect(confirm).toBeHidden(); await panel.getByRole("button", { name: "Delete account" }).click(); await confirm.getByRole("button", { name: "Delete account" }).click(); await expect(page).not.toHaveURL(/\/app/, { timeout: 30_000 }); const session = await page.request.get("/api/auth/get-session"); expect(await session.text()).not.toContain(email); });