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:
@@ -24,8 +24,11 @@ pb.autoCancellation(false);
|
||||
// Sync auth state to cookie on any change (login, logout, token refresh)
|
||||
// This allows Next.js middleware to read auth state for route protection
|
||||
// Cookie is non-HttpOnly because the client-side SDK needs read/write access
|
||||
// Using document.cookie is intentional here - Cookie Store API has limited browser
|
||||
// support and PocketBase SDK's exportToCookie() returns a cookie string format
|
||||
if (typeof window !== "undefined") {
|
||||
pb.authStore.onChange(() => {
|
||||
// biome-ignore lint/suspicious/noDocumentCookie: PocketBase SDK requires document.cookie for auth sync
|
||||
document.cookie = pb.authStore.exportToCookie({ httpOnly: false });
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user