mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
* End multiple PTYs without blocking confirmation dialogs - Add virtualized multi-selection and bounded concurrent termination - Show per-terminal errors while ending continues in the background * Batch PTY termination updates to keep the Resource Manager responsive - Share four termination slots across all End actions - Coalesce completion and exit publications to reduce render churn - Preserve focus when virtualized terminal rows are ended * Defer PTY inventory refresh until termination batches drain * Remove obsolete terminal end confirmation translations * Allow PTY end strings to be localized * Refine terminal list row spacing and remove redundant icon * Remove extra left padding from PTY details button
99 lines
4.7 KiB
TypeScript
99 lines
4.7 KiB
TypeScript
import { expect, test } from './helpers/orca-app'
|
|
import { makeResourceManagerFixtureVisible } from './helpers/resource-manager-visible-fixture'
|
|
import { ensureTerminalVisible, waitForActiveWorktree, waitForSessionReady } from './helpers/store'
|
|
import { waitForActivePanePtyId } from './helpers/terminal'
|
|
|
|
for (const theme of ['light', 'dark'] as const) {
|
|
test(`PTY navigation keeps Resource Manager open while browsing and ending terminals (${theme})`, async ({
|
|
electronApp,
|
|
orcaPage
|
|
}, testInfo) => {
|
|
await waitForSessionReady(orcaPage)
|
|
await waitForActiveWorktree(orcaPage)
|
|
await ensureTerminalVisible(orcaPage)
|
|
await orcaPage.setViewportSize({ width: 1200, height: 900 })
|
|
await orcaPage.evaluate(async (theme) => {
|
|
await window.__store!.getState().updateSettingsOrThrow({ theme })
|
|
}, theme)
|
|
const terminals: { tabId: string; ptyId: string; title: string }[] = []
|
|
for (const title of ['Terminal 1', 'Terminal 8', '工作日仓库审计 run 33']) {
|
|
const tabId = await orcaPage.evaluate(
|
|
({ title, create }) => {
|
|
const state = window.__store!.getState()
|
|
const workspaceId = state.activeWorktreeId
|
|
if (!workspaceId || !state.activeTabId) {
|
|
throw new Error('Missing active workspace or tab')
|
|
}
|
|
const tabId = create ? state.createTab(workspaceId).id : state.activeTabId
|
|
state.setActiveTab(tabId)
|
|
state.setTabCustomTitle(tabId, title)
|
|
return tabId
|
|
},
|
|
{ title, create: terminals.length > 0 }
|
|
)
|
|
terminals.push({ title, tabId, ptyId: await waitForActivePanePtyId(orcaPage) })
|
|
}
|
|
await makeResourceManagerFixtureVisible(electronApp, orcaPage)
|
|
const openPtys = async (): Promise<void> => {
|
|
await orcaPage.getByRole('button', { name: /^Resource Manager,/ }).click()
|
|
await orcaPage.getByRole('tab', { name: /^PTYs/ }).click()
|
|
}
|
|
await openPtys()
|
|
await expect(orcaPage.getByText('3 Orca PTYs on this computer')).toBeVisible()
|
|
const body = orcaPage.locator('[data-resource-pty-body]')
|
|
await orcaPage.screenshot({
|
|
animations: 'disabled',
|
|
path: testInfo.outputPath(`bound-ptys-collapsed-${theme}.png`)
|
|
})
|
|
for (const terminal of terminals) {
|
|
await expect(
|
|
body.getByRole('button', { name: `Open ${terminal.title}`, exact: true })
|
|
).toBeVisible()
|
|
await expect(
|
|
body.getByRole('button', { name: `End ${terminal.title}`, exact: true })
|
|
).toBeEnabled()
|
|
}
|
|
const panel = orcaPage.getByRole('tabpanel', { name: /^PTYs/ })
|
|
const first = terminals[0]
|
|
await expect(panel.getByRole('searchbox')).toHaveCount(0)
|
|
await expect(panel.getByRole('combobox')).toHaveCount(0)
|
|
await expect(body.getByRole('button', { name: 'Open Terminal 8', exact: true })).toBeVisible()
|
|
const details = body.getByRole('button', { name: `Details for ${first.title}`, exact: true })
|
|
await details.click()
|
|
await expect(details).toHaveAttribute('aria-expanded', 'true')
|
|
await expect(body.locator('dl').getByText(first.ptyId, { exact: true })).toBeVisible()
|
|
await details.click()
|
|
for (const terminal of terminals) {
|
|
await body.getByRole('button', { name: `Open ${terminal.title}`, exact: true }).click()
|
|
await expect(body).toBeVisible()
|
|
await expect(
|
|
orcaPage.locator(`[data-testid="sortable-tab"][data-tab-id="${terminal.tabId}"]`)
|
|
).toHaveAttribute('data-active', 'true')
|
|
}
|
|
await body.getByRole('button', { name: `End ${first.title}`, exact: true }).click()
|
|
await expect(orcaPage.getByRole('dialog', { name: `End ${first.title}?` })).toHaveCount(0)
|
|
await expect(orcaPage.getByText('2 Orca PTYs on this computer')).toBeVisible()
|
|
await expect(
|
|
body.getByRole('button', { name: `Open ${first.title}`, exact: true })
|
|
).toHaveCount(0)
|
|
await orcaPage.screenshot({
|
|
animations: 'disabled',
|
|
path: testInfo.outputPath(`bound-ptys-${theme}.png`)
|
|
})
|
|
await expect(orcaPage.getByRole('heading', { name: `End ${first.title}?` })).toHaveCount(0)
|
|
for (const terminal of terminals.slice(1)) {
|
|
await body.getByRole('checkbox', { name: `Select ${terminal.title}`, exact: true }).check()
|
|
}
|
|
await orcaPage.screenshot({
|
|
animations: 'disabled',
|
|
path: testInfo.outputPath(`bound-ptys-selected-${theme}.png`)
|
|
})
|
|
await panel.getByRole('button', { name: 'End selected (2)', exact: true }).click()
|
|
await expect(orcaPage.getByText('0 Orca PTYs on this computer')).toBeVisible()
|
|
await expect(body.getByText('No local Orca PTYs', { exact: true })).toBeVisible()
|
|
await expect(orcaPage.getByRole('dialog', { name: /^End / })).toHaveCount(0)
|
|
await orcaPage.keyboard.press('Escape')
|
|
await expect(body).toHaveCount(0)
|
|
})
|
|
}
|