2022-05-12 02:21:16 +00:00
|
|
|
import { expect } from "@playwright/test";
|
|
|
|
|
|
|
|
import { test } from "../lib/fixtures";
|
|
|
|
|
|
|
|
test("Can delete user account", async ({ page, users }) => {
|
|
|
|
const user = await users.create({
|
|
|
|
username: "delete-me",
|
|
|
|
});
|
|
|
|
await user.login();
|
2022-01-14 13:49:15 +00:00
|
|
|
|
|
|
|
await page.waitForSelector("[data-testid=dashboard-shell]");
|
|
|
|
|
2023-02-24 18:39:09 +00:00
|
|
|
await page.goto(`/settings/my-account/profile`);
|
2022-01-14 13:49:15 +00:00
|
|
|
await page.click("[data-testid=delete-account]");
|
2022-08-31 20:57:53 +00:00
|
|
|
if (!user.username) throw Error(`Test user doesn't have a username`);
|
2022-01-14 13:49:15 +00:00
|
|
|
|
2022-09-15 16:59:48 +00:00
|
|
|
const $passwordField = page.locator("[data-testid=password]");
|
|
|
|
await $passwordField.fill(user.username);
|
|
|
|
|
|
|
|
await Promise.all([page.waitForNavigation({ url: "/auth/logout" }), page.click("text=Delete my account")]);
|
2022-01-17 18:15:18 +00:00
|
|
|
|
|
|
|
await expect(page.locator(`[id="modal-title"]`)).toHaveText("You've been logged out");
|
2022-01-14 13:49:15 +00:00
|
|
|
});
|