Преглед изворни кода

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

kingwl пре 1 месец
родитељ
комит
eb628f979b

+ 2 - 2
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.goto(scaffold.baseUrl, { waitUntil: 'load' })
     await page.waitForSelector('[class*="frame"]', { timeout: 30_000 })
     await page.waitForSelector('[class*="frame"]', { timeout: 30_000 })
-    await connectFreshWorkspace(page, 'continuous-chat-e2e')
+    await connectFreshWorkspace(page, scaffold.workspaceCwd, 'continuous-chat-e2e')
   }, 120_000)
   }, 120_000)
 
 
   afterAll(async () => {
   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}"]`)
       const toolRow = page.locator(`[data-chat-call-id="${spec.callId}"]`)
       await expect.poll(() => toolRow.count(), { timeout: 10_000 }).toBe(1)
       await expect.poll(() => toolRow.count(), { timeout: 10_000 }).toBe(1)
       expect(await toolRow.textContent()).toContain(spec.toolResultMarker)
       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')
       expect(await disclosure.getAttribute('aria-expanded')).toBe('false')
       await disclosure.click()
       await disclosure.click()
       await expect.poll(() => disclosure.getAttribute('aria-expanded'), { timeout: 10_000 }).toBe('true')
       await expect.poll(() => disclosure.getAttribute('aria-expanded'), { timeout: 10_000 }).toBe('true')

+ 7 - 4
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 branchUserMarker = FIXTURE.markers.user(BRANCH_TURN)
     const branchAssistantMarker = FIXTURE.markers.assistant(BRANCH_TURN)
     const branchAssistantMarker = FIXTURE.markers.assistant(BRANCH_TURN)
     const branchUserEvent = requiredEvent(source.session.events, 'user/message', branchUserMarker)
     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'> => (
     const boundary = source.session.events.find((event): event is SessionEvent<'turn/end'> => (
       event.type === 'turn/end' && event.data.turn === BRANCH_TURN
       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[0]).not.toBeNull()
     expect(groupKeys[1]).toBe(groupKeys[0])
     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 summary1.getAttribute('aria-expanded')).toBe('false')
     expect(await summary2.getAttribute('aria-expanded')).toBe('false')
     expect(await summary2.getAttribute('aria-expanded')).toBe('false')
     await summary2.focus()
     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)
     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 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 userRow.textContent()).toContain(branchUserMarker)
+    expect(await assistantRow.textContent()).toContain(branchAssistantMarker)
     await page.context().grantPermissions(['clipboard-read', 'clipboard-write'])
     await page.context().grantPermissions(['clipboard-read', 'clipboard-write'])
     await userRow.hover()
     await userRow.hover()
     await userRow.getByRole('button', { name: 'Copy', exact: true }).click()
     await userRow.getByRole('button', { name: 'Copy', exact: true }).click()
     await expect.poll(() => page.evaluate(() => navigator.clipboard.readText()), { timeout: 5_000 })
     await expect.poll(() => page.evaluate(() => navigator.clipboard.readText()), { timeout: 5_000 })
       .toBe(expectedUserText)
       .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(
     await expect.poll(
       () => scaffold.ctx.agents.list().find(agent => agent.session.header.parentSession === SessionId(SESSION_ID)),
       () => scaffold.ctx.agents.list().find(agent => agent.session.header.parentSession === SessionId(SESSION_ID)),
       { timeout: 15_000 },
       { timeout: 15_000 },

+ 2 - 2
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 composer.fill(LIVE_TOOL_PROMPT)
         await world.page.getByRole('button', { name: 'Send message', exact: true }).click()
         await world.page.getByRole('button', { name: 'Send message', exact: true }).click()
         await expect.poll(() => fileExists(readyPath), { timeout: 15_000 }).toBe(true)
         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 })
         await liveRow.waitFor({ timeout: 15_000 })
         expect(await liveRow.getAttribute('data-state')).toBe('running')
         expect(await liveRow.getAttribute('data-state')).toBe('running')
         await expectBottom(world.page)
         await expectBottom(world.page)
@@ -557,7 +557,7 @@ describe('web e2e: long Chat scroll contract', () => {
       await expectBottom(world.page)
       await expectBottom(world.page)
       await expectMarkerAboveComposer(world.page, LIVE_TOOL_DONE)
       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)
       const liveRow = world.page.locator(liveRowSelector)
       await wheelUntilVisible(world.page, liveRowSelector, -300)
       await wheelUntilVisible(world.page, liveRowSelector, -300)
       const toolAnchor = await liveRow.evaluate((row) => {
       const toolAnchor = await liveRow.evaluate((row) => {

+ 1 - 1
apps/web/tests/complex-history.perf.ts

@@ -1394,7 +1394,7 @@ describe('manual web performance: complex workspace and history', () => {
     try {
     try {
       await world.page.goto(world.scaffold.baseUrl, { waitUntil: 'load' })
       await world.page.goto(world.scaffold.baseUrl, { waitUntil: 'load' })
       await world.page.waitForSelector('[class*="frame"]', { timeout: 30_000 })
       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)
       const cdp = await world.page.context().newCDPSession(world.page)
       await cdp.send('Performance.enable')
       await cdp.send('Performance.enable')
       const conversation = await continueConversation(world, cdp, {
       const conversation = await continueConversation(world, cdp, {