Files
lucia-frontend/tests/e2e/specs/accountAdmin/deleteAccount.spec.ts
2026-03-22 18:52:18 +08:00

40 lines
1.2 KiB
TypeScript

// The Lucia project.
// Copyright 2026-2026 DSP, inc. All rights reserved.
// Authors:
// imacat.yang@dsp.im (imacat), 2026/03/22
import { test, expect } from "@playwright/test";
import { loginWithMSW } from "../../helpers";
test.describe("Delete an Account", () => {
test.beforeEach(async ({ page, context }) => {
await loginWithMSW(context);
await page.goto("/account-admin");
await expect(page.getByText("Test Admin").first()).toBeVisible();
});
test("Delete button opens confirmation modal and deletes on confirm.", async ({
page,
}) => {
await page.locator("img.delete-account").first().click();
await expect(
page.getByText("ARE YOU SURE TO DELETE"),
).toBeVisible();
await page.locator("#sure_to_delete_acct_btn").click();
await expect(page.getByText("Account deleted")).toBeVisible();
});
test("Cancel button closes the delete confirmation modal.", async ({
page,
}) => {
await page.locator("img.delete-account").first().click();
await expect(
page.getByText("ARE YOU SURE TO DELETE"),
).toBeVisible();
await page.locator("#calcel_delete_acct_btn").click();
await expect(
page.getByText("ARE YOU SURE TO DELETE"),
).not.toBeVisible();
});
});