fix(e2e): fix test failures after CTO review

- Scope STAFF VIEW locator to impersonation-banner testid
- Fix loading state test: unroute before setting delayed handler

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Lint Roller
2026-03-22 11:42:32 +00:00
parent 355f11fdaa
commit b3514626a1
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ test.describe("ImpersonationBanner", () => {
test("banner displays when session is active", async ({ page }) => { test("banner displays when session is active", async ({ page }) => {
await page.goto("/?sessionId=session-1"); await page.goto("/?sessionId=session-1");
await expect(page.locator("[data-testid=\"impersonation-banner\"]")).toBeVisible(); await expect(page.locator("[data-testid=\"impersonation-banner\"]")).toBeVisible();
await expect(page.getByText("STAFF VIEW")).toBeVisible(); await expect(page.getByTestId("impersonation-banner").getByText("STAFF VIEW")).toBeVisible();
}); });
test("banner shows reason when session has reason", async ({ page }) => { test("banner shows reason when session has reason", async ({ page }) => {
+2 -2
View File
@@ -14,9 +14,9 @@ test.describe("DevLoginSelector", () => {
}); });
test("shows loading state while fetching users", async ({ page }) => { test("shows loading state while fetching users", async ({ page }) => {
await page.unroute("**/api/dev/users");
await page.route("**/api/dev/users", async (route) => { await page.route("**/api/dev/users", async (route) => {
await page.waitForResponse((res) => res.url().includes("/api/dev/users")); await new Promise((r) => setTimeout(r, 200));
await new Promise((r) => setTimeout(r, 100));
await route.fulfill({ json: { staff: [], clients: [] } }); await route.fulfill({ json: { staff: [], clients: [] } });
}); });
await page.goto("/login"); await page.goto("/login");