cal.pub0.org/apps/web/playwright/auth/delete-account.e2e.ts

29 lines
843 B
TypeScript
Raw Normal View History

2022-05-12 02:21:16 +00:00
import { expect } from "@playwright/test";
import { test } from "../lib/fixtures";
2023-03-01 20:18:51 +00:00
test.afterEach(({ users }) => users.deleteAll());
2022-05-12 02:21:16 +00:00
test("Can delete user account", async ({ page, users }) => {
const user = await users.create({
username: "delete-me",
});
await user.apiLogin();
await page.goto(`/settings/my-account/profile`);
await page.waitForSelector("[data-testid=dashboard-shell]");
await page.click("[data-testid=delete-account]");
expect(user.username).toBeTruthy();
const $passwordField = page.locator("[data-testid=password]");
await $passwordField.fill(String(user.username));
await Promise.all([
page.waitForURL((url) => url.pathname === "/auth/logout"),
page.click("text=Delete my account"),
]);
await expect(page.locator(`[id="modal-title"]`)).toHaveText("You've been logged out");
});