Skip to content

chore: reduce flakiness when running parallel tests - #6848

Merged
sid-bruno merged 3 commits into
usebruno:mainfrom
sid-bruno:feat/improve-playwright-parallelization
Jan 27, 2026
Merged

sid-bruno merged 3 commits into
usebruno:mainfrom
sid-bruno:feat/improve-playwright-parallelization

Conversation

@sid-bruno

@sid-bruno sid-bruno commented Jan 19, 2026 •

Copy link
Copy Markdown
Collaborator

Description

PR attempts to make a few corrections

  • Reduce the use of .serial for tests that don't need it
  • Run tests using isolatedPage and isolatedPageWithUserData for tests that don't need shared state (new utils were added to avoid breaking the one's where shared state is necessary)
  • Reduce use of worker level app instance with test level app instance (so a fresh app instance is provided instead of trying to reuse older instances which might be in an arbitrary state)

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

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

    • Added GPU acceleration disable flag for Electron app to optimize rendering.
  • Chores

    • Improved test reliability by replacing time-based waits with direct element visibility checks.
    • Enhanced test environment interactions with improved hover and click sequencing.
    • Strengthened tab selection logic with visibility assertions and error handling.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 19, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

Walkthrough

This 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 saveRequest() utility helper is introduced for consistent request persistence in tests.

Changes

Cohort / File(s) Summary
Infrastructure & Electron Configuration
playwright/index.ts
Adds --disable-gpu flag to Electron app launch arguments to stabilize rendering behavior in test environment
Test Utility Enhancements
tests/utils/page/actions.ts
Improves selectRequestPaneTab() with visibility pre-checks, active state assertions after tab clicks, deferred overflow button creation, and error handling for missing tabs
Tag & Request Persistence Tests
tests/collection/moving-requests/tag-persistence.spec.ts
Replaces arbitrary waitForTimeout delays with visibility assertions; introduces saveRequest() utility for explicit request state persistence; validates element visibility instead of relying on time-based waits
Environment Variable & Selector Tests
tests/environments/api-setEnvVar/api-setEnvVar-with-persist.spec.ts, tests/environments/import-environment/bruno-env-import/collection-env-import/collection-env-import.spec.ts
Adds hover interactions before clicks to ensure UI elements are fully displayed; updates Environments tab locator to filter by nested label for more reliable element selection

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • bijin-bruno

Poem

🎮 GPU sleeps, waits retire with grace,
Hovers and clicks find their rightful place,
Tests now anchor on elements they see,
No more time-guessing, just stability! ✨

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pull-request-size pull-request-size Bot added size/M and removed size/L labels Jan 27, 2026
@sid-bruno
sid-bruno marked this pull request as ready for review January 27, 2026 14:26
Copilot AI review requested due to automatic review settings January 27, 2026 14:26
@sid-bruno
sid-bruno merged commit 51276be into usebruno:main Jan 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 selectRequestPaneTab utility to wait for request pane visibility before tab selection and verify active state after clicking
  • Added --disable-gpu flag 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');

Copilot AI Jan 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
await page.keyboard.press('Meta+s');
await saveRequest(page);

Copilot uses AI. Check for mistakes.
};

const selectRequestPaneTab = async (page: Page, tabName: string) => {
await test.step(`Wait for request to open up "${tabName}"`, async () => {

Copilot AI Jan 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
await test.step(`Wait for request to open up "${tabName}"`, async () => {
await test.step('Wait for request pane and tabs to be visible', async () => {

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants