Repository navigation
chore: reduce flakiness when running parallel tests - #6848
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThis PR stabilizes Electron-based tests by disabling GPU acceleration, replacing time-based waits with element visibility assertions, adding hover-before-click interactions, and improving error handling in tab selection logic. A new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
✨ 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. Comment |
avoid stale closures since the environment tag re-renders
There was a problem hiding this comment.
Pull request overview
This PR makes targeted improvements to reduce test flakiness when running tests in parallel by replacing arbitrary timeouts with proper assertions, adding hover actions for better element interaction reliability, and improving test utilities.
Changes:
- Enhanced
selectRequestPaneTabutility to wait for request pane visibility before tab selection and verify active state after clicking - Added
--disable-gpuflag to Electron launch arguments for improved stability in test environments - Replaced
page.waitForTimeout()calls with proper visibility assertions throughout test files - Added hover actions before clicking interactive elements to ensure they are in the correct state
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/utils/page/actions.ts | Enhanced selectRequestPaneTab function with better synchronization, moved overflowButton declaration for optimization, added active state verification after tab selection |
| tests/environments/import-environment/bruno-env-import/collection-env-import/collection-env-import.spec.ts | Added hover actions before clicking environment selector trigger for better reliability |
| tests/environments/api-setEnvVar/api-setEnvVar-with-persist.spec.ts | Added hover actions and improved environment tab selector to use more specific pattern with .tab-label |
| tests/collection/moving-requests/tag-persistence.spec.ts | Replaced arbitrary timeouts with proper visibility assertions, replaced keyboard save with saveRequest utility (partially), improved locator specificity for folder requests |
| playwright/index.ts | Added --disable-gpu flag to Electron launch args for stability, applied consistent formatting to empty catch blocks |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| await locators.tags.input().press('Enter'); | ||
| await page.waitForTimeout(200); | ||
| await expect(locators.tags.item('smoke')).toBeVisible(); | ||
| await page.keyboard.press('Meta+s'); |
There was a problem hiding this comment.
For consistency with the changes in this PR (line 30) and to reduce flakiness, consider replacing this direct keyboard shortcut with the saveRequest(page) utility function. The saveRequest function includes proper verification that the save was successful via a toast message, which helps ensure the save operation completed before proceeding with subsequent actions.
| await page.keyboard.press('Meta+s'); | |
| await saveRequest(page); |
| }; | ||
|
|
||
| const selectRequestPaneTab = async (page: Page, tabName: string) => { | ||
| await test.step(`Wait for request to open up "${tabName}"`, async () => { |
There was a problem hiding this comment.
The new wait step at lines 644-647 adds a synchronization point before attempting to select a tab. However, the step name "Wait for request to open up" is somewhat misleading since this is checking for the request pane visibility, not waiting for a request to open. Consider renaming to something like "Wait for request pane and tabs to be visible" for clarity.
| await test.step(`Wait for request to open up "${tabName}"`, async () => { | |
| await test.step('Wait for request pane and tabs to be visible', async () => { |
Description
PR attempts to make a few corrections
.serialfor tests that don't need itisolatedPageandisolatedPageWithUserDatafor tests that don't need shared state (new utils were added to avoid breaking the one's where shared state is necessary)Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit
Performance
Chores
✏️ Tip: You can customize this high-level summary in your review settings.