Repository navigation
test(browser): keep shortcut scope checks valid in narrow panes - #23709
Conversation
|
| const target = browserOverlay(page, browserTabId).getByRole('button', { | ||
| name: 'Reload', | ||
| exact: true | ||
| }) |
There was a problem hiding this comment.
Reload name changes during loading
After navigation or a Back/Forward shortcut, the test waits for the guest URL but not for loading to finish. While the page is loading, this button is named Stop, so the exact Reload lookup times out and the shortcut assertions never run. Wait for the owner guest to become idle before relying on that name, or locate the button independently of its loading label.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThe end-to-end test now focuses the browser’s Priority: ⬇️ Low Merge Risk: 🟡 Moderate · up to The revised shortcut test cannot complete its browser-isolation checks with the current locator and dismissal assertion. Restore assertions against the grab button’s active state before merging; this change does not alter production behavior. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 6970b564-830c-4747-a271-b8143f442327
📒 Files selected for processing (1)
tests/e2e/browser-floating-shortcut-scope.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
| await expect(cancelGrabButton(orcaPage, owner)).toBeVisible() | ||
| await expect(cancelGrabButton(orcaPage, other)).toBeHidden() | ||
| await cancelGrabButton(orcaPage, owner).click() | ||
| await expect(cancelGrabButton(orcaPage, owner)).toBeHidden() |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- production toolbar control ---'
sed -n '1,120p' src/renderer/src/components/browser-pane/assemble-chrome/browser-chrome-element-tool-buttons.tsx
printf '%s\n' '--- relevant button definitions/usages ---'
rg -n -C 5 "activeIntent|Grab page element|variant=|data-state|aria-pressed|pressed" src/renderer/src/components/browser-pane/assemble-chrome src/renderer/src/components/browser-pane/annotate | head -240
printf '%s\n' '--- changed test section ---'
sed -n '50,95p' tests/e2e/browser-floating-shortcut-scope.spec.ts
sed -n '140,170p' tests/e2e/browser-floating-shortcut-scope.spec.tsRepository: stablyai/orca
Length of output: 36823
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- PR test diff ---'
git diff 0f52bb8be5c0f3cdbfa0f98bd259e8d0425d8591 f8b5e161621da9f13f49806ad97aa17f49806ad97aa17dad2ebeef -- tests/e2e/browser-floating-shortcut-scope.spec.ts
printf '%s\n' '--- Button declarations ---'
rg -n --files | rg '(^|/)button\.(tsx|ts)$'
rg -n -C 8 "export.*Button|function Button|forwardRef.*Button|data-slot=.*button" src | head -180Repository: stablyai/orca
Length of output: 253
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- PR test diff ---'
git diff 0f52bb8be5c0f3cdbfa0f98bd259e8d0425d8591 f8b5e161621da9f13f49806ad97aa17dad2ebeef -- tests/e2e/browser-floating-shortcut-scope.spec.ts
printf '%s\n' '--- Button declarations ---'
rg -n --files | rg '(^|/)button\.(tsx|ts)$'
rg -n -C 8 "export.*Button|function Button|forwardRef.*Button|data-slot=.*button" src | head -180Repository: stablyai/orca
Length of output: 20171
🏁 Script executed:
sed -n '1,180p' src/renderer/src/components/ui/button.tsxRepository: stablyai/orca
Length of output: 2677
Restore the grab-button state assertions.
The browser element-grab flow renders Grab page element, not Cancel. The control remains rendered after cancellation. Its data-variant changes from default while grab mode is active to ghost after the toggle returns to idle.
Changing only the locator name would still make the final toBeHidden() assertion fail. Restore the Grab page element locator and assert data-variant for both browsers and after cancellation.
Suggested fix
-function cancelGrabButton(page: Page, browserTabId: string) {
+function grabButton(page: Page, browserTabId: string) {
return browserOverlay(page, browserTabId).getByRole('button', {
- name: 'Cancel',
+ name: 'Grab page element',
exact: true
})
}
- await expect(cancelGrabButton(orcaPage, owner)).toBeVisible()
- await expect(cancelGrabButton(orcaPage, other)).toBeHidden()
- await cancelGrabButton(orcaPage, owner).click()
- await expect(cancelGrabButton(orcaPage, owner)).toBeHidden()
+ await expect(grabButton(orcaPage, owner)).toHaveAttribute('data-variant', 'default')
+ await expect(grabButton(orcaPage, other)).toHaveAttribute('data-variant', 'ghost')
+ await grabButton(orcaPage, owner).click()
+ await expect(grabButton(orcaPage, owner)).toHaveAttribute('data-variant', 'ghost')There was a problem hiding this comment.
ℹ️ Minor suggestion inline — the fix is sound and directly targets the reported failure.
Reviewed changes
- Grab-scope assertions now read the banner, not the toolbar —
grabButtonbecomescancelGrabButton(role buttonCancel) and the copy-chord step assertsCancelvisible in the owning pane, hidden in the other, then clicks it and asserts hidden. The banner only renders whengrab.state !== 'idle'(browser-page-chrome-banners.tsx:53), so these visibility checks express the same isolation the olddata-variantdefault/ghost checks did, through user-visible DOM. focusChrometargetsReloadinstead ofGrab page element—Reloadis not a fold stage (absent fromBROWSER_CHROME_FOLD_ORDERinuse-browser-chrome-tool-fold.ts:18), so it survives the narrow-pane overflow fold that pushed the grab button into the menu and caused the Linux timeout. The focus target remains a non-editable chrome button, preserving the reload/find/grab key-scope checks.
The isolation test still fails if the copy chord arms grab in both panes (other Cancel becomes visible) or in neither (owner Cancel never appears), so it remains a real assertion rather than a tautology.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| const target = grabButton(page, browserTabId) | ||
| // Reload stays in the toolbar when narrow panes fold their element tools into the menu. | ||
| const target = browserOverlay(page, browserTabId).getByRole('button', { | ||
| name: 'Reload', |
There was a problem hiding this comment.
Reload is a sound stable-but-enabled target, but its accessible name is not actually constant: BrowserReloadControl renders label from reloadButtonLabel, which is Stop while the guest is loading and Retry after a failed load (use-browser-page-reload-actions.ts:110-116). focusChrome runs right after waitForGuestUrl without waitForGuestIdle, so if the owner pane is still loading the locator can momentarily match nothing. Playwright auto-waits up to the config's expect: { timeout: 10_000 }, so this is low probability with the local page server — but since this PR exists to remove CI flakiness, waiting for the guest to go idle at the top of focusChrome would make the target genuinely stable.
Technical details
# `focusChrome` can miss the reload button while the pane is loading
## Affected sites
- `tests/e2e/browser-floating-shortcut-scope.spec.ts:80-89` — `focusChrome` locates `getByRole('button', { name: 'Reload', exact: true })`; several call sites (e.g. line 125) run immediately after `navigateGuest`/`waitForGuestUrl`, which only confirm the URL, not load completion.
- `src/renderer/src/components/browser-pane/assemble-chrome/browser-reload-control.tsx:52` — `aria-label={label}`.
- `src/renderer/src/components/browser-pane/navigate/use-browser-page-reload-actions.ts:110-116` — label flips to `Stop` (loading) / `Retry` (failed).
## Required outcome
- `focusChrome` should locate its target deterministically regardless of the owner pane's load state, without weakening the shortcut-scope assertions.
## Suggested approach (optional)
- `await waitForGuestIdle(orcaPage, browserTabId)` at the top of `focusChrome` (already imported/used in this spec) before resolving the reload control.
ELI5
The floating-browser shortcut test assumed the Grab button always stayed in the toolbar. In a narrow split, the responsive toolbar correctly moves it into the menu, and the test waits forever for a button that has disappeared.
What Changed
Focus the always-present Reload button before sending chrome shortcuts. Check the visible grab banner's Cancel button to prove that only the intended pane entered grab mode, then cancel through that banner.
Why
The Linux failure screenshot shows grab mode active in the correct split, with its toolbar tools folded into overflow. The banner measures the user-visible mode regardless of toolbar width. All navigation, reload, find, address-focus, grab isolation, and guest-key assertions remain; no timeout changes.
Linked Issue
CI failure investigation; no existing issue.
Visual Proof
N/A — test-only change; responsive toolbar behavior is unchanged. Baseline evidence: https://github.com/stablyai/orca/actions/runs/36473057092 (shard 13, floating-browser failure screenshot).
Testing
Review
Agent skill upstream boundary
Checklist