test(web): align long-chat contracts with master

This commit is contained in:
kingwl
2026-08-04 14:23:34 +08:00
committed by imccyu
parent e53dcd56c7
commit eb628f979b
4 changed files with 12 additions and 9 deletions
@@ -191,7 +191,7 @@ describe('web e2e: continuous conversation grown through the composer', () => {
})
await page.goto(scaffold.baseUrl, { waitUntil: 'load' })
await page.waitForSelector('[class*="frame"]', { timeout: 30_000 })
await connectFreshWorkspace(page, 'continuous-chat-e2e')
await connectFreshWorkspace(page, scaffold.workspaceCwd, 'continuous-chat-e2e')
}, 120_000)
afterAll(async () => {
@@ -302,7 +302,7 @@ describe('web e2e: continuous conversation grown through the composer', () => {
const toolRow = page.locator(`[data-chat-call-id="${spec.callId}"]`)
await expect.poll(() => toolRow.count(), { timeout: 10_000 }).toBe(1)
expect(await toolRow.textContent()).toContain(spec.toolResultMarker)
const disclosure = toolRow.locator('[data-sample="bash-global"]')
const disclosure = toolRow.locator('[data-sample="bash"]')
expect(await disclosure.getAttribute('aria-expanded')).toBe('false')
await disclosure.click()
await expect.poll(() => disclosure.getAttribute('aria-expanded'), { timeout: 10_000 }).toBe('true')
+7 -4
View File
@@ -168,6 +168,7 @@ describe('web e2e: long Chat interaction contract', () => {
const branchUserMarker = FIXTURE.markers.user(BRANCH_TURN)
const branchAssistantMarker = FIXTURE.markers.assistant(BRANCH_TURN)
const branchUserEvent = requiredEvent(source.session.events, 'user/message', branchUserMarker)
const branchAssistantEvent = requiredEvent(source.session.events, 'assistant/message', branchAssistantMarker)
const boundary = source.session.events.find((event): event is SessionEvent<'turn/end'> => (
event.type === 'turn/end' && event.data.turn === BRANCH_TURN
))
@@ -208,8 +209,8 @@ describe('web e2e: long Chat interaction contract', () => {
expect(groupKeys[0]).not.toBeNull()
expect(groupKeys[1]).toBe(groupKeys[0])
const summary1 = call1.locator('[data-sample="bash-global"]')
const summary2 = call2.locator('[data-sample="bash-global"]')
const summary1 = call1.locator('[data-sample="bash"]')
const summary2 = call2.locator('[data-sample="bash"]')
expect(await summary1.getAttribute('aria-expanded')).toBe('false')
expect(await summary2.getAttribute('aria-expanded')).toBe('false')
await summary2.focus()
@@ -220,15 +221,17 @@ describe('web e2e: long Chat interaction contract', () => {
await wheelUntilMounted(page, `[data-chat-anchor-key="node:${String(branchUserEvent.seq)}"]`, -1_100)
const userRow = page.locator(`[data-chat-anchor-key="node:${String(branchUserEvent.seq)}"]`)
const assistantRow = page.locator(`[data-chat-anchor-key="node:${String(branchAssistantEvent.seq)}"]`)
expect(await userRow.textContent()).toContain(branchUserMarker)
expect(await assistantRow.textContent()).toContain(branchAssistantMarker)
await page.context().grantPermissions(['clipboard-read', 'clipboard-write'])
await userRow.hover()
await userRow.getByRole('button', { name: 'Copy', exact: true }).click()
await expect.poll(() => page.evaluate(() => navigator.clipboard.readText()), { timeout: 5_000 })
.toBe(expectedUserText)
await userRow.hover()
await userRow.getByRole('button', { name: 'Branch into a new conversation', exact: true }).click()
await assistantRow.hover()
await assistantRow.getByRole('button', { name: 'Branch into a new conversation', exact: true }).click()
await expect.poll(
() => scaffold.ctx.agents.list().find(agent => agent.session.header.parentSession === SessionId(SESSION_ID)),
{ timeout: 15_000 },
+2 -2
View File
@@ -514,7 +514,7 @@ describe('web e2e: long Chat scroll contract', () => {
await composer.fill(LIVE_TOOL_PROMPT)
await world.page.getByRole('button', { name: 'Send message', exact: true }).click()
await expect.poll(() => fileExists(readyPath), { timeout: 15_000 }).toBe(true)
const liveRow = world.page.locator(`[data-chat-call-id="${LIVE_TOOL_CALL_ID}"] [data-sample="bash-global"]`)
const liveRow = world.page.locator(`[data-chat-call-id="${LIVE_TOOL_CALL_ID}"] [data-sample="bash"]`)
await liveRow.waitFor({ timeout: 15_000 })
expect(await liveRow.getAttribute('data-state')).toBe('running')
await expectBottom(world.page)
@@ -557,7 +557,7 @@ describe('web e2e: long Chat scroll contract', () => {
await expectBottom(world.page)
await expectMarkerAboveComposer(world.page, LIVE_TOOL_DONE)
const liveRowSelector = `[data-chat-call-id="${LIVE_TOOL_CALL_ID}"] [data-sample="bash-global"]`
const liveRowSelector = `[data-chat-call-id="${LIVE_TOOL_CALL_ID}"] [data-sample="bash"]`
const liveRow = world.page.locator(liveRowSelector)
await wheelUntilVisible(world.page, liveRowSelector, -300)
const toolAnchor = await liveRow.evaluate((row) => {
+1 -1
View File
@@ -1394,7 +1394,7 @@ describe('manual web performance: complex workspace and history', () => {
try {
await world.page.goto(world.scaffold.baseUrl, { waitUntil: 'load' })
await world.page.waitForSelector('[class*="frame"]', { timeout: 30_000 })
await connectFreshWorkspace(world.page, 'continuous-conversation-perf')
await connectFreshWorkspace(world.page, world.scaffold.workspaceCwd, 'continuous-conversation-perf')
const cdp = await world.page.context().newCDPSession(world.page)
await cdp.send('Performance.enable')
const conversation = await continueConversation(world, cdp, {