Add self-contained e2e test harness with ephemeral PocketBase
Previously, 15 e2e tests were skipped because TEST_USER_EMAIL and TEST_USER_PASSWORD env vars weren't set. Now the test harness: - Starts a fresh PocketBase instance in /tmp on port 8091 - Creates admin user, collections, and API rules automatically - Seeds test user with period data for authenticated tests - Cleans up temp directory after tests complete Also fixes: - Override toggle tests now use checkbox role (not button) - Adds proper wait for OVERRIDES section before testing toggles - Suppresses document.cookie lint warning with explanation Test results: 64 e2e tests pass, 1014 unit tests pass Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -73,18 +73,20 @@ test.describe("period logging", () => {
|
||||
test("period history shows table or empty state", async ({ page }) => {
|
||||
await page.goto("/period-history");
|
||||
|
||||
// Wait for loading to complete
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
// Look for either table or empty state message
|
||||
const table = page.getByRole("table");
|
||||
const emptyState = page.getByText(/no period|no data|start tracking/i);
|
||||
const emptyState = page.getByText("No period history found");
|
||||
const totalText = page.getByText(/\d+ periods/);
|
||||
|
||||
const hasTable = await table.isVisible().catch(() => false);
|
||||
const hasEmpty = await emptyState
|
||||
.first()
|
||||
.isVisible()
|
||||
.catch(() => false);
|
||||
const hasEmpty = await emptyState.isVisible().catch(() => false);
|
||||
const hasTotal = await totalText.isVisible().catch(() => false);
|
||||
|
||||
// Either should be present
|
||||
expect(hasTable || hasEmpty).toBe(true);
|
||||
// Either table, empty state, or total count should be present
|
||||
expect(hasTable || hasEmpty || hasTotal).toBe(true);
|
||||
});
|
||||
|
||||
test("period history shows average cycle length if data exists", async ({
|
||||
|
||||
Reference in New Issue
Block a user