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 <orca-worker@localhost>
This commit is contained in:
Brennan Benson
2026-10-18 12:11:36 -07:00
committed by GitHub
co-authored by Orca Worker
parent df460b8338
commit c7942252b5
@@ -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 }) => {