fix(e2e): measure the clipped popup and assert the table's empty state

Two assertions were checking the wrong thing. The anchoring tests read
getByRole("listbox"), which resolves to SelectPrimitive.List; that sits at
full content height inside the popup that clips and scrolls it, so the box
overlapped the trigger even when nothing visible did. Measure the popup.

The SSO-ID search expected zero rows, but DataTable renders a "No results"
message row when a filter matches nothing, so the count is one. Assert the
empty state the user actually sees.
This commit is contained in:
Yuneng Jiang 2026-08-31 15:28:34 -07:00
parent cc258b5473
commit abd8beec01
No known key found for this signature in database
2 changed files with 7 additions and 7 deletions

View file

@ -23,6 +23,8 @@ async function boxes(trigger: Locator, options: Locator) {
return triggerBox && optionsBox ? { triggerBox, optionsBox } : null;
}
const clippedPopup = (page: PlaywrightPage) => page.locator('[data-slot="select-content"]');
function pollOptionsOpenBelowTrigger(trigger: Locator, options: Locator) {
return expect.poll(async () => {
const box = await boxes(trigger, options);
@ -50,10 +52,9 @@ test.describe("Auto Router template select anchoring", () => {
await trigger.scrollIntoViewIfNeeded();
await trigger.click();
const options = page.getByRole("listbox");
await expect(options).toBeVisible();
await expect(page.getByRole("listbox")).toBeVisible();
await pollOptionsOpenBelowTrigger(trigger, options).toBe(true);
await pollOptionsOpenBelowTrigger(trigger, clippedPopup(page)).toBe(true);
});
test("keeps the trigger uncovered when the options open with no room below it", async ({ page }) => {
@ -62,9 +63,8 @@ test.describe("Auto Router template select anchoring", () => {
await trigger.scrollIntoViewIfNeeded();
await trigger.click();
const options = page.getByRole("listbox");
await expect(options).toBeVisible();
await expect(page.getByRole("listbox")).toBeVisible();
await pollOptionsCoverTrigger(trigger, options).toBe(false);
await pollOptionsCoverTrigger(trigger, clippedPopup(page)).toBe(false);
});
});

View file

@ -46,6 +46,6 @@ test.describe("Internal Users Search", () => {
await page.getByTestId("users-filter-sso-id").fill("e2e-sso-id-that-matches-nobody");
await page.getByTestId("filter-drawer-apply").click();
await expect(userRows(page)).toHaveCount(0, { timeout: 30_000 });
await expect(page.getByRole("row").filter({ hasText: "No results" })).toBeVisible({ timeout: 30_000 });
});
});