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>
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import { API } from "api/api";
|
|
import {
|
|
createGroup,
|
|
createUser,
|
|
getCurrentOrgId,
|
|
setupApiCalls,
|
|
} from "../../api";
|
|
import { defaultOrganizationName, users } from "../../constants";
|
|
import { login, requiresLicense } from "../../helpers";
|
|
import { beforeCoderTest } from "../../hooks";
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
beforeCoderTest(page);
|
|
await login(page, users.userAdmin);
|
|
await setupApiCalls(page);
|
|
});
|
|
|
|
test("remove member", async ({ page, baseURL }) => {
|
|
requiresLicense();
|
|
|
|
const orgName = defaultOrganizationName;
|
|
const orgId = await getCurrentOrgId();
|
|
const [group, member] = await Promise.all([
|
|
createGroup(orgId),
|
|
createUser(orgId),
|
|
]);
|
|
await API.addMember(group.id, member.id);
|
|
|
|
await page.goto(`${baseURL}/organizations/${orgName}/groups/${group.name}`, {
|
|
waitUntil: "domcontentloaded",
|
|
});
|
|
await expect(page).toHaveTitle(`${group.display_name} - Coder`);
|
|
|
|
const userRow = page.getByRole("row", { name: member.username });
|
|
await userRow.getByRole("button", { name: "Open menu" }).click();
|
|
const menu = page.getByRole("menu");
|
|
await menu.getByText("Remove").click({ timeout: 1_000 });
|
|
|
|
await expect(
|
|
page.getByText(/has been removed from .* successfully/),
|
|
).toBeVisible();
|
|
});
|