Skip to content

Feat/playwright os 2 - #7941

Merged
sid-bruno merged 17 commits into
mainfrom
feat/playwright-os-2
May 14, 2026
Merged

sid-bruno merged 17 commits into
mainfrom
feat/playwright-os-2

Conversation

@bijin-bruno

@bijin-bruno bijin-bruno commented May 7, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Updated branch from #7253

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

Release Notes

  • Bug Fixes

    • Improved environment variables table performance and stability
    • Enhanced file watcher cleanup during app shutdown
    • Stricter URL validation for import operations
    • Better response clipboard handling and feedback
    • Improved app shutdown timing with graceful timeout handling
  • Tests

    • Consolidated platform-specific test workflows (Linux, macOS, Windows)
    • Enhanced test infrastructure for better reliability and consistency
    • Improved test synchronization and UI interaction handling

@coderabbitai

coderabbitai Bot commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

This PR consolidates CI workflows across Linux/macOS/Windows platforms with configurable shell support, refactors test infrastructure to use a standardized page-readiness helper (waitForReadyPage), upgrades Electron app shutdown to handle async watcher closure with timeouts, and stabilizes flaky test assertions around clipboard operations, modal interactions, and virtualized UI components.

Changes

CI/CD Workflow Platform Consolidation & Shell Configuration

Layer / File(s) Summary
GitHub Action shell input parameter
​.github/actions/common/setup-node-deps/action.yml, ​.github/actions/tests/run-cli-tests/action.yml, ​.github/actions/tests/run-e2e-tests/action.yml, ​.github/actions/tests/run-unit-tests/action.yml
New inputs.shell parameter (default bash, not required) is added to composite actions and wired into step shell properties, enabling per-platform shell selection (bash vs pwsh).
Playwright report artifact naming consolidation
​.github/actions/ssl/linux/run-ssl-e2e-tests/action.yml, ​.github/actions/ssl/macos/run-ssl-e2e-tests/action.yml, ​.github/actions/ssl/windows/run-ssl-e2e-tests/action.yml
SSL-specific Playwright report artifacts are renamed from generic platform names (playwright-report-linux, etc.) to SSL-scoped names (playwright-report-linux-ssl, etc.) to avoid artifact collisions when multiple test suites upload reports.
Linux test workflow platform consolidation
​.github/workflows/tests-linux.yml
Workflow renamed to "Linux Tests" with platform-scoped job names; timeout increased to 120min for E2E tests; two new jobs added: ssl-test (SSL CLI/E2E with feature/CA setup) and oauth1-tests (OAuth1 feature tests with test-server startup).
New macOS and Windows test workflows
​.github/workflows/tests-macos.yml, ​.github/workflows/tests-windows.yml
Complete macOS and Windows CI workflows added with unit/CLI/E2E/SSL/OAuth1 test jobs running on respective platform runners; Windows unit tests disabled via if: false.
Removed legacy auth and SSL workflows
.github/workflows/auth-tests.yml (deleted), .github/workflows/ssl-tests.yml (deleted)
Platform-specific auth and SSL test workflows consolidated into the new per-platform test suites (tests-linux.yml, tests-macos.yml, tests-windows.yml) to reduce workflow duplication.

Playwright Test Infrastructure & Page Readiness Standardization

