Przeglądaj źródła

test: synchronize console and shell readiness and pin browser timezone

07akioni 1 miesiąc temu
rodzic
commit
8b250f5df5

+ 6 - 2
apps/web/tests/cordis-tool-round.e2e.ts

@@ -18,7 +18,7 @@ import {
   captureStableAria, compareOrRefreshGolden, fixtureUserPrompts,
   launchWebScaffold, recordFixture, watchConsole, webSnapshotMode, type WebScaffold,
 } from './scaffold.ts'
-import { connectFreshWorkspace, expandOwningTurnProcess, newEnglishPage, saveFailureShot } from './support.ts'
+import { connectFreshWorkspace, expandOwningTurnProcess, saveFailureShot } from './support.ts'
 
 const FIXTURE = fileURLToPath(new URL('../../../snapshots/web/cordis-tool-round/session.v2.jsonl', import.meta.url))
 const UI_EXPECTED = fileURLToPath(new URL('../../../snapshots/web/cordis-tool-round/ui.expected.md', import.meta.url))
@@ -83,7 +83,11 @@ describe('web e2e: Cordis tools use their owned cards', () => {
       if (key === 'modelSelection') modelChanges.push(`${String(seq)}:${JSON.stringify(value)}`)
     })
     browser = await chromium.launch()
-    page = await newEnglishPage(browser)
+    page = await browser.newPage({
+      viewport: { width: 1680, height: 1000 },
+      locale: 'en-US',
+      timezoneId: 'Asia/Shanghai',
+    })
     page.on('websocket', (socket) => {
       socket.on('framereceived', (frame) => {
         const payload = String(frame.payload)

+ 7 - 0
packages/experimental/inspector/tests/integration.host.spec.ts

@@ -370,6 +370,13 @@ describe('experimental Inspector real Worker', () => {
     await Promise.all([cdp.call('Runtime.enable'), secondCdp.call('Runtime.enable')])
     const firstContext = await clientContext(cdp)
     const secondContext = await clientContext(secondCdp)
+    // Runtime.enable queues Console subscription frames on the Client socket.
+    // A round trip on that socket confirms both subscriptions before the
+    // independent fixture-worker channel emits the event.
+    await Promise.all([
+      cdp.call('Runtime.evaluate', { expression: 'void 0', contextId: firstContext }),
+      secondCdp.call('Runtime.evaluate', { expression: 'void 0', contextId: secondContext }),
+    ])
     const value = { owner: 'client-console' }
     const marker = 'client-console-event'
     await client.log(value, marker)

+ 8 - 1
packages/terminal/terminal-bash/tests/local.spec.ts

@@ -334,7 +334,14 @@ describe.skipIf(!hasPwsh)('terminal-bash pwsh real shell', () => {
         text: '$env:KEEP = "ok"; Set-Location /',
         submit: true,
       })
-      expect((await first.done).waitReason).toBe('stdin_read')
+      // Silence can settle a send before pwsh publishes its prompt. Empty
+      // sends keep observing the same command until exact readiness arrives.
+      const deadline = Date.now() + 8_000
+      let firstResult = await first.done
+      while (firstResult.waitReason === 'inferred_idle' && Date.now() < deadline) {
+        firstResult = await ctx.terminals.startSend(agent, created.sessionId, { text: '', submit: false }).done
+      }
+      expect(firstResult.waitReason).toBe('stdin_read')
       const second = ctx.terminals.startSend(agent, created.sessionId, {
         text: 'Write-Output "keep=$env:KEEP secret=$env:DSH_TEST_SECRET"',
         submit: true,