This commit is contained in:
counterweight 2025-12-26 19:21:34 +01:00
parent c0999370c6
commit 4e1a339432
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
17 changed files with 393 additions and 91 deletions

View file

@ -124,15 +124,25 @@ test.describe("Admin Invites Page", () => {
// Test status filter - filter by "revoked" status
const statusFilter = page.locator("select").nth(1); // Second select is the status filter
await statusFilter.selectOption("revoked");
// Wait for the filter to apply and verify revoked invite is visible
await page.waitForResponse((resp) => resp.url().includes("status=revoked"));
// Wait for filter response, but don't fail if it doesn't come (might be cached)
const filterPromise = page
.waitForResponse((resp) => resp.url().includes("status=revoked"), { timeout: 5000 })
.catch(() => null); // Ignore timeout - filter might be cached
await statusFilter.selectOption("revoked");
await filterPromise; // Wait for response if it comes
// Verify revoked invite is visible
await expect(revokedRow).toBeVisible({ timeout: 5000 });
// Filter by "ready" status - should not show our revoked invite
const readyFilterPromise = page
.waitForResponse((resp) => resp.url().includes("status=ready"), { timeout: 5000 })
.catch(() => null); // Ignore timeout - filter might be cached
await statusFilter.selectOption("ready");
await page.waitForResponse((resp) => resp.url().includes("status=ready"));
await readyFilterPromise; // Wait for response if it comes
await expect(revokedRow).not.toBeVisible({ timeout: 5000 });
});
});
@ -151,12 +161,13 @@ test.describe("Admin Invites Access Control", () => {
await page.fill('input[type="email"]', REGULAR_USER_EMAIL);
await page.fill('input[type="password"]', "user123");
await page.click('button[type="submit"]');
await expect(page).toHaveURL("/");
// Regular users are redirected to /exchange after login
await expect(page).toHaveURL("/exchange");
// Try to access admin invites page
await page.goto("/admin/invites");
// Should be redirected away (to home page based on fallbackRedirect)
// Should be redirected away (to exchange page based on fallbackRedirect)
await expect(page).not.toHaveURL("/admin/invites");
});
});