mirror of
https://github.com/coder/coder.git
synced 2026-10-12 23:31:00 +08:00
resolves coder/internal#173, coder/internal#175 This PR does the following 1. Updates the left sidebar for organizations to use a dropdown to select the organization 2. Move the create organization button inside the dropdown 3. Update the design of the create organization page 4. Do not display the organization in the dropdown if there is only 1 org to display Figma: https://www.figma.com/design/OR75XeUI0Z3ksqt1mHsNQw/Dashboard-v1?node-id=139-1380&m=dev The loading state for the save button in the create organization form will be handled separately after #14978 is completed. Note: Since the dropdown is based off the cmdk component, navigation in the dropdown is handled by the arrow keys, https://cmdk.paco.me/ <img width="560" alt="Screenshot 2025-01-03 at 21 11 26" src="https://github.com/user-attachments/assets/ff6e61ab-c8d4-4f97-b603-306492e9bfec" /> <img width="641" alt="Screenshot 2025-01-03 at 21 11 39" src="https://github.com/user-attachments/assets/fedb28e0-9ef3-4b0f-8665-06215338f351" /> <img width="1178" alt="Screenshot 2025-01-03 at 21 12 05" src="https://github.com/user-attachments/assets/ee672533-2689-4b2e-a7bf-471ea72e1095" /> <img width="1177" alt="Screenshot 2025-01-03 at 21 12 39" src="https://github.com/user-attachments/assets/f13824a6-2581-4bff-b5b6-2024c2e145a4" />
49 lines
1.7 KiB
TypeScript
49 lines
1.7 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import { setupApiCalls } from "../api";
|
|
import {
|
|
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 { 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);
|
|
await page.getByPlaceholder("User email or username").fill(personToAdd.email);
|
|
await page.getByRole("option", { name: personToAdd.email }).click();
|
|
await page.getByRole("button", { name: "Add user" }).click();
|
|
const addedRow = page.locator("tr", { hasText: personToAdd.email });
|
|
await expect(addedRow).toBeVisible();
|
|
|
|
// Give them a role
|
|
await addedRow.getByLabel("Edit user roles").click();
|
|
await page.getByText("Organization User Admin").click();
|
|
await page.getByText("Organization Template Admin").click();
|
|
await page.mouse.click(10, 10); // close the popover by clicking outside of it
|
|
await expect(addedRow.getByText("Organization User Admin")).toBeVisible();
|
|
await expect(addedRow.getByText("+1 more")).toBeVisible();
|
|
|
|
// Remove them from the org
|
|
await addedRow.getByLabel("More options").click();
|
|
await page.getByText("Remove").click(); // Click the "Remove" option
|
|
await page.getByRole("button", { name: "Remove" }).click(); // Click "Remove" in the confirmation dialog
|
|
await expect(addedRow).not.toBeVisible();
|
|
});
|