mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
* fix(sidebar): let a row click hand typing to the opened terminal again Since 1.4.259 a plain click on a workspace row parked keyboard focus on the sidebar list and marked it as keyboard navigation, so terminal and chat focus requests yielded and typing went nowhere until a second click (STA-15458). The same stale mark also swallowed explicit focus requests such as `orca terminal switch`, which reported success (STA-15415). - Only a modifier click (multi-select) claims list focus; a plain click hands keys to the opened workspace's terminal or chat. - Any pointer press ends list keyboard navigation again, so a click after arrow keys or a modifier click, and agent-row clicks, also hand focus off. - The focus-list shortcut marks keyboard navigation so a terminal that finishes mounting afterwards cannot take the keys back. - Explicit pane focus requests (CLI/notification focus, agent rows) end sidebar list navigation before focusing. The delete shortcut still acts only on sidebar-selected rows while the list has keyboard focus, and never on a hovered row. Co-authored-by: Pr1p <48266347+Pr1p@users.noreply.github.com> Co-authored-by: Pranav Tomar <43115768+Mystery01092000@users.noreply.github.com> * test: give the sidebar focus fixture rows aria-selected * fix(sidebar): re-clicking the open workspace row hands its terminal the keys --------- Co-authored-by: Pr1p <48266347+Pr1p@users.noreply.github.com> Co-authored-by: Pranav Tomar <43115768+Mystery01092000@users.noreply.github.com>
89 lines
3.2 KiB
TypeScript
89 lines
3.2 KiB
TypeScript
import { test, expect } from './helpers/orca-app'
|
|
import { getAllWorktreeIds, waitForActiveWorktree, waitForSessionReady } from './helpers/store'
|
|
import { pressShortcut } from './helpers/shortcuts'
|
|
import { worktreeRow } from './worktree-row-locators'
|
|
|
|
async function createIsolatedWorktree(
|
|
page: Parameters<typeof waitForActiveWorktree>[0]
|
|
): Promise<string> {
|
|
const name = `e2e-delete-shortcut-${Date.now()}`
|
|
return page.evaluate(async (worktreeName) => {
|
|
const state = window.__store?.getState()
|
|
if (!state?.activeWorktreeId) {
|
|
throw new Error('No active worktree to derive repo from')
|
|
}
|
|
const worktree = Object.values(state.worktreesByRepo)
|
|
.flat()
|
|
.find((candidate) => candidate.id === state.activeWorktreeId)
|
|
if (!worktree) {
|
|
throw new Error('Active worktree was not found')
|
|
}
|
|
|
|
const result = await state.createWorktree(worktree.repoId, worktreeName)
|
|
await state.fetchWorktrees(worktree.repoId)
|
|
return result.worktree.id
|
|
}, name)
|
|
}
|
|
|
|
test.describe('Worktree Delete Shortcut', () => {
|
|
let createdWorktreeId: string | null = null
|
|
|
|
test.beforeEach(async ({ orcaPage }) => {
|
|
await waitForSessionReady(orcaPage)
|
|
await waitForActiveWorktree(orcaPage)
|
|
})
|
|
|
|
test.afterEach(async ({ orcaPage }) => {
|
|
if (!createdWorktreeId) {
|
|
return
|
|
}
|
|
const worktreeId = createdWorktreeId
|
|
createdWorktreeId = null
|
|
await orcaPage
|
|
.evaluate(async (id) => {
|
|
const state = window.__store?.getState()
|
|
await state?.removeWorktree(
|
|
{ id, executionHostId: state.getKnownWorktreeById(id)?.hostId ?? null },
|
|
true
|
|
)
|
|
}, worktreeId)
|
|
.catch(() => undefined)
|
|
})
|
|
|
|
test('deletes the active worktree while another row is hovered', async ({ orcaPage }) => {
|
|
createdWorktreeId = await createIsolatedWorktree(orcaPage)
|
|
const worktreeId = createdWorktreeId
|
|
const row = worktreeRow(orcaPage, worktreeId)
|
|
await expect(row).toBeVisible()
|
|
|
|
const previousActiveId = await orcaPage.evaluate(
|
|
() => window.__store?.getState().activeWorktreeId
|
|
)
|
|
await row.click()
|
|
await expect
|
|
.poll(() => orcaPage.evaluate(() => window.__store?.getState().activeWorktreeId))
|
|
.toBe(worktreeId)
|
|
// A click hands keys to the opened workspace; the shortcut acts only from the focused list.
|
|
await pressShortcut(orcaPage, '0', { shift: true })
|
|
await expect(orcaPage.locator('[data-worktree-sidebar]')).toBeFocused()
|
|
if (!previousActiveId || previousActiveId === worktreeId) {
|
|
throw new Error('Expected a different workspace to hover')
|
|
}
|
|
await worktreeRow(orcaPage, previousActiveId).hover()
|
|
await pressShortcut(orcaPage, 'Backspace', { shift: true })
|
|
|
|
const dialog = orcaPage.getByRole('dialog')
|
|
await expect(dialog).toBeVisible()
|
|
await dialog.getByRole('button', { name: 'Delete', exact: true }).click()
|
|
|
|
await expect
|
|
.poll(async () => getAllWorktreeIds(orcaPage), {
|
|
timeout: 15_000,
|
|
message: 'active worktree was not removed by the delete shortcut'
|
|
})
|
|
.not.toContain(worktreeId)
|
|
expect(await getAllWorktreeIds(orcaPage)).toContain(previousActiveId)
|
|
createdWorktreeId = null
|
|
})
|
|
})
|