Skip to content

test(browser): keep shortcut scope checks valid in narrow panes - #23709

Merged
nwparker merged 1 commit into
mainfrom
nwparker/ci-floating-shortcut-toolbar
Sep 28, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/ci-floating-shortcut-toolbar

Conversation

@nwparker

@nwparker nwparker commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4
Prod 0 0 0 0

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

  • Manually tested (automated hidden-renderer check instead).
  • Updated E2E assertions; local macOS test passes, including both floating and split browser cases. Linux PR CI pending.
  • Changed-code quality gate run locally. No product code, protocol, platform shortcuts, or remote behavior changed.

Review

Agent skill upstream boundary

  • Not applicable.

Checklist

  • Small and focused
  • Explained behavior, mechanism, and rationale
  • Visual-proof applicability explained
  • Self-reviewed for correctness
  • Cross-platform and remote impact considered
  • Relevant local E2E and quality checks run; CI covers remaining gates

@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Low risk] Updates browser shortcut scope test for narrow pane layout.

This test change should not merge until chrome focus works while the browser is loading.

Findings

  1. P1 Reload name changes during loading ▶

Summary

The PR changes the floating-browser shortcut E2E test to focus the always-inline reload control and verify grab-mode isolation through the pane-scoped banner.

  • The new focus locator depends on a loading-sensitive accessible name, which can make the test time out during navigation.

Reviews (1) · Last reviewed commit: "test(browser): check grab scope through ..."

Comment on lines +82 to +85
const target = browserOverlay(page, browserTabId).getByRole('button', {
name: 'Reload',
exact: true
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 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.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

The end-to-end test now focuses the browser’s Reload button instead of the removed Grab page element button. It locates the overlay’s exact Cancel button. After Cmd/Ctrl+C, it verifies that Cancel appears only in the browser that received the shortcut. It clicks Cancel and verifies that the button disappears.

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to f8b5e

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the focused browser shortcut test update for narrow panes.
Description check ✅ Passed The description explains the failure, the test changes, the rationale, testing status, visual-proof decision, and compatibility considerations. It does not include an issue number, but it states that …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 6970b564-830c-4747-a271-b8143f442327

📥 Commits

Reviewing files that changed from the base of the PR and between 0ceb3fa and f8b5e16.

📒 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.

Comment on lines +155 to +158
await expect(cancelGrabButton(orcaPage, owner)).toBeVisible()
await expect(cancelGrabButton(orcaPage, other)).toBeHidden()
await cancelGrabButton(orcaPage, owner).click()
await expect(cancelGrabButton(orcaPage, owner)).toBeHidden()

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.

🎯 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.ts

Repository: 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 -180

Repository: 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 -180

Repository: stablyai/orca

Length of output: 20171


🏁 Script executed:

sed -n '1,180p' src/renderer/src/components/ui/button.tsx

Repository: 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')

@pullfrog pullfrog 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.

ℹ️ 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 — grabButton becomes cancelGrabButton (role button Cancel) and the copy-chord step asserts Cancel visible in the owning pane, hidden in the other, then clicks it and asserts hidden. The banner only renders when grab.state !== 'idle' (browser-page-chrome-banners.tsx:53), so these visibility checks express the same isolation the old data-variant default/ghost checks did, through user-visible DOM.
  • focusChrome targets Reload instead of Grab page element — Reload is not a fold stage (absent from BROWSER_CHROME_FOLD_ORDER in use-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.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using 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',

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.

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.

@nwparker
nwparker merged commit a880c88 into main Sep 28, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant