test(web): scope Mermaid snapshots to diagram content
This commit is contained in:
1 parent
0bfd594875
commit
4fabbd39c5
3 files changed
+3
-78
No files matched your search
@@ -1,17 +1,3 @@
|
||||
- banner:
|
||||
- navigation "Session hierarchy":
|
||||
- button "Mermaid previews" [disabled]
|
||||
- button "Session log":
|
||||
- text: Session log
|
||||
- img
|
||||
- button "Open the sidebar":
|
||||
- img
|
||||
- tablist:
|
||||
- tab "Chat" [selected]
|
||||
- tab "Trajectory"
|
||||
- text: Preview these Mermaid diagrams. {{clock}}
|
||||
- button "Copy":
|
||||
- img
|
||||
- heading "Mermaid previews" [level=1]
|
||||
- button "Source"
|
||||
- button "Copy"
|
||||
@@ -27,26 +13,3 @@
|
||||
- button "Source"
|
||||
- button "Copy"
|
||||
- img "Mermaid diagram"
|
||||
- button "Copy":
|
||||
- img
|
||||
- button "Good response":
|
||||
- img
|
||||
- button "Bad response":
|
||||
- img
|
||||
- button "Branch into a new conversation":
|
||||
- img
|
||||
- button "Ran for {{duration}}":
|
||||
- img
|
||||
- text: Ran for {{duration}}
|
||||
- text: {{clock}}
|
||||
- textbox "Message or run a task... / commands, @ files or sessions"
|
||||
- button "Commands":
|
||||
- img
|
||||
- button "Add attachment":
|
||||
- img
|
||||
- 'button "Access mode, current: Workspace Write"': Workspace Write
|
||||
- button "Select model, current DeepSeek-V4-Flash":
|
||||
- text: DeepSeek-V4-Flash
|
||||
- img
|
||||
- button "Send message" [disabled]
|
||||
- text: 1 turns · 1 steps LLM {{duration}}
|
||||
@@ -1,17 +1,3 @@
|
||||
- banner:
|
||||
- navigation "会话层级":
|
||||
- button "Mermaid previews" [disabled]
|
||||
- button "Session 日志":
|
||||
- text: Session 日志
|
||||
- img
|
||||
- button "展开侧栏":
|
||||
- img
|
||||
- tablist:
|
||||
- tab "对话" [selected]
|
||||
- tab "轨迹"
|
||||
- text: Preview these Mermaid diagrams. {{clock}}
|
||||
- button "复制":
|
||||
- img
|
||||
- heading "Mermaid previews" [level=1]
|
||||
- button "源码"
|
||||
- button "复制"
|
||||
@@ -26,26 +12,3 @@
|
||||
- button "源码"
|
||||
- button "复制"
|
||||
- img "Mermaid 图表"
|
||||
- button "复制":
|
||||
- img
|
||||
- button "好的回答":
|
||||
- img
|
||||
- button "有问题的回答":
|
||||
- img
|
||||
- button "在新对话中分支":
|
||||
- img
|
||||
- button "用时 {{duration}}":
|
||||
- img
|
||||
- text: 用时 {{duration}}
|
||||
- text: {{clock}}
|
||||
- textbox "发消息或做任务… / 调用指令 @ 文件或对话"
|
||||
- button "指令":
|
||||
- img
|
||||
- button "添加附件":
|
||||
- img
|
||||
- button "访问模式,当前:工作区内修改": 工作区内修改
|
||||
- button "选择模型,当前 DeepSeek-V4-Flash":
|
||||
- text: DeepSeek-V4-Flash
|
||||
- img
|
||||
- button "发送消息" [disabled]
|
||||
- text: 1 轮 · 1 步 LLM {{duration}}
|
||||
@@ -15,6 +15,7 @@ import { newEnglishPage, saveFailureShot } from './support.ts'
|
||||
const SNAPSHOT_DIR = fileURLToPath(new URL('./expected/markdown-mermaid', import.meta.url))
|
||||
const MODE = webSnapshotMode()
|
||||
const SEED_ID = 'markdown-mermaid-web-e2e'
|
||||
const DIAGRAM_MESSAGE = '[class*="markdown"]:has(.md-code-block)'
|
||||
const FLOW = 'flowchart LR\n A[输入] --> B[共享渲染器] --> C[图形预览]'
|
||||
const SEQUENCE = 'sequenceDiagram\n participant U as User\n participant R as Renderer\n U->>R: Mermaid source\n R-->>U: Diagram'
|
||||
const INVALID = 'flowchart LR\n A[unfinished'
|
||||
@@ -122,8 +123,7 @@ describe('web e2e: Mermaid chat previews', () => {
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
await page.getByRole('heading', { name: 'Mermaid previews' }).click()
|
||||
await page.mouse.move(0, 0)
|
||||
const snapshot = (await captureStableAria(page, '[class*="centerCol"]', scaffold.workspaceCwd))
|
||||
.split(SEED_ID).join('{{seededId}}')
|
||||
const snapshot = await captureStableAria(page, DIAGRAM_MESSAGE, scaffold.workspaceCwd)
|
||||
await compareOrRefreshGolden(join(SNAPSHOT_DIR, 'ui.expected.md'), snapshot, MODE)
|
||||
await page.close()
|
||||
}, 60_000)
|
||||
@@ -142,8 +142,7 @@ describe('web e2e: Mermaid chat previews', () => {
|
||||
await expect.poll(() => firstImage.evaluate(node => (node as HTMLImageElement).naturalWidth)).toBeGreaterThan(0)
|
||||
expect(await controls.evaluate(node => node.getBoundingClientRect().top))
|
||||
.toBeGreaterThanOrEqual(await firstImage.evaluate(node => node.getBoundingClientRect().bottom))
|
||||
const snapshot = (await captureStableAria(page, '[class*="centerCol"]', scaffold.workspaceCwd))
|
||||
.split(SEED_ID).join('{{seededId}}')
|
||||
const snapshot = await captureStableAria(page, DIAGRAM_MESSAGE, scaffold.workspaceCwd)
|
||||
await compareOrRefreshGolden(join(SNAPSHOT_DIR, 'zh.expected.md'), snapshot, MODE)
|
||||
await assertFixtureInventory(SNAPSHOT_DIR, ['ui.expected.md', 'zh.expected.md'])
|
||||
await page.close()
|
||||
|
||||
Reference in new issue
Block a user