Layer / File(s) Summary
Electron page-readiness helpers
playwright/index.ts
New waitForReadyPage(app, options?) helper fetches the Electron app's first window (with fallback on firstWindow() failure), waits for [data-app-state="loaded"], and returns the page after a brief delay, replacing repeated manual window-acquisition + loaded-state waits throughout tests.
Graceful Electron app shutdown with timeout enforcement
playwright/index.ts
closeElectronApp refactored to close all windows via app.evaluate, then attempt app.close(), each wrapped in individual timeouts; if close times out, the process receives SIGKILL. Fixture teardown closes tracked apps concurrently via Promise.allSettled instead of sequentially.
Test utilities consolidation & UI interaction robustness
tests/utils/page/actions.ts
New waitForReadyPage export; improved collection creation (native value setter + bubbling input event); response format/preview switching hardened with visibility waits and retries; modal close waits for hidden state instead of detached; tab selection retries via expect(...).toPass(...); discard-button click uses { force: true } to bypass layout shifts; "Configure env" interactions wait for visibility before dispatch-clicking.
Systematic test page-readiness refactoring (35+ test files)
tests/collections/*, tests/cookies/*, tests/environments/*, tests/import/*, tests/onboarding/*, tests/proxies/*, tests/request/*, tests/response/*, tests/runner/*, tests/snapshots/*, tests/workspace/*, and others
All tests importing from ../utils/page now use the shared waitForReadyPage(app) helper instead of manual app.firstWindow() + [data-app-state="loaded"] locator waits, ensuring consistent page-readiness semantics across the test suite and reducing flakiness from incomplete app initialization.

Electron App Shutdown & Async Watcher Cleanup

Layer / File(s) Summary
Async watcher shutdown in all watcher classes
packages/bruno-electron/src/app/apiSpecsWatcher.js, packages/bruno-electron/src/app/collection-watcher.js, packages/bruno-electron/src/app/dotenv-watcher.js, packages/bruno-electron/src/app/workspace-watcher.js
All closeAllWatchers() / closeAll() methods now collect promise-like results from watcher.close() calls, clear watcher state, and return Promise.allSettled(pending) so callers can await async closure without early rejection on individual watcher errors.
Guarded app shutdown with timeout & cleanup sequence
packages/bruno-electron/src/index.js
before-quit handler prevents default quit, guards against re-entrancy with quitInProgress, awaits watcher closure with a 2-second Promise.race cap, conditionally releases single-instance lock, flushes cookies, stops system monitor, kills terminals, then calls app.exit(0) explicitly—replacing synchronous fire-and-forget calls.

Test Robustness & Stability Improvements

Layer / File(s) Summary
Virtualized environment variables table pagination
tests/environments/import-environment/collection-env-import.spec.ts, tests/environments/import-environment/global-env-import.spec.ts, tests/import/insomnia/import-insomnia-v4-environments.spec.ts, tests/import/insomnia/import-insomnia-v5-environments.spec.ts
Tests updated to account for react-virtuoso virtualized rendering: environment variables are verified via suffix-based input selectors for visible rows, table container is scrolled to load remaining rows, and deep/nested flattened keys are gated as synchronization checkpoints before per-input assertions.
Clipboard & response-action assertion hardening
tests/response/response-actions.spec.ts, tests/scratch-requests/scratch-requests.spec.ts, tests/transient-requests/transient-requests.spec.ts
Before copy-to-clipboard actions, clipboard is cleared via page.evaluate(navigator.clipboard.writeText('')); "Response copied to clipboard" UI assertion uses extended timeout with .catch(() => {}) fallback; clipboard-read verification uses expect.poll on navigator.clipboard.readText() to wait for truthy clipboard state before final equality check.
Modal & UI interaction synchronization
tests/import/bulk-import/003-selection-list-viewport.spec.ts, tests/protobuf/manage-protofile.spec.ts, tests/preferences/default-collection-location/default-collection-location.spec.js, tests/request/response-pane-update-when-focused.spec.ts
Bulk import modal explicitly closes and verifies backdrop removal; "Don't Save" confirmation waits for visibility before clicking; collection-location assertions use regex-based toHaveValue instead of exact path matching; response-pane test waits for app loaded state before setup.
Tab focus & shortcut handling
tests/shortcuts/bound-actions.spec.ts
"Close Tab" shortcut test explicitly clicks the target tab and asserts active class before triggering the shortcut, ensuring the tab is focused before close.
CodeEditor undo/sentinel insertion refactoring
tests/codeeditor-state/fold-persistence.spec.ts
Undo sentinel insertion changed from async helper calls to a single in-editor evaluate block that suppresses/restores CodeMirror change handlers, appends sentinels with distinct *sentinel-* origins, and manually replays handlers once—preserving three distinct undo entries while keeping React state synchronized.
JUnit report path-separator normalization
tests/runner/collection-run-report/collection-run-report.spec.ts
JUnit XML normalization regex updated to match both forward slashes and backslashes in file attribute paths, handling platform-specific path separators in Windows test runs.

Minor Updates & Supporting Changes

Layer / File(s) Summary
Line ending standardization & package test scripts
.gitattributes, packages/bruno-cli/package.json, packages/bruno-converters/package.json, packages/bruno-electron/package.json, packages/bruno-js/package.json
Global .gitattributes rule enforces LF line endings for all text files; test:ci npm scripts added to all packages to run Jest via local binary (node --experimental-vm-modules ../../node_modules/jest/bin/jest.js) for CI environments.
CLI URL validation & environment memoization
packages/bruno-cli/src/commands/import.js, packages/bruno-app/src/components/EnvironmentVariablesTable/index.js
isUrl helper now validates protocol (http: / https: only) instead of accepting any parsable URL; EnvironmentVariablesTable memoizes _collection object construction via useMemo to ensure stability across renders.
Playwright shell-env initialization skip
packages/bruno-electron/src/store/shell-env-state.js
Shell environment initialization now short-circuits and returns a resolved Promise when process.env.PLAYWRIGHT is set, preventing initialization timeout during Playwright test runs.
Test fixture & fixture path normalization
playwright/index.ts
Collection fixture path and template-substitution values have Windows backslashes converted to forward slashes to maintain valid JSON paths in substituted test data.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

  • usebruno/bruno#7637: Extends the watcher cleanup logic by making watcher shutdown async-aware with Promise.allSettled and timeouts across all watcher classes.
  • usebruno/bruno#6707: Default workspace migration and recovery logic that the updated Playwright test suite (recovery-and-backup.spec.ts) validates via the new waitForReadyPage helper.
  • usebruno/bruno#6266: ResponseActions/ResponseCopy component updates that align with the clipboard assertion changes in response and transient request tests.

Suggested reviewers

  • lohit-bruno
  • helloanoop
  • naman-bruno

🚀 From old dance with firstWindow() and loaded waits, a readiness symphony emerges—
Watcher shutdown now bows gracefully with Promise.allSettled grace,
CI platforms cross-stitched to one, shells swapped with ease,
And tests, once fragile, now hold steady against flaky UI—
A grand refactoring waltz, where stability finds its place! 💃

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/playwright-os-2

@github-actions

github-actions Bot commented May 7, 2026 •

Copy link
Copy Markdown

CLI Test Results (Linux)

  1 files  211 suites   53s ⏱️
589 tests 589 ✅ 0 💤 0 ❌
702 runs  695 ✅ 7 💤 0 ❌

Results for commit f63c1fd.

♻️ This comment has been updated with latest results.

@bijin-bruno
bijin-bruno force-pushed the feat/playwright-os-2 branch from 1581a7b to 811419d Compare May 7, 2026 19:39
@bijin-bruno
bijin-bruno force-pushed the feat/playwright-os-2 branch 2 times, most recently from 11d50f8 to 6b739f8 Compare May 8, 2026 08:47
@github-actions

github-actions Bot commented May 8, 2026 •

Copy link
Copy Markdown

⚠️ Warning: You modified flaky/failed test files

The following test files you modified have reliability issues:

❌ Failed: tests/import/insomnia/import-insomnia-v4-environments.spec.ts

Test: Import Insomnia v4 collection with nested environments and verify flattening
Status: failed

To debug locally, run:

npx playwright test tests/import/insomnia/import-insomnia-v4-environments.spec.ts --repeat-each=5 --workers=1

❌ Failed: tests/shortcuts/bound-actions.spec.ts

Test: customized Alt+F opens sidebar search
Status: failed

To debug locally, run:

npx playwright test tests/shortcuts/bound-actions.spec.ts --repeat-each=5 --workers=1

Note: Flaky tests passed after retrying, failed tests did not pass. Please investigate and fix the root cause before merging.

@bijin-bruno
bijin-bruno force-pushed the feat/playwright-os-2 branch from a44b6b5 to 980b20c Compare May 11, 2026 20:09
@bijin-bruno
bijin-bruno force-pushed the feat/playwright-os-2 branch from f60f3e4 to 4cb5a0c Compare May 14, 2026 08:18
@bijin-bruno
bijin-bruno marked this pull request as ready for review May 14, 2026 10:55

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tests/response/response-actions.spec.ts (1)

58-62: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use event-driven polling for clipboard assertion to prevent race condition.

The clipboard may not be updated immediately after the toast appears. Line 33 of the same file already demonstrates the correct pattern with expect.poll(). Apply the same approach here: clear the clipboard before copying, then poll until the value equals 'cG9uZw==' instead of reading immediately.

Suggested fix
      await test.step('Copy response and verify clipboard contains Base64', async () => {
        await clickResponseAction(page, 'response-copy-btn');
        await expect(page.getByText('Response copied to clipboard')).toBeVisible({ timeout: 10000 }).catch(() => {});
-
-      const clipboardText = await page.evaluate(() => navigator.clipboard.readText());
-      // "pong" in Base64 is "cG9uZw=="
-      expect(clipboardText).toBe('cG9uZw==');
+      await page.evaluate(() => navigator.clipboard.writeText(''));
+      await expect.poll(
+        async () => await page.evaluate(() => navigator.clipboard.readText().catch(() => ''))
+      ).toBe('cG9uZw==');
      });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/response/response-actions.spec.ts` around lines 58 - 62, The clipboard
assertion has a race: instead of immediately calling page.evaluate(() =>
navigator.clipboard.readText()) after page.getByText('Response copied to
clipboard'), clear the clipboard first and replace the direct read with
event-driven polling using expect.poll to repeatedly call page.evaluate(() =>
navigator.clipboard.readText()) until it equals 'cG9uZw=='; locate the clipboard
usage around page.getByText and page.evaluate and change it to clear the
clipboard prior to the copy action and use expect.poll(() =>
page.evaluate(...)).toBe('cG9uZw==') to wait for the value.
tests/workspace/create-workspace/create-workspace.spec.ts (1)

395-396: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Inconsistent readiness pattern - missed during refactoring.

Lines 395-396 still use the old app.firstWindow() + [data-app-state="loaded"] pattern, while all other tests in this file use waitForReadyPage(app).

🔧 Align with the rest of the file
-      const page = await app.firstWindow();
-      await page.locator('[data-app-state="loaded"]').waitFor({ timeout: 30000 });
+      const page = await waitForReadyPage(app);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/workspace/create-workspace/create-workspace.spec.ts` around lines 395 -
396, The test still uses the old readiness pattern by calling app.firstWindow()
and waiting on the '[data-app-state="loaded"]' locator; replace that with the
shared helper waitForReadyPage(app) to align with other tests. Locate the
occurrence using app.firstWindow() and the locator '[data-app-state="loaded"]'
in create-workspace.spec.ts and remove those two lines, then call
waitForReadyPage(app) (the existing helper used elsewhere in this file) to
ensure consistent readiness handling.
🧹 Nitpick comments (8)
tests/runner/collection-run-report/collection-run-report.spec.ts (1)

23-43: ⚡ Quick win

Consider using test.step for better reporting.

The test would benefit from wrapping the main actions in test.step blocks to improve readability of generated reports. For example:

test('CLI: Run collection and generate JUnit report', async ({ createTmpDir }) => {
  await test.step('Setup output directory', async () => {
    const outputDir = await createTmpDir('junit-report');
    // ...
  });

  await test.step('Execute CLI with JUnit reporter', async () => {
    // ...
  });

  await test.step('Verify report content', async () => {
    // ...
  });
});

As per coding guidelines, promoting the use of test.step makes generated reports easier to read.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/runner/collection-run-report/collection-run-report.spec.ts` around
lines 23 - 43, The test 'CLI: Run collection and generate JUnit report' should
be split into logical test.step blocks to improve report readability; refactor
the body of the test that currently uses createTmpDir, constructs
junitOutputPath, runs execSync(command), and asserts via normalizeJunitReport
into three await test.step calls (e.g., "Setup output directory", "Execute CLI
with JUnit reporter", "Verify report content") so each major action (creating
outputDir/junitOutputPath, running execSync, reading/normalizing and
snapshotting the report) is wrapped in its own test.step for clearer reporting.
tests/import/insomnia/import-insomnia-v5-environments.spec.ts (1)

80-80: 💤 Low value

Consider extracting the timeout value as a constant.

The 15-second timeout appears three times in this file. Extracting it as a named constant (e.g., ENV_FLATTEN_TIMEOUT_MS) would make it easier to adjust if CI performance characteristics change.

♻️ Optional refactor
+const ENV_FLATTEN_TIMEOUT_MS = 15000;
+
 test.describe('Import Insomnia v5 Collection - Environment Import', () => {

Then replace each occurrence:

-      await page.locator('input[value="config.debug"]').waitFor({ state: 'visible', timeout: 15000 });
+      await page.locator('input[value="config.debug"]').waitFor({ state: 'visible', timeout: ENV_FLATTEN_TIMEOUT_MS });

Also applies to: 148-148, 206-206

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/import/insomnia/import-insomnia-v5-environments.spec.ts` at line 80,
Extract the repeated 15000 ms literal into a named constant (e.g.,
ENV_FLATTEN_TIMEOUT_MS = 15000) at the top of the test file and replace each
hard-coded timeout in the three waitFor calls (the one using
page.locator('input[value="config.debug"]').waitFor and the other two
occurrences referenced in the comment) with that constant; ensure any imports or
top-level test-level scope accommodate the new constant so all references
compile and maintain original behavior.
tests/import/insomnia/import-insomnia-v4-environments.spec.ts (1)

83-83: 💤 Low value

Consider extracting the timeout value as a constant.

The 15-second timeout appears three times in this file. Extracting it as a named constant (e.g., ENV_FLATTEN_TIMEOUT_MS) would improve maintainability and allow easy adjustment for CI performance tuning.

♻️ Optional refactor
+const ENV_FLATTEN_TIMEOUT_MS = 15000;
+
 test.describe('Import Insomnia v4 Collection - Environment Import', () => {

Then replace each occurrence:

-      await page.locator('input[value="user.roles[1]"]').waitFor({ state: 'visible', timeout: 15000 });
+      await page.locator('input[value="user.roles[1]"]').waitFor({ state: 'visible', timeout: ENV_FLATTEN_TIMEOUT_MS });

Also applies to: 137-137, 187-187

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/import/insomnia/import-insomnia-v4-environments.spec.ts` at line 83,
Extract the repeated 15000 timeout into a named constant (e.g.,
ENV_FLATTEN_TIMEOUT_MS = 15000) at the top of the test file and replace the
three literal timeouts used in the locators/waits (the lines using
page.locator(...).waitFor({ state: 'visible', timeout: 15000 })) with timeout:
ENV_FLATTEN_TIMEOUT_MS so the tests reference the single constant for easier
tuning and maintenance.
packages/bruno-app/src/components/EnvironmentVariablesTable/index.js (1)

154-168: ⚡ Quick win

Memoization dependency is broken—globalEnvironmentVariables creates a new object reference every render.

The getGlobalEnvironmentVariables() function (at packages/bruno-app/src/utils/collections/index.js:1139-1150) creates a fresh object with let variables = {} on every call, returning a new reference regardless of content. This means the useMemo dependency on globalEnvironmentVariables changes every render, causing the memo to re-run and defeating its performance purpose.

Fix by depending directly on the source data instead:

const _collection = useMemo(() => {
  const c = collection ? cloneDeep(collection) : {};
  c.globalEnvironmentVariables = globalEnvironmentVariables;
  if (!collection && workspaceProcessEnvVariables) {
    c.workspaceProcessEnvVariables = workspaceProcessEnvVariables;
  }
  return c;
-}, [collection, globalEnvironmentVariables, workspaceProcessEnvVariables]);
+}, [collection, globalEnvironments, activeGlobalEnvironmentUid, workspaceProcessEnvVariables]);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bruno-app/src/components/EnvironmentVariablesTable/index.js` around
lines 154 - 168, The memoization is broken because globalEnvironmentVariables is
a new object each render; update the _collection useMemo so it does not depend
on the computed globalEnvironmentVariables reference—move the call to
getGlobalEnvironmentVariables(...) inside the useMemo and change the dependency
array to the raw inputs (globalEnvironments and activeGlobalEnvironmentUid)
along with collection and workspaceProcessEnvVariables; this ensures _collection
only recomputes when collection, globalEnvironments, activeGlobalEnvironmentUid,
or workspaceProcessEnvVariables actually change while still setting
c.globalEnvironmentVariables from getGlobalEnvironmentVariables(...) inside the
memo.
.github/workflows/tests-windows.yml (1)

10-29: 💤 Low value

Track the disabled unit tests for Windows.

The unit-test job is currently disabled with if: false and includes a TODO comment. While this is a valid pattern for temporarily disabling a job, ensure there's a tracking issue to re-enable these tests once they're fixed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/tests-windows.yml around lines 10 - 29, The Windows
unit-test job ("unit-test") is temporarily disabled via "if: false" with a TODO;
create and link a tracking issue for re-enabling Windows unit tests and update
the TODO to reference that issue (e.g., include the issue number/URL) so it's
easy to find later, and when the issue is resolved remove the "if: false"
conditional and the TODO; ensure the job name "unit-test" and the step names
("Setup Node Dependencies", "Run Unit Tests") remain unchanged so the CI
workflow resumes correctly once re-enabled.
tests/environments/api-setEnvVar/api-setEnvVar-without-persist.spec.ts (1)

23-25: ⚡ Quick win

Replace dispatchEvent('click') with locator.click() for proper E2E test interaction.

Using synthetic dispatchEvent bypasses Playwright's actionability checks (visibility, stability, receiveability). The click() method performs full actionability validation and simulates real user interaction, making tests more reliable and aligned with E2E best practices.

Suggested changes
     await page.locator('#configure-env').waitFor({ state: 'visible' });
-    await page.locator('#configure-env').dispatchEvent('click');
+    await page.locator('#configure-env').click();

Also at line 45:

     await newPage.locator('#configure-env').waitFor({ state: 'visible' });
-    await newPage.locator('#configure-env').dispatchEvent('click');
+    await newPage.locator('#configure-env').click();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/environments/api-setEnvVar/api-setEnvVar-without-persist.spec.ts`
around lines 23 - 25, Replace synthetic dispatchEvent('click') calls on the
Playwright locator for '#configure-env' with locator.click() to use Playwright's
actionability checks; locate the usages of
page.locator('#configure-env').dispatchEvent('click') (there are two
occurrences, one near the initial open and another later) and change them to
await page.locator('#configure-env').click() so clicks are real user-like
interactions and tests become more stable.
tests/environments/api-setEnvVar/api-setEnvVar-with-persist.spec.ts (2)

26-27: ⚡ Quick win

Consider replacing dispatchEvent('click') with standard user interaction.

E2E tests should verify user-visible behavior. Using dispatchEvent('click') bypasses the normal event flow and may mask interaction issues like visibility, z-index, or hover state problems.

♻️ Suggested approach

Replace the waitFor + dispatchEvent pattern with a standard click, potentially adding a force: true option if the element is intentionally obscured:

-await page.locator('#configure-env').waitFor({ state: 'visible' });
-await page.locator('#configure-env').dispatchEvent('click');
+await page.locator('#configure-env').click();

If click flakiness persists, investigate the root cause (e.g., hover-dependent visibility, animation timing) rather than working around it.

As per coding guidelines, E2E tests must verify user-visible behaviour, not implementation details.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/environments/api-setEnvVar/api-setEnvVar-with-persist.spec.ts` around
lines 26 - 27, The test currently uses
page.locator('#configure-env').dispatchEvent('click') which bypasses normal user
interaction; change it to use the locator's click API
(page.locator('#configure-env').click()) so Playwright triggers real user events
and visibility checks, and if the element is intentionally covered or flaky add
the click option { force: true } only after investigating
hover/animation/visibility causes; update any related waits or assertions around
the configure-env locator to ensure the click reflects real user-visible
behavior.

47-48: ⚡ Quick win

Consider replacing dispatchEvent('click') with standard user interaction.

Same concern as the earlier #configure-env interaction: using dispatchEvent('click') bypasses normal user interaction patterns.

♻️ Suggested approach
-await newPage.locator('#configure-env').waitFor({ state: 'visible' });
-await newPage.locator('#configure-env').dispatchEvent('click');
+await newPage.locator('#configure-env').click();

As per coding guidelines, E2E tests must verify user-visible behaviour, not implementation details.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/environments/api-setEnvVar/api-setEnvVar-with-persist.spec.ts` around
lines 47 - 48, The test uses
newPage.locator('#configure-env').dispatchEvent('click') which bypasses normal
user interactions; replace this with a real user action such as awaiting
newPage.locator('#configure-env').click() (or await
newPage.click('#configure-env')) after the existing waitFor({ state: 'visible'
}) so the test exercises user-visible behaviour and events the same way a real
user would when invoking the Configure Env button.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/actions/tests/run-cli-tests/action.yml:
- Around line 15-22: The non-Windows job starts the testbench with "npm start
--workspace=packages/bruno-tests &" but doesn’t validate the background process;
update the step that spawns the testbench so it captures the process id (PID)
after starting npm, sleeps briefly, then checks whether that PID is still
running and exits the workflow with an error message if the process has already
terminated; ensure the check happens before running "node
../../bruno-cli/bin/bru.js run ..." so the job fails fast on testbench startup
failures.

In `@packages/bruno-cli/package.json`:
- Line 39: The "test" npm script uses POSIX-only command substitution and which
(the "test" script value) which fails on Windows; change the "test" script so it
invokes the Jest binary by relative path like the existing test:ci script (e.g.,
call node --experimental-vm-modules ../../node_modules/jest/bin/jest.js) instead
of using $(npx which jest) to ensure cross-platform compatibility.

In `@packages/bruno-electron/package.json`:
- Line 24: The "test" script in package.json uses POSIX command substitution
($(npx which jest)) which fails on Windows; update the "test" script to use the
same cross-platform Jest invocation pattern used by the package's "test:ci"
script (and as implemented in bruno-js, bruno-cli, bruno-converters) so it
resolves and runs the local jest binary on all platforms—locate the "test" entry
in package.json and replace the POSIX-only invocation with the proven
cross-platform command used by "test:ci".

In `@tests/environments/import-environment/collection-env-import.spec.ts`:
- Around line 66-67: The test uses a brittle fixed sleep after scrolling the
virtualized table (see page.locator('.table-container').evaluate(...) and
page.waitForTimeout(500)); replace the magic timeout with an event-driven wait
by waiting for an expected row or cell element to appear or become visible (for
example, use the page.locator(...) for a specific row/cell created by the scroll
and call waitFor or waitForElementState/visibility) so the test proceeds only
once the table rows are actually rendered.

In `@tests/environments/import-environment/global-env-import.spec.ts`:
- Around line 61-62: The fixed 500ms sleep after scrolling the virtualized table
should be replaced with an event-driven wait: remove the
page.waitForTimeout(500) and instead wait for a concrete render signal (for
example use variablesTable.locator(...) or page.waitForSelector(...) to wait for
an expected row/cell or a known row identifier to become visible or attached) so
that after await variablesTable.evaluate((el) => el.scrollTop = el.scrollHeight)
the test blocks until the virtualized rows finish rendering (use .waitFor or
.waitForSelector on the specific row/cell text or data attribute).

In
`@tests/preferences/default-collection-location/default-collection-location.spec.js`:
- Around line 4-5: The regex for DEFAULT_LOCATION_SUFFIX_PATTERN is OS-dependent
because it hardcodes '/'; update the pattern construction in
escapeRegExp/DEFAULT_LOCATION_SUFFIX_PATTERN so it accepts both forward and
backslashes (e.g., use a separator character class like [\\/]) or build the
suffix using platform-safe separators (path.sep) and escape it; ensure
escapeRegExp is still used to escape literal parts and that the final RegExp
matches either separator between 'tests/preferences' and
'default-collection-location' when present.

In `@tests/protobuf/manage-protofile.spec.ts`:
- Around line 95-99: Remove the forced click on the close icon: instead of
calling requestTab.getByTestId('request-tab-close-icon').click({ force: true }),
wait for the close icon to be visible/actionable (e.g., await
expect(requestTab.getByTestId('request-tab-close-icon')).toBeVisible() or
toBeEnabled()) and then call click() without the force option; keep the
subsequent Dont Save button checks (page.getByRole('button', { name: 'Don\'t
Save' })) as-is to assert the save dialog and click it normally.

In `@tests/response/response-actions.spec.ts`:
- Around line 30-34: The clipboard assertion is too loose; update the final
expectation in tests/response/response-actions.spec.ts to assert the exact
copied string instead of truthiness: after invoking clickResponseAction(page,
'response-copy-btn') and waiting for the "Response copied to clipboard" toast,
change the expect.poll that reads navigator.clipboard.readText() to assert
.toBe('pong') (ensure the page.evaluate call returns a string fallback like ''
so the assertion is deterministic), so the test verifies the exact clipboard
content copied by the response action.

In `@tests/scratch-requests/scratch-requests.spec.ts`:
- Around line 153-157: Before reading and asserting clipboard contents in the
test that uses page.getByText('Response copied to clipboard') and
page.evaluate(() => navigator.clipboard.readText()), clear the clipboard first
to make the test parallel-safe: use page.evaluate to write an empty string (or
unique sentinel) with navigator.clipboard.writeText('') before triggering the
copy action, then wait for the "Response copied to clipboard" toast and finally
read navigator.clipboard.readText() and assert it equals 'pong'.

In `@tests/shortcuts/bound-actions.spec.ts`:
- Around line 153-157: The assertion using toHaveClass(/active/) on the reqTab
locator can false-match classes like "inactive"; update the assertion in the
test so it checks for a whole-word class (e.g., use a word-boundary regex such
as /\bactive\b/ or an equivalent exact-class check) when verifying reqTab is
active; locate the reqTab variable and the await expect(reqTab).toHaveClass(...)
call and replace the regex accordingly to avoid matching substrings.

---

Outside diff comments:
In `@tests/response/response-actions.spec.ts`:
- Around line 58-62: The clipboard assertion has a race: instead of immediately
calling page.evaluate(() => navigator.clipboard.readText()) after
page.getByText('Response copied to clipboard'), clear the clipboard first and
replace the direct read with event-driven polling using expect.poll to
repeatedly call page.evaluate(() => navigator.clipboard.readText()) until it
equals 'cG9uZw=='; locate the clipboard usage around page.getByText and
page.evaluate and change it to clear the clipboard prior to the copy action and
use expect.poll(() => page.evaluate(...)).toBe('cG9uZw==') to wait for the
value.

In `@tests/workspace/create-workspace/create-workspace.spec.ts`:
- Around line 395-396: The test still uses the old readiness pattern by calling
app.firstWindow() and waiting on the '[data-app-state="loaded"]' locator;
replace that with the shared helper waitForReadyPage(app) to align with other
tests. Locate the occurrence using app.firstWindow() and the locator
'[data-app-state="loaded"]' in create-workspace.spec.ts and remove those two
lines, then call waitForReadyPage(app) (the existing helper used elsewhere in
this file) to ensure consistent readiness handling.

---

Nitpick comments:
In @.github/workflows/tests-windows.yml:
- Around line 10-29: The Windows unit-test job ("unit-test") is temporarily
disabled via "if: false" with a TODO; create and link a tracking issue for
re-enabling Windows unit tests and update the TODO to reference that issue
(e.g., include the issue number/URL) so it's easy to find later, and when the
issue is resolved remove the "if: false" conditional and the TODO; ensure the
job name "unit-test" and the step names ("Setup Node Dependencies", "Run Unit
Tests") remain unchanged so the CI workflow resumes correctly once re-enabled.

In `@packages/bruno-app/src/components/EnvironmentVariablesTable/index.js`:
- Around line 154-168: The memoization is broken because
globalEnvironmentVariables is a new object each render; update the _collection
useMemo so it does not depend on the computed globalEnvironmentVariables
reference—move the call to getGlobalEnvironmentVariables(...) inside the useMemo
and change the dependency array to the raw inputs (globalEnvironments and
activeGlobalEnvironmentUid) along with collection and
workspaceProcessEnvVariables; this ensures _collection only recomputes when
collection, globalEnvironments, activeGlobalEnvironmentUid, or
workspaceProcessEnvVariables actually change while still setting
c.globalEnvironmentVariables from getGlobalEnvironmentVariables(...) inside the
memo.

In `@tests/environments/api-setEnvVar/api-setEnvVar-with-persist.spec.ts`:
- Around line 26-27: The test currently uses
page.locator('#configure-env').dispatchEvent('click') which bypasses normal user
interaction; change it to use the locator's click API
(page.locator('#configure-env').click()) so Playwright triggers real user events
and visibility checks, and if the element is intentionally covered or flaky add
the click option { force: true } only after investigating
hover/animation/visibility causes; update any related waits or assertions around
the configure-env locator to ensure the click reflects real user-visible
behavior.
- Around line 47-48: The test uses
newPage.locator('#configure-env').dispatchEvent('click') which bypasses normal
user interactions; replace this with a real user action such as awaiting
newPage.locator('#configure-env').click() (or await
newPage.click('#configure-env')) after the existing waitFor({ state: 'visible'
}) so the test exercises user-visible behaviour and events the same way a real
user would when invoking the Configure Env button.

In `@tests/environments/api-setEnvVar/api-setEnvVar-without-persist.spec.ts`:
- Around line 23-25: Replace synthetic dispatchEvent('click') calls on the
Playwright locator for '#configure-env' with locator.click() to use Playwright's
actionability checks; locate the usages of
page.locator('#configure-env').dispatchEvent('click') (there are two
occurrences, one near the initial open and another later) and change them to
await page.locator('#configure-env').click() so clicks are real user-like
interactions and tests become more stable.

In `@tests/import/insomnia/import-insomnia-v4-environments.spec.ts`:
- Line 83: Extract the repeated 15000 timeout into a named constant (e.g.,
ENV_FLATTEN_TIMEOUT_MS = 15000) at the top of the test file and replace the
three literal timeouts used in the locators/waits (the lines using
page.locator(...).waitFor({ state: 'visible', timeout: 15000 })) with timeout:
ENV_FLATTEN_TIMEOUT_MS so the tests reference the single constant for easier
tuning and maintenance.

In `@tests/import/insomnia/import-insomnia-v5-environments.spec.ts`:
- Line 80: Extract the repeated 15000 ms literal into a named constant (e.g.,
ENV_FLATTEN_TIMEOUT_MS = 15000) at the top of the test file and replace each
hard-coded timeout in the three waitFor calls (the one using
page.locator('input[value="config.debug"]').waitFor and the other two
occurrences referenced in the comment) with that constant; ensure any imports or
top-level test-level scope accommodate the new constant so all references
compile and maintain original behavior.

In `@tests/runner/collection-run-report/collection-run-report.spec.ts`:
- Around line 23-43: The test 'CLI: Run collection and generate JUnit report'
should be split into logical test.step blocks to improve report readability;
refactor the body of the test that currently uses createTmpDir, constructs
junitOutputPath, runs execSync(command), and asserts via normalizeJunitReport
into three await test.step calls (e.g., "Setup output directory", "Execute CLI
with JUnit reporter", "Verify report content") so each major action (creating
outputDir/junitOutputPath, running execSync, reading/normalizing and
snapshotting the report) is wrapped in its own test.step for clearer reporting.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d4528b38-5b32-413f-9ad0-fe78f1f8e421

📥 Commits

Reviewing files that changed from the base of the PR and between 9190de5 and f63c1fd.

📒 Files selected for processing (66)
  • .gitattributes
  • .github/actions/common/setup-node-deps/action.yml
  • .github/actions/ssl/linux/run-ssl-e2e-tests/action.yml
  • .github/actions/ssl/macos/run-ssl-e2e-tests/action.yml
  • .github/actions/ssl/windows/run-ssl-e2e-tests/action.yml
  • .github/actions/tests/run-cli-tests/action.yml
  • .github/actions/tests/run-e2e-tests/action.yml
  • .github/actions/tests/run-unit-tests/action.yml
  • .github/workflows/auth-tests.yml
  • .github/workflows/ssl-tests.yml
  • .github/workflows/tests-linux.yml
  • .github/workflows/tests-macos.yml
  • .github/workflows/tests-windows.yml
  • packages/bruno-app/src/components/EnvironmentVariablesTable/index.js
  • packages/bruno-cli/package.json
  • packages/bruno-cli/src/commands/import.js
  • packages/bruno-converters/package.json
  • packages/bruno-electron/package.json
  • packages/bruno-electron/src/app/apiSpecsWatcher.js
  • packages/bruno-electron/src/app/collection-watcher.js
  • packages/bruno-electron/src/app/dotenv-watcher.js
  • packages/bruno-electron/src/app/workspace-watcher.js
  • packages/bruno-electron/src/index.js
  • packages/bruno-electron/src/store/shell-env-state.js
  • packages/bruno-js/package.json
  • packages/bruno-tests/collection/scripting/node-builtins/node-path.bru
  • playwright/index.ts
  • tests/codeeditor-state/fold-persistence.spec.ts
  • tests/collection/close-all-collections/close-all-collections.spec.ts
  • tests/cookies/cookie-persistence.spec.ts
  • tests/cookies/corrupted-passkey.spec.ts
  • tests/environments/api-setEnvVar/api-setEnvVar-with-persist.spec.ts
  • tests/environments/api-setEnvVar/api-setEnvVar-without-persist.spec.ts
  • tests/environments/api-setEnvVar/multiple-persist-vars.spec.ts
  • tests/environments/global-env-migration-from-file/global-env-migration-from-file.spec.ts
  • tests/environments/global-env-workspace-persistence/global-env-workspace-persistence.spec.ts
  • tests/environments/import-environment/collection-env-import.spec.ts
  • tests/environments/import-environment/global-env-import.spec.ts
  • tests/import/bulk-import/003-selection-list-viewport.spec.ts
  • tests/import/insomnia/import-insomnia-v4-environments.spec.ts
  • tests/import/insomnia/import-insomnia-v5-environments.spec.ts
  • tests/onboarding/sample-collection.spec.ts
  • tests/onboarding/welcome-modal.spec.ts
  • tests/preferences/default-collection-location/default-collection-location.spec.js
  • tests/protobuf/manage-protofile.spec.ts
  • tests/proxy/pac/pac-proxy.spec.ts
  • tests/request/newlines/newlines-persistence.spec.ts
  • tests/request/response-pane-update-when-focused.spec.ts
  • tests/response/response-actions.spec.ts
  • tests/runner/collection-run-report/collection-run-report.spec.ts
  • tests/runner/collection-run-report/collection-run-report.spec.ts-snapshots/cli-junit-report-default-win32.xml
  • tests/scratch-requests/scratch-requests.spec.ts
  • tests/shortcuts/bound-actions.spec.ts
  • tests/snapshots/basic.spec.ts
  • tests/snapshots/global-tabs.spec.ts
  • tests/snapshots/request-pane-interactivity.spec.ts
  • tests/snapshots/sidebar-state.spec.ts
  • tests/transient-requests/transient-requests.spec.ts
  • tests/utils/page/actions.ts
  • tests/workspace/close-tab-stays-in-workspace.spec.ts
  • tests/workspace/collection-reorder-persistence.spec.ts
  • tests/workspace/create-workspace/create-workspace.spec.ts
  • tests/workspace/default-workspace/default-workspace.spec.ts
  • tests/workspace/default-workspace/migration.spec.ts
  • tests/workspace/default-workspace/recovery-and-backup.spec.ts
  • tests/workspace/git-backed-collections/git-backed-collections.spec.ts
💤 Files with no reviewable changes (3)
  • .github/workflows/auth-tests.yml
  • .github/workflows/ssl-tests.yml
  • packages/bruno-tests/collection/scripting/node-builtins/node-path.bru

Comment thread packages/bruno-cli/package.json Resolved
Comment thread packages/bruno-electron/package.json Resolved
Comment thread playwright/index.ts Resolved
Comment thread tests/protobuf/manage-protofile.spec.ts Resolved
Comment thread tests/response/response-actions.spec.ts Resolved
Comment thread tests/shortcuts/bound-actions.spec.ts Resolved
@sid-bruno
sid-bruno merged commit d79aabb into main May 14, 2026
17 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jun 23, 2026
6 tasks
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