-
Notifications
You must be signed in to change notification settings - Fork 591
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
fix e2e flakiness because of timeline API #4892
Conversation
WalkthroughThe changes introduce a new private method, Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 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
Documentation and Community
|
c67d0aa
to
7747d78
Compare
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
🧹 Outside diff range and nitpick comments (2)
e2e-pw/src/oss/poms/modal/imavid-controls.ts (2)
35-42
: Approve implementation with a timeout suggestion.The
waitUntilBufferingIsFinished
method effectively addresses the PR objective by implementing a blocking mechanism while buffering is in progress. The use of a data attribute for checking the playhead state is a good practice for e2e testing.However, consider adding a timeout to prevent potential infinite waits:
private async waitUntilBufferingIsFinished(timeout = 30000) { await this.page.waitForFunction( () => document .querySelector("[data-cy=imavid-playhead]") ?.getAttribute("data-playhead-state") !== "buffering", { timeout } ); }This ensures the method will throw an error if buffering takes longer than expected, making tests more robust.
44-50
: Approve changes with a safety mechanism suggestion.The addition of
waitUntilBufferingIsFinished
effectively addresses the PR objective by ensuring that play/pause actions don't interfere with buffering. This should help reduce e2e test flakiness.To further improve robustness, consider adding a safety mechanism to prevent potential infinite loops:
private async togglePlay(maxAttempts = 5) { await this.waitUntilBufferingIsFinished(); let currentPlayHeadStatus = await this.playPauseButton.getAttribute( "data-playhead-state" ); const original = currentPlayHeadStatus; let attempts = 0; while (currentPlayHeadStatus === original && attempts < maxAttempts) { await this.playPauseButton.click(); currentPlayHeadStatus = await this.playPauseButton.getAttribute( "data-playhead-state" ); attempts++; } if (attempts >= maxAttempts) { throw new Error("Failed to toggle play state after maximum attempts"); } }This ensures the method will throw an error if it fails to toggle the play state after a certain number of attempts, preventing potential infinite loops.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
- e2e-pw/src/oss/poms/modal/imavid-controls.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
e2e-pw/src/oss/poms/modal/imavid-controls.ts (1)
Pattern
**/*.{ts,tsx}
: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.
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.
LGTM
Summary by CodeRabbit
New Features
Bug Fixes