From eb628f979bc75af173e8ee856c2c5a12375b4246 Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 3 Aug 2026 19:51:59 +0800 Subject: [PATCH] test(web): align long-chat contracts with master --- apps/web/tests/chat-continuous-conversation.e2e.ts | 4 ++-- apps/web/tests/chat-long-interactions.e2e.ts | 11 +++++++---- apps/web/tests/chat-scroll-contract.e2e.ts | 4 ++-- apps/web/tests/complex-history.perf.ts | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/apps/web/tests/chat-continuous-conversation.e2e.ts b/apps/web/tests/chat-continuous-conversation.e2e.ts index 71e4037929..61701c1cdc 100644 --- a/apps/web/tests/chat-continuous-conversation.e2e.ts +++ b/apps/web/tests/chat-continuous-conversation.e2e.ts @@ -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') diff --git a/apps/web/tests/chat-long-interactions.e2e.ts b/apps/web/tests/chat-long-interactions.e2e.ts index a477e17810..44bc6f0012 100644 --- a/apps/web/tests/chat-long-interactions.e2e.ts +++ b/apps/web/tests/chat-long-interactions.e2e.ts @@ -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 }, diff --git a/apps/web/tests/chat-scroll-contract.e2e.ts b/apps/web/tests/chat-scroll-contract.e2e.ts index 36465713a8..b4b67bf3a3 100644 --- a/apps/web/tests/chat-scroll-contract.e2e.ts +++ b/apps/web/tests/chat-scroll-contract.e2e.ts @@ -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) => { diff --git a/apps/web/tests/complex-history.perf.ts b/apps/web/tests/complex-history.perf.ts index 2f8c3c48d0..f2c8c5332d 100644 --- a/apps/web/tests/complex-history.perf.ts +++ b/apps/web/tests/complex-history.perf.ts @@ -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, {