test(web): drive browser e2e through the Session panel
Forge, background-job, subagent, and shared-task scenarios open the Session panel instead of the retired header controls and sidebar tab, through shared showSessionPanel and dismissSessionPanel helpers. The jobs popover layering scenario becomes a Session panel layering scenario, the start-page review entry scenario is removed with its entry, and the captured goldens follow the panel's sections.
This commit is contained in:
1 parent
bbb44b9e36
commit
cae407c381
32 files changed
+624
-764
No files matched your search
@@ -2,7 +2,7 @@
|
||||
// over the real Host projection frame flow.
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { join } from 'node:path'
|
||||
import type { Browser, Page } from 'playwright'
|
||||
import type { Browser, Locator, Page } from 'playwright'
|
||||
import { chromium } from 'playwright'
|
||||
import { afterAll, beforeAll, describe, expect, it, onTestFailed, onTestFinished, vi } from 'vitest'
|
||||
import type {} from '@deepseek-ai/dsh-agent-team'
|
||||
@@ -13,12 +13,16 @@ import {
|
||||
acknowledgeReloadConnectionLoss, assertFixtureInventory, captureStableAria, compareOrRefreshGolden,
|
||||
launchWebScaffold, watchConsole, webSnapshotMode, type WebScaffold,
|
||||
} from './scaffold.ts'
|
||||
import { assertWarningDialogLayout, connectFreshWorkspace, connectFreshWorkspaceZh, newEnglishPage, saveFailureShot, writeComposerDraft } from './support.ts'
|
||||
import {
|
||||
assertWarningDialogLayout, connectFreshWorkspace, connectFreshWorkspaceZh, dismissSessionPanel, newEnglishPage,
|
||||
saveFailureShot, sessionPanelToggle, showSessionPanel, writeComposerDraft,
|
||||
} from './support.ts'
|
||||
|
||||
const SNAPSHOT_DIR = fileURLToPath(new URL('./snapshots/agent-team-panel', import.meta.url))
|
||||
const PANEL_EXPECTED = join(SNAPSHOT_DIR, 'task.expected.md')
|
||||
const RESIZE_EXPECTED = join(SNAPSHOT_DIR, 'resize.expected.md')
|
||||
const MODE = webSnapshotMode()
|
||||
const SUBAGENTS_SECTION = '[data-session-panel-section="subagents"]'
|
||||
const RESEARCHER_DESCRIPTION = 'Researcher: investigate the construction and verify every bound before reporting the result. '.repeat(8).trim()
|
||||
const RECEIPT_LOCALES = [
|
||||
{
|
||||
@@ -39,6 +43,16 @@ const RECEIPT_LOCALES = [
|
||||
|
||||
type ReceiptLocale = typeof RECEIPT_LOCALES[number]
|
||||
|
||||
/**
|
||||
* Show the Session panel and return its Subagents section once the panel's
|
||||
* entrance animation has ended, so geometry reads see its resting position.
|
||||
* @param page - the page under test.
|
||||
* @returns the section, hidden while it has nothing to show.
|
||||
*/
|
||||
async function showSubagentsSection(page: Page): Promise<Locator> {
|
||||
return (await showSessionPanel(page)).locator(SUBAGENTS_SECTION)
|
||||
}
|
||||
|
||||
async function seedTeamConversation(page: Page, scaffold: WebScaffold): Promise<void> {
|
||||
const agent = scaffold.ctx.agents.list()[0]
|
||||
if (agent === undefined) throw new Error('connected Team workspace did not create an Agent')
|
||||
@@ -176,7 +190,11 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
|
||||
it('defaults off and saves a Session selection in the model menu', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-team-mode'))
|
||||
expect(await page.locator('[data-subagent-action]').count()).toBe(0)
|
||||
const assertNoSubagentsSection = async (): Promise<void> => {
|
||||
expect(await (await showSubagentsSection(page)).locator('[data-subagents-section]').count()).toBe(0)
|
||||
await dismissSessionPanel(page)
|
||||
}
|
||||
await assertNoSubagentsSection()
|
||||
await page.getByRole('button', { name: /^Select model/u }).click()
|
||||
const toggle = page.getByRole('switch', { name: 'Enable agent teamwork', exact: true })
|
||||
await toggle.waitFor()
|
||||
@@ -189,7 +207,7 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
await page.keyboard.press('Space')
|
||||
await expect.poll(() => toggle.getAttribute('aria-checked')).toBe('true')
|
||||
await page.keyboard.press('Escape')
|
||||
expect(await page.locator('[data-subagent-action]').count()).toBe(0)
|
||||
await assertNoSubagentsSection()
|
||||
const agent = scaffold.ctx.agents.list()[0]!
|
||||
expect(scaffold.ctx.commands.list(agent).some(command => command.name === 'team')).toBe(false)
|
||||
expect(agent.session.ownEvents().filter(event => event.type === 'command/run' || event.type === 'command/done')).toEqual([])
|
||||
@@ -198,8 +216,8 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
await other.dispose()
|
||||
const beforeReload = tripwire.warnings.length
|
||||
await page.reload({ waitUntil: 'load' })
|
||||
await assertNoSubagentsSection()
|
||||
await page.getByRole('button', { name: /^Select model/u }).click()
|
||||
expect(await page.locator('[data-subagent-action]').count()).toBe(0)
|
||||
expect(await toggle.getAttribute('aria-checked')).toBe('true')
|
||||
await page.keyboard.press('Escape')
|
||||
acknowledgeReloadConnectionLoss(tripwire, beforeReload)
|
||||
@@ -233,22 +251,21 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
})
|
||||
|
||||
it('shows tasks without children or a divider and hides the entry after the last task is deleted', async () => {
|
||||
it('shows tasks without children or a divider and hides the section after the last task is deleted', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-team-task-only'))
|
||||
const agent = scaffold.ctx.agents.list()[0]!
|
||||
expect(await page.locator('[data-subagent-action]').count()).toBe(0)
|
||||
const section = await showSubagentsSection(page)
|
||||
expect(await section.locator('[data-subagents-section]').count()).toBe(0)
|
||||
expect(await section.isVisible()).toBe(false)
|
||||
const task = await scaffold.ctx.agentTeams.createTask(agent, {
|
||||
subject: 'Plan before delegation', description: 'Prepare shared work before creating subagents',
|
||||
})
|
||||
await page.getByRole('button', { name: '0 subagents', exact: true }).click()
|
||||
const board = page.locator('[data-team-panel]')
|
||||
const board = section.locator('[data-team-panel]')
|
||||
await board.getByText(task.subject, { exact: true }).waitFor()
|
||||
const panel = page.locator('[data-subagent-panel]')
|
||||
expect(await panel.getByRole('treeitem').count()).toBe(0)
|
||||
await panel.getByText('No subagents', { exact: true }).waitFor()
|
||||
expect(await panel.locator('[data-subagent-section-header]').textContent()).toBe('Subagents')
|
||||
expect(await panel.locator('[data-subagent-section-header] button, h3 button').count()).toBe(0)
|
||||
expect(await panel.evaluate(element => element.getBoundingClientRect().width)).toBe(360)
|
||||
expect(await section.getByRole('treeitem').count()).toBe(0)
|
||||
await section.getByText('No subagents', { exact: true }).waitFor()
|
||||
expect(await section.getByRole('heading', { level: 2 }).locator('..').textContent()).toBe('Subagents')
|
||||
expect(await section.locator('h2 button, h3 button').count()).toBe(0)
|
||||
expect(await board.locator('[data-team-task-details]').count()).toBe(0)
|
||||
expect(await board.getByRole('button', { expanded: false }).count()).toBe(1)
|
||||
expect(await board.evaluate((element) => {
|
||||
@@ -256,14 +273,15 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
return { border: style.borderTopWidth, margin: style.marginTop }
|
||||
})).toEqual({ border: '0px', margin: '0px' })
|
||||
await compareOrRefreshGolden(join(SNAPSHOT_DIR, 'task-only.expected.md'),
|
||||
await captureStableAria(page, '[data-subagent-panel]', scaffold.workspaceCwd), MODE)
|
||||
await captureStableAria(page, SUBAGENTS_SECTION, scaffold.workspaceCwd), MODE)
|
||||
await scaffold.ctx.agentTeams.updateTask(agent, { taskId: task.id, expectedRevision: task.revision, action: 'delete' })
|
||||
await page.locator('[data-subagent-action]').waitFor({ state: 'hidden' })
|
||||
await page.locator('[data-subagent-panel]').waitFor({ state: 'hidden' })
|
||||
await section.locator('[data-subagents-section]').waitFor({ state: 'detached' })
|
||||
await section.waitFor({ state: 'hidden' })
|
||||
await dismissSessionPanel(page)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
})
|
||||
|
||||
it('opens the member tree and live read-only tasks in one panel', async () => {
|
||||
it('opens the member tree and live read-only tasks in one section', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-agent-team-panel'))
|
||||
const projectionReads = vi.spyOn(scaffold.ctx.sessionController, 'projections')
|
||||
onTestFinished(() => { projectionReads.mockRestore() })
|
||||
@@ -273,32 +291,16 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
version: 2, childId: memberId, childCreatedAt: Date.now(), mode: 'external',
|
||||
label: RESEARCHER_DESCRIPTION,
|
||||
})
|
||||
const countAction = page.locator('[data-subagent-action]')
|
||||
await countAction.waitFor()
|
||||
await page.mouse.move(2, 2)
|
||||
expect(await countAction.evaluate((element) => {
|
||||
const header = element.closest('[data-slot="conversation.session.header.actions"]')!.parentElement!
|
||||
const preset = header.querySelector('[data-icon="dsw-icon-agent-preset-outline-regular"]')!
|
||||
const users = element.querySelector('[data-icon="dsw-icon-users-outline-regular"]')!
|
||||
return {
|
||||
display: getComputedStyle(header).display, gap: getComputedStyle(header).gap,
|
||||
presetOpacity: getComputedStyle(preset).opacity,
|
||||
presetParentOpacity: getComputedStyle(preset.parentElement!).opacity,
|
||||
sameColor: getComputedStyle(preset).color === getComputedStyle(users).color,
|
||||
}
|
||||
})).toEqual({ display: 'flex', gap: '10px', presetOpacity: '1', presetParentOpacity: '1', sameColor: true })
|
||||
const countTrigger = countAction.getByRole('button', { name: /subagents?$/u })
|
||||
await countTrigger.click()
|
||||
await countTrigger.click()
|
||||
await page.locator('[data-subagent-panel]').waitFor({ state: 'detached' })
|
||||
expect(await countTrigger.evaluate(element => element === document.activeElement)).toBe(true)
|
||||
await countTrigger.click()
|
||||
const action = page.locator('[data-subagent-panel]')
|
||||
const toggle = sessionPanelToggle(page)
|
||||
await toggle.click()
|
||||
await toggle.click()
|
||||
await page.locator('[data-session-panel]').waitFor({ state: 'detached' })
|
||||
expect(await toggle.evaluate(element => element === document.activeElement)).toBe(true)
|
||||
const action = await showSubagentsSection(page)
|
||||
await action.getByRole('treeitem', { name: /Researcher/u }).waitFor()
|
||||
expect(await action.locator('[data-team-panel], [data-subagent-section-header]').count()).toBe(0)
|
||||
expect(await action.locator('[data-team-panel]').count()).toBe(0)
|
||||
expect(await action.getByText('No shared tasks yet. Create them through the conversation.').count()).toBe(0)
|
||||
expect(await action.evaluate(element => element.getBoundingClientRect().width)).toBe(360)
|
||||
expect(await action.locator('[data-subagent-section-header] button, h3 button').count()).toBe(0)
|
||||
expect(await action.locator('h2 button, h3 button').count()).toBe(0)
|
||||
expect(await action.getByRole('heading', { name: 'Members', exact: true }).count()).toBe(0)
|
||||
expect(projectionReads).not.toHaveBeenCalled()
|
||||
|
||||
@@ -306,15 +308,16 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
expect(await action.getByRole('button', { name: /Refresh/u }).count()).toBe(0)
|
||||
|
||||
await action.getByRole('treeitem', { name: /Researcher/u }).waitFor()
|
||||
expect(await page.locator('[data-subagent-panel]').count()).toBe(1)
|
||||
expect(await page.locator('[data-subagents-section]').count()).toBe(1)
|
||||
expect(await page.getByRole('button', { name: 'Task board', exact: true }).count()).toBe(0)
|
||||
const task = await scaffold.ctx.agentTeams.createTask(agent, {
|
||||
subject: 'Agent task', description: 'Created by the root agent', writeScopes: ['src/web'],
|
||||
})
|
||||
const row = action.locator(`[data-team-task="${task.id}"]`)
|
||||
await row.getByRole('button', { name: 'Pending Agent task', exact: true, expanded: false }).waitFor()
|
||||
expect(await action.locator('[data-subagent-section-header]').textContent()).toBe('Subagents1 external')
|
||||
expect(await action.locator('[data-subagent-section-header] button, h3 button').count()).toBe(0)
|
||||
const head = action.getByRole('heading', { level: 2 }).locator('..')
|
||||
expect(await head.textContent()).toBe('Subagents1 external')
|
||||
expect(await action.locator('h2 button, h3 button').count()).toBe(0)
|
||||
expect(await action.locator('[data-team-panel]').evaluate((element) => {
|
||||
const style = getComputedStyle(element)
|
||||
return { border: style.borderTopWidth, margin: style.marginTop }
|
||||
@@ -327,31 +330,21 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
expect(await row.evaluate(element => ({ tag: element.tagName, parent: element.parentElement?.tagName })))
|
||||
.toEqual({ tag: 'LI', parent: 'UL' })
|
||||
expect(await action.locator('[data-team-task-details], article').count()).toBe(0)
|
||||
expect(await action.evaluate(element => element.getBoundingClientRect().width)).toBe(360)
|
||||
await action.getByRole('heading', { name: 'Shared tasks 1 pending', exact: true }).waitFor()
|
||||
expect(await action.evaluate(element => getComputedStyle(element).padding)).toBe('6px')
|
||||
expect(await action.locator('[data-subagent-section-header]').evaluate((element) => {
|
||||
const style = getComputedStyle(element)
|
||||
return { padding: style.padding, gap: style.gap }
|
||||
})).toEqual({ padding: '4px 7px 8px', gap: '7px' })
|
||||
expect(await action.locator('[data-team-panel]').getByRole('heading')
|
||||
.evaluate(element => getComputedStyle(element).columnGap)).toBe('7px')
|
||||
for (const [title, progress] of [
|
||||
[action.locator('[data-subagent-section-header]').getByRole('heading'), action.getByText('1 external', { exact: true })],
|
||||
[action.locator('[data-team-panel]').getByText('Shared tasks', { exact: true }), action.getByText('1 pending', { exact: true })],
|
||||
] as const) {
|
||||
expect(await progress.evaluate(element => getComputedStyle(element).marginInlineStart)).toBe('4px')
|
||||
const titleRight = await title.evaluate(element => element.getBoundingClientRect().right)
|
||||
const progressLeft = await progress.evaluate(element => element.getBoundingClientRect().left)
|
||||
expect(Math.abs(progressLeft - titleRight - 11)).toBeLessThanOrEqual(1)
|
||||
}
|
||||
const boardTitle = action.locator('[data-team-panel]').getByText('Shared tasks', { exact: true })
|
||||
const boardProgress = action.getByText('1 pending', { exact: true })
|
||||
expect(await boardProgress.evaluate(element => getComputedStyle(element).marginInlineStart)).toBe('4px')
|
||||
const boardTitleRight = await boardTitle.evaluate(element => element.getBoundingClientRect().right)
|
||||
const boardProgressLeft = await boardProgress.evaluate(element => element.getBoundingClientRect().left)
|
||||
expect(Math.abs(boardProgressLeft - boardTitleRight - 11)).toBeLessThanOrEqual(1)
|
||||
const member = action.getByRole('treeitem', { name: /Researcher/u })
|
||||
const memberTitle = member.getByText(RESEARCHER_DESCRIPTION, { exact: true })
|
||||
const taskTitle = row.getByText('Agent task', { exact: true })
|
||||
const titleLefts = await Promise.all([
|
||||
memberTitle,
|
||||
action.locator('[data-subagent-section-header]').getByRole('heading'),
|
||||
action.locator('[data-team-panel]').getByText('Shared tasks', { exact: true }),
|
||||
boardTitle,
|
||||
taskTitle,
|
||||
].map(locator => locator.evaluate(element => element.getBoundingClientRect().left)))
|
||||
expect(Math.max(...titleLefts) - Math.min(...titleLefts)).toBeLessThanOrEqual(1)
|
||||
@@ -415,7 +408,6 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
expect(await row.locator('[data-team-task-details] p, [data-team-task-owner]')
|
||||
.evaluateAll(elements => elements.every(element => getComputedStyle(element).fontSize === '12px'))).toBe(true)
|
||||
expect(await row.getByRole('button').getAttribute('aria-expanded')).toBe('true')
|
||||
expect(await action.evaluate(element => element.getBoundingClientRect().width)).toBe(360)
|
||||
await scaffold.ctx.agentTeams.updateTask(agent, {
|
||||
taskId: task.id, expectedRevision: task.revision, action: 'claim',
|
||||
})
|
||||
@@ -425,12 +417,12 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
expect(await action.getByRole('button', { name: /^(New task|Edit|Complete|Reopen|Delete)$/u }).count()).toBe(0)
|
||||
expect(await action.locator('input, select, textarea').count()).toBe(0)
|
||||
|
||||
const snapshot = await captureStableAria(page, '[data-subagent-panel]', scaffold.workspaceCwd)
|
||||
const snapshot = await captureStableAria(page, SUBAGENTS_SECTION, scaffold.workspaceCwd)
|
||||
await compareOrRefreshGolden(PANEL_EXPECTED, snapshot, MODE)
|
||||
expect(projectionReads).not.toHaveBeenCalled()
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
await page.keyboard.press('Escape')
|
||||
await dismissSessionPanel(page)
|
||||
}, 60_000)
|
||||
|
||||
it('hides the board while disabled and restores its tasks when re-enabled', async () => {
|
||||
@@ -438,94 +430,47 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
const toggle = page.getByRole('switch', { name: 'Enable agent teamwork', exact: true })
|
||||
await toggle.click()
|
||||
await expect.poll(() => toggle.getAttribute('aria-checked')).toBe('false')
|
||||
expect(await page.locator('[data-subagent-action]').count()).toBe(1)
|
||||
await page.keyboard.press('Escape')
|
||||
await page.locator('[data-subagent-action]').getByRole('button', { name: '1 subagent', exact: true }).click()
|
||||
await page.getByRole('treeitem', { name: /Researcher/u }).waitFor()
|
||||
const section = await showSubagentsSection(page)
|
||||
await section.getByRole('treeitem', { name: /Researcher/u }).waitFor()
|
||||
expect(await page.locator('[data-subagents-section]').count()).toBe(1)
|
||||
expect(await page.locator('[data-team-panel]').count()).toBe(0)
|
||||
expect(await page.locator('[data-subagent-panel]').evaluate(element => element.getBoundingClientRect().width)).toBe(360)
|
||||
expect(await page.locator('[data-subagent-section-header]').count()).toBe(0)
|
||||
await page.keyboard.press('Escape')
|
||||
await dismissSessionPanel(page)
|
||||
await page.getByRole('button', { name: /^Select model/u }).click()
|
||||
await toggle.click()
|
||||
await expect.poll(() => toggle.getAttribute('aria-checked')).toBe('true')
|
||||
await page.keyboard.press('Escape')
|
||||
await page.locator('[data-subagent-action]').getByRole('button', { name: /subagents?$/u }).click()
|
||||
await page.locator('[data-subagent-panel]').getByText('Agent task', { exact: true }).waitFor()
|
||||
await page.keyboard.press('Escape')
|
||||
await (await showSubagentsSection(page)).getByText('Agent task', { exact: true }).waitFor()
|
||||
await dismissSessionPanel(page)
|
||||
})
|
||||
|
||||
it('keeps the narrow Users trigger focused and opens its catalog only on explicit activation', async () => {
|
||||
it('keeps the toggle focused in a narrow window and opens the catalog only on explicit activation', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-team-narrow-trigger'))
|
||||
const trigger = page.locator('[data-subagent-action]').getByRole('button', { name: '1 subagent', exact: true })
|
||||
const panel = page.locator('[data-subagent-panel]')
|
||||
const count = trigger.locator('[data-subagent-count]')
|
||||
const trigger = sessionPanelToggle(page)
|
||||
const panel = page.locator('[data-session-panel]')
|
||||
const viewport = page.viewportSize()!
|
||||
expect(await count.isVisible()).toBe(true)
|
||||
expect(await trigger.locator('[data-icon="dsw-icon-users-outline-regular"]').count()).toBe(1)
|
||||
expect(await trigger.locator('[data-icon="dsw-icon-users-outline-regular"]').evaluate((element) => {
|
||||
const bounds = element.getBoundingClientRect()
|
||||
return { width: bounds.width, height: bounds.height }
|
||||
})).toEqual({ width: 14, height: 14 })
|
||||
expect(await trigger.locator('[data-icon="dsw-icon-chevron-down-outline-regular"]').count()).toBe(0)
|
||||
expect(await trigger.locator('svg').count()).toBe(1)
|
||||
await trigger.focus()
|
||||
const original = await trigger.elementHandle()
|
||||
if (original === null) throw new Error('Subagent trigger is missing')
|
||||
if (original === null) throw new Error('Session panel toggle is missing')
|
||||
try {
|
||||
await page.setViewportSize({ width: 390, height: 700 })
|
||||
await expect.poll(() => count.evaluate(element => getComputedStyle(element).display)).toBe('none')
|
||||
expect(await original.evaluate(element => element.isConnected && element === document.activeElement)).toBe(true)
|
||||
const expandSidebar = page.locator('[data-sidebar-right-expand]')
|
||||
const compactStyles = await Promise.all([trigger, expandSidebar].map(control => control.evaluate((element) => {
|
||||
const bounds = element.getBoundingClientRect()
|
||||
const icon = element.querySelector('svg')!.getBoundingClientRect()
|
||||
const style = getComputedStyle(element)
|
||||
return { width: bounds.width, height: bounds.height, padding: style.padding, radius: style.borderRadius,
|
||||
color: style.color, iconWidth: icon.width, iconHeight: icon.height }
|
||||
})))
|
||||
expect(compactStyles[0]).toEqual(compactStyles[1])
|
||||
expect(compactStyles[0]).toMatchObject({ width: 28, height: 28, padding: '0px', iconWidth: 15, iconHeight: 15 })
|
||||
expect(await trigger.evaluate(element => getComputedStyle(element.closest('[data-slot="conversation.session.header.actions"]')!.parentElement!).gap)).toBe('8px')
|
||||
await expandSidebar.hover()
|
||||
const expandHover = await expandSidebar.evaluate((element) => {
|
||||
const style = getComputedStyle(element)
|
||||
return { background: style.backgroundColor, color: style.color }
|
||||
})
|
||||
await page.mouse.move(1, 1)
|
||||
await page.keyboard.press('Tab')
|
||||
const countTooltip = page.getByRole('tooltip', { name: '1 subagent', exact: true })
|
||||
await countTooltip.waitFor({ state: 'hidden' })
|
||||
await trigger.hover()
|
||||
expect(await trigger.evaluate((element) => {
|
||||
const style = getComputedStyle(element)
|
||||
return { background: style.backgroundColor, color: style.color }
|
||||
})).toEqual(expandHover)
|
||||
expect(expandHover.background).not.toBe('rgba(0, 0, 0, 0)')
|
||||
// Observe beyond the wide trigger's 150ms hover-open deadline.
|
||||
// Hover alone opens nothing, even past the 150ms delay of hover-opened subagent menus.
|
||||
await page.waitForTimeout(200)
|
||||
expect(await panel.count()).toBe(0)
|
||||
await countTooltip.waitFor({ state: 'visible' })
|
||||
expect(await panel.count()).toBe(0)
|
||||
await trigger.click()
|
||||
await panel.waitFor()
|
||||
expect(await panel.getAttribute('data-session-panel')).toBe('overlay')
|
||||
expect(await trigger.getAttribute('aria-expanded')).toBe('true')
|
||||
expect(await page.getByRole('tooltip', { name: '1 subagent', exact: true }).count()).toBe(0)
|
||||
await panel.getByRole('treeitem', { name: /Researcher/u }).waitFor()
|
||||
await panel.locator('[data-team-task]').getByRole('button', { expanded: false }).waitFor()
|
||||
const section = panel.locator(SUBAGENTS_SECTION)
|
||||
await section.getByRole('treeitem', { name: /Researcher/u }).waitFor()
|
||||
await section.locator('[data-team-task]').getByRole('button', { expanded: false }).waitFor()
|
||||
await trigger.click()
|
||||
await panel.waitFor({ state: 'detached' })
|
||||
expect(await trigger.getAttribute('aria-expanded')).toBe('false')
|
||||
await trigger.press('ArrowDown')
|
||||
await panel.waitFor()
|
||||
await page.mouse.move(1, 1)
|
||||
// Keyboard activation stays pinned beyond the 120ms pointer-leave grace.
|
||||
await page.waitForTimeout(180)
|
||||
expect(await panel.count()).toBe(1)
|
||||
await page.keyboard.press('Escape')
|
||||
await panel.waitFor({ state: 'detached' })
|
||||
} finally {
|
||||
await page.keyboard.press('Escape')
|
||||
await page.setViewportSize(viewport)
|
||||
await original.dispose()
|
||||
}
|
||||
@@ -533,24 +478,25 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
|
||||
it('keeps the panel inside the viewport and closes on outside click or Escape', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-agent-team-panel-keyboard'))
|
||||
const panel = page.locator('[data-subagent-panel]')
|
||||
const trigger = page.locator('[data-subagent-action]').getByRole('button', { name: /subagents?$/u })
|
||||
const panel = page.locator('[data-session-panel]')
|
||||
const section = panel.locator(SUBAGENTS_SECTION)
|
||||
const trigger = sessionPanelToggle(page)
|
||||
const viewport = page.viewportSize()!
|
||||
await trigger.click()
|
||||
await panel.getByRole('heading', { name: /Shared tasks/u }).waitFor()
|
||||
try {
|
||||
for (const size of [{ width: 760, height: 540 }, { width: 600, height: 420 }, { width: 390, height: 700 }]) {
|
||||
await page.setViewportSize(size)
|
||||
await showSessionPanel(page)
|
||||
await section.getByRole('heading', { name: /Shared tasks/u }).waitFor()
|
||||
await expect.poll(() => panel.evaluate((element) => {
|
||||
const rect = element.getBoundingClientRect()
|
||||
return element.parentElement === document.body
|
||||
&& rect.left >= 16 && rect.top >= 16
|
||||
&& rect.right <= window.innerWidth - 16 && rect.bottom <= window.innerHeight - 16
|
||||
return element.getAttribute('data-session-panel') === 'overlay'
|
||||
&& rect.left >= 0 && rect.top >= 0
|
||||
&& rect.right <= window.innerWidth && rect.bottom <= window.innerHeight
|
||||
&& [[rect.left + 12, rect.top + 12], [rect.right - 12, rect.bottom - 12]]
|
||||
.every(([x, y]) => element.contains(document.elementFromPoint(x!, y!)))
|
||||
})).toBe(true)
|
||||
}
|
||||
const row = panel.getByRole('treeitem', { name: /Researcher/u })
|
||||
const row = section.getByRole('treeitem', { name: /Researcher/u })
|
||||
const primary = row.getByText(RESEARCHER_DESCRIPTION, { exact: true })
|
||||
const secondary = row.getByText('team-panel-researcher', { exact: true })
|
||||
expect(await row.getByRole('button').count()).toBe(0)
|
||||
@@ -574,15 +520,15 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
expect(await secondary.evaluate(element => element.scrollWidth <= element.clientWidth)).toBe(true)
|
||||
await secondary.hover()
|
||||
expect(await page.getByRole('tooltip').count()).toBe(0)
|
||||
await panel.getByRole('heading', { name: /Shared tasks/u }).click()
|
||||
await section.getByRole('heading', { name: /Shared tasks/u }).click()
|
||||
expect(await panel.count()).toBe(1)
|
||||
await page.mouse.click(2, 2)
|
||||
await panel.waitFor({ state: 'detached' })
|
||||
await page.setViewportSize(viewport)
|
||||
await trigger.focus()
|
||||
await page.keyboard.press('Enter')
|
||||
await panel.getByRole('heading', { name: /Shared tasks/u }).waitFor()
|
||||
expect(await panel.evaluate(element => element === document.activeElement)).toBe(true)
|
||||
await section.getByRole('heading', { name: /Shared tasks/u }).waitFor()
|
||||
await section.locator('[data-team-task]').getByRole('button').focus()
|
||||
await page.keyboard.press('Escape')
|
||||
await panel.waitFor({ state: 'detached' })
|
||||
expect(await trigger.evaluate(element => element === document.activeElement)).toBe(true)
|
||||
@@ -599,24 +545,7 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('keeps the hovered panel open when the pointer returns directly to its trigger', async () => {
|
||||
onTestFailed(async () => {
|
||||
await saveFailureShot(page, 'web-e2e-agent-team-hover')
|
||||
console.error('Agent Team hover diagnostics', JSON.stringify({ errors: tripwire.pageErrors, warnings: tripwire.warnings }))
|
||||
})
|
||||
const trigger = page.locator('[data-subagent-action]').getByRole('button', { name: /subagents?$/u })
|
||||
const panel = page.locator('[data-subagent-panel]')
|
||||
await trigger.hover()
|
||||
await panel.waitFor()
|
||||
await panel.hover()
|
||||
await trigger.hover()
|
||||
// The assertion spans the 120ms dismissal grace while the pointer stays on the trigger.
|
||||
await page.waitForTimeout(180)
|
||||
expect(await panel.count()).toBe(1)
|
||||
await page.keyboard.press('Escape')
|
||||
})
|
||||
|
||||
it('keeps compact tasks ordered, opens one full detail at a time, and scrolls only the fixed-width menu', async () => {
|
||||
it('keeps compact tasks ordered, opens one full detail at a time, and scrolls only the Session panel', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-team-compact-details'))
|
||||
const agent = scaffold.ctx.agents.list()[0]!
|
||||
const completed = await scaffold.ctx.agentTeams.createTask(agent, {
|
||||
@@ -637,17 +566,16 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
subject, description, blockedBy: [blocker.id], writeScopes: ['src/web/components'],
|
||||
})
|
||||
const viewport = page.viewportSize()!
|
||||
const trigger = page.locator('[data-subagent-action]').getByRole('button', { name: /subagents?$/u })
|
||||
const panel = page.locator('[data-subagent-panel]')
|
||||
const board = panel.locator('[data-team-panel]')
|
||||
const panel = page.locator('[data-session-panel]')
|
||||
const section = panel.locator(SUBAGENTS_SECTION)
|
||||
const board = section.locator('[data-team-panel]')
|
||||
const row = board.locator(`[data-team-task="${task.id}"]`)
|
||||
const emptyRow = board.locator(`[data-team-task="${completed.id}"]`)
|
||||
onTestFinished(() => page.setViewportSize(viewport))
|
||||
// Constrain the menu so closed and expanded task rows both exercise its scrollbar.
|
||||
// Constrain the panel so closed and expanded task rows both exercise its scrollbar.
|
||||
await page.setViewportSize({ width: viewport.width, height: 540 })
|
||||
await trigger.click()
|
||||
await showSubagentsSection(page)
|
||||
await row.waitFor()
|
||||
expect(await panel.evaluate(element => element.getBoundingClientRect().width)).toBe(360)
|
||||
expect(await board.locator('[data-team-task-details], article').count()).toBe(0)
|
||||
expect(await board.getByRole('button', { expanded: false }).count()).toBe(4)
|
||||
expect(await board.locator('[data-team-task]').evaluateAll(elements => elements.map(element => element.getAttribute('data-status'))))
|
||||
@@ -655,46 +583,29 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
const counts = board.getByText('1 completed\u2002·\u20021 in progress\u2002·\u20022 pending', { exact: true })
|
||||
await counts.waitFor()
|
||||
expect(await counts.textContent()).toBe('1 completed\u2002·\u20021 in progress\u2002·\u20022 pending')
|
||||
expect(await panel.locator('[data-subagent-section-header] button, h3 button').count()).toBe(0)
|
||||
expect(await panel.getByRole('button', { name: /^Show (more|less)$/u }).count()).toBe(0)
|
||||
expect(await section.locator('h2 button, h3 button').count()).toBe(0)
|
||||
expect(await section.getByRole('button', { name: /^Show (more|less)$/u }).count()).toBe(0)
|
||||
await row.getByRole('img', { name: 'Blocked by dependencies', exact: true }).waitFor()
|
||||
// The panel itself scrolls; its client box ends where its scrollbar track begins.
|
||||
const measureScroll = async () => panel.evaluate((element) => {
|
||||
const style = getComputedStyle(element)
|
||||
const bounds = element.getBoundingClientRect()
|
||||
const scroller = element.querySelector('[role="tree"]')!.parentElement!
|
||||
const scrollStyle = getComputedStyle(scroller)
|
||||
const scrollBounds = scroller.getBoundingClientRect()
|
||||
const taskBounds = element.querySelector('[data-team-task] button')!.getBoundingClientRect()
|
||||
const scrollbarWidth = Number.parseFloat(getComputedStyle(scroller, '::-webkit-scrollbar').width)
|
||||
const trackLeft = bounds.left + element.clientLeft + element.clientWidth
|
||||
return {
|
||||
innerWidth: bounds.width - Number.parseFloat(style.paddingLeft) - Number.parseFloat(style.paddingRight)
|
||||
- Number.parseFloat(style.borderLeftWidth) - Number.parseFloat(style.borderRightWidth),
|
||||
clientWidth: scroller.clientWidth, clientHeight: scroller.clientHeight, scrollHeight: scroller.scrollHeight,
|
||||
overflowing: scroller.scrollHeight > scroller.clientHeight,
|
||||
gutter: scrollStyle.scrollbarGutter, marginRight: scrollStyle.marginRight,
|
||||
trackMargin: scrollStyle.getPropertyValue('--dsh-scrollbar-track-margin').trim(),
|
||||
overflowing: element.scrollHeight > element.clientHeight,
|
||||
taskLeft: taskBounds.left, taskRight: taskBounds.right,
|
||||
trackLeft: scrollBounds.right - scrollbarWidth, trackRight: scrollBounds.right, panelRight: bounds.right,
|
||||
arrowsBeforeTrack: [...element.querySelectorAll('[data-team-task] button svg')]
|
||||
.every(arrow => arrow.getBoundingClientRect().right <= scrollBounds.right - scrollbarWidth),
|
||||
.every(arrow => arrow.getBoundingClientRect().right <= trackLeft),
|
||||
}
|
||||
})
|
||||
const closedScroll = await measureScroll()
|
||||
expect(closedScroll.overflowing, JSON.stringify(closedScroll)).toBe(true)
|
||||
expect(Math.abs(closedScroll.clientWidth - closedScroll.innerWidth), JSON.stringify(closedScroll)).toBeLessThanOrEqual(1)
|
||||
expect(closedScroll.gutter).toBe('stable')
|
||||
expect(closedScroll.marginRight).toBe('-5px')
|
||||
expect(closedScroll.trackMargin).toBe('6px')
|
||||
await row.getByRole('button').click()
|
||||
const expandedScroll = await measureScroll()
|
||||
expect(expandedScroll.overflowing).toBe(true)
|
||||
expect(expandedScroll.clientWidth).toBe(closedScroll.clientWidth)
|
||||
expect(expandedScroll.taskLeft).toBe(closedScroll.taskLeft)
|
||||
expect(expandedScroll.taskRight).toBe(closedScroll.taskRight)
|
||||
expect(expandedScroll.arrowsBeforeTrack).toBe(true)
|
||||
expect(expandedScroll.trackLeft).toBeGreaterThanOrEqual(expandedScroll.panelRight - 6)
|
||||
expect(expandedScroll.trackRight).toBeLessThanOrEqual(expandedScroll.panelRight - 1)
|
||||
expect(await panel.evaluate(element => element.getBoundingClientRect().width)).toBe(360)
|
||||
const details = row.locator('[data-team-task-details]')
|
||||
expect(await details.locator('p:not([data-team-task-owner])').textContent()).toBe(description)
|
||||
expect(await details.locator('[data-team-task-owner]').textContent()).toBe('Owner: Unowned')
|
||||
@@ -709,35 +620,32 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
await page.setViewportSize({ width: 390, height: 700 })
|
||||
await expect.poll(() => panel.evaluate((element) => {
|
||||
const rect = element.getBoundingClientRect()
|
||||
return rect.width === Math.min(360, innerWidth - 32) && rect.left >= 16 && rect.right <= innerWidth - 16
|
||||
&& rect.top >= 16 && rect.bottom <= innerHeight - 16
|
||||
return element.getAttribute('data-session-panel') === 'overlay'
|
||||
&& rect.left >= 0 && rect.right <= innerWidth && rect.top >= 0 && rect.bottom <= innerHeight
|
||||
&& element.scrollWidth <= element.clientWidth
|
||||
})).toBe(true)
|
||||
expect(await panel.locator('*').evaluateAll((elements) => {
|
||||
const scrollers = elements.filter(element =>
|
||||
expect(await panel.evaluate((panelElement) => {
|
||||
const scrollers = [panelElement, ...panelElement.querySelectorAll('*')].filter(element =>
|
||||
['auto', 'scroll'].includes(getComputedStyle(element).overflowY)
|
||||
&& element.scrollHeight > element.clientHeight)
|
||||
return scrollers.map(element => ({
|
||||
hasHeader: element.querySelector('[data-subagent-section-header]') !== null,
|
||||
panel: element === panelElement,
|
||||
hasTree: element.querySelector('[role="tree"]') !== null,
|
||||
hasBoard: element.querySelector('[data-team-panel]') !== null,
|
||||
fitsWidth: element.scrollWidth <= element.clientWidth,
|
||||
}))
|
||||
})).toEqual([{ hasHeader: true, hasTree: true, hasBoard: true, fitsWidth: true }])
|
||||
const narrowScroll = await measureScroll()
|
||||
expect(Math.abs(narrowScroll.clientWidth - narrowScroll.innerWidth), JSON.stringify(narrowScroll)).toBeLessThanOrEqual(1)
|
||||
expect(narrowScroll.arrowsBeforeTrack).toBe(true)
|
||||
const scroller = panel.getByRole('tree').locator('..')
|
||||
await scroller.hover({ position: { x: 20, y: 20 } })
|
||||
})).toEqual([{ panel: true, hasTree: true, hasBoard: true, fitsWidth: true }])
|
||||
expect((await measureScroll()).arrowsBeforeTrack).toBe(true)
|
||||
await panel.hover({ position: { x: 20, y: 20 } })
|
||||
await Promise.all([
|
||||
scroller.evaluate(element => new Promise<void>((resolve) => {
|
||||
panel.evaluate(element => new Promise<void>((resolve) => {
|
||||
element.addEventListener('scrollend', () => { resolve() }, { once: true })
|
||||
})),
|
||||
page.mouse.wheel(0, 180),
|
||||
])
|
||||
await expect.poll(() => scroller.evaluate(element => element.scrollTop)).toBeGreaterThan(0)
|
||||
await scroller.evaluate((element) => { element.scrollTo({ top: 0 }) })
|
||||
await expect.poll(() => scroller.evaluate(element => element.scrollTop)).toBe(0)
|
||||
await expect.poll(() => panel.evaluate(element => element.scrollTop)).toBeGreaterThan(0)
|
||||
await panel.evaluate((element) => { element.scrollTo({ top: 0 }) })
|
||||
await expect.poll(() => panel.evaluate(element => element.scrollTop)).toBe(0)
|
||||
expect(await row.getByText(subject, { exact: true }).evaluate(element =>
|
||||
element.scrollWidth <= element.clientWidth && getComputedStyle(element).whiteSpace === 'pre-wrap')).toBe(true)
|
||||
expect(await details.locator('p:not([data-team-task-owner])').evaluate(element => element.scrollHeight === element.clientHeight)).toBe(true)
|
||||
@@ -757,7 +665,7 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
expect(titleBounds).not.toBeNull()
|
||||
expect(countBounds).not.toBeNull()
|
||||
expect(countBounds!.y).toBeGreaterThanOrEqual(titleBounds!.y + titleBounds!.height)
|
||||
await compareOrRefreshGolden(RESIZE_EXPECTED, await captureStableAria(page, '[data-subagent-panel]', scaffold.workspaceCwd), MODE)
|
||||
await compareOrRefreshGolden(RESIZE_EXPECTED, await captureStableAria(page, SUBAGENTS_SECTION, scaffold.workspaceCwd), MODE)
|
||||
await emptyRow.getByRole('button').click()
|
||||
expect(await row.getAttribute('data-expanded')).toBe('false')
|
||||
expect(await row.locator('[data-team-task-details]').count()).toBe(0)
|
||||
@@ -769,7 +677,6 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
await emptyRow.getByRole('button').click()
|
||||
expect(await board.locator('[data-team-task-details]').count()).toBe(0)
|
||||
await page.setViewportSize(viewport)
|
||||
expect(await panel.evaluate(element => element.getBoundingClientRect().width)).toBe(360)
|
||||
} finally {
|
||||
await page.keyboard.press('Escape')
|
||||
await page.setViewportSize(viewport)
|
||||
@@ -819,10 +726,9 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
})
|
||||
|
||||
it('removes both section headings and the board divider when the last shared task is deleted', async () => {
|
||||
it('removes the shared-task heading and the board divider when the last shared task is deleted', async () => {
|
||||
const agent = scaffold.ctx.agents.list()[0]!
|
||||
await page.getByRole('button', { name: '1 subagent', exact: true }).click()
|
||||
const panel = page.locator('[data-subagent-panel]')
|
||||
const panel = await showSubagentsSection(page)
|
||||
await panel.locator('[data-team-panel]').waitFor()
|
||||
for (const task of scaffold.ctx.agentTeams.listTasks(agent).toReversed()) {
|
||||
if (task.status === 'deleted') continue
|
||||
@@ -831,12 +737,10 @@ describe('web e2e: agent teamwork panel', () => {
|
||||
})
|
||||
}
|
||||
await panel.locator('[data-team-panel]').waitFor({ state: 'detached' })
|
||||
expect(await panel.locator('[data-subagent-section-header]').count()).toBe(0)
|
||||
expect(await panel.getByRole('heading').count()).toBe(0)
|
||||
expect(await panel.getByRole('heading').allTextContents()).toEqual(['Subagents'])
|
||||
expect(await panel.getByText('No shared tasks yet. Create them through the conversation.').count()).toBe(0)
|
||||
expect(await panel.getByRole('treeitem', { name: /Researcher/u }).count()).toBe(1)
|
||||
expect(await panel.evaluate(element => element.getBoundingClientRect().width)).toBe(360)
|
||||
await page.keyboard.press('Escape')
|
||||
await dismissSessionPanel(page)
|
||||
})
|
||||
|
||||
it.skipIf(MODE === 'record')('keeps the fixture inventory closed', async () => {
|
||||
@@ -976,12 +880,10 @@ it('shows the Chinese empty subagent section above compact shared tasks', async
|
||||
await scaffold.ctx.agentTeams.createTask(agent, {
|
||||
subject: '准备协作', description: '先准备共享任务,再创建子智能体。',
|
||||
})
|
||||
await page.getByRole('button', { name: '0 个子智能体', exact: true }).click()
|
||||
const panel = page.locator('[data-subagent-panel]')
|
||||
const panel = await showSubagentsSection(page)
|
||||
await panel.getByText('暂无子智能体', { exact: true }).waitFor()
|
||||
expect(await panel.locator('[data-subagent-section-header]').textContent()).toBe('子智能体')
|
||||
expect(await panel.locator('[data-subagent-section-header] button, h3 button').count()).toBe(0)
|
||||
expect(await panel.evaluate(element => element.getBoundingClientRect().width)).toBe(360)
|
||||
expect(await panel.getByRole('heading', { level: 2 }).locator('..').textContent()).toBe('子智能体')
|
||||
expect(await panel.locator('h2 button, h3 button').count()).toBe(0)
|
||||
await panel.getByRole('heading', { name: '共享任务 1 待处理', exact: true }).waitFor()
|
||||
expect(await panel.locator('[data-team-task-details]').count()).toBe(0)
|
||||
})
|
||||
|
||||
@@ -10,9 +10,8 @@ const PANELS = [
|
||||
{ file: 'client/ui-schedule/src/client/TaskMenu.module.css', classes: 'list portal scrollable alignEnd', align: 'end' },
|
||||
{ file: 'client/ui-schedule/src/client/PickerPopover.module.css', classes: 'panel', align: 'start' },
|
||||
{ file: 'client/ui-schedule/src/client/ScheduleCatalogAction.module.css', classes: 'menu', align: 'start' },
|
||||
{ file: 'client/ui-subagent/src/client/SubagentHeaderLineage.module.css', classes: 'menu', align: 'start' },
|
||||
{ file: 'client/ui-subagent/src/client/SubagentCatalog.module.css', classes: 'menu', align: 'start' },
|
||||
{ file: 'client/ui-approval/src/client/ApprovalPanel.module.css', classes: 'warningPopover', align: 'end' },
|
||||
{ file: 'client/ui-jobs/src/client/JobListAction.module.css', classes: 'menu', align: 'start' },
|
||||
{ file: 'client/ui-conversation/src/client/skeleton/ContextMeter.module.css', classes: 'panel', align: 'start' },
|
||||
{ file: 'client/ui-chat/src/client/chat/stat-dialog.module.css', classes: 'panel', align: 'start' },
|
||||
{ file: 'client/ui-sidebar-documentpreview/src/client/office/FontNotice.module.css', classes: 'panel', align: 'start' },
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { executeToolFixture } from '@deepseek-ai/dsh-tool-testkit'
|
||||
// Session-header background jobs driven by a real `ctx.jobs` entry. No model
|
||||
// call is involved.
|
||||
// The Session panel's background-jobs section driven by a real `ctx.jobs`
|
||||
// entry. No model call is involved.
|
||||
import { readFile, writeFile } from 'node:fs/promises'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { join } from 'node:path'
|
||||
@@ -15,12 +15,13 @@ import {
|
||||
assertFixtureInventory, captureStableAria, compareOrRefreshGolden,
|
||||
launchWebScaffold, seedSession, watchConsole, webSnapshotMode, type WebScaffold,
|
||||
} from './scaffold.ts'
|
||||
import { newEnglishPage, saveFailureShot } from './support.ts'
|
||||
import { newEnglishPage, saveFailureShot, sessionPanelToggle, showSessionPanel } from './support.ts'
|
||||
|
||||
const FIXTURE = fileURLToPath(new URL('../../../snapshots/web/fresh-round-trip/session.v3.jsonl', import.meta.url))
|
||||
const SNAPSHOT_DIR = fileURLToPath(new URL('../../../snapshots/web/background-job-list', import.meta.url))
|
||||
const RUNNING_EXPECTED = join(SNAPSHOT_DIR, 'running.expected.md')
|
||||
const SETTLED_EXPECTED = join(SNAPSHOT_DIR, 'settled.expected.md')
|
||||
const SECTION = '[data-session-panel-section="background-jobs"]'
|
||||
const MODE = webSnapshotMode()
|
||||
const SEED_ID = 'background-job-list-web-e2e'
|
||||
// A hold on a barrier file the test owns in the job's cwd: the process never
|
||||
@@ -81,12 +82,18 @@ describe.skipIf(MODE === 'record')('web e2e: background job list', () => {
|
||||
await scaffold?.close()
|
||||
})
|
||||
|
||||
it('shows a running background job in the header without a refresh, then kills it from the two-press stop control', async () => {
|
||||
it('shows a running background job in the Session panel without a refresh, then kills it from the two-press stop control', async () => {
|
||||
let phase = 'running'
|
||||
onTestFailed(() => saveFailureShot(page, `web-e2e-background-job-${phase}`))
|
||||
// Polling for zero would pass at t=0 before delivery and prove nothing.
|
||||
const trigger = page.getByRole('button', { name: '1 background job', exact: true })
|
||||
expect(await trigger.count()).toBe(0)
|
||||
const toggle = sessionPanelToggle(page)
|
||||
const section = (await showSessionPanel(page)).locator(SECTION)
|
||||
const list = section.getByRole('list', { name: 'Background jobs' })
|
||||
// The mounted section keeps the roster stream open but renders no rows
|
||||
// yet, so the panel hides it with its title. A one-shot check: polling for
|
||||
// zero would pass at t=0 before delivery and prove nothing.
|
||||
expect(await section.count()).toBe(1)
|
||||
expect(await section.isVisible()).toBe(false)
|
||||
expect(await list.count()).toBe(0)
|
||||
|
||||
const started = await executeToolFixture(scaffold.ctx, {
|
||||
signal: new AbortController().signal,
|
||||
@@ -100,31 +107,19 @@ describe.skipIf(MODE === 'record')('web e2e: background job list', () => {
|
||||
if (matched === null) throw new Error(`background bash reported no job id: ${reported}`)
|
||||
const jobId = JobId(matched[0])
|
||||
|
||||
await trigger.waitFor({ timeout: 15_000 })
|
||||
expect(await trigger.locator('[data-state="ongoing"]').count()).toBe(1)
|
||||
expect(await trigger.locator('[data-icon="dsw-icon-chevron-down-outline-regular"]').count()).toBe(0)
|
||||
await trigger.hover()
|
||||
const list = page.getByRole('list', { name: 'Background jobs' })
|
||||
const row = list.getByRole('listitem').first()
|
||||
await row.waitFor({ timeout: 10_000 })
|
||||
await row.waitFor({ timeout: 15_000 })
|
||||
await expect.poll(() => row.textContent()).toContain(COMMAND)
|
||||
expect(await trigger.getAttribute('aria-expanded')).toBe('true')
|
||||
await row.hover()
|
||||
await row.getByRole('button', { name: /Show live output/ }).focus()
|
||||
await page.mouse.move(2, 2)
|
||||
// Focusing a menu control pins it beyond the 120ms hover-leave deadline.
|
||||
await page.waitForTimeout(180)
|
||||
expect(await list.count()).toBe(1)
|
||||
await trigger.click()
|
||||
expect(await section.getByRole('heading', { name: 'Background jobs', level: 2 }).isVisible()).toBe(true)
|
||||
expect(await row.locator('[data-state="ongoing"]').count()).toBe(1)
|
||||
// Hiding the panel unmounts the section; showing it again lists the live job.
|
||||
await toggle.click()
|
||||
await list.waitFor({ state: 'detached' })
|
||||
await trigger.click()
|
||||
await list.waitFor()
|
||||
await page.mouse.move(2, 2)
|
||||
await page.waitForTimeout(180)
|
||||
expect(await list.count()).toBe(1)
|
||||
expect(await trigger.getAttribute('aria-label')).toBe('1 background job')
|
||||
await showSessionPanel(page)
|
||||
await row.waitFor({ timeout: 10_000 })
|
||||
expect(await toggle.getAttribute('aria-expanded')).toBe('true')
|
||||
|
||||
const running = await captureStableAria(page, '[class*="menu"]', scaffold.workspaceCwd, { runningJobs: 'keep' })
|
||||
const running = await captureStableAria(page, SECTION, scaffold.workspaceCwd)
|
||||
await compareOrRefreshGolden(RUNNING_EXPECTED, running, MODE)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
@@ -132,146 +127,97 @@ describe.skipIf(MODE === 'record')('web e2e: background job list', () => {
|
||||
phase = 'settled'
|
||||
// The whole human path: arm, confirm, job.kill, registry kill, jobs
|
||||
// frames flipping the row — no registry call from the test.
|
||||
const stop = page.locator('[data-kill-state]')
|
||||
const stop = section.locator('[data-kill-state]')
|
||||
await stop.waitFor({ timeout: 10_000 })
|
||||
await stop.click()
|
||||
await expect.poll(() => stop.getAttribute('data-kill-state')).toBe('armed')
|
||||
await stop.click()
|
||||
|
||||
expect(await trigger.getAttribute('aria-label')).toBe('1 background job')
|
||||
// The unclaimed report's reason lands in the settled row's detail.
|
||||
await expect.poll(
|
||||
() => page.getByRole('list', { name: 'Background jobs' }).textContent(),
|
||||
{ timeout: 15_000 },
|
||||
).toContain('cancelled by the user')
|
||||
// The unclaimed report's reason lands in the settled row's detail; presses
|
||||
// inside the overlay leave it open.
|
||||
await expect.poll(() => list.textContent(), { timeout: 15_000 }).toContain('cancelled by the user')
|
||||
expect(await toggle.getAttribute('aria-expanded')).toBe('true')
|
||||
expect(scaffold.ctx.jobs.get(jobId, agent.id).status).toBe('killed')
|
||||
|
||||
const settled = await captureStableAria(page, '[class*="menu"]', scaffold.workspaceCwd)
|
||||
const settled = await captureStableAria(page, SECTION, scaffold.workspaceCwd)
|
||||
await compareOrRefreshGolden(SETTLED_EXPECTED, settled, MODE)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
}, 90_000)
|
||||
|
||||
it('keeps the open list above the expanded right sidebar and in the header Tab order', async () => {
|
||||
it('opens the section over the conversation beside the expanded right sidebar and closes it with Escape', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-background-job-right-sidebar'))
|
||||
const trigger = page.getByRole('button', { name: '1 background job', exact: true })
|
||||
if (await trigger.getAttribute('aria-expanded') === 'true') await trigger.click()
|
||||
const toggle = sessionPanelToggle(page)
|
||||
await page.getByRole('button', { name: 'Open right sidebar' }).click()
|
||||
const sidebar = page.locator('[data-rightbar-col]')
|
||||
// A toggle holds data-animating on the frame until its tracks settle.
|
||||
await expect.poll(() => sidebar.evaluate(column => column.parentElement?.hasAttribute('data-animating'))).toBe(false)
|
||||
await trigger.click()
|
||||
const list = page.getByRole('list', { name: 'Background jobs' })
|
||||
await list.waitFor({ timeout: 10_000 })
|
||||
// The list crosses into the sidebar column, so the hit test below covers it.
|
||||
const [menuBox, sidebarBox] = await Promise.all([list.boundingBox(), sidebar.boundingBox()])
|
||||
if (menuBox === null || sidebarBox === null) throw new Error('job list geometry is unavailable')
|
||||
expect(menuBox.x + menuBox.width).toBeGreaterThan(sidebarBox.x)
|
||||
// Every corner of the list hit-tests to the list itself; the inset clears its rounded corners.
|
||||
const covered = await list.evaluate((menu) => {
|
||||
const rect = menu.getBoundingClientRect()
|
||||
const panel = await showSessionPanel(page)
|
||||
expect(await panel.getAttribute('data-session-panel')).toBe('overlay')
|
||||
const section = panel.locator(SECTION)
|
||||
const settledToggle = section.getByRole('button', { name: 'Finished 1', exact: true })
|
||||
await settledToggle.waitFor({ timeout: 10_000 })
|
||||
// The overlay stays in the conversation body, clear of the sidebar column.
|
||||
const [panelBox, sidebarBox] = await Promise.all([panel.boundingBox(), sidebar.boundingBox()])
|
||||
if (panelBox === null || sidebarBox === null) throw new Error('Session panel geometry is unavailable')
|
||||
expect(panelBox.x + panelBox.width).toBeLessThanOrEqual(sidebarBox.x)
|
||||
// Every corner of the panel hit-tests to the panel itself; the inset clears its rounded corners.
|
||||
const covered = await panel.evaluate((element) => {
|
||||
const rect = element.getBoundingClientRect()
|
||||
const inset = 20
|
||||
const points: Array<[number, number]> = [
|
||||
[rect.left + inset, rect.top + inset], [rect.right - inset, rect.top + inset],
|
||||
[rect.left + inset, rect.bottom - inset], [rect.right - inset, rect.bottom - inset],
|
||||
]
|
||||
return points.filter(([x, y]) => !menu.contains(document.elementFromPoint(x, y)))
|
||||
return points.filter(([x, y]) => !element.contains(document.elementFromPoint(x, y)))
|
||||
})
|
||||
expect(covered).toEqual([])
|
||||
|
||||
// Keyboard order matches the in-place list: the trigger leads into the
|
||||
// list, and Tab off its last control reaches the control after the trigger.
|
||||
const after = await trigger.evaluate((node) => {
|
||||
const all = [...document.querySelectorAll<HTMLElement>('button, a[href], [tabindex]:not([tabindex="-1"])')]
|
||||
const outside = all.filter(el => el.closest('[aria-label="Background jobs"]') === null && el.tabIndex >= 0)
|
||||
return outside[outside.indexOf(node as HTMLElement) + 1]?.outerHTML.slice(0, 120)
|
||||
})
|
||||
expect(after).toMatch(/^<button/)
|
||||
await trigger.focus()
|
||||
await page.keyboard.press('Tab')
|
||||
expect(await list.evaluate(menu => menu.contains(document.activeElement))).toBe(true)
|
||||
const controls = await list.evaluate(menu => menu.querySelectorAll('button:not(:disabled)').length)
|
||||
for (let i = 1; i < controls; i += 1) await page.keyboard.press('Tab')
|
||||
await page.keyboard.press('Tab')
|
||||
expect(await page.evaluate(() => document.activeElement?.outerHTML.slice(0, 120))).toBe(after)
|
||||
await trigger.focus()
|
||||
await page.keyboard.press('Tab')
|
||||
// Escape from a control in the section closes the overlay and returns focus to the toggle.
|
||||
await settledToggle.focus()
|
||||
await page.keyboard.press('Escape')
|
||||
await list.waitFor({ state: 'detached', timeout: 10_000 })
|
||||
expect(await trigger.evaluate(node => node === document.activeElement)).toBe(true)
|
||||
await panel.waitFor({ state: 'detached', timeout: 10_000 })
|
||||
expect(await toggle.getAttribute('aria-expanded')).toBe('false')
|
||||
expect(await toggle.evaluate(node => node === document.activeElement)).toBe(true)
|
||||
}, 60_000)
|
||||
|
||||
it('keeps the compact Layers trigger focused and opens jobs only on click or keyboard', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-background-job-compact-trigger'))
|
||||
const trigger = page.getByRole('button', { name: '1 background job', exact: true })
|
||||
const list = page.getByRole('list', { name: 'Background jobs' })
|
||||
const count = trigger.locator('[data-job-count]')
|
||||
it('fits the section into the narrow overlay and closes it on a press outside', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-background-job-narrow-overlay'))
|
||||
const toggle = sessionPanelToggle(page)
|
||||
const viewport = page.viewportSize()!
|
||||
await page.getByRole('button', { name: 'Collapse right sidebar', exact: true }).click()
|
||||
await expect.poll(() => page.locator('[data-rightbar-col]')
|
||||
.evaluate(column => column.parentElement?.hasAttribute('data-animating'))).toBe(false)
|
||||
await page.getByRole('button', { name: 'Open right sidebar', exact: true }).waitFor()
|
||||
await page.mouse.move(2, 2)
|
||||
expect(await count.isVisible()).toBe(true)
|
||||
expect(await trigger.locator('[data-icon="dsw-icon-layers-outline-regular"]').count()).toBe(1)
|
||||
expect(await trigger.locator('svg').count()).toBe(1)
|
||||
expect(await trigger.locator('svg').evaluate((element) => {
|
||||
const bounds = element.getBoundingClientRect()
|
||||
return [bounds.width, bounds.height]
|
||||
})).toEqual([14, 14])
|
||||
await trigger.focus()
|
||||
const original = await trigger.elementHandle()
|
||||
if (original === null) throw new Error('Background jobs trigger is missing')
|
||||
await toggle.focus()
|
||||
const original = await toggle.elementHandle()
|
||||
if (original === null) throw new Error('Session panel toggle is missing')
|
||||
try {
|
||||
await page.setViewportSize({ width: 390, height: 700 })
|
||||
await expect.poll(() => count.evaluate(element => getComputedStyle(element).display)).toBe('none')
|
||||
expect(await original.evaluate(element => element.isConnected && element === document.activeElement)).toBe(true)
|
||||
const expandSidebar = page.locator('[data-sidebar-right-expand]')
|
||||
const compactStyles = await Promise.all([trigger, expandSidebar].map(control => control.evaluate((element) => {
|
||||
const style = getComputedStyle(element)
|
||||
const bounds = element.getBoundingClientRect()
|
||||
const icon = element.querySelector('svg')!.getBoundingClientRect()
|
||||
return { width: bounds.width, height: bounds.height, padding: style.padding, radius: style.borderRadius,
|
||||
color: style.color, iconWidth: icon.width, iconHeight: icon.height }
|
||||
})))
|
||||
expect(compactStyles[0]).toEqual(compactStyles[1])
|
||||
expect(compactStyles[0]).toMatchObject({ width: 28, height: 28, padding: '0px', iconWidth: 15, iconHeight: 15 })
|
||||
expect(await trigger.evaluate(element => getComputedStyle(element.closest('[data-slot="conversation.session.header.actions"]')!.parentElement!).gap)).toBe('8px')
|
||||
await expandSidebar.hover()
|
||||
const expandHover = await expandSidebar.evaluate((element) => {
|
||||
const style = getComputedStyle(element)
|
||||
return { background: style.backgroundColor, color: style.color }
|
||||
})
|
||||
await expect.poll(() => trigger.evaluate((element) => {
|
||||
const bounds = element.getBoundingClientRect()
|
||||
return element.contains(document.elementFromPoint(bounds.left + bounds.width / 2, bounds.top + bounds.height / 2))
|
||||
})).toBe(true)
|
||||
await trigger.hover()
|
||||
expect(await trigger.evaluate((element) => {
|
||||
const style = getComputedStyle(element)
|
||||
return { background: style.backgroundColor, color: style.color }
|
||||
})).toEqual(expandHover)
|
||||
expect(expandHover.background).not.toBe('rgba(0, 0, 0, 0)')
|
||||
// Compact hover stays closed beyond the wide trigger's 150ms open deadline.
|
||||
await page.waitForTimeout(200)
|
||||
expect(await list.count()).toBe(0)
|
||||
await trigger.click()
|
||||
await list.waitFor()
|
||||
const panel = await showSessionPanel(page)
|
||||
expect(await panel.getAttribute('data-session-panel')).toBe('overlay')
|
||||
const list = panel.locator(SECTION).getByRole('list', { name: 'Background jobs' })
|
||||
await list.getByRole('button', { name: 'Finished 1', exact: true }).waitFor()
|
||||
await trigger.click()
|
||||
await list.waitFor({ state: 'detached' })
|
||||
await trigger.press('ArrowDown')
|
||||
await list.waitFor()
|
||||
expect(await list.getByRole('button').first().evaluate(element => element === document.activeElement)).toBe(true)
|
||||
await page.mouse.move(2, 2)
|
||||
// Keyboard activation remains pinned after leaving both trigger and menu.
|
||||
await page.waitForTimeout(180)
|
||||
expect(await list.count()).toBe(1)
|
||||
await page.mouse.click(2, 2)
|
||||
await list.waitFor({ state: 'detached' })
|
||||
expect(await trigger.getAttribute('aria-expanded')).toBe('false')
|
||||
// The long command truncates inside its row instead of widening the panel past the viewport.
|
||||
const fit = await panel.evaluate((element) => {
|
||||
const rect = element.getBoundingClientRect()
|
||||
const rows = [...element.querySelectorAll<HTMLElement>('[data-jobs-section] li')]
|
||||
return {
|
||||
inViewport: rect.left >= 0 && rect.right <= innerWidth,
|
||||
panelOverflow: element.scrollWidth > element.clientWidth,
|
||||
rowOverflow: rows.some(row => row.getBoundingClientRect().right > rect.right),
|
||||
}
|
||||
})
|
||||
expect(fit).toEqual({ inViewport: true, panelOverflow: false, rowOverflow: false })
|
||||
// The overlay's inline margin is transcript: a press there is outside the panel.
|
||||
const box = await panel.boundingBox()
|
||||
if (box === null) throw new Error('Session panel geometry is unavailable')
|
||||
expect(box.x).toBeGreaterThan(4)
|
||||
await page.mouse.click(box.x / 2, box.y + box.height / 2)
|
||||
await panel.waitFor({ state: 'detached' })
|
||||
expect(await toggle.getAttribute('aria-expanded')).toBe('false')
|
||||
} finally {
|
||||
await page.keyboard.press('Escape')
|
||||
await page.setViewportSize(viewport)
|
||||
await original.dispose()
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
- button "本地变更"
|
||||
- text: HEAD → origin/main
|
||||
- button "查看本会话的变更:1 个文件,新增 1 行,删除 0 行": +1 −0 1 个文件
|
||||
- button "创建变更请求"
|
||||
- button "查看本会话的变更:1 个文件,新增 1 行,删除 0 行": 本地变更 · 1 个文件
|
||||
- text: +1 −0
|
||||
- button "本地变更操作"
|
||||
@@ -1,20 +1,23 @@
|
||||
- text: feat 项目目录
|
||||
- button "复制项目目录路径"
|
||||
- button "本地变更"
|
||||
- text: HEAD → origin/main
|
||||
- button "查看本会话的变更:4 个文件,新增 4 行,删除 1 行": +4 −1 4 个文件
|
||||
- heading "本会话的变更请求 · 1" [level=3]
|
||||
- button "刷新状态"
|
||||
- list:
|
||||
- listitem:
|
||||
- img "变更请求状态:需要处理"
|
||||
- link "Add the pull request panel":
|
||||
- /url: https://github.com/octo/demo/pull/7
|
||||
- text: "#7 feat → main"
|
||||
- button "在浏览器中打开"
|
||||
- button "复制变更请求链接"
|
||||
- 'button "从本会话移除 #7"'
|
||||
- 'button "收起 #7" [expanded]'
|
||||
- button "检查 已加载 1 项检查,仍有更多"
|
||||
- text: 评审 等待评审 · 1 条未解决讨论 合并 无冲突
|
||||
- 'button "查看 #7 的变更:新增 128 行,删除 14 行"': 变更 +128 −14
|
||||
- complementary "会话面板":
|
||||
- region "环境":
|
||||
- heading "环境" [level=2]
|
||||
- button "刷新状态"
|
||||
- text: {{cwd}}/workspace feat 项目目录
|
||||
- button "查看本会话的变更:4 个文件,新增 4 行,删除 1 行": 本地变更 · 4 个文件
|
||||
- text: +4 −1
|
||||
- button "本地变更操作"
|
||||
- region "变更请求":
|
||||
- heading "变更请求" [level=2]
|
||||
- text: "1"
|
||||
- button "刷新状态"
|
||||
- list:
|
||||
- listitem:
|
||||
- img "变更请求状态:需要处理"
|
||||
- link "Add the pull request panel":
|
||||
- /url: https://github.com/octo/demo/pull/7
|
||||
- text: "#7 feat → main"
|
||||
- button "#7 的操作"
|
||||
- 'button "收起 #7" [expanded]'
|
||||
- button "检查 已加载 1 项检查,仍有更多"
|
||||
- text: 评审 等待评审 · 1 条未解决讨论 合并 无冲突
|
||||
- 'button "查看 #7 的变更:新增 128 行,删除 14 行"': 变更 +128 −14
|
||||
@@ -1,4 +1,3 @@
|
||||
- button "Local changes"
|
||||
- text: HEAD → origin/main
|
||||
- 'button "View the changes of this Session: 60 files, 60 lines added, 0 lines deleted"': +60 −0 60 files
|
||||
- button "Create change request"
|
||||
- 'button "View the changes of this Session: 60 files, 60 lines added, 0 lines deleted"': Local changes · 60 files
|
||||
- text: +60 −0
|
||||
- button "Local changes actions"
|
||||
@@ -1,17 +1,20 @@
|
||||
- text: dsh-{{worktree}} 工作树 · 基于 release
|
||||
- button "复制工作树路径"
|
||||
- heading "本会话的变更请求 · 1" [level=3]
|
||||
- button "刷新状态"
|
||||
- list:
|
||||
- listitem:
|
||||
- img "变更请求状态:需要处理"
|
||||
- link "Add the pull request panel":
|
||||
- /url: https://github.com/octo/demo/pull/7
|
||||
- text: "#7 feat → main"
|
||||
- button "在浏览器中打开"
|
||||
- button "复制变更请求链接"
|
||||
- 'button "从本会话移除 #7"'
|
||||
- 'button "收起 #7" [expanded]'
|
||||
- button "检查 已加载 1 项检查,仍有更多"
|
||||
- text: 评审 等待评审 · 1 条未解决讨论 合并 无冲突
|
||||
- 'button "查看 #7 的变更:新增 128 行,删除 14 行"': 变更 +128 −14
|
||||
- complementary "会话面板":
|
||||
- region "环境":
|
||||
- heading "环境" [level=2]
|
||||
- button "刷新状态"
|
||||
- text: {{cwd}}/workspace dsh-{{worktree}} 工作树 · 基于 release
|
||||
- region "变更请求":
|
||||
- heading "变更请求" [level=2]
|
||||
- text: "1"
|
||||
- button "刷新状态"
|
||||
- list:
|
||||
- listitem:
|
||||
- img "变更请求状态:需要处理"
|
||||
- link "Add the pull request panel":
|
||||
- /url: https://github.com/octo/demo/pull/7
|
||||
- text: "#7 feat → main"
|
||||
- button "#7 的操作"
|
||||
- 'button "收起 #7" [expanded]'
|
||||
- button "检查 已加载 1 项检查,仍有更多"
|
||||
- text: 评审 等待评审 · 1 条未解决讨论 合并 无冲突
|
||||
- 'button "查看 #7 的变更:新增 128 行,删除 14 行"': 变更 +128 −14
|
||||
@@ -3,9 +3,7 @@
|
||||
- link "Add the pull request panel":
|
||||
- /url: https://github.com/octo/demo/pull/7
|
||||
- text: "#7 feat → main"
|
||||
- button "在浏览器中打开"
|
||||
- button "复制变更请求链接"
|
||||
- 'button "从本会话移除 #7"'
|
||||
- button "#7 的操作"
|
||||
- 'button "收起 #7" [expanded]'
|
||||
- button "检查 已加载 1 项检查,仍有更多"
|
||||
- text: 评审 等待评审 · 1 条未解决讨论 合并 无冲突
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
# Background jobs above the Browser dock
|
||||
|
||||
```json
|
||||
{
|
||||
"collapsed": {
|
||||
"dockMode": "push",
|
||||
"bodyMounted": true,
|
||||
"fixed": true,
|
||||
"anchored": true,
|
||||
"viewportBounded": true,
|
||||
"overlapsBrowser": true,
|
||||
"aboveBrowser": true
|
||||
},
|
||||
"expanded": {
|
||||
"dockMode": "push",
|
||||
"bodyMounted": true,
|
||||
"fixed": true,
|
||||
"anchored": true,
|
||||
"viewportBounded": true,
|
||||
"overlapsBrowser": true,
|
||||
"aboveBrowser": true
|
||||
},
|
||||
"resized": {
|
||||
"dockMode": "push",
|
||||
"bodyMounted": true,
|
||||
"fixed": true,
|
||||
"anchored": true,
|
||||
"viewportBounded": true,
|
||||
"overlapsBrowser": true,
|
||||
"aboveBrowser": true
|
||||
},
|
||||
"escapeRestoresFocus": true,
|
||||
"outsideDismisses": true
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,38 @@
|
||||
# Background jobs beside the Browser dock
|
||||
|
||||
```json
|
||||
{
|
||||
"collapsed": {
|
||||
"dockMode": "push",
|
||||
"presentation": "overlay",
|
||||
"insideBody": true,
|
||||
"clearOfBrowser": true,
|
||||
"clearOfComposer": true,
|
||||
"viewportBounded": true,
|
||||
"sectionShown": true,
|
||||
"onTop": true
|
||||
},
|
||||
"expanded": {
|
||||
"dockMode": "push",
|
||||
"presentation": "overlay",
|
||||
"insideBody": true,
|
||||
"clearOfBrowser": true,
|
||||
"clearOfComposer": true,
|
||||
"viewportBounded": true,
|
||||
"sectionShown": true,
|
||||
"onTop": true
|
||||
},
|
||||
"resized": {
|
||||
"dockMode": "push",
|
||||
"presentation": "overlay",
|
||||
"insideBody": true,
|
||||
"clearOfBrowser": true,
|
||||
"clearOfComposer": true,
|
||||
"viewportBounded": true,
|
||||
"sectionShown": true,
|
||||
"onTop": true
|
||||
},
|
||||
"escapeRestoresFocus": true,
|
||||
"outsideDismisses": true
|
||||
}
|
||||
```
|
||||
@@ -1,7 +1,6 @@
|
||||
- banner:
|
||||
- navigation "Session hierarchy": Delegate a background job.
|
||||
- button "1 subagent"
|
||||
- button "1 background job"
|
||||
- button "Session panel"
|
||||
- button "More actions"
|
||||
- button "Open right sidebar"
|
||||
- tablist:
|
||||
|
||||
@@ -10,13 +10,15 @@ import { pluginRecordOf, type SessionEvent } from '@deepseek-ai/dsh-session'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import { initialShortcutConfig, type DesktopShortcutInput, type ShortcutRevision } from '@deepseek-ai/dsh-client-shortcuts/protocol'
|
||||
import { abbreviateHomePath } from '@deepseek-ai/dsh-util-workspace-path'
|
||||
import { chromium, type Browser, type Page } from 'playwright'
|
||||
import { chromium, type Browser, type Locator, type Page } from 'playwright'
|
||||
import { expect, it, onTestFailed, onTestFinished } from 'vitest'
|
||||
import {
|
||||
captureStableAria, compareOrRefreshGolden, fixtureUserPrompts, launchWebScaffold, readPersistedEvents, watchConsole,
|
||||
webSnapshotMode, type WebScaffold,
|
||||
} from './scaffold.ts'
|
||||
import { connectFreshWorkspaceZh, saveFailureShot, writeComposerDraft, ZH_BROWSER_LOCALE } from './support.ts'
|
||||
import {
|
||||
connectFreshWorkspaceZh, hideSessionPanel, saveFailureShot, sessionPanelToggle, showSessionPanel, writeComposerDraft, ZH_BROWSER_LOCALE,
|
||||
} from './support.ts'
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
@@ -373,6 +375,21 @@ async function sendPrompt(page: Page, scaffold: WebScaffold): Promise<{ readonly
|
||||
return { prompt, settled }
|
||||
}
|
||||
|
||||
/**
|
||||
* Choose an item from the More menu of a change request card.
|
||||
* @param page - the page under test.
|
||||
* @param change - the card.
|
||||
* @param name - the card's name in the menu button, such as `#7`.
|
||||
* @param item - the item to choose.
|
||||
*/
|
||||
async function chooseCardAction(page: Page, change: Locator, name: string, item: string): Promise<void> {
|
||||
await change.getByRole('button', { name: `${name} 的操作`, exact: true }).click()
|
||||
await page.getByRole('menuitem', { name: item, exact: true }).click()
|
||||
}
|
||||
|
||||
/** Accessible name of the panel toggle while a change request needs attention. */
|
||||
const TOGGLE_ATTENTION = '会话面板 本会话的变更请求需要处理'
|
||||
|
||||
function worktreeRecords(events: readonly SessionEvent[]): unknown[] {
|
||||
return events.flatMap((event) => {
|
||||
const record = pluginRecordOf(event)
|
||||
@@ -388,9 +405,9 @@ it.skipIf(MODE === 'record')('reads local Git with full access when the sandbox
|
||||
const { settled } = await sendPrompt(page, scaffold)
|
||||
const sessionId = await settled
|
||||
await page.getByText('LIGHTHOUSE', { exact: true }).waitFor()
|
||||
await page.locator('[data-forge-header]').click()
|
||||
const panel = page.locator('[data-forge-panel]')
|
||||
await panel.getByText('无法读取 Git 信息', { exact: true }).waitFor({ timeout: 20_000 })
|
||||
const panel = await showSessionPanel(page)
|
||||
const failed = panel.locator('[data-forge-checkout][data-failed]')
|
||||
await failed.getByText('无法读取 Git 信息', { exact: true }).waitFor({ timeout: 20_000 })
|
||||
|
||||
const permission = page.locator('button[aria-label^="访问模式"]').first()
|
||||
await permission.click()
|
||||
@@ -398,6 +415,7 @@ it.skipIf(MODE === 'record')('reads local Git with full access when the sandbox
|
||||
const confirmation = page.getByRole('dialog', { name: '确认启用完全权限?' })
|
||||
await confirmation.getByRole('checkbox', { name: '我已了解风险,并愿意继续' }).check()
|
||||
await confirmation.getByRole('button', { name: '启用完全权限' }).click()
|
||||
await showSessionPanel(page)
|
||||
const local = page.locator('[data-forge-local]')
|
||||
await local.getByRole('button', { name: '查看本会话的变更:1 个文件,新增 1 行,删除 0 行', exact: true }).waitFor({ timeout: 20_000 })
|
||||
await compareOrRefreshGolden(join(EXPECTED, 'full-access.expected.md'), await captureStableAria(page, '[data-forge-local]', scaffold.workspaceCwd), MODE)
|
||||
@@ -406,8 +424,8 @@ it.skipIf(MODE === 'record')('reads local Git with full access when the sandbox
|
||||
|
||||
await permission.click()
|
||||
await page.getByRole('menuitem', { name: '工作区内修改', exact: true }).click()
|
||||
if (!await panel.isVisible()) await page.locator('[data-forge-header]').click()
|
||||
await panel.getByText('无法读取 Git 信息', { exact: true }).waitFor({ timeout: 20_000 })
|
||||
await showSessionPanel(page)
|
||||
await failed.getByText('无法读取 Git 信息', { exact: true }).waitFor({ timeout: 20_000 })
|
||||
await expect.poll(async () => (await readPersistedEvents(scaffold, sessionId))
|
||||
.filter(event => event.type === 'sandbox/mode').map(event => event.data.mode).slice(-2))
|
||||
.toEqual(['danger-full-access', 'workspace-write'])
|
||||
@@ -423,7 +441,7 @@ it.skipIf(MODE === 'record')('reports incomplete filter configuration and retrie
|
||||
const { settled } = await sendPrompt(page, scaffold)
|
||||
await settled
|
||||
await page.getByText('LIGHTHOUSE', { exact: true }).waitFor()
|
||||
await page.locator('[data-forge-header]').click()
|
||||
await showSessionPanel(page)
|
||||
const openChanges = page.locator('[data-forge-local]').getByRole('button', { name: '查看本会话的变更:1 个文件,新增 1 行,删除 0 行', exact: true })
|
||||
await openChanges.waitFor({ timeout: 20_000 })
|
||||
const key = `filter.${'long'.repeat(200)}.clean`
|
||||
@@ -452,9 +470,8 @@ it.skipIf(MODE === 'record')('automatically shows a numbered PR when gh JSON omi
|
||||
const toolOutput = events.flatMap(event => event.type === 'tool/result'
|
||||
? event.data.message.content.flatMap(block => block.type === 'text' ? [block.text] : []) : []).join('\n')
|
||||
expect(toolOutput).toContain('Add the pull request panel')
|
||||
const header = page.locator('[data-forge-header]')
|
||||
await expect.poll(() => header.getAttribute('aria-label'), { timeout: 20_000 }).toBe('本会话的变更请求需要处理')
|
||||
await header.click()
|
||||
await page.getByRole('button', { name: TOGGLE_ATTENTION, exact: true }).waitFor({ timeout: 20_000 })
|
||||
await showSessionPanel(page)
|
||||
const change = page.locator(`[data-forge-change="${PULL}"]`)
|
||||
await change.getByRole('link', { name: 'Add the pull request panel', exact: true }).waitFor({ timeout: 20_000 })
|
||||
await change.getByText('等待评审 · 1 条未解决讨论', { exact: true }).waitFor()
|
||||
@@ -507,9 +524,8 @@ it.skipIf(MODE === 'record')('starts a Session in a worktree before its first me
|
||||
|
||||
// A change request bound the way a `gh pr create` result binds one.
|
||||
scaffold.ctx.forgeSession.track(session, PULL)
|
||||
const header = page.locator('[data-forge-header]')
|
||||
await expect.poll(() => header.getAttribute('aria-label'), { timeout: 20_000 }).toBe('本会话的变更请求需要处理')
|
||||
expect(await header.getAttribute('aria-pressed')).toBe('false')
|
||||
await page.getByRole('button', { name: TOGGLE_ATTENTION, exact: true }).waitFor({ timeout: 20_000 })
|
||||
expect(await sessionPanelToggle(page).getAttribute('aria-expanded')).toBe('false')
|
||||
|
||||
// The Session row marks the worktree and its change request's state, and its hover card names both.
|
||||
const row = page.locator(`[data-row-key="session:${sessionId}"]`)
|
||||
@@ -527,9 +543,7 @@ it.skipIf(MODE === 'record')('starts a Session in a worktree before its first me
|
||||
await captureStableAria(page, '[data-forge-session-hover]', scaffold.workspaceCwd, { replacements: [[branch, 'dsh-{{worktree}}']] }), MODE)
|
||||
await page.mouse.move(0, 0)
|
||||
await rowHover.waitFor({ state: 'detached' })
|
||||
await header.click()
|
||||
await expect.poll(() => header.getAttribute('aria-pressed')).toBe('true')
|
||||
const panel = page.locator('[data-forge-panel]')
|
||||
const panel = await showSessionPanel(page)
|
||||
const checkout = panel.locator('[data-forge-checkout]')
|
||||
const checkoutName = checkout.getByText(branch, { exact: true })
|
||||
await checkoutName.waitFor({ timeout: 20_000 })
|
||||
@@ -544,7 +558,7 @@ it.skipIf(MODE === 'record')('starts a Session in a worktree before its first me
|
||||
await change.getByText('等待评审 · 1 条未解决讨论', { exact: true }).waitFor()
|
||||
// The random branch suffix can read as a duration, so the branch is replaced before the capture normalizes durations.
|
||||
await compareOrRefreshGolden(join(EXPECTED, 'panel.expected.md'),
|
||||
await captureStableAria(page, '[data-forge-panel]', scaffold.workspaceCwd, { replacements: [[branch, 'dsh-{{worktree}}']] }), MODE)
|
||||
await captureStableAria(page, '[data-session-panel]', scaffold.workspaceCwd, { replacements: [[branch, 'dsh-{{worktree}}']] }), MODE)
|
||||
const beforeChecks = (await readFile(join(root, 'calls.jsonl'), 'utf8')).trim().split('\n').map(line => JSON.parse(line) as string[])
|
||||
expect(beforeChecks.some(args => args.includes('id=rollup-7'))).toBe(false)
|
||||
const checksRow = change.getByRole('button', { name: /^检查/ })
|
||||
@@ -561,18 +575,18 @@ it.skipIf(MODE === 'record')('starts a Session in a worktree before its first me
|
||||
const record = pluginRecordOf(event)
|
||||
return record?.type === 'plugin:forge-session/binding' ? [record.data] : []
|
||||
})
|
||||
await change.getByRole('button', { name: '从本会话移除 #7', exact: true }).click()
|
||||
await chooseCardAction(page, change, '#7', '从本会话移除')
|
||||
await change.waitFor({ state: 'detached' })
|
||||
await panel.getByText('本会话还没有变更请求', { exact: true }).waitFor()
|
||||
await panel.locator('[data-session-panel-section="change-requests"]').waitFor({ state: 'hidden' })
|
||||
await page.getByRole('alert').filter({ hasText: '已从本会话移除 #7' }).getByRole('button', { name: '撤销', exact: true }).click()
|
||||
await showSessionPanel(page)
|
||||
await title.waitFor({ timeout: 20_000 })
|
||||
await expect.poll(bindings).toEqual([{ action: 'track', url: PULL }, { action: 'dismiss', url: PULL }, { action: 'track', url: PULL }])
|
||||
|
||||
const calls = (await readFile(join(root, 'calls.jsonl'), 'utf8')).trim().split('\n').map(line => JSON.parse(line) as string[])
|
||||
expect(calls).toContainEqual(['auth', 'status', '--hostname', 'github.com'])
|
||||
expect(calls.some(args => args[0] === 'api' && args[1] === 'graphql' && args.includes('--hostname'))).toBe(true)
|
||||
await header.click()
|
||||
await expect.poll(() => header.getAttribute('aria-pressed')).toBe('false')
|
||||
await hideSessionPanel(page)
|
||||
|
||||
// Removing the worktree outside the Session holds the next message in the inbox until the worktree is restored.
|
||||
await git(project, 'worktree', 'remove', '--force', directory)
|
||||
@@ -585,6 +599,7 @@ it.skipIf(MODE === 'record')('starts a Session in a worktree before its first me
|
||||
const missing = page.locator('[data-forge-missing]')
|
||||
await missing.getByText(`可以在原位置恢复分支 ${branch} 的工作树。删除前未提交的修改无法恢复`, { exact: true }).waitFor()
|
||||
await missing.getByText('恢复工作树或在项目目录继续后,消息会接着发送', { exact: true }).waitFor()
|
||||
await showSessionPanel(page)
|
||||
await expect.poll(() => checkout.getAttribute('data-missing')).toBe('')
|
||||
const turns = async (): Promise<number> => (await readPersistedEvents(scaffold, sessionId)).filter(event => event.type === 'turn/start').length
|
||||
expect(await turns()).toBe(1)
|
||||
@@ -593,6 +608,7 @@ it.skipIf(MODE === 'record')('starts a Session in a worktree before its first me
|
||||
await page.getByRole('alert').filter({ hasText: '工作树已恢复' }).waitFor()
|
||||
expect(await git(directory, 'rev-parse', '--abbrev-ref', 'HEAD')).toBe(branch)
|
||||
expect(await git(directory, 'rev-parse', 'HEAD')).toBe(baseCommit)
|
||||
await showSessionPanel(page)
|
||||
await expect.poll(() => checkout.getAttribute('data-missing')).toBeNull()
|
||||
// The waiting message goes on in the restored worktree.
|
||||
await page.getByText(FOLLOW_UP_REPLY, { exact: true }).waitFor({ timeout: 20_000 })
|
||||
@@ -629,8 +645,7 @@ it.skipIf(MODE === 'record')('keeps the first message waiting when the worktree
|
||||
expect(worktreeRecords(events)).toEqual([{ action: 'request', from: 'main' }, { action: 'request', from: 'release' }, { action: 'cancel' }])
|
||||
expect(events.filter(event => event.type === 'turn/start')).toHaveLength(1)
|
||||
expect(events.some(event => event.type === 'user/message' && event.data.source.kind === 'working-directory')).toBe(false)
|
||||
await page.locator('[data-forge-header]').click({ timeout: 20_000 })
|
||||
const checkout = page.locator('[data-forge-panel] [data-forge-checkout]')
|
||||
const checkout = (await showSessionPanel(page)).locator('[data-forge-checkout]')
|
||||
const checkoutName = checkout.getByText('main', { exact: true })
|
||||
await checkoutName.waitFor({ timeout: 20_000 })
|
||||
await checkout.getByText('项目目录', { exact: true }).waitFor()
|
||||
@@ -649,14 +664,12 @@ it.skipIf(MODE === 'record')('marks a draft change request ready for review and
|
||||
if (session === undefined) throw new Error('The Session must stay loaded')
|
||||
|
||||
scaffold.ctx.forgeSession.track(session, DRAFT)
|
||||
const header = page.locator('[data-forge-header]')
|
||||
await expect.poll(() => header.getAttribute('aria-label'), { timeout: 20_000 }).toBe('本会话的变更请求')
|
||||
await header.click()
|
||||
await showSessionPanel(page)
|
||||
const change = page.locator(`[data-forge-change="${DRAFT}"]`)
|
||||
await change.getByRole('link', { name: 'Add the merge button', exact: true }).waitFor({ timeout: 20_000 })
|
||||
|
||||
// The only open change request starts expanded, so its action is in view.
|
||||
await change.getByRole('button', { name: '标记为可评审', exact: true }).click()
|
||||
// The only open change request starts expanded, so its Merge action shows once it is ready.
|
||||
await chooseCardAction(page, change, '#9', '标记为可评审')
|
||||
await page.getByRole('alert').filter({ hasText: '已将 #9 标记为可评审' }).waitFor()
|
||||
const merge = change.getByRole('button', { name: '合并', exact: true })
|
||||
await merge.waitFor({ timeout: 20_000 })
|
||||
@@ -709,18 +722,11 @@ it.skipIf(MODE === 'record')('shows the local changes of the Session by scope an
|
||||
await page.getByText('LIGHTHOUSE', { exact: true }).waitFor()
|
||||
const session = scaffold.ctx.sessions.get(sessionId)
|
||||
if (session === undefined) throw new Error('The Session must stay loaded')
|
||||
const header = page.locator('[data-forge-header]')
|
||||
await page.getByRole('button', { name: '打开右侧边栏', exact: true }).click()
|
||||
const guide = page.locator('[data-sidebar-right-guide]')
|
||||
await guide.getByRole('button', { name: /^代码审查和变更/ }).waitFor()
|
||||
await compareOrRefreshGolden(join(EXPECTED, 'review-guide.expected.md'),
|
||||
await captureStableAria(page, '[data-sidebar-right-guide-entry="forge-panel"]', scaffold.workspaceCwd), MODE)
|
||||
await guide.getByRole('button', { name: /^代码审查和变更/ }).click()
|
||||
const environment = (await showSessionPanel(page)).locator('[data-session-panel-section="environment"]')
|
||||
// The New Session screen inspected the checkout before these changes, which came from outside the Session.
|
||||
await page.locator('[data-forge-panel]').getByRole('button', { name: '刷新状态', exact: true }).click()
|
||||
await environment.getByRole('button', { name: '刷新状态', exact: true }).click()
|
||||
const card = page.locator('[data-forge-local]')
|
||||
await card.getByText('HEAD → origin/main', { exact: true }).waitFor({ timeout: 20_000 })
|
||||
await card.getByRole('button', { name: '查看本会话的变更:4 个文件,新增 4 行,删除 1 行', exact: true }).click()
|
||||
await card.getByRole('button', { name: '查看本会话的变更:4 个文件,新增 4 行,删除 1 行', exact: true }).click({ timeout: 20_000 })
|
||||
|
||||
const local = page.locator('[data-forge-changes="local"]')
|
||||
await local.getByRole('button', { name: '基准分支:origin/main', exact: true }).waitFor({ timeout: 20_000 })
|
||||
@@ -791,18 +797,20 @@ it.skipIf(MODE === 'record')('shows the local changes of the Session by scope an
|
||||
|
||||
// A change request bound the way a `gh pr create` result binds one.
|
||||
scaffold.ctx.forgeSession.track(session, PULL)
|
||||
await expect.poll(() => header.getAttribute('aria-pressed'), { timeout: 20_000 }).toBe('false')
|
||||
await header.click()
|
||||
await showSessionPanel(page)
|
||||
const change = page.locator(`[data-forge-change="${PULL}"]`)
|
||||
await change.getByRole('link', { name: 'Add the pull request panel', exact: true }).waitFor({ timeout: 20_000 })
|
||||
await card.getByRole('button', { name: '查看本会话的变更:4 个文件,新增 4 行,删除 1 行', exact: true }).waitFor()
|
||||
expect(await card.getByRole('button', { name: '创建变更请求', exact: true }).count()).toBe(0)
|
||||
// The open change request of the checked-out branch replaces the offer to create one.
|
||||
await card.getByRole('button', { name: '本地变更操作', exact: true }).click()
|
||||
await page.getByRole('menuitem', { name: '查看变更', exact: true }).waitFor()
|
||||
expect(await page.getByRole('menuitem', { name: '创建变更请求', exact: true }).count()).toBe(0)
|
||||
await card.getByRole('button', { name: '本地变更操作', exact: true }).click()
|
||||
await compareOrRefreshGolden(join(EXPECTED, 'local-and-pr.expected.md'),
|
||||
await captureStableAria(page, '[data-forge-panel]', scaffold.workspaceCwd), MODE)
|
||||
await captureStableAria(page, '[data-session-panel]', scaffold.workspaceCwd), MODE)
|
||||
await card.getByRole('button', { name: '查看本会话的变更:4 个文件,新增 4 行,删除 1 行', exact: true }).click()
|
||||
await local.getByText('暂存区与 HEAD 比较', { exact: true }).waitFor()
|
||||
await expect.poll(() => header.getAttribute('aria-pressed')).toBe('false')
|
||||
await header.click()
|
||||
await showSessionPanel(page)
|
||||
await change.getByRole('button', { name: '查看 #7 的变更:新增 128 行,删除 14 行', exact: true }).click()
|
||||
const view = page.locator('[data-forge-changes="change"]')
|
||||
const panelFile = view.locator('[data-forge-diff-file="src/panel.ts"]')
|
||||
@@ -991,7 +999,7 @@ it.skipIf(MODE === 'record')('shows the local changes of the Session by scope an
|
||||
await page.setViewportSize({ width: 1680, height: 1000 })
|
||||
await page.locator('[data-dockkit-tab]').filter({ hasText: '#7 的变更' }).locator('[data-dockkit-tab-close]').click()
|
||||
await expect.poll(() => view.count()).toBe(0)
|
||||
if (await header.getAttribute('aria-pressed') !== 'true') await header.click()
|
||||
await showSessionPanel(page)
|
||||
await change.getByRole('button', { name: '查看 #7 的变更:新增 128 行,删除 14 行', exact: true }).click()
|
||||
await panelFile.getByRole('button', { name: '6 行未变更', exact: true }).waitFor()
|
||||
expect(await panelFile.locator('[data-forge-review-thread]').count()).toBe(0)
|
||||
@@ -1003,8 +1011,7 @@ it.skipIf(MODE === 'record')('shows the local changes of the Session by scope an
|
||||
|
||||
// GitHub refuses the diff of pull request 9 as too large, so its view offers the web page instead of a retry.
|
||||
scaffold.ctx.forgeSession.track(session, DRAFT)
|
||||
await expect.poll(() => header.getAttribute('aria-pressed'), { timeout: 20_000 }).toBe('false')
|
||||
await header.click()
|
||||
await showSessionPanel(page)
|
||||
const draft = page.locator(`[data-forge-change="${DRAFT}"]`)
|
||||
await draft.getByRole('button', { name: '展开 #9', exact: true }).click()
|
||||
await draft.getByRole('button', { name: '查看 #9 的变更:新增 30 行,删除 2 行', exact: true }).click({ timeout: 20_000 })
|
||||
@@ -1040,8 +1047,11 @@ it.skipIf(MODE === 'record')('retains a wrapped code line and tree width across
|
||||
scaffold.ctx.forgeSession.track(session, PULL)
|
||||
// Keep the file tree and the Session sidebar visible together on every platform.
|
||||
await page.setViewportSize({ width: 2400, height: 700 })
|
||||
await page.locator('[data-forge-header]').click()
|
||||
await showSessionPanel(page)
|
||||
await page.locator(`[data-forge-change="${PULL}"]`).getByRole('button', { name: /查看 #7 的变更/ }).click()
|
||||
// A start page beside the changes tab is the other tab the switches below show.
|
||||
await page.getByRole('button', { name: '新标签页', exact: true }).first().click()
|
||||
await page.getByRole('tab').filter({ hasText: '#7 的变更' }).click()
|
||||
const view = page.locator('[data-forge-changes="change"]')
|
||||
const scroll = view.locator('[data-forge-changes-scroll]')
|
||||
const file = view.locator('[data-forge-diff-file="src/server.ts"]')
|
||||
@@ -1078,7 +1088,7 @@ it.skipIf(MODE === 'record')('retains a wrapped code line and tree width across
|
||||
expect(position.line).toBe('300')
|
||||
expect(position.offset).toBe(-7)
|
||||
for (const destination of ['tab', 'session', 'tab', 'session']) {
|
||||
if (destination === 'tab') await page.getByRole('tab').filter({ hasText: '变更请求' }).click()
|
||||
if (destination === 'tab') await page.getByRole('tab').filter({ hasText: '开始' }).click()
|
||||
else await page.getByRole('button', { name: '新建会话', exact: true }).last().click()
|
||||
await expect.poll(() => view.isVisible()).toBe(false)
|
||||
await layout()
|
||||
@@ -1106,8 +1116,7 @@ it.skipIf(MODE === 'record')('uses horizontal arrows to navigate files while pre
|
||||
}
|
||||
const { settled } = await sendPrompt(page, scaffold)
|
||||
await settled
|
||||
await page.locator('[data-forge-header]').click()
|
||||
await page.locator('[data-forge-panel]').getByRole('button', { name: '刷新状态', exact: true }).click()
|
||||
await (await showSessionPanel(page)).locator('[data-session-panel-section="environment"]').getByRole('button', { name: '刷新状态', exact: true }).click()
|
||||
await page.locator('[data-forge-local]').getByRole('button', { name: /查看本会话的变更:3 个文件/ }).click()
|
||||
const view = page.locator('[data-forge-changes="local"]')
|
||||
const scroll = view.getByRole('region', { name: '全部 3 个文件', exact: true })
|
||||
@@ -1197,9 +1206,8 @@ it.skipIf(MODE === 'record')('keeps tall branch and changed-file menus aligned w
|
||||
await git(project, 'commit', '--quiet', '-m', 'long file list')
|
||||
const { settled } = await sendPrompt(page, scaffold)
|
||||
await settled
|
||||
await page.locator('[data-forge-header]').click()
|
||||
const panel = page.locator('[data-forge-panel]')
|
||||
await panel.getByRole('button', { name: '刷新状态', exact: true }).click()
|
||||
const panel = await showSessionPanel(page)
|
||||
await panel.locator('[data-session-panel-section="environment"]').getByRole('button', { name: '刷新状态', exact: true }).click()
|
||||
await panel.getByRole('button', { name: /^查看本会话的变更:60 个文件/ }).click()
|
||||
const changes = page.locator('[data-forge-changes="local"]')
|
||||
const files = changes.getByRole('button', { name: '全部 60 个文件', exact: true })
|
||||
@@ -1226,7 +1234,7 @@ it.skipIf(MODE === 'record')('keeps tall branch and changed-file menus aligned w
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
})
|
||||
|
||||
it.skipIf(MODE === 'record')('keeps localized status columns separate and long file lists inside one vertical scroller', async () => {
|
||||
it.skipIf(MODE === 'record')('keeps localized status columns separate in the Session panel at every width', async () => {
|
||||
const { scaffold, page, project, tripwire } = await launchPanel('web-e2e-forge-layout')
|
||||
await page.locator('[data-forge-current-branch]').waitFor()
|
||||
await compareOrRefreshGolden(join(EXPECTED, 'worktree-option.expected.md'),
|
||||
@@ -1244,29 +1252,9 @@ it.skipIf(MODE === 'record')('keeps localized status columns separate and long f
|
||||
const session = scaffold.ctx.sessions.get(await settled)
|
||||
if (session === undefined) throw new Error('The Session must stay loaded')
|
||||
scaffold.ctx.forgeSession.track(session, PULL)
|
||||
await page.locator('[data-forge-header]').click()
|
||||
const panel = page.locator('[data-forge-panel]')
|
||||
await panel.getByRole('button', { name: '刷新状态', exact: true }).click()
|
||||
const local = panel.locator('[data-forge-local]')
|
||||
await local.locator('button[aria-expanded]').click()
|
||||
await expect.poll(() => local.locator('li').count(), { timeout: 20_000 }).toBe(60)
|
||||
for (const width of [1280, 390]) {
|
||||
await page.setViewportSize({ width, height: 700 })
|
||||
const outerScrollers = await panel.evaluate((element) => {
|
||||
const scrollers: string[] = []
|
||||
for (let ancestor = element.parentElement; ancestor !== null; ancestor = ancestor.parentElement) {
|
||||
if (/auto|scroll/.test(getComputedStyle(ancestor).overflowY) && ancestor.scrollHeight > ancestor.clientHeight + 1) {
|
||||
scrollers.push(ancestor.className)
|
||||
}
|
||||
}
|
||||
return scrollers
|
||||
})
|
||||
expect(outerScrollers).toEqual([])
|
||||
expect(await panel.evaluate(element => element.scrollHeight > element.clientHeight)).toBe(true)
|
||||
await local.locator('li').last().scrollIntoViewIfNeeded()
|
||||
expect(await local.locator('li').last().isVisible()).toBe(true)
|
||||
}
|
||||
await local.locator('button[aria-expanded]').click()
|
||||
const panel = await showSessionPanel(page)
|
||||
await panel.locator('[data-session-panel-section="environment"]').getByRole('button', { name: '刷新状态', exact: true }).click()
|
||||
await panel.locator('[data-forge-local]').getByRole('button', { name: /^查看本会话的变更:60 个文件/ }).waitFor({ timeout: 20_000 })
|
||||
const change = panel.locator(`[data-forge-change="${PULL}"]`)
|
||||
for (const [locale, labels] of [
|
||||
['zh', ['检查', '评审', '合并', '变更']],
|
||||
@@ -1281,6 +1269,8 @@ it.skipIf(MODE === 'record')('keeps localized status columns separate and long f
|
||||
}
|
||||
for (const width of [1280, 390]) {
|
||||
await page.setViewportSize({ width, height: 700 })
|
||||
// A narrower window can hide the panel, which then opens over the conversation.
|
||||
await showSessionPanel(page)
|
||||
await expect.poll(() => change.evaluate(element => element.getBoundingClientRect().right)).toBeLessThanOrEqual(width)
|
||||
await change.getByText(labels[3], { exact: true }).hover()
|
||||
for (const label of labels) {
|
||||
@@ -1385,8 +1375,7 @@ it.skipIf(MODE === 'record').each(['darwin', 'win32'] as const)('closes diff men
|
||||
await writeFile(join(project, 'README.md'), 'review this change\n')
|
||||
const { settled } = await sendPrompt(page, scaffold)
|
||||
const sessionId = await settled
|
||||
await page.locator('[data-forge-header]').click()
|
||||
await page.locator('[data-forge-panel]').getByRole('button', { name: '刷新状态', exact: true }).click()
|
||||
await (await showSessionPanel(page)).locator('[data-session-panel-section="environment"]').getByRole('button', { name: '刷新状态', exact: true }).click()
|
||||
await page.locator('[data-forge-local]').getByRole('button', { name: /查看本会话的变更:1 个文件/ }).click()
|
||||
const view = page.locator('[data-forge-changes="local"]')
|
||||
await view.locator('[data-forge-diff-file="README.md"]').waitFor()
|
||||
@@ -1420,7 +1409,7 @@ it.skipIf(MODE === 'record').each([120, 4000])('types a review comment beside %i
|
||||
const session = scaffold.ctx.sessions.get(sessionId)
|
||||
if (session === undefined) throw new Error('Session must stay loaded')
|
||||
scaffold.ctx.forgeSession.track(session, PULL)
|
||||
await page.locator('[data-forge-header]').click()
|
||||
await showSessionPanel(page)
|
||||
const change = page.locator(`[data-forge-change="${PULL}"]`)
|
||||
await change.getByRole('button', { name: '查看 #7 的变更:新增 128 行,删除 14 行', exact: true }).click()
|
||||
const file = page.locator('[data-forge-diff-file="src/typing.ts"]')
|
||||
|
||||
+54
-66
@@ -1,4 +1,4 @@
|
||||
/** Background-job menu geometry over the normal Browser dock in the shipped Web composition. */
|
||||
/** Session panel geometry with an expanded background job beside the normal Browser dock in the shipped Web composition. */
|
||||
import { executeToolFixture } from '@deepseek-ai/dsh-tool-testkit'
|
||||
import { mkdir, readFile, writeFile } from 'node:fs/promises'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
@@ -14,55 +14,50 @@ import {
|
||||
assertFixtureInventory, compareOrRefreshGolden, launchWebScaffold, seedSession,
|
||||
watchConsole, webSnapshotMode, type WebScaffold,
|
||||
} from './scaffold.ts'
|
||||
import { newEnglishPage, saveFailureShot } from './support.ts'
|
||||
import { newEnglishPage, saveFailureShot, sessionPanelToggle, showSessionPanel } from './support.ts'
|
||||
|
||||
const FIXTURE = fileURLToPath(new URL('../../../snapshots/web/fresh-round-trip/session.v3.jsonl', import.meta.url))
|
||||
const EXPECTED_DIR = fileURLToPath(new URL('./expected/jobs-menu-layering', import.meta.url))
|
||||
const EXPECTED_DIR = fileURLToPath(new URL('./expected/jobs-panel-layering', import.meta.url))
|
||||
const MODE = webSnapshotMode()
|
||||
const SEED_ID = SessionId('jobs-menu-layering-web-e2e')
|
||||
const SEED_ID = SessionId('jobs-panel-layering-web-e2e')
|
||||
// The private scaffold cwd owns the barrier; the loop bounds an orphan's lifetime.
|
||||
const RELEASE = '.jobs-menu-layering.release'
|
||||
const COMMAND = `printf 'jobs-menu-%s\\n' output; for _ in $(seq 1 3000); do [ -e ${RELEASE} ] && break; sleep 0.2; done`
|
||||
const RELEASE = '.jobs-panel-layering.release'
|
||||
const COMMAND = `printf 'jobs-panel-%s\\n' output; for _ in $(seq 1 3000); do [ -e ${RELEASE} ] && break; sleep 0.2; done`
|
||||
|
||||
/** Measure actual overlap and hit testing; ARIA alone cannot expose clipping or stacking. */
|
||||
function placement(page: Page) {
|
||||
return page.evaluate(() => {
|
||||
const list = document.querySelector<HTMLElement>('ul[aria-label="Background jobs"]')
|
||||
const anchor = document.querySelector<HTMLElement>('button[aria-label="1 background job"]')
|
||||
const panel = document.querySelector<HTMLElement>('[data-session-panel]')
|
||||
const section = document.querySelector<HTMLElement>('[data-session-panel-section="background-jobs"]')
|
||||
const frame = document.querySelector<HTMLElement>('[data-sidebar-browser-frame]')
|
||||
const dock = document.querySelector<HTMLElement>('[data-sidebar-right-panel][data-sidebar-right-open]')
|
||||
if (list === null || anchor === null || frame === null || dock === null) {
|
||||
throw new Error('job menu, trigger, or Browser dock is missing')
|
||||
if (panel === null || section === null || frame === null || dock === null) {
|
||||
throw new Error('Session panel, jobs section, or Browser dock is missing')
|
||||
}
|
||||
const menu = list.closest<HTMLElement>('[data-menu-material]') ?? list
|
||||
const box = menu.getBoundingClientRect()
|
||||
const trigger = anchor.getBoundingClientRect()
|
||||
const body = panel.closest<HTMLElement>('[data-conversation-content]')
|
||||
const seat = body?.querySelector<HTMLElement>('[data-composer-seat]') ?? null
|
||||
if (body === null || seat === null) throw new Error('conversation body or composer seat is missing')
|
||||
const box = panel.getBoundingClientRect()
|
||||
const host = body.getBoundingClientRect()
|
||||
const browser = frame.getBoundingClientRect()
|
||||
const left = Math.max(box.left, browser.left)
|
||||
const right = Math.min(box.right, browser.right)
|
||||
const top = Math.max(box.top, browser.top)
|
||||
const bottom = Math.min(box.bottom, browser.bottom)
|
||||
const overlapsBrowser = right - left > 8 && bottom - top > 8
|
||||
const aboveBrowser = overlapsBrowser && [0.25, 0.5, 0.75].every(x =>
|
||||
[0.25, 0.5, 0.75].every(y => menu.contains(document.elementFromPoint(
|
||||
left + (right - left) * x, top + (bottom - top) * y,
|
||||
))))
|
||||
const verticalGap = Math.min(Math.abs(box.top - trigger.bottom - 5), Math.abs(trigger.top - box.bottom - 5))
|
||||
const horizontalAlignment = Math.min(Math.abs(box.left - trigger.left), Math.abs(box.right - trigger.right))
|
||||
const composer = seat.getBoundingClientRect()
|
||||
const sectionBox = section.getBoundingClientRect()
|
||||
return {
|
||||
dockMode: dock.dataset.sidebarRightPanel,
|
||||
bodyMounted: menu.parentElement === document.body,
|
||||
fixed: getComputedStyle(menu).position === 'fixed',
|
||||
anchored: verticalGap <= 1 && horizontalAlignment <= 1,
|
||||
viewportBounded: box.left >= 11 && box.top >= 11
|
||||
&& box.right <= innerWidth - 11 && box.bottom <= innerHeight - 11,
|
||||
overlapsBrowser,
|
||||
aboveBrowser,
|
||||
presentation: panel.dataset.sessionPanel,
|
||||
insideBody: box.left >= host.left && box.right <= host.right && box.top >= host.top,
|
||||
clearOfBrowser: box.right <= browser.left,
|
||||
clearOfComposer: box.bottom <= composer.top,
|
||||
viewportBounded: box.left >= 0 && box.top >= 0 && box.right <= innerWidth && box.bottom <= innerHeight,
|
||||
sectionShown: sectionBox.height > 0,
|
||||
onTop: [0.25, 0.5, 0.75].every(x => [0.25, 0.5, 0.75].every(y => panel.contains(document.elementFromPoint(
|
||||
box.left + box.width * x, box.top + box.height * y,
|
||||
)))),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
describe.skipIf(MODE === 'record')('web e2e: jobs menu layering', () => {
|
||||
describe.skipIf(MODE === 'record')('web e2e: jobs panel layering', () => {
|
||||
let scaffold: WebScaffold
|
||||
let browser: Browser
|
||||
let page: Page
|
||||
@@ -79,7 +74,7 @@ describe.skipIf(MODE === 'record')('web e2e: jobs menu layering', () => {
|
||||
page = await newEnglishPage(browser)
|
||||
await page.emulateMedia({ reducedMotion: 'reduce' })
|
||||
await page.route('https://browser.test/**', async route => route.fulfill({
|
||||
contentType: 'text/html', body: '<h1>Jobs menu browser fixture</h1>',
|
||||
contentType: 'text/html', body: '<h1>Jobs panel browser fixture</h1>',
|
||||
}))
|
||||
tripwire = watchConsole(page)
|
||||
await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' })
|
||||
@@ -93,18 +88,18 @@ describe.skipIf(MODE === 'record')('web e2e: jobs menu layering', () => {
|
||||
if (jobId !== undefined) {
|
||||
const settled = await scaffold.ctx.jobs.wait(jobId, 15_000, agent.id)
|
||||
if (settled.status === 'running' || settled.status === 'stopping') {
|
||||
throw new Error('jobs menu fixture did not settle after releasing its barrier')
|
||||
throw new Error('jobs panel fixture did not settle after releasing its barrier')
|
||||
}
|
||||
}
|
||||
} catch (error) { failures.push(error) }
|
||||
}
|
||||
try { await browser?.close() } catch (error) { failures.push(error) }
|
||||
try { await scaffold?.close() } catch (error) { failures.push(error) }
|
||||
if (failures.length > 0) throw new AggregateError(failures, 'jobs menu layering teardown failed')
|
||||
if (failures.length > 0) throw new AggregateError(failures, 'jobs panel layering teardown failed')
|
||||
})
|
||||
|
||||
it('keeps the list and live output above the Browser dock while anchored and dismissable', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-jobs-menu-layering'))
|
||||
it('keeps the section and its live output in the conversation body beside the Browser dock and dismissable', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-jobs-panel-layering'))
|
||||
const initialViewport = page.viewportSize()!
|
||||
const session = page.locator(`[data-row-key="session:${SEED_ID}"]`)
|
||||
await expect.poll(async () => {
|
||||
@@ -120,9 +115,9 @@ describe.skipIf(MODE === 'record')('web e2e: jobs menu layering', () => {
|
||||
agent = opened
|
||||
const started = await executeToolFixture(scaffold.ctx, {
|
||||
signal: new AbortController().signal,
|
||||
callId: ToolCallId('jobs-menu-layering-e2e'),
|
||||
callId: ToolCallId('jobs-panel-layering-e2e'),
|
||||
name: 'bash',
|
||||
arguments: { command: COMMAND, description: 'Emit output and hold the jobs menu fixture', run_in_background: true },
|
||||
arguments: { command: COMMAND, description: 'Emit output and hold the jobs panel fixture', run_in_background: true },
|
||||
agent,
|
||||
})
|
||||
const reported = started.content.map(block => block.type === 'text' ? block.text : '').join('')
|
||||
@@ -134,7 +129,7 @@ describe.skipIf(MODE === 'record')('web e2e: jobs menu layering', () => {
|
||||
await expect.poll(() => {
|
||||
const job = scaffold.ctx.jobs.get(startedJobId, agent.id)
|
||||
const output = scaffold.ctx.jobs.readAt(startedJobId, 0, agent.id).chunks.map(chunk => chunk.text).join('')
|
||||
return job.status !== 'running' || output.includes('jobs-menu-output')
|
||||
return job.status !== 'running' || output.includes('jobs-panel-output')
|
||||
}, { timeout: 15_000 }).toBe(true)
|
||||
const readyJob = scaffold.ctx.jobs.get(startedJobId, agent.id)
|
||||
const readyOutput = scaffold.ctx.jobs.readAt(startedJobId, 0, agent.id).chunks.map(chunk => chunk.text).join('')
|
||||
@@ -144,61 +139,54 @@ describe.skipIf(MODE === 'record')('web e2e: jobs menu layering', () => {
|
||||
const column = page.locator('[data-rightbar-col]')
|
||||
await column.locator('[data-sidebar-right-guide-entry="browser"]').click()
|
||||
const address = column.getByRole('textbox', { name: 'Enter an HTTP(S) address' })
|
||||
await address.fill('https://browser.test/jobs-menu')
|
||||
await address.fill('https://browser.test/jobs-panel')
|
||||
await address.press('Enter')
|
||||
await page.frameLocator('[data-sidebar-browser-frame]')
|
||||
.getByRole('heading', { name: 'Jobs menu browser fixture' }).waitFor()
|
||||
.getByRole('heading', { name: 'Jobs panel browser fixture' }).waitFor()
|
||||
|
||||
const trigger = page.getByRole('button', { name: '1 background job', exact: true })
|
||||
await trigger.waitFor({ timeout: 15_000 })
|
||||
await trigger.focus()
|
||||
const toggle = sessionPanelToggle(page)
|
||||
await toggle.focus()
|
||||
await page.keyboard.press('Enter')
|
||||
const list = page.getByRole('list', { name: 'Background jobs' })
|
||||
await list.waitFor()
|
||||
await page.keyboard.press('Tab')
|
||||
expect(await list.getByRole('button', { name: /Show live output/ })
|
||||
.evaluate(element => element === document.activeElement)).toBe(true)
|
||||
const panel = page.locator('[data-session-panel]')
|
||||
await panel.waitFor()
|
||||
const list = panel.getByRole('list', { name: 'Background jobs' })
|
||||
await list.getByRole('button', { name: /Show live output/ }).waitFor({ timeout: 15_000 })
|
||||
const expectedPlacement = {
|
||||
dockMode: 'push', bodyMounted: true, fixed: true, anchored: true,
|
||||
viewportBounded: true, overlapsBrowser: true, aboveBrowser: true,
|
||||
dockMode: 'push', presentation: 'overlay', insideBody: true, clearOfBrowser: true,
|
||||
clearOfComposer: true, viewportBounded: true, sectionShown: true, onTop: true,
|
||||
}
|
||||
await expect.poll(() => placement(page)).toEqual(expectedPlacement)
|
||||
const collapsed = await placement(page)
|
||||
|
||||
await list.getByRole('button', { name: /Show live output/ }).click()
|
||||
await list.getByText('jobs-menu-output', { exact: true }).waitFor({ timeout: 15_000 })
|
||||
await list.getByText('jobs-panel-output', { exact: true }).waitFor({ timeout: 15_000 })
|
||||
await expect.poll(() => placement(page)).toEqual(expectedPlacement)
|
||||
const expanded = await placement(page)
|
||||
|
||||
await page.setViewportSize({ width: 1280, height: 760 })
|
||||
await showSessionPanel(page)
|
||||
await expect.poll(() => placement(page)).toEqual(expectedPlacement)
|
||||
const resized = await placement(page)
|
||||
await list.getByRole('button', { name: /Hide live output/ }).focus()
|
||||
await page.keyboard.press('Escape')
|
||||
await list.waitFor({ state: 'detached' })
|
||||
const escapeRestoresFocus = await trigger.evaluate(node => node === document.activeElement)
|
||||
await panel.waitFor({ state: 'detached' })
|
||||
const escapeRestoresFocus = await toggle.evaluate(node => node === document.activeElement)
|
||||
expect(escapeRestoresFocus).toBe(true)
|
||||
|
||||
await trigger.click()
|
||||
await list.waitFor()
|
||||
await showSessionPanel(page)
|
||||
await address.click()
|
||||
await list.waitFor({ state: 'detached' })
|
||||
const outsideDismisses = await trigger.getAttribute('aria-expanded') === 'false'
|
||||
await panel.waitFor({ state: 'detached' })
|
||||
const outsideDismisses = await toggle.getAttribute('aria-expanded') === 'false'
|
||||
expect(outsideDismisses).toBe(true)
|
||||
expect(await address.evaluate(element => element === document.activeElement)).toBe(true)
|
||||
await page.setViewportSize(initialViewport)
|
||||
await trigger.hover()
|
||||
await list.waitFor()
|
||||
expect(await address.evaluate(element => element === document.activeElement)).toBe(true)
|
||||
await page.keyboard.press('Escape')
|
||||
await list.waitFor({ state: 'detached' })
|
||||
expect(await address.evaluate(element => element === document.activeElement)).toBe(true)
|
||||
expect(scaffold.ctx.jobs.get(jobId, agent.id).status).toBe('running')
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
|
||||
await mkdir(EXPECTED_DIR, { recursive: true })
|
||||
await compareOrRefreshGolden(join(EXPECTED_DIR, 'geometry.expected.md'), [
|
||||
'# Background jobs above the Browser dock', '',
|
||||
'# Background jobs beside the Browser dock', '',
|
||||
'```json',
|
||||
JSON.stringify({ collapsed, expanded, resized, escapeRestoresFocus, outsideDismisses }, null, 2),
|
||||
'```',
|
||||
@@ -1,8 +1,8 @@
|
||||
import { executeToolFixture } from '@deepseek-ai/dsh-tool-testkit'
|
||||
// Session-header job list driven by a real background bash run: the job row
|
||||
// arrives over the job roster stream, expanding it opens the output
|
||||
// observation stream, and the panel shows the process's real output while it
|
||||
// is still running. No model call is involved.
|
||||
// The Session panel's background-jobs section driven by a real background
|
||||
// bash run: the job row arrives over the job roster stream, expanding it opens
|
||||
// the output observation stream, and the row shows the process's real output
|
||||
// while it is still running. No model call is involved.
|
||||
import { readFile, writeFile } from 'node:fs/promises'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { join } from 'node:path'
|
||||
@@ -17,12 +17,13 @@ import {
|
||||
assertFixtureInventory, captureStableAria, compareOrRefreshGolden,
|
||||
launchWebScaffold, seedSession, watchConsole, webSnapshotMode, type WebScaffold,
|
||||
} from './scaffold.ts'
|
||||
import { newEnglishPage, saveFailureShot } from './support.ts'
|
||||
import { hideSessionPanel, newEnglishPage, saveFailureShot, showSessionPanel } from './support.ts'
|
||||
|
||||
const FIXTURE = fileURLToPath(new URL('../../../snapshots/web/fresh-round-trip/session.v2.jsonl', import.meta.url))
|
||||
const SNAPSHOT_DIR = fileURLToPath(new URL('./snapshots/live-job-stream', import.meta.url))
|
||||
const STREAMING_EXPECTED = join(SNAPSHOT_DIR, 'streaming.expected.md')
|
||||
const SETTLED_EXPECTED = join(SNAPSHOT_DIR, 'settled.expected.md')
|
||||
const SECTION = '[data-session-panel-section="background-jobs"]'
|
||||
const MODE = webSnapshotMode()
|
||||
const SEED_ID = 'live-job-stream-web-e2e'
|
||||
// One fixed line of early output, then a hold on a barrier file the test owns
|
||||
@@ -82,11 +83,12 @@ describe.skipIf(MODE === 'record')('web e2e: live job stream', () => {
|
||||
await scaffold?.close()
|
||||
})
|
||||
|
||||
it('streams a running job\'s real output into the expanded panel, then settles it in place on kill', async () => {
|
||||
it('streams a running job\'s real output into the expanded row, then settles it in place on kill', async () => {
|
||||
let phase = 'streaming'
|
||||
onTestFailed(() => saveFailureShot(page, `web-e2e-live-job-${phase}`))
|
||||
const trigger = page.getByRole('button', { name: '1 background job', exact: true })
|
||||
expect(await trigger.count()).toBe(0)
|
||||
const list = page.locator(SECTION).getByRole('list', { name: 'Background jobs' })
|
||||
await showSessionPanel(page)
|
||||
expect(await list.count()).toBe(0)
|
||||
|
||||
const started = await executeToolFixture(scaffold.ctx, {
|
||||
signal: new AbortController().signal,
|
||||
@@ -108,43 +110,41 @@ describe.skipIf(MODE === 'record')('web e2e: live job stream', () => {
|
||||
const readyOutput = scaffold.ctx.jobs.readAt(jobId, 0, agent.id).chunks.map(chunk => chunk.text).join('')
|
||||
expect(readyJob.status, `${readyJob.detail ?? ''}\n${readyOutput}`).toBe('running')
|
||||
|
||||
// The job row reaches the header over the job roster stream.
|
||||
await trigger.waitFor({ timeout: 15_000 })
|
||||
await trigger.click()
|
||||
|
||||
// Expanding the row opens the output observation stream; the panel then renders
|
||||
// the command's real stdout while the process is still running.
|
||||
const expand = page.getByRole('button', { name: /Show live output/ })
|
||||
await expand.waitFor({ timeout: 10_000 })
|
||||
// The job row reaches the open section over the job roster stream.
|
||||
// Expanding the row opens the output observation stream; the row then
|
||||
// renders the command's real stdout while the process is still running.
|
||||
const expand = list.getByRole('button', { name: /Show live output/ })
|
||||
await expand.waitFor({ timeout: 15_000 })
|
||||
await expand.click()
|
||||
await page.getByText('streamed-marker-line').waitFor({ timeout: 15_000 })
|
||||
await list.getByText('streamed-marker-line').waitFor({ timeout: 15_000 })
|
||||
|
||||
const streaming = await captureStableAria(page, '[class*="menu"]', scaffold.workspaceCwd, { runningJobs: 'keep' })
|
||||
const streaming = await captureStableAria(page, SECTION, scaffold.workspaceCwd)
|
||||
await compareOrRefreshGolden(STREAMING_EXPECTED, streaming, MODE)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
|
||||
await trigger.click()
|
||||
await page.getByRole('list', { name: 'Background jobs' }).waitFor({ state: 'detached' })
|
||||
// Hiding the panel unmounts the section, which closes the observation
|
||||
// stream; showing it again lists the row collapsed, and expanding it
|
||||
// reopens the stream from the retained output.
|
||||
await hideSessionPanel(page)
|
||||
await list.waitFor({ state: 'detached' })
|
||||
expect(await page.getByText('streamed-marker-line', { exact: true }).count()).toBe(0)
|
||||
await page.mouse.move(2, 2)
|
||||
await trigger.hover()
|
||||
await page.getByRole('list', { name: 'Background jobs' }).waitFor()
|
||||
await page.getByRole('button', { name: /Hide live output/ }).waitFor()
|
||||
await page.getByText('streamed-marker-line', { exact: true }).waitFor()
|
||||
await showSessionPanel(page)
|
||||
await list.getByRole('button', { name: /Show live output/ }).click()
|
||||
await list.getByRole('button', { name: /Hide live output/ }).waitFor()
|
||||
await list.getByText('streamed-marker-line', { exact: true }).waitFor({ timeout: 15_000 })
|
||||
expect(scaffold.ctx.jobs.get(jobId, agent.id).status).toBe('running')
|
||||
|
||||
phase = 'settled'
|
||||
expect(scaffold.ctx.jobs.kill(jobId, agent.id, 'web e2e cancellation')).toBe('requested')
|
||||
|
||||
// The unchanged count label is not a settlement signal; the output row owns that state.
|
||||
await page.getByRole('button', { name: 'Finished 1', exact: true }).waitFor({ timeout: 20_000 })
|
||||
await expect.poll(() => page.getByRole('list', { name: 'Background jobs' }).textContent()).toContain('web e2e cancellation')
|
||||
expect(await trigger.getAttribute('aria-label')).toBe('1 background job')
|
||||
// The settled section line owns the settlement signal; the expanded row moves under it.
|
||||
await list.getByRole('button', { name: 'Finished 1', exact: true }).waitFor({ timeout: 20_000 })
|
||||
await expect.poll(() => list.textContent()).toContain('web e2e cancellation')
|
||||
expect(scaffold.ctx.jobs.get(jobId, agent.id).status).toBe('killed')
|
||||
await page.getByText('streamed-marker-line').waitFor({ timeout: 10_000 })
|
||||
await list.getByText('streamed-marker-line').waitFor({ timeout: 10_000 })
|
||||
|
||||
const settled = await captureStableAria(page, '[class*="menu"]', scaffold.workspaceCwd)
|
||||
const settled = await captureStableAria(page, SECTION, scaffold.workspaceCwd)
|
||||
await compareOrRefreshGolden(SETTLED_EXPECTED, settled, MODE)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
|
||||
@@ -1621,18 +1621,13 @@ function normalizeAria(snapshot: string, workspaceCwd: string, age: boolean): st
|
||||
/**
|
||||
* Capture the region's aria snapshot at a settled milestone: poll until two
|
||||
* consecutive normalized captures are equal — a single-shot capture races the
|
||||
* last React commits. A foreground shell command is a job while it runs, and
|
||||
* its removal reaches the browser one coalesced roster frame after the tool
|
||||
* result, so by default the capture first waits for the session header's
|
||||
* running-job control to leave; a scenario whose milestone is a running job
|
||||
* keeps it with `runningJobs: 'keep'`.
|
||||
* last React commits.
|
||||
* @param page - the page under test.
|
||||
* @param selector - the region locator selector.
|
||||
* @param workspaceCwd - normalization input.
|
||||
* @param options - `normalizeAge` collapses relative-time buckets to `{{age}}`
|
||||
* for a region whose rows are dated from live wall-clock state;
|
||||
* `replacements` tokenizes scenario-owned values before generic normalization;
|
||||
* `runningJobs` is `'settle'` (default: wait for no running-job control) or `'keep'`.
|
||||
* `replacements` tokenizes scenario-owned values before generic normalization.
|
||||
* @returns the stable normalized snapshot.
|
||||
*/
|
||||
export async function captureStableAria(
|
||||
@@ -1642,13 +1637,8 @@ export async function captureStableAria(
|
||||
options: {
|
||||
normalizeAge?: boolean
|
||||
replacements?: readonly (readonly [value: string, token: string])[]
|
||||
runningJobs?: 'settle' | 'keep'
|
||||
} = {},
|
||||
): Promise<string> {
|
||||
if ((options.runningJobs ?? 'settle') === 'settle') {
|
||||
await page.getByRole('button', { name: /background jobs? running/ })
|
||||
.waitFor({ state: 'detached', timeout: 10_000 })
|
||||
}
|
||||
const region = page.locator(selector).first()
|
||||
const age = options.normalizeAge === true
|
||||
const normalize = (snapshot: string): string => {
|
||||
|
||||
@@ -169,8 +169,7 @@ describe.skipIf(MODE === 'record')('web e2e: archiving a running Session stops i
|
||||
expect(scaffold.ctx.agents.get(sessionId)?.status).toBe('running')
|
||||
expect(await childAlive(cwd)).toBe(true)
|
||||
await expect.poll(() => sessionRow().count()).toBe(1)
|
||||
// The Bash command is a running job while the dialog is open, by design.
|
||||
const snapshot = await captureStableAria(page, '[role="dialog"]', scaffold.workspaceCwd, { runningJobs: 'keep' })
|
||||
const snapshot = await captureStableAria(page, '[role="dialog"]', scaffold.workspaceCwd)
|
||||
await compareOrRefreshGolden(DIALOG_EXPECTED, snapshot, MODE)
|
||||
|
||||
// Cancel keeps everything as it was.
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
webSnapshotMode,
|
||||
type WebScaffold,
|
||||
} from './scaffold.ts'
|
||||
import { connectFreshWorkspace, newEnglishPage, saveFailureShot } from './support.ts'
|
||||
import { connectFreshWorkspace, newEnglishPage, saveFailureShot, sessionPanelToggle, showSessionPanel } from './support.ts'
|
||||
|
||||
const SNAPSHOT_DIR = fileURLToPath(new URL('./expected/sidebar-subagent-activity', import.meta.url))
|
||||
const RUNNING_OWNER_EXPECTED = join(SNAPSHOT_DIR, 'owner-running.expected.md')
|
||||
@@ -145,9 +145,10 @@ describe('web e2e: sidebar subagent activity', () => {
|
||||
)
|
||||
expect(await ownerRow.locator('[data-state="ongoing"]').count()).toBe(1)
|
||||
await ownerRow.click()
|
||||
const runningTrigger = page.getByRole('button', { name: '1 subagent', exact: true })
|
||||
await runningTrigger.waitFor({ timeout: 10_000 })
|
||||
expect(await runningTrigger.locator('[data-state="ongoing"]').count()).toBe(1)
|
||||
const toggle = sessionPanelToggle(page)
|
||||
const subagents = (await showSessionPanel(page)).locator('[data-session-panel-section="subagents"]')
|
||||
await subagents.getByRole('treeitem').locator('[data-state="ongoing"]').waitFor({ timeout: 10_000 })
|
||||
expect(await subagents.getByText('1 in progress', { exact: true }).isVisible()).toBe(true)
|
||||
// This directly created owner has no tool preset; the fixture collects its own job.
|
||||
scaffold.ctx.effect(() => scaffold.ctx.jobs.attachController('compact header fixture'), 'compact header job controller')
|
||||
const completion = Promise.withResolvers<{ status: 'completed' }>()
|
||||
@@ -160,54 +161,34 @@ describe('web e2e: sidebar subagent activity', () => {
|
||||
},
|
||||
})
|
||||
const viewport = page.viewportSize()!
|
||||
const panel = page.locator('[data-session-panel]')
|
||||
const assertRunningSections = async (): Promise<void> => {
|
||||
await showSessionPanel(page)
|
||||
for (const section of ['subagents', 'background-jobs']) {
|
||||
await panel.locator(`[data-session-panel-section="${section}"]`).locator('[data-state="ongoing"]').first()
|
||||
.waitFor({ timeout: 10_000 })
|
||||
}
|
||||
expect(await panel.getAttribute('data-session-panel')).toBe('overlay')
|
||||
await page.keyboard.press('Escape')
|
||||
await panel.waitFor({ state: 'detached' })
|
||||
}
|
||||
try {
|
||||
const jobTrigger = page.getByRole('button', { name: '1 background job', exact: true })
|
||||
await jobTrigger.waitFor()
|
||||
expect(await jobTrigger.evaluate(element => document.getElementById(element.getAttribute('aria-describedby')!)?.textContent)).toBe('Running')
|
||||
const controls = [
|
||||
{ trigger: runningTrigger, icon: '[data-icon="dsw-icon-users-outline-regular"]', count: '[data-subagent-count]' },
|
||||
{ trigger: jobTrigger, icon: '[data-icon="dsw-icon-layers-outline-regular"]', count: '[data-job-count]' },
|
||||
]
|
||||
for (const { trigger, icon, count } of controls) {
|
||||
expect(await trigger.locator(count).isVisible()).toBe(true)
|
||||
expect(await trigger.locator('[data-state="ongoing"]').isVisible()).toBe(true)
|
||||
expect(await trigger.locator(icon).isVisible()).toBe(false)
|
||||
}
|
||||
await runningTrigger.focus()
|
||||
await assertRunningSections()
|
||||
await toggle.focus()
|
||||
await page.setViewportSize({ width: 390, height: 700 })
|
||||
for (const { trigger, icon, count } of controls) {
|
||||
await expect.poll(() => trigger.locator(count).isVisible()).toBe(false)
|
||||
expect(await trigger.locator(icon).isVisible()).toBe(true)
|
||||
expect(await trigger.locator('[data-state="ongoing"]').isVisible()).toBe(false)
|
||||
}
|
||||
expect(await runningTrigger.evaluate(element => element === document.activeElement)).toBe(true)
|
||||
expect(await jobTrigger.evaluate(element => document.getElementById(element.getAttribute('aria-describedby')!)?.textContent)).toBe('Running')
|
||||
expect(await toggle.evaluate(element => element === document.activeElement)).toBe(true)
|
||||
await compareOrRefreshGolden(
|
||||
join(SNAPSHOT_DIR, 'compact-running.expected.md'),
|
||||
await captureStableAria(page, 'header:has([data-subagent-action])', scaffold.workspaceCwd),
|
||||
await captureStableAria(page, 'header:has([data-session-panel-toggle])', scaffold.workspaceCwd),
|
||||
MODE,
|
||||
)
|
||||
await saveFailureShot(page, 'web-e2e-compact-running-icons')
|
||||
await runningTrigger.click()
|
||||
const members = page.locator('[data-subagent-panel]')
|
||||
await members.waitFor()
|
||||
expect(await members.getByRole('treeitem').locator('[data-state="ongoing"]').isVisible()).toBe(true)
|
||||
await page.keyboard.press('Escape')
|
||||
await jobTrigger.click()
|
||||
const jobs = page.getByRole('list', { name: 'Background jobs', exact: true })
|
||||
await jobs.waitFor()
|
||||
expect(await jobs.locator('[data-state="ongoing"]').isVisible()).toBe(true)
|
||||
await page.keyboard.press('Escape')
|
||||
await saveFailureShot(page, 'web-e2e-compact-running-header')
|
||||
await assertRunningSections()
|
||||
await page.setViewportSize(viewport)
|
||||
for (const { trigger, icon, count } of controls) {
|
||||
await expect.poll(() => trigger.locator(count).isVisible()).toBe(true)
|
||||
expect(await trigger.locator('[data-state="ongoing"]').isVisible()).toBe(true)
|
||||
expect(await trigger.locator(icon).isVisible()).toBe(false)
|
||||
}
|
||||
await assertRunningSections()
|
||||
} finally {
|
||||
completion.resolve({ status: 'completed' })
|
||||
await scaffold.ctx.jobs.wait(jobId, 5_000, ownerId)
|
||||
await page.keyboard.press('Escape')
|
||||
await page.setViewportSize(viewport)
|
||||
}
|
||||
await assertFixtureInventory(SNAPSHOT_DIR, ['owner-running.expected.md', 'compact-running.expected.md'])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
- dialog "Subagent sessions":
|
||||
- heading "Subagents" [level=3]
|
||||
- region "Subagents":
|
||||
- heading "Subagents" [level=2]
|
||||
- text: 1 external
|
||||
- tree "Subagent sessions":
|
||||
- 'treeitem "Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. team-panel-researcher · External task" [disabled] [level=1]': "Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. team-panel-researcher"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
- dialog "Subagent sessions":
|
||||
- heading "Subagents" [level=3]
|
||||
- region "Subagents":
|
||||
- heading "Subagents" [level=2]
|
||||
- paragraph: No subagents
|
||||
- tree "Subagent sessions"
|
||||
- region "Task board":
|
||||
- heading "Shared tasks 1 pending" [level=3]
|
||||
- list:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
- dialog "Subagent sessions":
|
||||
- heading "Subagents" [level=3]
|
||||
- region "Subagents":
|
||||
- heading "Subagents" [level=2]
|
||||
- text: 1 external
|
||||
- tree "Subagent sessions":
|
||||
- 'treeitem "Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. team-panel-researcher · External task" [disabled] [level=1]': "Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. Researcher: investigate the construction and verify every bound before reporting the result. team-panel-researcher"
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
- list "Background jobs":
|
||||
- listitem:
|
||||
- button "Finished 1" [expanded]
|
||||
- button "Clear"
|
||||
- listitem:
|
||||
- button "Hide live output of printf 'streamed-%s\\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done" [expanded]: "bash printf 'streamed-%s\\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done signal: SIGTERM; web e2e cancellation {{duration}}"
|
||||
- text: $ printf 'streamed-%s\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done
|
||||
- button "Copy"
|
||||
- text: streamed-marker-line
|
||||
- region "Background jobs":
|
||||
- heading "Background jobs" [level=2]
|
||||
- list "Background jobs":
|
||||
- listitem:
|
||||
- button "Finished 1" [expanded]
|
||||
- button "Clear"
|
||||
- listitem:
|
||||
- button "Hide live output of printf 'streamed-%s\\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done" [expanded]: "bash printf 'streamed-%s\\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done signal: SIGTERM; web e2e cancellation {{duration}}"
|
||||
- text: $ printf 'streamed-%s\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done
|
||||
- button "Copy"
|
||||
- text: streamed-marker-line
|
||||
@@ -1,7 +1,9 @@
|
||||
- list "Background jobs":
|
||||
- listitem:
|
||||
- button "Hide live output of printf 'streamed-%s\\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done" [expanded]: printf 'streamed-%s\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done bash {{duration}}
|
||||
- button "Stop task printf 'streamed-%s\\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done"
|
||||
- text: $ printf 'streamed-%s\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done
|
||||
- button "Copy"
|
||||
- text: streamed-marker-line
|
||||
- region "Background jobs":
|
||||
- heading "Background jobs" [level=2]
|
||||
- list "Background jobs":
|
||||
- listitem:
|
||||
- button "Hide live output of printf 'streamed-%s\\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done" [expanded]: printf 'streamed-%s\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done bash {{duration}}
|
||||
- button "Stop task printf 'streamed-%s\\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done"
|
||||
- text: $ printf 'streamed-%s\n' marker-line; for _ in $(seq 1 3000); do [ -e .live-job-stream.release ] && break; sleep 0.2; done
|
||||
- button "Copy"
|
||||
- text: streamed-marker-line
|
||||
@@ -3,7 +3,7 @@ import { tmpdir } from 'node:os'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { zstdCompressSync } from 'node:zlib'
|
||||
import type { Browser, Page } from 'playwright'
|
||||
import type { Browser, Locator, Page } from 'playwright'
|
||||
import { chromium } from 'playwright'
|
||||
import { afterAll, beforeAll, describe, expect, it, onTestFailed, onTestFinished, vi } from 'vitest'
|
||||
import { prepareSessionSnapshotFixtureForComparison } from '@deepseek-ai/dsh-llm-replay'
|
||||
@@ -20,7 +20,10 @@ import {
|
||||
launchWebScaffold, readPersistedEvents, realizeSeedFixture, seedSession, selectedSessionFixture, watchConsole,
|
||||
webSnapshotMode, type WebScaffold,
|
||||
} from './scaffold.ts'
|
||||
import { connectFreshWorkspace, newEnglishPage, pinBrowserClock, pinHostClock, saveFailureShot, writeComposerDraft } from './support.ts'
|
||||
import {
|
||||
connectFreshWorkspace, dismissSessionPanel, newEnglishPage, pinBrowserClock, pinHostClock, saveFailureShot,
|
||||
sessionPanelToggle, showSessionPanel, writeComposerDraft,
|
||||
} from './support.ts'
|
||||
|
||||
const BASE_FIXTURE = fileURLToPath(new URL('../../../snapshots/web/live-interactions/session.v3.jsonl', import.meta.url))
|
||||
const AVAILABLE_CHILD_EXPECTED = fileURLToPath(new URL('../../../snapshots/web/subagent-conversation/ui.expected.md', import.meta.url))
|
||||
@@ -38,6 +41,7 @@ const MIGRATING_CHILD_EXPECTED = fileURLToPath(new URL(
|
||||
'./expected/subagent-conversation/migration-required-child.expected.md', import.meta.url,
|
||||
))
|
||||
const MODE = webSnapshotMode()
|
||||
const SUBAGENTS_SECTION = '[data-session-panel-section="subagents"]'
|
||||
const LABEL = 'event-sourcing researcher'
|
||||
/** The live child's catalog name; it is the parent's first named child. */
|
||||
const CHILD_NAME = 'agent-1'
|
||||
@@ -79,6 +83,15 @@ function childFixture(source: string, fixtureId: string, withContinuation: boole
|
||||
return [childHeader, ...eventLines, ...continued, ''].join('\n')
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Session panel and return its Subagents section.
|
||||
* @param page - the page under test.
|
||||
* @returns the section.
|
||||
*/
|
||||
async function showSubagentsSection(page: Page): Promise<Locator> {
|
||||
return (await showSessionPanel(page)).locator(SUBAGENTS_SECTION)
|
||||
}
|
||||
|
||||
async function waitForAgentToSettle(scaffold: WebScaffold, id: SessionId): Promise<void> {
|
||||
const deadline = Date.now() + 30_000
|
||||
while (scaffold.ctx.agents.get(id) !== undefined) {
|
||||
@@ -221,7 +234,8 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
await oneShotHandle.close()
|
||||
scaffold.ctx.sessionProjectionCache.coldSnapshot(oneShotHeader, SessionLogOffset(0), oneShotEvents)
|
||||
await waitForCacheRow(scaffold, oneShotHeader)
|
||||
await page.getByRole('button', { name: '1 subagent', exact: true }).waitFor({ timeout: 15_000 })
|
||||
const pushedSection = await showSubagentsSection(page)
|
||||
await pushedSection.getByRole('treeitem', { name: new RegExp(LABEL) }).waitFor({ timeout: 15_000 })
|
||||
const catalogReads = apiCalls.filter(path => path === '/api/session/projections').length
|
||||
parent.session.append('subagent/catalog', {
|
||||
version: 0,
|
||||
@@ -230,10 +244,12 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
mode: 'one-shot',
|
||||
label: ONE_SHOT_LABEL,
|
||||
})
|
||||
const pushedCount = page.getByRole('button', { name: '2 subagents', exact: true })
|
||||
await pushedCount.waitFor({ timeout: 15_000 })
|
||||
await pushedSection.getByRole('treeitem', { name: new RegExp(ONE_SHOT_LABEL) }).waitFor({ timeout: 15_000 })
|
||||
await pushedSection.getByText('1 completed\u2002·\u20021 not running', { exact: true }).waitFor({ timeout: 15_000 })
|
||||
expect(apiCalls.filter(path => path === '/api/session/projections')).toHaveLength(catalogReads)
|
||||
await compareOrRefreshGolden(CATALOG_PUSH_EXPECTED, await pushedCount.ariaSnapshot(), MODE)
|
||||
await compareOrRefreshGolden(CATALOG_PUSH_EXPECTED,
|
||||
await pushedSection.getByRole('heading', { level: 2 }).locator('..').ariaSnapshot(), MODE)
|
||||
await dismissSessionPanel(page)
|
||||
grandchildId = sessionId('recorded-grandchild')
|
||||
const authoredAt = Date.now()
|
||||
const grandchildHeader: SessionHeader = {
|
||||
@@ -342,13 +358,9 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
const warningStart = tripwire.warnings.length
|
||||
await page.reload({ waitUntil: 'load' })
|
||||
await page.waitForSelector('[class*="frame"]', { timeout: 30_000 })
|
||||
const catalogButton = page.getByRole('button', { name: '2 subagents', exact: true })
|
||||
await catalogButton.waitFor({ timeout: 15_000 })
|
||||
await catalogButton.hover()
|
||||
const catalogTree = page.getByRole('tree', { name: 'Subagent sessions' })
|
||||
const catalogTree = (await showSubagentsSection(page)).getByRole('tree', { name: 'Subagent sessions' })
|
||||
await catalogTree.getByRole('treeitem').nth(1).waitFor({ timeout: 15_000 })
|
||||
await catalogTree.press('Escape')
|
||||
await page.getByRole('button', { name: '2 subagents' }).waitFor({ timeout: 15_000 })
|
||||
await dismissSessionPanel(page)
|
||||
acknowledgeReloadConnectionLoss(tripwire, warningStart)
|
||||
}, 120_000)
|
||||
|
||||
@@ -379,9 +391,11 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
await writeComposerDraft(page, input, '')
|
||||
})
|
||||
|
||||
it('enters the member tree after pointer or keyboard activation of its trigger', async () => {
|
||||
it('enters the sibling tree after pointer or keyboard activation of the breadcrumb switcher', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-subagent-trigger-focus'))
|
||||
const trigger = page.getByRole('button', { name: '2 subagents', exact: true })
|
||||
await (await showSubagentsSection(page)).getByRole('treeitem', { name: new RegExp(LABEL) }).getByText(LABEL, { exact: true }).click()
|
||||
const hierarchy = page.getByRole('navigation', { name: 'Session hierarchy' })
|
||||
const trigger = hierarchy.getByRole('button', { name: `Switch subagent: ${LABEL}`, exact: true })
|
||||
const panel = page.locator('[data-subagent-panel]')
|
||||
try {
|
||||
for (const activation of ['click', 'Enter', 'Space']) {
|
||||
@@ -397,6 +411,8 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
}
|
||||
} finally {
|
||||
await page.locator('[data-composer-input]').first().hover()
|
||||
await hierarchy.getByRole('button').first().click()
|
||||
await trigger.waitFor({ state: 'detached' })
|
||||
}
|
||||
})
|
||||
|
||||
@@ -407,9 +423,7 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
try {
|
||||
for (const width of [originalViewport.width, 390]) {
|
||||
await page.setViewportSize({ ...originalViewport, width })
|
||||
const trigger = page.getByRole('button', { name: '2 subagents', exact: true })
|
||||
await trigger.click()
|
||||
const panel = page.locator('[data-subagent-panel]')
|
||||
const panel = await showSubagentsSection(page)
|
||||
const row = panel.getByRole('treeitem', { name: new RegExp(LABEL) })
|
||||
const primary = row.getByText(LABEL, { exact: true })
|
||||
const secondary = row.getByText(CHILD_NAME, { exact: true })
|
||||
@@ -427,10 +441,9 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
expect(await row.getByRole('button', { name: `Expand ${LABEL} descendants`, exact: true }).count()).toBe(1)
|
||||
expect(await row.getByRole('button', { name: `Open ${LABEL} in sidebar`, exact: true }).count()).toBe(1)
|
||||
expect(page.url()).toBe(originalUrl)
|
||||
expect(await page.getByRole('tooltip').count()).toBe(0)
|
||||
expect(await page.getByRole('tooltip').filter({ hasText: LABEL }).count()).toBe(0)
|
||||
expect(scaffold.ctx.agents.get(childId)).toBeUndefined()
|
||||
await page.keyboard.press('Escape')
|
||||
await panel.waitFor({ state: 'detached' })
|
||||
await dismissSessionPanel(page)
|
||||
}
|
||||
} finally {
|
||||
await page.setViewportSize(originalViewport)
|
||||
@@ -440,15 +453,12 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
|
||||
it('recovers a current-format cold child catalog cache miss without activating either level', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'screenshots/non-migrating-session-reads/web-e2e-subagent-tree'))
|
||||
await page.getByRole('button', { name: '2 subagents' }).hover()
|
||||
const catalogTree = page.getByRole('tree', { name: 'Subagent sessions' })
|
||||
const catalogTree = (await showSubagentsSection(page)).getByRole('tree', { name: 'Subagent sessions' })
|
||||
expect(await catalogTree.evaluate((element) => {
|
||||
const rect = element.getBoundingClientRect()
|
||||
const hit = document.elementFromPoint(rect.left + 8, rect.top + 8)
|
||||
return hit !== null && element.contains(hit)
|
||||
})).toBe(true)
|
||||
const sectionHeader = page.locator('[data-subagent-section-header]')
|
||||
expect(await sectionHeader.count()).toBe(0)
|
||||
const oneShotDisclosure = page.getByRole('button', {
|
||||
name: `Expand ${ONE_SHOT_LABEL} descendants`,
|
||||
})
|
||||
@@ -507,7 +517,6 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
await clickDisclosureGutter(3)
|
||||
await projections
|
||||
await page.getByRole('treeitem', { name: new RegExp(NESTED_LABEL) }).waitFor({ timeout: 15_000 })
|
||||
expect(await sectionHeader.count()).toBe(0)
|
||||
expect(observe.mock.calls.some(([id]) => id === childId)).toBe(true)
|
||||
expect(observe.mock.calls.some(([id]) => id === grandchildId)).toBe(false)
|
||||
} finally {
|
||||
@@ -578,13 +587,13 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
expect(scaffold.ctx.agents.get(childId)).toBeUndefined()
|
||||
expect(scaffold.ctx.agents.get(grandchildId)).toBeUndefined()
|
||||
await hierarchy.getByRole('button').first().click()
|
||||
await page.getByRole('button', { name: '2 subagents', exact: true }).waitFor()
|
||||
await hierarchy.getByRole('button', { name: /^Switch subagent:/u }).waitFor({ state: 'detached' })
|
||||
})
|
||||
|
||||
it('opens child history in the right Sidebar and releases it when closed', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-subagent-sidebar-chat'))
|
||||
await page.getByRole('button', { name: '2 subagents' }).hover()
|
||||
await page.getByRole('treeitem', { name: new RegExp(LABEL) }).getByRole('button', { name: `Open ${LABEL} in sidebar`, exact: true }).click()
|
||||
await (await showSubagentsSection(page)).getByRole('treeitem', { name: new RegExp(LABEL) })
|
||||
.getByRole('button', { name: `Open ${LABEL} in sidebar`, exact: true }).click()
|
||||
const sidebarChat = page.locator('[data-sidebar-chat]')
|
||||
await sidebarChat.getByText(/^Explain event sourcing in one sentence\./).waitFor({ timeout: 15_000 })
|
||||
await compareOrRefreshGolden(
|
||||
@@ -595,8 +604,8 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
await page.locator('[data-sidebar-right-panel] [data-dockkit-tab-close]').click()
|
||||
await sidebarChat.waitFor({ state: 'detached' })
|
||||
|
||||
await page.getByRole('button', { name: '2 subagents' }).hover()
|
||||
await page.getByRole('treeitem', { name: new RegExp(ONE_SHOT_LABEL) }).getByRole('button', { name: `Open ${ONE_SHOT_LABEL} in sidebar`, exact: true }).click()
|
||||
await (await showSubagentsSection(page)).getByRole('treeitem', { name: new RegExp(ONE_SHOT_LABEL) })
|
||||
.getByRole('button', { name: `Open ${ONE_SHOT_LABEL} in sidebar`, exact: true }).click()
|
||||
await page.locator('[data-sidebar-chat]').getByText(
|
||||
'One-shot tasks do not accept follow-ups; review the full execution record here.',
|
||||
).waitFor({ timeout: 15_000 })
|
||||
@@ -606,8 +615,7 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
|
||||
it('opens the completed child from persistence without activating it', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-subagent-open'))
|
||||
await page.getByRole('button', { name: '2 subagents' }).hover()
|
||||
await page.getByRole('treeitem', { name: new RegExp(LABEL) }).getByText(LABEL, { exact: true }).click()
|
||||
await (await showSubagentsSection(page)).getByRole('treeitem', { name: new RegExp(LABEL) }).getByText(LABEL, { exact: true }).click()
|
||||
await expect.poll(
|
||||
() => page.getByText(/^Explain event sourcing in one sentence\./).count(),
|
||||
{ timeout: 15_000 },
|
||||
@@ -633,8 +641,12 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
.toEqual([{ fontSize: '14px', lineHeight: '20px' }, { fontSize: '14px', lineHeight: '20px' }])
|
||||
expect(Math.abs(crumbGeometry[0]!.top - crumbGeometry[1]!.top), JSON.stringify(crumbGeometry)).toBeLessThanOrEqual(1)
|
||||
expect(Math.abs(crumbGeometry[0]!.bottom - crumbGeometry[1]!.bottom), JSON.stringify(crumbGeometry)).toBeLessThanOrEqual(1)
|
||||
expect(await hierarchy.getByRole('button', { name: '1 subagent', exact: true })
|
||||
.evaluate(element => getComputedStyle(element).fontSize)).toBe('12px')
|
||||
// The breadcrumb holds only the two titles; the child's own subagents are listed by its Session panel.
|
||||
expect(await hierarchy.getByRole('button').count()).toBe(2)
|
||||
await (await showSubagentsSection(page)).getByRole('treeitem', { name: new RegExp(NESTED_LABEL) }).waitFor()
|
||||
await dismissSessionPanel(page)
|
||||
// Park the pointer off the toggle so its tooltip stays out of later captures.
|
||||
await page.locator('[data-composer-input]').first().hover()
|
||||
const sidebar = await captureStableAria(
|
||||
page,
|
||||
'[role="tree"][aria-label="Sessions"]',
|
||||
@@ -720,8 +732,7 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
|
||||
it('opens a persisted grandchild with input enabled while its creator is offline', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-subagent-grandchild'))
|
||||
await page.getByRole('button', { name: '1 subagent' }).hover()
|
||||
const tree = page.getByRole('tree', { name: 'Subagent sessions' })
|
||||
const tree = (await showSubagentsSection(page)).getByRole('tree', { name: 'Subagent sessions' })
|
||||
const nestedRow = tree.locator('[role="treeitem"]').filter({ hasText: NESTED_LABEL })
|
||||
await nestedRow.waitFor({ timeout: 15_000 })
|
||||
const nestedDisclosure = page.getByRole('button', {
|
||||
@@ -730,17 +741,17 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
expect(await nestedDisclosure.count()).toBe(0)
|
||||
const clickArea = nestedRow.locator(':scope > div')
|
||||
expect(await clickArea.count()).toBe(1)
|
||||
const [menuBox, clickAreaBox] = await Promise.all([
|
||||
page.locator('[data-subagent-panel]').boundingBox(),
|
||||
const [panelBox, clickAreaBox] = await Promise.all([
|
||||
page.locator('[data-session-panel]').boundingBox(),
|
||||
clickArea.boundingBox(),
|
||||
])
|
||||
expect(menuBox).not.toBeNull()
|
||||
expect(panelBox).not.toBeNull()
|
||||
expect(clickAreaBox).not.toBeNull()
|
||||
expect([
|
||||
Math.round(clickAreaBox!.x - menuBox!.x),
|
||||
Math.round(menuBox!.x + menuBox!.width - clickAreaBox!.x - clickAreaBox!.width),
|
||||
// Menu padding plus the branchless row's one-pixel leading inset.
|
||||
]).toEqual([7, 6])
|
||||
Math.round(clickAreaBox!.x - panelBox!.x),
|
||||
Math.round(panelBox!.x + panelBox!.width - clickAreaBox!.x - clickAreaBox!.width),
|
||||
// Panel padding plus the branchless row's one-pixel leading inset.
|
||||
]).toEqual([9, 8])
|
||||
await compareOrRefreshGolden(
|
||||
BRANCHLESS_EXPECTED,
|
||||
await captureStableAria(page, '[role="tree"][aria-label="Subagent sessions"]', scaffold.workspaceCwd),
|
||||
@@ -766,8 +777,8 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
const parentSession = page.getByRole('tree', { name: 'Sessions' })
|
||||
.getByRole('treeitem', { name: /Ask a research subagent to/ })
|
||||
await parentSession.click()
|
||||
await page.getByRole('button', { name: '2 subagents' }).hover()
|
||||
await page.getByRole('treeitem', { name: new RegExp(ONE_SHOT_LABEL) }).getByText(oneShotId, { exact: true }).click()
|
||||
await (await showSubagentsSection(page)).getByRole('treeitem', { name: new RegExp(ONE_SHOT_LABEL) })
|
||||
.getByText(oneShotId, { exact: true }).click()
|
||||
await page.getByText('One-shot tasks do not accept follow-ups; review the full execution record here.').waitFor()
|
||||
expect(scaffold.ctx.agents.get(oneShotId)).toBeUndefined()
|
||||
})
|
||||
@@ -777,8 +788,8 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
await page.getByRole('tree', { name: 'Sessions' })
|
||||
.getByRole('treeitem', { name: /Ask a research subagent to/ })
|
||||
.click()
|
||||
await page.getByRole('button', { name: '2 subagents' }).hover()
|
||||
await page.getByRole('treeitem', { name: new RegExp(LABEL) }).getByText(CHILD_NAME, { exact: true }).click()
|
||||
await (await showSubagentsSection(page)).getByRole('treeitem', { name: new RegExp(LABEL) })
|
||||
.getByText(CHILD_NAME, { exact: true }).click()
|
||||
await page.getByRole('textbox', { name: 'Message or run a task, / commands, @ files or sessions' }).waitFor()
|
||||
const forkResponse = page.waitForResponse(response =>
|
||||
new URL(response.url()).pathname === '/api/session/fork')
|
||||
@@ -806,8 +817,8 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-subagent-post-fork-followup'))
|
||||
const sessions = page.getByRole('tree', { name: 'Sessions' })
|
||||
await sessions.getByRole('treeitem', { name: /Ask a research subagent to/ }).click()
|
||||
await page.getByRole('button', { name: '2 subagents' }).hover()
|
||||
await page.getByRole('treeitem', { name: new RegExp(LABEL) }).getByText(CHILD_NAME, { exact: true }).click()
|
||||
await (await showSubagentsSection(page)).getByRole('treeitem', { name: new RegExp(LABEL) })
|
||||
.getByText(CHILD_NAME, { exact: true }).click()
|
||||
await page.locator('[data-composer-input][contenteditable="true"]').first().waitFor()
|
||||
expect(scaffold.ctx.agents.get(childId)).toBeUndefined()
|
||||
|
||||
@@ -823,8 +834,9 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
await expect.poll(() => scaffold.ctx.agents.get(forkId)).not.toBeUndefined()
|
||||
|
||||
await sessions.getByRole('treeitem', { name: /Ask a research subagent to/ }).click()
|
||||
await page.getByRole('button', { name: '2 subagents' }).press('ArrowDown')
|
||||
await page.getByRole('treeitem', { name: new RegExp(LABEL) }).getByText(CHILD_NAME, { exact: true }).click()
|
||||
await sessionPanelToggle(page).press('Enter')
|
||||
await page.locator(SUBAGENTS_SECTION).getByRole('treeitem', { name: new RegExp(LABEL) })
|
||||
.getByText(CHILD_NAME, { exact: true }).click()
|
||||
const input = page.locator('[data-composer-input][contenteditable="true"]').first()
|
||||
await input.waitFor()
|
||||
const promptResponse = page.waitForResponse(response =>
|
||||
@@ -860,12 +872,11 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
})
|
||||
await page.getByRole('tree', { name: 'Sessions' })
|
||||
.getByRole('treeitem', { name: /Ask a research subagent to/ }).click()
|
||||
await page.getByRole('button', { name: '2 subagents', exact: true }).click()
|
||||
await page.locator('[data-team-panel]').getByText('Root-only shared task', { exact: true }).waitFor()
|
||||
const rootHeader = page.locator('[data-subagent-section-header]')
|
||||
const rootSection = await showSubagentsSection(page)
|
||||
await rootSection.locator('[data-team-panel]').getByText('Root-only shared task', { exact: true }).waitFor()
|
||||
const rootHeader = rootSection.getByRole('heading', { level: 2 }).locator('..')
|
||||
expect(await rootHeader.textContent()).toBe('Subagents1 completed\u2002·\u20021 not running')
|
||||
expect(await rootHeader.getByRole('button').count()).toBe(0)
|
||||
expect(await rootHeader.locator('[data-icon="dsw-icon-users-outline-regular"]').count()).toBe(1)
|
||||
const progress = await rootHeader.textContent()
|
||||
await page.getByRole('button', { name: `Expand ${LABEL} descendants`, exact: true }).click()
|
||||
await page.getByRole('treeitem', { name: new RegExp(NESTED_LABEL) }).waitFor()
|
||||
@@ -877,8 +888,7 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
await panel.getByRole('treeitem', { name: new RegExp(ONE_SHOT_LABEL) }).waitFor()
|
||||
expect(await panel.locator('[data-team-panel]').count()).toBe(0)
|
||||
expect(await panel.evaluate(element => element.getBoundingClientRect().width)).toBe(360)
|
||||
const header = panel.locator('[data-subagent-section-header]')
|
||||
expect(await header.count()).toBe(0)
|
||||
expect(await panel.getByRole('heading').count()).toBe(0)
|
||||
expect(await switcher.textContent()).toBe(LABEL)
|
||||
const currentRow = panel.getByRole('treeitem', { name: new RegExp(LABEL) })
|
||||
const currentCheck = currentRow.locator('[data-subagent-current]')
|
||||
@@ -990,8 +1000,8 @@ describe('web e2e: migration-required subagent catalog', () => {
|
||||
const workspaceRow = page.getByRole('tree', { name: 'Sessions' }).getByRole('treeitem').first()
|
||||
await workspaceRow.click()
|
||||
await page.locator(`[data-row-key="session:${parentId}"]`).click()
|
||||
await page.getByRole('button', { name: '1 subagent', exact: true }).hover()
|
||||
const tree = page.getByRole('tree', { name: 'Subagent sessions' })
|
||||
await showSessionPanel(page)
|
||||
const tree = page.locator(SUBAGENTS_SECTION).getByRole('tree', { name: 'Subagent sessions' })
|
||||
const childRow = tree.getByRole('treeitem', { name: new RegExp(childLabel) })
|
||||
await childRow.waitFor()
|
||||
await expect.poll(() => childRow.textContent()).toContain('Migration required')
|
||||
@@ -1012,7 +1022,7 @@ describe('web e2e: migration-required subagent catalog', () => {
|
||||
|
||||
await childRow.getByText(childId, { exact: true }).click()
|
||||
await page.getByRole('button', { name: `Switch subagent: ${childLabel}`, exact: true }).waitFor()
|
||||
await page.getByRole('button', { name: '1 subagent', exact: true }).hover()
|
||||
await showSessionPanel(page)
|
||||
const grandchildRow = tree.getByRole('treeitem', { name: new RegExp(grandchildLabel) })
|
||||
await grandchildRow.waitFor()
|
||||
expect(await grandchildRow.textContent()).toContain('Migration required')
|
||||
|
||||
@@ -468,3 +468,46 @@ export async function openSettings(page: Page, locale: 'en' | 'zh' | 'ja'): Prom
|
||||
await trigger.click()
|
||||
await page.getByRole('menuitem', { name: labels[locale][1], exact: true }).click()
|
||||
}
|
||||
|
||||
/** The Session panel toggle in the Session header. */
|
||||
export function sessionPanelToggle(page: Page): Locator {
|
||||
return page.locator('[data-session-panel-toggle]')
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Session panel unless it already shows, and wait for its entrance
|
||||
* animation so geometry reads see the final position. A panel over the
|
||||
* conversation closes on presses outside it and a narrower window can hide
|
||||
* it, so each step that reads the panel shows it first.
|
||||
* @param page - the page under test.
|
||||
* @returns the panel.
|
||||
*/
|
||||
export async function showSessionPanel(page: Page): Promise<Locator> {
|
||||
const toggle = sessionPanelToggle(page)
|
||||
if (await toggle.getAttribute('aria-expanded', { timeout: 20_000 }) !== 'true') await toggle.click()
|
||||
const panel = page.locator('[data-session-panel]')
|
||||
await panel.waitFor()
|
||||
await panel.evaluate(async (element) => {
|
||||
await Promise.all(element.getAnimations().map(animation => animation.finished))
|
||||
})
|
||||
return panel
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the Session panel shown over the conversation with Escape.
|
||||
* @param page - the page under test.
|
||||
*/
|
||||
export async function dismissSessionPanel(page: Page): Promise<void> {
|
||||
await page.keyboard.press('Escape')
|
||||
await page.locator('[data-session-panel]').waitFor({ state: 'detached' })
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide the Session panel unless it is already hidden.
|
||||
* @param page - the page under test.
|
||||
*/
|
||||
export async function hideSessionPanel(page: Page): Promise<void> {
|
||||
const toggle = sessionPanelToggle(page)
|
||||
if (await toggle.getAttribute('aria-expanded') === 'true') await toggle.click()
|
||||
await expect.poll(() => toggle.getAttribute('aria-expanded')).toBe('false')
|
||||
}
|
||||
@@ -97,7 +97,7 @@
|
||||
"tests/excel-opc.e2e.ts",
|
||||
"tests/office-fixture.ts",
|
||||
"tests/sidebar-browser.e2e.ts",
|
||||
"tests/jobs-menu-layering.e2e.ts",
|
||||
"tests/jobs-panel-layering.e2e.ts",
|
||||
"tests/plugin-config.e2e.ts",
|
||||
"tests/input-plugin-extensions.e2e.ts",
|
||||
"tests/plugin-manager.e2e.ts",
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
- list "Background jobs":
|
||||
- listitem:
|
||||
- button "Show live output of for _ in $(seq 1 3000); do [ -e .background-job-list.release ] && break; sleep 0.2; done": for _ in $(seq 1 3000); do [ -e .background-job-list.release ] && break; sleep 0.2; done bash {{duration}}
|
||||
- button "Stop task for _ in $(seq 1 3000); do [ -e .background-job-list.release ] && break; sleep 0.2; done"
|
||||
- region "Background jobs":
|
||||
- heading "Background jobs" [level=2]
|
||||
- list "Background jobs":
|
||||
- listitem:
|
||||
- button "Show live output of for _ in $(seq 1 3000); do [ -e .background-job-list.release ] && break; sleep 0.2; done": for _ in $(seq 1 3000); do [ -e .background-job-list.release ] && break; sleep 0.2; done bash {{duration}}
|
||||
- button "Stop task for _ in $(seq 1 3000); do [ -e .background-job-list.release ] && break; sleep 0.2; done"
|
||||
@@ -1,5 +1,7 @@
|
||||
- list "Background jobs":
|
||||
- listitem:
|
||||
- button "Finished 1" [expanded]
|
||||
- button "Clear"
|
||||
- listitem: "bash for _ in $(seq 1 3000); do [ -e .background-job-list.release ] && break; sleep 0.2; done signal: SIGTERM; cancelled by the user {{duration}}"
|
||||
- region "Background jobs":
|
||||
- heading "Background jobs" [level=2]
|
||||
- list "Background jobs":
|
||||
- listitem:
|
||||
- button "Finished 1" [expanded]
|
||||
- button "Clear"
|
||||
- listitem: "bash for _ in $(seq 1 3000); do [ -e .background-job-list.release ] && break; sleep 0.2; done signal: SIGTERM; cancelled by the user {{duration}}"
|
||||
@@ -1 +1,2 @@
|
||||
- button "2 subagents"
|
||||
- heading "Subagents" [level=2]
|
||||
- text: 1 completed · 1 not running
|
||||
@@ -5,6 +5,7 @@
|
||||
- 'button "Switch subagent: event-sourcing researcher"': event-sourcing researcher
|
||||
- text: /
|
||||
- 'button "Switch subagent: example editor"': example editor
|
||||
- button "Session panel"
|
||||
- button "More actions"
|
||||
- button "Open right sidebar"
|
||||
- tablist:
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
- button "Ask a research subagent to"
|
||||
- text: /
|
||||
- 'button "Switch subagent: event-sourcing researcher"': event-sourcing researcher
|
||||
- button "1 subagent"
|
||||
- text: Standard mode
|
||||
- button "Session panel"
|
||||
- button "More actions"
|
||||
- button "Open right sidebar"
|
||||
- tablist:
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
- button "Ask a research subagent to"
|
||||
- text: /
|
||||
- 'button "Switch subagent: event-sourcing researcher"': event-sourcing researcher
|
||||
- button "1 subagent"
|
||||
- text: Standard mode
|
||||
- button "Session panel"
|
||||
- button "More actions"
|
||||
- button "Open right sidebar"
|
||||
- tablist:
|
||||
|
||||
+1
-1
@@ -218,7 +218,7 @@
|
||||
"apps/web/tests/subagent-interrupt-ui.e2e.ts",
|
||||
"apps/web/tests/sidebar-subagent-activity.e2e.ts",
|
||||
"apps/web/tests/background-job-list.e2e.ts",
|
||||
"apps/web/tests/jobs-menu-layering.e2e.ts",
|
||||
"apps/web/tests/jobs-panel-layering.e2e.ts",
|
||||
"apps/web/tests/live-job-stream.e2e.ts",
|
||||
"apps/web/tests/bash-abort-row.e2e.ts",
|
||||
"apps/web/tests/skill-tool-row.e2e.ts",
|
||||
|
||||
Reference in new issue
Block a user