-
-
Notifications
You must be signed in to change notification settings - Fork 21
Fixed flakey test for unread notifications #1325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughRenamed two notification scenarios in features/notifications.feature to check for presence/absence of unread notifications and added visiting the notifications page to mark them read. In features/step_definitions/notifications_steps.js: removed the explicit unread-count assertion, imported waitForZeroUnreadNotifications, replaced the reset action with "When we visit the notifications page", and added steps "Then we have unread notifications" and "Then all notifications are marked as read". In features/support/notifications.js: removed the count parameter from waitForUnreadNotifications (now treats any positive count as unread), added waitForZeroUnreadNotifications, adjusted retry/delay recursion and error messages, and exported the new function. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
features/notifications.feature (1)
13-13: Prefer an explicit Given for the precondition; single step-def verifiedChange the precondition to Given to make intent explicit:
features/notifications.feature:13- And we reset unread notifications count + Given we reset unread notifications countVerification: the step is implemented once as When('we reset unread notifications count', ...) in features/step_definitions/notifications_steps.js (≈line 79) — no duplicate/ambiguous step definitions found.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
features/notifications.feature(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
features/**/*.feature
📄 CodeRabbit inference engine (AGENTS.md)
e2e tests should reside in the features directory
Files:
features/notifications.feature
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build / Build Docker Images (linux/amd64, amd64)
🔇 Additional comments (1)
features/notifications.feature (1)
10-10: LGTM: Scenario rename and consolidation look goodMerging the reset flow into this scenario reduces redundancy and clarifies intent.
closes https://linear.app/ghost/issue/PROD-2663/fix-flakey-test-requests-for-unread-notifications-count - in our cucumber test suite, the notification count scenario has shown to be flaky, returning a count of 6 instead of 4, sometimes - fixed the flakiness of the scenario by resetting the notification count before running the scenario - also merged two scenarios into one, as there was redundancy (second scenario would essentially test first scenario already)
a25fb8a to
e90e0d9
Compare
| Then we have unread notifications | ||
|
|
||
| Scenario: Reset unread notifications count | ||
| Scenario: Visiting the notifications page marks notifications as read |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should talk about "pages" here - I know this aligns better with the action the user is taking, but its not a pattern we follow in any other scenarios and is potentially confusing / misleading. What about just:
Retrieving notifications marks them all as read
| }); | ||
| } | ||
|
|
||
| export async function waitForZeroUnreadNotifications( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not following how this is any different to waitForUnreadNotifications(0)?
| And we get a reply notification from "Alice" | ||
| And we get a reply notification from "Bob" | ||
| Then the unread notifications count is 4 | ||
| Then we have unread notifications |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 My concern is here we are just masking a problem? It is valid that we do expect a specific amount of notifications, and if there are more or less, than something is not correct somewhere
|
Closing, as the solution doesn't feel 100% right |
closes https://linear.app/ghost/issue/PROD-2663