Repository navigation
test(dashboard): Read push notifications only after Chrome displays them - #4056
Merged
Merged
Conversation
Chrome stores a persistent notification before it displays it. A getNotifications() call in that gap deletes the stored notification, so later reads return none. The no-tag push test polled getNotifications() while the worker showed the notification, and sometimes saw [] forever. Wait for the DevTools "Notification displayed" event, then read once. Share the push delivery in one helper for the classic and inbox tests.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…cation-no-tag # Conflicts: # packages/junior-dashboard/e2e/inbox/settings.spec.ts # packages/junior-dashboard/e2e/settings.spec.ts
Contributor
|
Found 3 test failures on Blacksmith runners: Failures
|
dcramer
approved these changes
Nov 23, 2026
22 tasks done
This branch was successfully deployed
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.
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-v2-3x.png)
Fixes the flaky "shows a push notification that has no tag" e2e test. The classic copy (
e2e/settings.spec.ts) and the inbox copy (e2e/inbox/settings.spec.ts) have the same flake. Its finalgetNotifications()poll sees[]for the full 10s, for example in https://github.com/getsentry/junior/actions/runs/45070158782/job/137357691017.Why it flakes. Chrome has a race between showing a persistent notification and reading notifications.
showNotification()stores the notification in Chrome's notification database first, then displays it.getNotifications()deletes each stored notification that the platform does not list as displayed, unless the notification was created after the read started. So a read that starts between the store and the display deletes the new notification. Every later read then returns[], even with the notification on screen. The test started to poll right afterdeliverPushMessage, so sometimes its first poll overlapped the worker'sshowNotification().The service worker does not hit this race. It reads the badge count after
showNotification()resolves, and that happens after the display.Change.
e2e/push-notification.ts(showPlainTextPush), which both tests use. It delivers the same plain text push as before, then waits for the DevTools BackgroundService "Notification displayed" event before onegetNotifications()read. Chrome sends this event only after it stores and displays the notification, so the read cannot overlap the show.dashboard-spec-page-scriptbaseline for both spec files is lower, because the page script moved into the helper.via automation
evt_ca7e4de75a7c7b194d53107f21c973ee· Run IDdispatch_848193028721465afcdd769442de502e.--
View Session [Sentry]