test(playwright): absorb the Keycloak reload bounce in notification specs - #3772
Draft
EmilyRagan wants to merge 2 commits into
Draft
test(playwright): absorb the Keycloak reload bounce in notification specs#3772EmilyRagan wants to merge 2 commits into
EmilyRagan wants to merge 2 commits into
Conversation
…pecs page.reload() resolves on the load event of the pre-redirect document, so in Enterprise the Keycloak redirect round trip runs after it and was landing inside the toast assertion. On a saturated CI runner that bounce alone took 20s, so the un-acked-alert reload test timed out before the app could boot and replay the message stream (the passing retry needed ~7s after the bounce). Wait for the app bar with a 60s budget after reload, raise the reload tests to a 180s timeout, and assert the persisted stream offset before reloading so an offset-bookkeeping regression fails by name rather than as a missing toast. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3772 +/- ##
==========================================
- Coverage 79.13% 79.10% -0.03%
==========================================
Files 894 894
Lines 66865 66865
Branches 2551 2599 +48
==========================================
- Hits 52911 52892 -19
- Misses 13293 13312 +19
Partials 661 661
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Problem
notifications.s.spec.ts›un-acked alerts survive a page reload (must-ack persists)is flaky on Enterprise CI. Seen in cosmos-enterprise run 32395585458 (attempt 2) — it failed, retried, and passed, so the run reported1 flaky.Root cause
Not a product bug, and not slowness in the message-stream replay.
page.reload()resolves on the load event of the pre-redirect document. In Enterprise,OpenC3Auth.init()then kicks off the Keycloak redirect round trip, so that bounce happens afterreload()returns and lands inside whatever assertion comes next. The call log above shows the entire 20s budget spent in "waiting for navigation to finish", with the OIDC callback URL (#state=…&session_state=…) arriving at the moment of timeout — leaving zero budget for app boot, cable resubscribe, and stream replay.The trace from the passing retry confirms the normal path: reload at t=27.6s, toast visible at t=34.9s, i.e. ~7s is needed after the bounce completes. The failing screenshot shows the app booted with an empty notification badge — the replay simply hadn't arrived yet.
Changes
reloadAndWaitForAppreloads withwaitUntil: 'domcontentloaded'and waits 60s (was 30s) for the app bar, so the Keycloak bounce is absorbed there instead of eating the toast timeout. The old comment estimated the bounce at "roughly 4s"; the observed CI worst case is 20s+.test.setTimeout120000 → 180000 on both reload tests, so the worst case each step is now allowed (20s emit + 60s reload + 30s replay) can't overflow into an opaque test timeout.localStorage.notificationStreamOffsetmatches/^\d+-\d+$/before the reload. The re-toast depends entirely on that offset having been lowered below the un-acked alert; checking it turns an offset-bookkeeping regression — or a malformed<ms>-<seq>id, which makes the server-sideXREADfail and deliver nothing at all — into a named failure instead of a missing toast 30s later.Test-only change; no product code touched.
🤖 Generated with Claude Code