From c7942252b58bca576867ca77f14908519e9a6702 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Sun, 18 Oct 2026 12:11:36 -0700 Subject: [PATCH] test(e2e): align title-strip drops with pane selection rules (#29903) * fix(terminal): a file dropped on a pane makes that pane active Dropping a file on an inactive pane's title strip pasted the path but left the other pane selected, because the drop only focused the terminal. Activate the pane instead (which also focuses it). Tracked in STA-9893. * test(e2e): give the title-strip drop the source owner real drags carry * test(e2e): preserve pane selection when checking title-strip drops --------- Co-authored-by: Orca Worker --- ...erminal-pane-title-strip-placement.spec.ts | 51 ++++++++++++++----- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/tests/e2e/terminal-pane-title-strip-placement.spec.ts b/tests/e2e/terminal-pane-title-strip-placement.spec.ts index d3e150496b9..395a19f31e8 100644 --- a/tests/e2e/terminal-pane-title-strip-placement.spec.ts +++ b/tests/e2e/terminal-pane-title-strip-placement.spec.ts @@ -11,8 +11,7 @@ import { readTerminalPaneDomLeafOrder, splitActiveTerminalPane, waitForPaneIdentitySnapshot, - waitForPaneCount, - getTerminalContent + waitForPaneCount } from './helpers/terminal' import { setPaneTitleFromTerminalMenu } from './helpers/terminal-pane-title-actions' import { registerTerminalPaneMountReadiness } from './helpers/terminal-pane-mount-readiness' @@ -58,7 +57,9 @@ test.describe.configure({ mode: 'serial' }) test.describe('Terminal Panes', () => { registerTerminalPaneMountReadiness() - test('Set Title strip activates its pane and accepts file-path drops', async ({ orcaPage }) => { + test('Set Title strip accepts file-path drops without changing the active pane', async ({ + orcaPage + }) => { const title = `Drop target title ${Date.now()}` const droppedPath = `/tmp/title-drop-${Date.now()}.txt` @@ -94,6 +95,15 @@ test.describe('Terminal Panes', () => { await titleBar.evaluate((element, path) => { const dataTransfer = new DataTransfer() dataTransfer.setData('text/x-orca-file-path', path) + // Internal drops are refused without the source owner an Explorer drag records. + dataTransfer.setData( + 'application/x-orca-workspace-file-source', + JSON.stringify({ + executionHostId: 'local', + workspaceId: window.__store?.getState().activeWorktreeId, + version: 1 + }) + ) element.dispatchEvent( new DragEvent('dragover', { bubbles: true, cancelable: true, dataTransfer }) ) @@ -103,17 +113,30 @@ test.describe('Terminal Panes', () => { }, droppedPath) await expect - .poll(async () => (await readPaneIdentitySnapshot(orcaPage))?.activeLeafId ?? null, { - timeout: 5_000, - message: 'Title-strip drop did not activate the titled pane' - }) - .toBe(titledLeafId) - await expect - .poll(async () => (await getTerminalContent(orcaPage)).includes(droppedPath), { - timeout: 5_000, - message: 'Title-strip drop did not paste into the titled pane terminal' - }) - .toBe(true) + .poll( + () => + orcaPage.evaluate( + ({ tabId, targetLeafId, otherLeafId, droppedPath }) => { + const manager = window.__paneManagers?.get(tabId) + const panes = manager?.getPanes() ?? [] + const content = (leafId: string) => + panes.find((pane) => pane.leafId === leafId)?.serializeAddon?.serialize() ?? '' + return { + activeLeafId: manager?.getActivePane()?.leafId ?? null, + targetHasPath: content(targetLeafId).includes(droppedPath), + otherHasPath: content(otherLeafId).includes(droppedPath) + } + }, + { + tabId: splitSnapshot.tabId, + targetLeafId: titledLeafId, + otherLeafId: otherPane.leafId, + droppedPath + } + ), + { timeout: 5_000, message: 'Title-strip drop changed selection or missed its target' } + ) + .toEqual({ activeLeafId: otherPane.leafId, targetHasPath: true, otherHasPath: false }) }) test('Set Title overlay follows its pane after same-count pane move', async ({ orcaPage }) => {