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

test(web): stabilize delivered-file snapshots across CI hosts

creatixchu пре 1 месец
родитељ
комит
0b3248e67d

+ 2 - 3
apps/web/tests/navigation-panes.e2e.ts

@@ -403,14 +403,13 @@ describe('web e2e: navigation & panes over a rich seeded session', () => {
     // the right column either — the expanded terminal card is read in place.
     await page.locator('[data-sample="bash"] ~ div [data-terminal] [class*="_copyButton_"]').first().click()
     await expect.poll(() => frame.getAttribute('data-rightbar-collapsed'), { timeout: 5_000 }).toBe('true')
-    // Read summaries are file links: one click opens the file as a text-preview
-    // tab in the right Sidebar, which expands to show it beside the guide tab.
+    // Opening a file into the empty column creates only its preview tab.
     const fileLink = page.locator('[data-variant="read"] button').first()
     await fileLink.waitFor({ timeout: 10_000 })
     await fileLink.click()
     await expect.poll(() => frame.getAttribute('data-rightbar-collapsed'), { timeout: 5_000 }).toBe(null)
     const column = page.locator('[data-rightbar-col]')
-    await expect.poll(() => column.locator('[data-dockkit-tab-title]').count(), { timeout: 5_000 }).toBe(2)
+    await expect.poll(() => column.locator('[data-dockkit-tab-title]').allTextContents(), { timeout: 5_000 }).toEqual(['nav-a.md'])
     // Put the column back so later cases start from the default frame.
     await column.locator('[data-sidebar-right-toggle]').click()
     await expect.poll(() => frame.getAttribute('data-rightbar-collapsed'), { timeout: 5_000 }).toBe('true')

+ 2 - 0
apps/web/tests/present-svg.e2e.ts

@@ -40,6 +40,7 @@ describe('web e2e: requested SVG is explicitly delivered', () => {
     }
     scaffold = await launchWebScaffold({
       compareReplaySession: true,
+      extraOverlayPath: fileURLToPath(new URL('./present-svg.overlay.yml', import.meta.url)),
       ...(replayOverride === undefined ? {} : { replayFixture: FIXTURE, replayOverride }),
     })
     browser = await chromium.launch()
@@ -114,6 +115,7 @@ describe('web e2e: requested SVG is explicitly delivered', () => {
 
   it.skipIf(MODE === 'record')('replays the delivered file and Chinese conversation', async () => {
     await assertFinalWorkspaceSnapshot(DIR, cwd)
+    await expect.poll(() => page.getByRole('button', { name: `${FILE} 的更多文件操作`, exact: true }).isDisabled()).toBe(true)
     // Delivery owns the transcript; navigation and composer chrome have separate scenarios.
     const aria = await captureExpandedTurnProcessAria(page, '[data-chat-flow]', scaffold.workspaceCwd)
     await compareOrRefreshGolden(join(DIR, 'ui.expected.md'), aria, MODE)

+ 4 - 0
apps/web/tests/present-svg.overlay.yml

@@ -0,0 +1,4 @@
+# This transcript includes the no-desktop state on every test platform.
+- id: session-controller
+  config:
+    nativeOpen: false

+ 1 - 0
packages/client/ui-primitives/src/LinkIcon.tsx

@@ -48,6 +48,7 @@ export function classifyLinkPath(path: string): LinkIconKind {
     case 'markdown':
     case 'other':
     case 'video': return 'other'
+    /* v8 ignore next -- classifyFileType returns a closed union exhausted above */
     default: return assertNever(type)
   }
 }

+ 2 - 1
snapshots/web/present-svg/ui.expected.md

@@ -51,10 +51,11 @@
 - paragraph: 下方附一行核心思想说明:指令与数据以二进制统一存储在存储器中。用浏览器打开该 SVG 文件即可查看。
 - text: 本轮文件改动
 - button "打开 {{cwd}}/workspace/von-neumann.svg": von-neumann.svg
+- text: 此主机没有可用的桌面,无法打开文件或文件夹
 - button "在侧边栏预览 von-neumann.svg"
 - text: von-neumann.svg 冯诺依曼架构示意图 SVG
 - button "在侧边栏打开 von-neumann.svg": 打开
-- button "von-neumann.svg 的更多文件操作":
+- button "von-neumann.svg 的更多文件操作" [disabled]:
   - img
 - button "复制":
   - img