diff --git a/docs/agents/task-logs/daily/2026-02-25_15-15-00_ci-health-agent_completed.md b/docs/agents/task-logs/daily/2026-02-25_15-15-00_ci-health-agent_completed.md new file mode 100644 index 00000000..f50abfde --- /dev/null +++ b/docs/agents/task-logs/daily/2026-02-25_15-15-00_ci-health-agent_completed.md @@ -0,0 +1,14 @@ +# CI Health Agent - Daily Run (2026-02-25) + +## Summary +- **Investigated Tests**: `tests/nostr/nip07Permissions.test.js` and `tests/nostr/sessionActor.test.js` (flagged as suspicious in prior runs). +- **Findings**: Tests passed 10/10 times when run with correct environment setup (polyfilled localStorage). No inherent flakiness detected in current environment. +- **Fixes Applied**: + - `tests/e2e/login-flows.spec.ts`: Added `waitForFunction` after programmatic logout to ensure app state is settled before assertion, preventing race conditions (identified via static analysis and memory guidelines). + +## Details +- `tests/nostr/nip07Permissions.test.js` and `tests/nostr/sessionActor.test.js` require `node --import tests/test-helpers/setup-localstorage.mjs` to run correctly in isolation. +- E2E login flow race condition fixed by waiting for `getAppState().isLoggedIn === false`. + +## Next Steps +- Monitor next CI run to confirm stability of E2E login flows. diff --git a/tests/e2e/login-flows.spec.ts b/tests/e2e/login-flows.spec.ts index 8aa52694..7154fe82 100644 --- a/tests/e2e/login-flows.spec.ts +++ b/tests/e2e/login-flows.spec.ts @@ -64,6 +64,14 @@ test.describe("Login and authentication flows", () => { (window as any).__bitvidTest__.logout(); }); + // Wait for state to settle + await page.waitForFunction( + () => { + return (window as any).__bitvidTest__.getAppState().isLoggedIn === false; + }, + { timeout: 15000 }, + ); + // Then: state is fully cleared const loggedOutState = await page.evaluate(() => { return (window as any).__bitvidTest__.getAppState();