Repository navigation
feat: keybindings customisation - #7603
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughRemoved editor-local run/save shortcuts, added a Redux-aware Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant UI as Editor / Sidebar / Tab
participant Mousetrap
participant Hook as useKeybinding
participant Redux as Store
participant Handler as ActionHandler
participant Modal as SaveRequestsModal
User->>UI: Press shortcut
UI->>Mousetrap: Global key event
Mousetrap->>Hook: Bound combo triggers
Hook->>Redux: Read keybindings & enabled flag
Redux-->>Hook: Return prefs & overrides
Hook->>Handler: Invoke handler (may return false)
Handler->>Handler: Evaluate context (active tab, focus, type)
alt Requires confirmation/save
Handler->>Modal: Open SaveRequestsModal
Modal-->>Handler: User decision
Handler->>Redux: Dispatch save/close actions
else Direct action
Handler->>Redux: Dispatch action (open tab, run, toggle UI)
end
Redux-->>UI: State updates reflected
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 8
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/bruno-app/src/providers/App/ConfirmAppClose/SaveRequestsModal.js (1)
85-97:⚠️ Potential issue | 🟠 MajorDon't pull the global environment draft into a tab-scoped close.
When
forCloseTabsis true, this still includes the global environment draft unconditionally. Closing tabs in one collection can therefore prompt for, save, or discard unrelated global-environment edits, andclearGlobalEnvironmentDraft()wipes that draft app-wide.🩹 Suggested guard
- if (globalEnvironmentDraft) { + if (!forCloseTabs && globalEnvironmentDraft) { const { environmentUid, variables } = globalEnvironmentDraft; const environment = globalEnvironments?.find((env) => env.uid === environmentUid); if (environment && variables) { environmentDrafts.push({ type: 'global-environment',If a global-environment tab is supposed to participate in tab-closing, gate it on that tab being present in
tabUidsToCloseinstead of including it unconditionally.Also applies to: 129-130, 175-177
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/providers/App/ConfirmAppClose/SaveRequestsModal.js` around lines 85 - 97, The globalEnvironmentDraft is being added to environmentDrafts unconditionally; change this so that when forCloseTabs is true you only include the global-environment draft if its associated tab UID is in tabUidsToClose (i.e., gate the push on tabUidsToClose.includes(<tabUid>)); otherwise keep current behavior when not closing specific tabs. Apply the same conditional guard to the other occurrences that handle globalEnvironmentDraft (the later blocks referenced) and ensure any calls that clearGlobalEnvironmentDraft() are only invoked for drafts that were actually part of the targeted tabUidsToClose.
🧹 Nitpick comments (4)
tests/collection/moving-tabs/move-tabs.spec.ts (1)
141-141: Consider replacingwaitForTimeoutwith explicit assertions.Per coding guidelines, prefer
expect()Playwright calls overpage.waitForTimeout(). The tab reorder should be verifiable via the subsequentexpect(tabs.nth(...))assertions without the delay.♻️ Proposed refactor
await page.keyboard.press(`${modifier}+BracketLeft`); - await page.waitForTimeout(500); // Verify order of tabs after move await expect(tabs.nth(0)).toHaveText('GETtest-request');The
expect().toHaveText()will auto-retry until the condition is met or times out, making the explicit delay unnecessary.Also applies to: 150-150
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/collection/moving-tabs/move-tabs.spec.ts` at line 141, Replace the explicit sleeps that call page.waitForTimeout(...) with relying on Playwright's auto-retrying assertions: remove the page.waitForTimeout(500) calls and ensure the following assertions (the expect(tabs.nth(...).toHaveText(...) checks used right after the waits) are used as the synchronization point so they validate the tab reorder by themselves; update any test flow that assumed the delay to instead assert the expected tab text/position using expect(...) which will wait until the UI reaches the expected state.packages/bruno-app/src/components/Preferences/Keybindings/index.js (1)
618-625: Add cleanup for success flash timer on unmount.If the component unmounts while the success timer is pending, it will attempt to update state on an unmounted component. Add a cleanup effect.
🛠️ Suggested fix
+ useEffect(() => { + return () => { + if (successTimerRef.current) clearTimeout(successTimerRef.current); + }; + }, []); + const showSuccessFlash = (action) => { if (successTimerRef.current) clearTimeout(successTimerRef.current); setSuccessAction(action);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js` around lines 618 - 625, The showSuccessFlash function sets successTimerRef.current with setTimeout but lacks cleanup on unmount; add a useEffect cleanup that runs on component unmount to clearTimeout(successTimerRef.current) (and set successTimerRef.current = null) to prevent setState on an unmounted component; locate the Keybindings component and modify it to include a useEffect that returns a cleanup function referencing successTimerRef and setSuccessAction to ensure the pending timer is cleared when the component unmounts.packages/bruno-app/src/components/Preferences/Keybindings/StyledWrapper.js (1)
182-195: Consider using theme colors for status states.Several hardcoded hex values (
#E4AE49,#CE4F3B,#2E8A54) are used for editing/error/success states. For consistency with the codebase pattern, consider using theme props like${(props) => props.theme.status.danger.text}(which you already use on line 319).Also applies to: 234-260
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/Preferences/Keybindings/StyledWrapper.js` around lines 182 - 195, Replace hardcoded hex colors used for status states in StyledWrapper (e.g., in the .shortcut-input--editing, .shortcut-input--error.shortcut-input--editing and the success state around lines 234-260) with theme values to match the codebase pattern; for example use props.theme.status.warning.text for the editing outline instead of `#E4AE49`, props.theme.status.danger.text for the error outline instead of `#CE4F3B`, and props.theme.status.success.text for success instead of `#2E8A54`, ensuring you reference the theme via the same arrow function pattern already used elsewhere in this file.tests/shortcuts/bound-actions.spec.ts (1)
83-133: Please add coverage for the unsaved-drafts close-all-tabs path.These cases only assert the zero-draft flow, but this PR moves
closeAllTabsthroughSaveRequestsModal. Adding one save case and one discard case with a real draft would exercise the new scoped prompt/cleanup behavior.As per coding guidelines, "Cover both the 'happy path' and the realistically problematic paths. Validate expected success behaviour, but also validate error handling, edge cases, and degraded-mode behaviour when appropriate."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/shortcuts/bound-actions.spec.ts` around lines 83 - 133, The tests for the "Close All Tabs" shortcut only cover the zero-draft flow; add two new test cases that exercise the unsaved-drafts path through the SaveRequestsModal: (1) create a real unsaved draft (e.g., openRequest with persist: false or edit an open request), trigger the closeAllTabs shortcut and choose the "Save" option in the SaveRequestsModal, then assert drafts were saved and tabs closed/cleaned up; (2) repeat but choose the "Discard" option in the SaveRequestsModal and assert drafts were removed and tabs closed/cleaned up; use the existing helpers createRequest/openRequest, reference the keybinding trigger steps (keyboard.down('...') sequence) and the SaveRequestsModal UI identifiers to locate and interact with the modal.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/bruno-app/jest/transformers/babel-with-esm-replacements.cjs`:
- Around line 3-7: The custom transformer exported by module.exports.process in
babel-with-esm-replacements.cjs is never used because your Jest transform
mapping still points to 'babel-jest'; either wire this transformer into Jest by
replacing the 'transform' mapping that references 'babel-jest' with a path to
this module so the replace of import.meta.env.MODE -> 'test' runs, or delete
this transformer file and ensure tests set the environment another way (e.g.,
mock import.meta.env.MODE in tests or adjust the existing babel-jest config);
update whichever you choose so files that use import.meta.env.MODE (e.g.,
ReduxStore, useTelemetry) see 'test' during test runs.
- Line 6: The custom Jest transformer in
packages/bruno-app/jest/transformers/babel-with-esm-replacements.cjs is never
used and its replacement call is wrong: update your Jest config to register this
transformer for the appropriate file extensions (ensure the transform map points
to this module instead of or in addition to 'babel-jest' for the files you want
transformed) and fix the replacement in transformer.process so it injects a
string literal and replaces all occurrences (replace import.meta.env.MODE with
the string "'test'" using a global replace or replaceAll). Target symbols: the
transformer module (babel-with-esm-replacements.cjs) and the
transformer.process(...) call so you locate and update the replacement logic,
and the Jest transform mapping in your jest.config.js to register the
transformer.
In
`@packages/bruno-app/src/components/Devtools/Console/TerminalTab/SessionList.js`:
- Line 116: The data-testid attributes in the SessionList component are
currently using the loop index (inside sessions.map) which makes tests flaky;
update all occurrences where data-testid uses the index (the JSX produced in the
sessions.map callback) to use a stable identifier like session.sessionId (e.g.,
replace data-testid={`...-${idx}`} with
data-testid={`...-${session.sessionId}`}), and ensure any related test selectors
referencing those testids are updated accordingly; locate this change in the
sessions.map rendering block and the other similar JSX instances in the same
component.
In `@packages/bruno-app/src/components/MultiLineEditor/index.js`:
- Around line 73-77: Fix the typo in the inline comment above the CodeMirror
input-field handling: change "mousetrap calss" to "mousetrap class" and
"Codemirror" to "CodeMirror" in the comment that precedes the code using
this.editor.getInputField() and cmInput.classList.add('mousetrap') inside the
MultiLineEditor component so the comment is consistent and correctly spelled.
In `@packages/bruno-app/src/components/RequestTabPanel/index.js`:
- Around line 63-71: The keybinding currently enables when isRequestTab is true
but handleRunRef.current may be null if item hasn't loaded; fix by either adding
a runtime guard inside the useKeybinding handler to only call
handleRunRef.current() when it is non-null (referencing handleRunRef and
useKeybinding), or tighten the enabled condition to include the item load check
(e.g., require item exists along with isRequestTab and focusedTab) so the
shortcut is only enabled when handleRunRef is guaranteed to be set.
In `@packages/bruno-app/src/providers/Hotkeys/keyMappings.js`:
- Around line 149-172: The StatusBar component calls
getKeyBindingsForActionAllOS(action) without the userKeyBindings parameter, so
user overrides (e.g., for globalSearch) are ignored; update the StatusBar
invocation to pass the current userKeyBindings (prop or context) into
getKeyBindingsForActionAllOS(action, userKeyBindings), and if StatusBar does not
receive userKeyBindings, thread the value through the parent components or read
it from the existing user settings/key-bindings context (or hook) so that
globalSearch and other actions use the user overrides.
In `@tests/shortcuts/bound-actions.spec.ts`:
- Around line 1245-1273: The test remaps the collapseSidebar binding but never
invokes it and uses a brittle timeout plus a wrong assertion; after editing the
keybinding inputs (elements keybinding-row-collapseSidebar,
keybinding-edit-collapseSidebar, keybinding-input-collapseSidebar) press the new
shortcut once (e.g., page.keyboard.press('Shift+G') or a single down/up
sequence) to trigger collapse, remove page.waitForTimeout(1000), and replace the
width check on aside.sidebar with a Playwright waitable assertion such as
expect(page.locator('aside.sidebar')).toHaveCSS('width', '0px') to verify the
collapsed state.
- Around line 34-36: Tests depend on state from previous tests (use of Shift+X,
Alt+Y remaps and resources named req-1-renamed, kb-folder-renamed,
kb-collection-renamed), so make each spec self-contained by creating/remapping
the shortcuts and creating/renaming the required resources in that test or move
shared setup into a beforeAll; update the tests referencing Shift+X and Alt+Y to
perform the remap steps (or call a shared helper) before asserting behavior, and
ensure req-1-renamed, kb-folder-renamed, kb-collection-renamed are
created/renamed during setup for tests that reference them. Replace
page.waitForTimeout(1000) with explicit waits (e.g., await locator.waitFor or
expect(locator).toBeVisible()/toHaveText()) and change the fragile assertion
expect(width).not.toBe('255px') to assert the actual collapsed state (check an
aria-expanded attribute, a collapse CSS class, or a specific computed property
indicating collapsed vs expanded).
---
Outside diff comments:
In `@packages/bruno-app/src/providers/App/ConfirmAppClose/SaveRequestsModal.js`:
- Around line 85-97: The globalEnvironmentDraft is being added to
environmentDrafts unconditionally; change this so that when forCloseTabs is true
you only include the global-environment draft if its associated tab UID is in
tabUidsToClose (i.e., gate the push on tabUidsToClose.includes(<tabUid>));
otherwise keep current behavior when not closing specific tabs. Apply the same
conditional guard to the other occurrences that handle globalEnvironmentDraft
(the later blocks referenced) and ensure any calls that
clearGlobalEnvironmentDraft() are only invoked for drafts that were actually
part of the targeted tabUidsToClose.
---
Nitpick comments:
In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js`:
- Around line 618-625: The showSuccessFlash function sets
successTimerRef.current with setTimeout but lacks cleanup on unmount; add a
useEffect cleanup that runs on component unmount to
clearTimeout(successTimerRef.current) (and set successTimerRef.current = null)
to prevent setState on an unmounted component; locate the Keybindings component
and modify it to include a useEffect that returns a cleanup function referencing
successTimerRef and setSuccessAction to ensure the pending timer is cleared when
the component unmounts.
In `@packages/bruno-app/src/components/Preferences/Keybindings/StyledWrapper.js`:
- Around line 182-195: Replace hardcoded hex colors used for status states in
StyledWrapper (e.g., in the .shortcut-input--editing,
.shortcut-input--error.shortcut-input--editing and the success state around
lines 234-260) with theme values to match the codebase pattern; for example use
props.theme.status.warning.text for the editing outline instead of `#E4AE49`,
props.theme.status.danger.text for the error outline instead of `#CE4F3B`, and
props.theme.status.success.text for success instead of `#2E8A54`, ensuring you
reference the theme via the same arrow function pattern already used elsewhere
in this file.
In `@tests/collection/moving-tabs/move-tabs.spec.ts`:
- Line 141: Replace the explicit sleeps that call page.waitForTimeout(...) with
relying on Playwright's auto-retrying assertions: remove the
page.waitForTimeout(500) calls and ensure the following assertions (the
expect(tabs.nth(...).toHaveText(...) checks used right after the waits) are used
as the synchronization point so they validate the tab reorder by themselves;
update any test flow that assumed the delay to instead assert the expected tab
text/position using expect(...) which will wait until the UI reaches the
expected state.
In `@tests/shortcuts/bound-actions.spec.ts`:
- Around line 83-133: The tests for the "Close All Tabs" shortcut only cover the
zero-draft flow; add two new test cases that exercise the unsaved-drafts path
through the SaveRequestsModal: (1) create a real unsaved draft (e.g.,
openRequest with persist: false or edit an open request), trigger the
closeAllTabs shortcut and choose the "Save" option in the SaveRequestsModal,
then assert drafts were saved and tabs closed/cleaned up; (2) repeat but choose
the "Discard" option in the SaveRequestsModal and assert drafts were removed and
tabs closed/cleaned up; use the existing helpers createRequest/openRequest,
reference the keybinding trigger steps (keyboard.down('...') sequence) and the
SaveRequestsModal UI identifiers to locate and interact with the modal.
🪄 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: 2368911e-9183-40a8-9c89-965fb120c0fd
📒 Files selected for processing (31)
packages/bruno-app/jest/transformers/babel-with-esm-replacements.cjspackages/bruno-app/src/components/ApiSpecPanel/FileEditor/CodeEditor/index.jspackages/bruno-app/src/components/CodeEditor/index.jspackages/bruno-app/src/components/Devtools/Console/TerminalTab/SessionList.jspackages/bruno-app/src/components/GlobalSearchModal/index.jspackages/bruno-app/src/components/MultiLineEditor/index.jspackages/bruno-app/src/components/Preferences/Keybindings/StyledWrapper.jspackages/bruno-app/src/components/Preferences/Keybindings/index.jspackages/bruno-app/src/components/Preferences/StyledWrapper.jspackages/bruno-app/src/components/RequestPane/QueryEditor/index.jspackages/bruno-app/src/components/RequestTabPanel/index.jspackages/bruno-app/src/components/RequestTabs/CollectionHeader/index.jspackages/bruno-app/src/components/RequestTabs/RequestTab/index.jspackages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/CloneCollectionItem/index.jspackages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/RenameCollectionItem/index.jspackages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.jspackages/bruno-app/src/components/Sidebar/Collections/Collection/index.jspackages/bruno-app/src/components/Sidebar/NewFolder/index.jspackages/bruno-app/src/components/Sidebar/NewRequest/index.jspackages/bruno-app/src/components/Sidebar/Sections/CollectionsSection/index.jspackages/bruno-app/src/components/SingleLineEditor/index.jspackages/bruno-app/src/hooks/useKeybinding/index.jspackages/bruno-app/src/providers/App/ConfirmAppClose/SaveRequestsModal.jspackages/bruno-app/src/providers/Hotkeys/index.jspackages/bruno-app/src/providers/Hotkeys/keyMappings.jspackages/bruno-app/src/providers/ReduxStore/slices/app.jspackages/bruno-app/src/providers/ReduxStore/slices/tabs.jspackages/bruno-electron/src/app/menu-template.jstests/collection/moving-tabs/move-tabs.spec.tstests/shortcuts/bound-actions.spec.tstests/utils/page/actions.ts
💤 Files with no reviewable changes (2)
- packages/bruno-app/src/components/ApiSpecPanel/FileEditor/CodeEditor/index.js
- packages/bruno-app/src/components/RequestPane/QueryEditor/index.js
There was a problem hiding this comment.
♻️ Duplicate comments (1)
packages/bruno-app/src/components/RequestTabPanel/index.js (1)
63-67:⚠️ Potential issue | 🟠 MajorPotential ReferenceError when
itemis not found.
handleRunis defined at line 284—after the early return at line 272-274 whenitemis missing. If the user triggers the shortcut whileisRequestTabis true butitemdoesn't exist (e.g., deleted request), the handler will hit a TDZ error sincehandleRunwas never initialized.Tighten the
enabledcondition to also requireitem:+ const item = findItemInCollection(collection, activeTabUid); + const isGrpcRequest = item?.type === 'grpc-request'; + const isWsRequest = item?.type === 'ws-request'; + const isRequestTab = focusedTab && ['request', 'grpc-request', 'ws-request', 'graphql-request'].includes(focusedTab.type); useKeybinding('sendRequest', () => { handleRun(); return false; - }, { enabled: !!isRequestTab, deps: [isRequestTab] }); + }, { enabled: !!isRequestTab && !!item, deps: [isRequestTab, item] });This requires moving the
itemcomputation (currently at line 231) before the keybinding call, or alternatively restructuring to ensurehandleRunis always in scope when the binding is active.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/RequestTabPanel/index.js` around lines 63 - 67, The keybinding can reference handleRun before it's initialized if item is missing; fix by tightening the binding's enabled condition to also require item (e.g., change enabled to !!isRequestTab && !!item) and include item in deps, or move the item computation (currently below) above the useKeybinding call so handleRun is always defined when the binding is active; update the useKeybinding call that binds 'sendRequest' and its deps accordingly (reference: isRequestTab, useKeybinding('sendRequest', ...), handleRun, item).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@packages/bruno-app/src/components/RequestTabPanel/index.js`:
- Around line 63-67: The keybinding can reference handleRun before it's
initialized if item is missing; fix by tightening the binding's enabled
condition to also require item (e.g., change enabled to !!isRequestTab &&
!!item) and include item in deps, or move the item computation (currently below)
above the useKeybinding call so handleRun is always defined when the binding is
active; update the useKeybinding call that binds 'sendRequest' and its deps
accordingly (reference: isRequestTab, useKeybinding('sendRequest', ...),
handleRun, item).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e0c18c35-9e07-4879-80f6-ad235a89fde2
📒 Files selected for processing (1)
packages/bruno-app/src/components/RequestTabPanel/index.js
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (4)
packages/bruno-app/src/providers/App/ConfirmAppClose/SaveRequestsModal.js (1)
85-97: Global environment draft included regardless of tab-close scope.When
forceCloseTabsis true, the global environment draft is still included inallDrafts. This means closing a subset of tabs could prompt users about global environment changes that aren't directly related to those tabs. If this is intentional (global env is workspace-wide), consider adding a brief comment clarifying the design decision.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/providers/App/ConfirmAppClose/SaveRequestsModal.js` around lines 85 - 97, The global environment draft (globalEnvironmentDraft) is always added into environmentDrafts and thus into allDrafts even when forceCloseTabs is true, causing unrelated global env prompts when closing a subset of tabs; change the logic so the globalEnvironmentDraft is only collected when the close operation targets the whole workspace (e.g., when forceCloseTabs is false or when closing all tabs), by wrapping the existing globalEnvironmentDraft block in a condition that checks !forceCloseTabs (or the appropriate "closing all" flag) and still verify environment exists via globalEnvironments.find; if including it unconditionally was intentional, add a clarifying comment explaining that global env changes are treated as workspace-wide and should always prompt users.tests/shortcuts/bound-actions.spec.ts (3)
24-29: Use proper PlaywrightPagetype instead ofany.+import { Page } from '@playwright/test'; + -const closeTabByName = async (page: any, name: string | RegExp) => { +const closeTabByName = async (page: Page, name: string | RegExp) => {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/shortcuts/bound-actions.spec.ts` around lines 24 - 29, The test helper closeTabByName currently types the first parameter as any; update it to use Playwright's Page type by importing Page from '@playwright/test' and changing the signature to closeTabByName(page: Page, name: string | RegExp). Keep the rest of the function identical (locators and assertions) so typechecking is accurate and you get proper editor/IDE completions for methods like locator, hover, and getByTestId.
674-710: Consider usingtest.stepfor complex multi-phase tests.This test (and others like the terminal tests) has multiple logical phases: setup tabs, close in order, reopen and verify. Using
test.stepwould make the generated reports easier to read.test('default Cmd/Ctrl+Shift+T reopens multiple tab types in LIFO order', async ({ page }) => { await test.step('Open various tab types', async () => { await page.locator('.collection-name').filter({ hasText: 'kb-collection' }).dblclick(); // ... }); await test.step('Close tabs in specific order', async () => { await closeTabByName(page, 'kb-folder'); // ... }); await test.step('Verify LIFO reopen order', async () => { await page.keyboard.press(`${modifier}+Shift+KeyT`); // ... }); });As per coding guidelines: "Promote the use of
test.stepas much as possible so the generated reports are easier to read."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/shortcuts/bound-actions.spec.ts` around lines 674 - 710, The test 'default Cmd/Ctrl+Shift+T reopens multiple tab types in LIFO order' is multi-phase; wrap each logical phase (setup, close, reopen/verify) in Playwright test.step calls to improve report readability: enclose the setup actions (calls to createFolder, page.locator/dblclick, getting tabs), the closing sequence (calls to closeTabByName with 'kb-folder','Collection','Variables','Runner'), and the reopen/verify sequence (page.keyboard.press with `${modifier}+Shift+KeyT` and the corresponding expects) each in their own test.step blocks with concise step names.
749-749: UnusedcreateTmpDirfixture parameter.Multiple tests (lines 749, 788, 806, 838, 864, etc.) destructure
createTmpDirbut never use it. Either remove the unused parameter or use it to create isolated test directories.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/shortcuts/bound-actions.spec.ts` at line 749, The tests like the one named "default Cmd/Ctrl+F open sidebar search" destructure an unused fixture parameter createTmpDir; remove createTmpDir from the test parameter list (e.g., change async ({ page, createTmpDir }) => to async ({ page }) =>) in each affected test (same pattern at tests around the other mentioned lines) or alternatively use createTmpDir to create an isolated directory before the test actions — update the test functions (the async test callbacks) accordingly so the parameter is no longer unused.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/bruno-app/src/providers/App/ConfirmAppClose/SaveRequestsModal.js`:
- Around line 104-113: The useEffect callback calls onClose but the onClose
function is not listed in the dependency array which can cause a stale
reference; update the effect for totalDraftsCount handling (the useEffect that
checks totalDraftsCount, forceCloseTabs, dispatch, tabUidsToClose) to include
onClose in its dependency array so the effect re-runs when onClose changes,
leaving the logic that dispatches closeTabs or completeQuitFlow and calls
onClose intact.
- Around line 179-184: The modal closes before tab cleanup finishes because
dispatch(closeTabs({ tabUids: tabUidsToClose })) is not awaited; change the
handler to await the thunk dispatch when forceCloseTabs is true (e.g., await
dispatch(closeTabs({ tabUids: tabUidsToClose }))) before calling onClose(),
ensure the enclosing function is declared async so awaiting works, and keep the
existing else branch that dispatches completeQuitFlow() unchanged.
- Around line 138-142: The dispatch(closeTabs({ tabUids: tabUidsToClose })) call
triggers an async thunk but is not awaited, so onClose() can run before cleanup
finishes; update the handler that contains dispatch(closeTabs(...)),
dispatch(completeQuitFlow()), and onClose() to await the async closeTabs thunk
(e.g., await dispatch(closeTabs({ tabUids: tabUidsToClose }))) and ensure the
enclosing function is async (or handle the returned promise) so onClose() is
only called after closeTabs resolves; keep the existing branch for
completeQuitFlow untouched but ensure any async dispatchs are awaited before
calling onClose().
In `@tests/shortcuts/bound-actions.spec.ts`:
- Around line 1325-1329: After clicking the first close button, remove the fixed
sleep and instead wait explicitly for the next element to appear using
Playwright's waiting APIs: replace the waitForTimeout with awaiting the
visibility (or presence) of page.getByTestId('session-close-0') (e.g., await
expect(page.getByTestId('session-close-0')).toBeVisible({ timeout: 3000 }) or
page.getByTestId('session-close-0').waitFor({ state: 'visible' })), then click
page.getByTestId('session-close-0') and keep the existing
expect(...).not.toBeVisible assertion and final click on page.getByTitle('Close
console').
- Line 1355: Replace the flaky arbitrary sleep call page.waitForTimeout(500)
with an explicit wait for the expected condition: identify the element or
condition the test is waiting for in this spec and use Playwright's explicit
wait APIs (e.g., page.waitForSelector('...'), locator.waitFor({...}),
page.waitForResponse(...), or page.waitForFunction(...)) targeting that
selector/response/state with a sensible timeout and assertion; update the test
at the location where page.waitForTimeout(500) appears to wait for the specific
UI element/state change instead of a fixed delay.
- Around line 1378-1383: The test uses a fixed sleep after clicking
page.getByTestId('session-close-1') — replace that await
page.waitForTimeout(1000) with an explicit wait for the UI change (e.g., await
expect(page.getByTestId('session-close-1')).not.toBeVisible() or await
page.waitForSelector('[data-testid="session-close-1"]', { state: 'hidden' }) )
before proceeding to click page.getByTestId('session-close-0'); keep the
existing explicit assertion await
expect(page.getByTestId('session-close-0')).not.toBeVisible(...) and the final
page.getByTitle('Close console').click() as-is.
---
Nitpick comments:
In `@packages/bruno-app/src/providers/App/ConfirmAppClose/SaveRequestsModal.js`:
- Around line 85-97: The global environment draft (globalEnvironmentDraft) is
always added into environmentDrafts and thus into allDrafts even when
forceCloseTabs is true, causing unrelated global env prompts when closing a
subset of tabs; change the logic so the globalEnvironmentDraft is only collected
when the close operation targets the whole workspace (e.g., when forceCloseTabs
is false or when closing all tabs), by wrapping the existing
globalEnvironmentDraft block in a condition that checks !forceCloseTabs (or the
appropriate "closing all" flag) and still verify environment exists via
globalEnvironments.find; if including it unconditionally was intentional, add a
clarifying comment explaining that global env changes are treated as
workspace-wide and should always prompt users.
In `@tests/shortcuts/bound-actions.spec.ts`:
- Around line 24-29: The test helper closeTabByName currently types the first
parameter as any; update it to use Playwright's Page type by importing Page from
'@playwright/test' and changing the signature to closeTabByName(page: Page,
name: string | RegExp). Keep the rest of the function identical (locators and
assertions) so typechecking is accurate and you get proper editor/IDE
completions for methods like locator, hover, and getByTestId.
- Around line 674-710: The test 'default Cmd/Ctrl+Shift+T reopens multiple tab
types in LIFO order' is multi-phase; wrap each logical phase (setup, close,
reopen/verify) in Playwright test.step calls to improve report readability:
enclose the setup actions (calls to createFolder, page.locator/dblclick, getting
tabs), the closing sequence (calls to closeTabByName with
'kb-folder','Collection','Variables','Runner'), and the reopen/verify sequence
(page.keyboard.press with `${modifier}+Shift+KeyT` and the corresponding
expects) each in their own test.step blocks with concise step names.
- Line 749: The tests like the one named "default Cmd/Ctrl+F open sidebar
search" destructure an unused fixture parameter createTmpDir; remove
createTmpDir from the test parameter list (e.g., change async ({ page,
createTmpDir }) => to async ({ page }) =>) in each affected test (same pattern
at tests around the other mentioned lines) or alternatively use createTmpDir to
create an isolated directory before the test actions — update the test functions
(the async test callbacks) accordingly so the parameter is no longer unused.
🪄 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: ec0c1901-e3fc-4839-aef8-5f8b73e10ff3
📒 Files selected for processing (3)
packages/bruno-app/src/providers/App/ConfirmAppClose/SaveRequestsModal.jspackages/bruno-app/src/providers/Hotkeys/index.jstests/shortcuts/bound-actions.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/bruno-app/src/providers/Hotkeys/index.js
sid-bruno
left a comment
There was a problem hiding this comment.
LGTM, waiting on tests
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/environments/focus-retention/environment-focus.spec.ts`:
- Line 23: The test is asserting the environment-switch toast text ("Environment
changed to...") instead of the save-success toast; update the assertion to check
for the save confirmation text "Changes saved successfully" (use the same
selector pattern used now, e.g., page.getByText(/(^Changes saved
successfully)/).last() with the existing timeout) so the spec validates the
actual save behavior emitted by EnvironmentVariablesTable rather than the
environment-selection toast.
🪄 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: 469d6dac-a26d-4cd7-9876-9b43440854e2
📒 Files selected for processing (1)
tests/environments/focus-retention/environment-focus.spec.ts
Description
JIRA
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
New Features
Improvements
Tests