Files
orca/tests/e2e/resource-manager-end-tabless-terminals.spec.ts
Jinjing 21accb2316 End multiple PTYs without blocking the Resource Manager (#36753)
* 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
2026-10-31 17:12:51 -07:00

61 lines
2.2 KiB
TypeScript

import { mkdirSync } from 'node:fs'
import { expect, test } from './helpers/orca-app'
import { makeResourceManagerFixtureVisible } from './helpers/resource-manager-visible-fixture'
import { waitForSessionReady } from './helpers/store'
test.use({ seedTestRepo: false })
test('Resource Manager ends a tab-less terminal this run spawned', async ({
orcaPage,
electronApp
}, testInfo) => {
const folderPath = testInfo.outputPath('notes')
mkdirSync(folderPath, { recursive: true })
await waitForSessionReady(orcaPage)
await orcaPage.setViewportSize({ width: 1200, height: 900 })
const ptyId = await orcaPage.evaluate(async (folderPath) => {
const state = window.__store!.getState()
const group = await window.api.projectGroups.create({
name: 'Notes',
parentPath: folderPath,
createdFrom: 'folder-scan'
})
await state.fetchProjectGroups({ runtimeEnvironmentId: null, throwOnError: true })
if (!group) {
throw new Error('Could not create project group')
}
const folder = await state.createFolderWorkspace(
{ projectGroupId: group.id, name: 'Notes', folderPath },
{ runtimeEnvironmentId: null }
)
if (!folder) {
throw new Error('Could not create folder workspace')
}
const spawned = await window.api.pty.spawn({
cols: 80,
rows: 24,
cwd: folderPath,
worktreeId: `folder:${folder.id}`,
initiallyHidden: true
})
return spawned.id
}, folderPath)
await makeResourceManagerFixtureVisible(electronApp, orcaPage)
await orcaPage.getByRole('button', { name: /^Resource Manager,/ }).click()
await orcaPage.getByRole('tab', { name: 'PTYs', exact: true }).click()
const panel = orcaPage.getByRole('tabpanel', { name: /^PTYs/ })
await expect(panel.getByText(/1 without a tab/)).toBeVisible()
const rows = panel.locator('[data-resource-pty-row]')
await rows.getByRole('button', { name: /^End / }).click()
await expect(orcaPage.getByRole('dialog', { name: /^End .*\?$/ })).toHaveCount(0)
await expect(rows).toHaveCount(0)
await expect
.poll(async () =>
(await orcaPage.evaluate(() => window.api.pty.listSessions({ connectionId: null }))).map(
(session) => session.id
)
)
.not.toContain(ptyId)
})