mirror of
https://github.com/coder/coder.git
synced 2026-06-04 05:28:20 +00:00
15a2bab1cd
Replaces our custom `<GlobalSnackbar />` (MUI Snackbar + event emitter) with [`sonner`](https://github.com/emilkowalski/sonner). Deletes `GlobalSnackbar/`, the custom event emitter infra, and migrates ~80 source files to `toast.success()` / `toast.error()` from `sonner`. - ~47 error toasts now surface API error detail via `getErrorDetail(error)` in the toast description, not just a generic message. Coincides with #22229. - Toast messages follow an `{Action} "{entity}" {result}.` format (e.g. `User "alice" suspended successfully.`) since toasts persist across navigation now. - 17 uses of `toast.promise()` for loading → success → error lifecycle. - Some toasts include action buttons for quick navigation (e.g. "View task", "View template"). - Multiple toasts can stack and display simultaneously. --------- Co-authored-by: Kayla はな <mckayla@hey.com>
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import { createUser, getCurrentOrgId, setupApiCalls } from "../../api";
|
|
import { login } from "../../helpers";
|
|
import { beforeCoderTest } from "../../hooks";
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
beforeCoderTest(page);
|
|
await login(page);
|
|
await setupApiCalls(page);
|
|
});
|
|
|
|
test("remove user", async ({ page, baseURL }) => {
|
|
const orgId = await getCurrentOrgId();
|
|
const user = await createUser(orgId);
|
|
|
|
await page.goto(`${baseURL}/users`, { waitUntil: "domcontentloaded" });
|
|
await expect(page).toHaveTitle("Users - Coder");
|
|
|
|
const userRow = page.getByRole("row", { name: user.email });
|
|
await userRow.getByRole("button", { name: "Open menu" }).click();
|
|
const menu = page.getByRole("menu");
|
|
await menu.getByText("Delete…").click();
|
|
|
|
const dialog = page.getByTestId("dialog");
|
|
await dialog.getByLabel("Name of the user to delete").fill(user.username);
|
|
await dialog.getByRole("button", { name: "Delete" }).click();
|
|
|
|
await expect(page.getByText(/deleted successfully/)).toBeVisible();
|
|
});
|