-
Notifications
You must be signed in to change notification settings - Fork 2
BA-2334: fix flaky test #231
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
BA-2334: fix flaky test #231
Conversation
|
WalkthroughThe pull request updates the test cases for the comments component. The modified test now checks that after triggering comment loading by scrolling, the loading indicator is absent and the "Fifth comment" is present. The check for the loading state is reordered to occur before verifying the new comment, ensuring the test reflects the intended component behavior. No changes were made to publicly exported entities. Changes
Sequence Diagram(s)sequenceDiagram
participant T as Test
participant C as CommentsComponent
T->>C: Scroll to bottom to trigger loading
C-->>T: Load additional comments
T->>C: Verify loading indicator is absent
T->>C: Assert "Fifth comment" is present
Suggested Reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
packages/components/modules/comments/web/Comments/__tests__/Comments.cy.tsxOops! Something went wrong! :( ESLint: 8.57.1 Error: Cannot read config file: /packages/components/.eslintrc.js
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
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)
packages/components/modules/comments/web/Comments/__tests__/Comments.cy.tsx (1)
216-226: Improved test reliability by correcting test flow and assertionsThe changes properly address the flaky test issue by improving the test sequence and assertions to better match the component's behavior.
The changes fix the flaky test by ensuring the correct sequence of events:
- The test now verifies the "Fifth comment" is loaded after scrolling to the "Fourth comment"
- It then properly checks that the loading indicator disappears after the comments are loaded
This change makes the test more deterministic. To further enhance the test's readability and reliability, consider adding a comment explaining the expected loading behavior:
cy.step('Scroll to the bottom and see the next 5 comments') + // Scrolling to the fourth comment should load the fifth comment immediately cy.findByText('Fourth comment').should('exist').scrollIntoView() cy.findByText('Fifth comment').should('exist').scrollIntoView() + // After scrolling to the fifth comment, more comments should be loading cy.findByLabelText('loading more comments') .should('exist') .then(() => { resolveMostRecentOperation({ data: commentsNextPageMockData }) }) + // After resolving the operation, loading should complete and more comments should be visible cy.findByLabelText('loading more comments').should('not.exist')
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/components/modules/comments/web/Comments/__tests__/Comments.cy.tsx(1 hunks)



On BaseApp Frontend there is a test on Comments that is flaky, meaning, sometimes it passes and sometimes it does not, so we need to investigate and fix that.
Summary by CodeRabbit