Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ Viva 客户端的测试是 Go 测试。macOS 和 Windows 的桌面计时入口
- 正确做法:指定真实 Go 包和测试名,检查报告包含目标用例,再结合竞态测试和对应平台的原生验收。不要用零匹配报告、单独的无头测试或旧 Swift/Tauri 报告证明现有 Viva 工作流已通过。
- 静态稳定性扫描器当前仍只分析 Rust、Swift 和 TypeScript 测试,**尚不分析 Go**。Go 测试需要人工检查有界等待、同步和资源清理;计时报表不能替代静态扫描或正确性测试。

### 界面测试必须明确触发重绘

Viva 无头驱动的 `Pump()` 只消费已经请求的重绘,不会因测试修改了模型就主动绘制。
测试直接调用 `reduceChrome` 后再 `settle()`,可能只改了面板状态而没有声明面板内容。
终端输出等后台通知又可能碰巧请求一帧,令同一个测试有时通过、有时失败(#1907)。

验证用户交互时,应点击真实控件,让驱动走与原生窗口相同的输入和重绘路径;只需准备
布局时,使用已有的 `h.chromeAction`,它明确请求重绘。不要给每次 `settle()` 强制加一帧,
那会掩盖生产代码漏通知的问题,也不能用延时等待后台通知替测试完成刷新。
终端菜单用例先消费输出的待绘制帧,再点击终端侧栏按钮;其进程仍由测试清理流程关闭。

## 考虑过的备选方案

- 将整包耗时平均分给测试:不能反映真实慢用例,也无法区分包编译和运行时间。
Expand All @@ -32,6 +43,7 @@ Viva 客户端的测试是 Go 测试。macOS 和 Windows 的桌面计时入口
- `node --test --test-timeout=15000 .agents/skills/write-stable-tests/scripts/test-go-timing.mjs`:通过、失败、零匹配、损坏输出、超预算、超时和清理失败;Windows 额外覆盖 `taskkill` 失败。
- `./.agents/skills/write-stable-tests/scripts/test-stability-macos.sh --package ./internal/core --package ./internal/workbench -- --filter 'TestCoreAgentKeepsGoChildSignalStack|TestSignalGuardLeavesOtherSignalActionsUnchanged|TestGitCloneUsesCoreAndPreservesExistingDestination|TestWelcomeClonesRepositoryThroughRealCore|TestClone|TestClosingWindowCancelsClone|TestWelcomeMoreMenuClosesOnEscape'`:macOS 已生成 12 项真实结果及 HTML/JUnit。
- Windows 云主机在含空格的隔离路径运行了计时器自检和真实 `documentio` 文件读取测试;夹具的轻量桌面包装器直接调用 Go,未编译或验证 Core,也不代表 Windows 工作台验收。
- `TestTerminalMenuSelectsAllAndCopies` 在排空后台重绘后,旧的直接状态调用连续 5 次失败;改为真实按钮点击后连续 20 次通过。该证据是 macOS 无头交互,不代替原生窗口验收。

## 适用范围

Expand Down
5 changes: 4 additions & 1 deletion desktop/internal/workbench/context_menu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ func TestTerminalMenuSelectsAllAndCopies(t *testing.T) {
h.open(t.TempDir())
term := busyTerminal(t, h, "printf 'menu-marker\\n'; read line")
h.await("the shell's output", func() bool { return strings.Contains(term.view.RetainedText(1<<16), "menu-marker") })
// Finish the output's paint before opening the panel: a late shell wake must not
// hide a missing redraw in the operation that opens it.
h.settle()

if !h.app.chrome.isOpen(catalogIndex[itemTerminal]) {
h.app.reduceChrome(core.SetChromeOpen(itemTerminal, true))
h.click(center(h.button(itemTerminal)))
}
h.settle()
if term.hit.IsZero() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"desktop/internal/workbench/terminal_find.go",
"desktop/internal/workbench/fonts.go",
"desktop/internal/workbench/fonts_test.go",
"desktop/internal/bundledfont/bundledfont.go"
"desktop/internal/bundledfont/bundledfont.go",
"desktop/internal/workbench/terminal_menu.go",
"desktop/internal/workbench/context_menu_test.go"
]
},
"windows": {
Expand Down Expand Up @@ -76,5 +78,5 @@
"verificationStatus": "pending"
}
},
"notes": "Viva:复制粘贴与 Control 输入在 termview/input.go;终端内查找(termview/find.go、workbench/terminal_find.go)支持上下跳转与高亮;点击 http/https 链接用系统浏览器打开(openTerminalLink,其他协议不打开);窗口大小变化时按单元格重新计算行列;终端切换快捷键走工作台快捷键。macOS 用户未选终端字体时,按 fonts.go 的 terminalNerdFonts 顺序选第一个可用的 Nerd Font:已安装的 MesloLGS Nerd Font Mono 优先,其次是发行包编译进可执行文件的 JetBrainsMono Nerd Font Mono(internal/bundledfont,lithe_bundled_fonts 构建标签),再其次其他已装 Nerd Font;都没有时用随包 JetBrains Mono。开发构建不带字体,回退到系统等宽字体。"
"notes": "Viva:复制粘贴与 Control 输入在 termview/input.go;终端内查找(termview/find.go、workbench/terminal_find.go)支持上下跳转与高亮;点击 http/https 链接用系统浏览器打开(openTerminalLink,其他协议不打开);窗口大小变化时按单元格重新计算行列;终端切换快捷键走工作台快捷键。macOS 用户未选终端字体时,按 fonts.go 的 terminalNerdFonts 顺序选第一个可用的 Nerd Font:已安装的 MesloLGS Nerd Font Mono 优先,其次是发行包编译进可执行文件的 JetBrainsMono Nerd Font Mono(internal/bundledfont,lithe_bundled_fonts 构建标签),再其次其他已装 Nerd Font;都没有时用随包 JetBrains Mono。开发构建不带字体,回退到系统等宽字体。 #1907:macOS 无头终端菜单测试先消费 shell 输出的待绘制帧,再点击真实终端侧栏按钮,覆盖全选、复制和关闭;旧的直接布局调用连续 5 次失败,修复后连续 20 次通过,并通过相邻菜单用例的竞态检查。该用例使用 /bin/sh,在 Windows 跳过;原生窗口与 Windows 验收仍为 pending。"
}
Loading