fix(test): add wait for logout state in login-flows e2e

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-25 16:11:48 +00:00
1 parent 8102fb97ee
commit b8cf1315e1
2 files changed
+22

No files matched your search

@@ -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.
+8
View File
@@ -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();