Files
coder/site/e2e/tests/organizationMembers.spec.ts
T
Jaayden Halko d9ef6ed8ae chore: replace MoreMenu with DropdownMenu (#17615)
Replace MoreMenu with DropDownMenu component to match update design
patterns.

Note: This was the result of experimentation using Cursor to make the
changes and Claude Code for fixing tests.

One key takeaway is that verbose e2e logging, especially benign
warnings/errors can confuse Claude Code in running playwright and
confirming its work.


<img width="201" alt="Screenshot 2025-05-01 at 00 00 52"
src="https://github.com/user-attachments/assets/4905582e-902e-4b61-adc8-14cab6bd006b"
/>
<img width="257" alt="Screenshot 2025-05-01 at 00 01 07"
src="https://github.com/user-attachments/assets/5befc420-724a-4c57-9a9d-330a39867fae"
/>
<img width="270" alt="Screenshot 2025-05-01 at 00 01 20"
src="https://github.com/user-attachments/assets/9cbf07cb-7d44-4228-ae6f-216e9f2faed0"
/>
<img width="224" alt="Screenshot 2025-05-01 at 00 01 30"
src="https://github.com/user-attachments/assets/9fe95916-3d9d-4600-9b1f-8a620e152a53"
/>
2025-05-01 13:14:11 -04:00

48 lines
1.6 KiB
TypeScript

import { expect, test } from "@playwright/test";
import { setupApiCalls } from "../api";
import {
addUserToOrganization,
createOrganization,
createUser,
login,
requiresLicense,
} from "../helpers";
import { beforeCoderTest } from "../hooks";
test.beforeEach(async ({ page }) => {
beforeCoderTest(page);
await login(page);
await setupApiCalls(page);
});
test("add and remove organization member", async ({ page }) => {
requiresLicense();
// Create a new organization
const { name: orgName, displayName } = await createOrganization(page);
// Navigate to members page
await page.getByRole("link", { name: "Members" }).click();
await expect(page).toHaveTitle(`Members - ${displayName} - Coder`);
// Add a user to the org
const personToAdd = await createUser(page);
// This must be done as an admin, because you can't assign a role that has more
// permissions than you, even if you have the ability to assign roles.
await addUserToOrganization(page, orgName, personToAdd.email, [
"Organization User Admin",
"Organization Template Admin",
]);
const addedRow = page.locator("tr", { hasText: personToAdd.email });
await expect(addedRow.getByText("Organization User Admin")).toBeVisible();
await expect(addedRow.getByText("+1 more")).toBeVisible();
// Remove them from the org
await addedRow.getByRole("button", { name: "Open menu" }).click();
const menu = page.getByRole("menu");
await menu.getByText("Remove").click();
await page.getByRole("button", { name: "Remove" }).click(); // Click "Remove" in the confirmation dialog
await expect(addedRow).not.toBeVisible();
});