test(e2e): harden team-admin member specs per review feedback
Some checks failed
Unit Tests: Proxy DB Operations / assert-shard-coverage (push) Has been cancelled
Unit Tests: Security / security (push) Has been cancelled
Unit Tests: Proxy DB Operations / auth-checks (push) Has been cancelled
Unit Tests: Proxy DB Operations / budgets (push) Has been cancelled
Unit Tests: Proxy DB Operations / custom-logging (push) Has been cancelled
Unit Tests: Proxy DB Operations / db-and-spend (push) Has been cancelled
Unit Tests: Proxy DB Operations / endpoints-and-responses (push) Has been cancelled
Unit Tests: Proxy DB Operations / guardrails-hooks (push) Has been cancelled
Unit Tests: Proxy DB Operations / jwt-and-keys (push) Has been cancelled
Unit Tests: Proxy DB Operations / key-generation (push) Has been cancelled
Unit Tests: Proxy DB Operations / logging-misc (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-runtime (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-server-core (push) Has been cancelled
Unit Tests: Proxy DB Operations / schema-migration (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-utils (push) Has been cancelled

Address Greptile feedback on the Team Admin spec:
- locate the delete action via getByTestId("delete-member") instead of
  the fragile svg/img .last() selector
- match the seeded removable member by user_id (members_with_roles stores
  no email, so the roster renders user_id)
- assert exact success-toast strings rather than broad regexes that could
  match unrelated "success" text
This commit is contained in:
ryan-crabbe-berri 2026-05-28 22:41:30 -07:00
parent 1fca23c44f
commit ff13ade1b6

View file

@ -60,7 +60,7 @@ test.describe("Team Admin", () => {
await modal.getByRole("button", { name: /Add Member/i }).click();
await expect(page.getByText(/member.*added|success/i).first())
await expect(page.getByText("Team member added successfully").first())
.toBeVisible({ timeout: 10_000 });
});
@ -72,17 +72,17 @@ test.describe("Team Admin", () => {
await page.getByRole("tab", { name: "Members" }).click();
// Find the row for the seeded removable member and click its delete icon.
const row = page.locator("tr", { hasText: "removable@test.local" }).first();
// Seeded members appear in the roster by user_id (members_with_roles has no
// email), so match the row on the user_id rather than the email.
const row = page.locator("tr", { hasText: "e2e-removable-member" }).first();
await expect(row).toBeVisible({ timeout: 10_000 });
// The trash icon sits in the Actions column at the end of the row.
await row.locator("svg, img").last().click();
await row.getByTestId("delete-member").click();
const modal = page.locator(".ant-modal:visible");
await expect(modal).toBeVisible({ timeout: 5_000 });
await modal.getByRole("button", { name: /^Delete$/ }).click();
await expect(page.getByText(/removed|deleted|success/i).first())
await expect(page.getByText("Team member removed successfully").first())
.toBeVisible({ timeout: 10_000 });
});