Skip to content

chore: add e2e tests for organization members #15807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
>:(
  • Loading branch information
aslilac committed Dec 10, 2024
commit d193bb1a064dbabea56633c89ffe8ef06afce5b5
29 changes: 18 additions & 11 deletions site/e2e/tests/organizationMembers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,39 @@ test.beforeEach(async ({ page }) => {
test("create and delete organization", async ({ page }) => {
requiresLicense();

// Create an organization
await page.goto("/organizations/new", {
waitUntil: "domcontentloaded",
});

// Create a new organization to test
await page.goto("/organizations/new", { waitUntil: "domcontentloaded" });
const name = randomName();
await page.getByLabel("Slug").fill(name);
await page.getByLabel("Display name").fill(`Org ${name}`);
await page.getByLabel("Description").fill(`Org description ${name}`);
await page.getByLabel("Icon", { exact: true }).fill("/emojis/1f957.png");
await page.getByRole("button", { name: "Submit" }).click();

// Expect to be redirected to the new organization
// Navigate to members page
await expectUrl(page).toHavePathName(`/organizations/${name}`);
await expect(page.getByText("Organization created.")).toBeVisible();

await page.getByText("Members").click();

// 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();
await page.pause();
await expect(
page.locator("tr", { hasText: personToAdd.email }),
).toBeVisible();
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.getByRole("checkbox", { name: "Organization admin" }).click();
// await addedRow.getByLabel("Edit user roles").click();
await expect(addedRow.getByText("Organization admin")).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();

// await page.getByRole("button", { name: "Delete this organization" }).click();
// const dialog = page.getByTestId("dialog");
Expand Down
10 changes: 2 additions & 8 deletions site/src/pages/ManagementSettingsPage/UserTable/UserRoleCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,8 @@ const OverflowRolePill: FC<OverflowRolePillProps> = ({ roles }) => {
minWidth: "auto",
},
}}
anchorOrigin={{
vertical: -4,
horizontal: "center",
}}
transformOrigin={{
vertical: "bottom",
horizontal: "center",
}}
anchorOrigin={{ vertical: -4, horizontal: "center" }}
transformOrigin={{ vertical: "bottom", horizontal: "center" }}
>
{roles.map((role) => (
<Pill
Expand Down
Loading