Files
SimpleRemoter/test/e2e
yuanyuanxianganddeepseek-flash be19744898 Test: harden the E2E smoke script against hangs and hidden crashes
A crash inside the client-online wait was swallowed by Wait-Until's empty
catch, so a dead server or client surfaced only as "no host online after
60s" once the timeout expired. Record the failure reason and report it
right after the wait.

LVM_GETITEMCOUNT and LVM_GETITEMSTATE used SendMessage without a timeout.
A hung server UI thread - the exact regression this script exists to catch
- would block the script forever instead of failing. Send with
SendMessageTimeout (2s) and treat a timeout as a failure.

-Build ran after settings.ini had been temporarily rewritten for busy
MCP/Web ports, so a build failure left the file modified. Build before
touching settings and restore unconditionally in a catch block.

Verified by re-running the Search feature end to end.

Co-Authored-By: deepseek-flash
2026-11-22 21:51:10 +01:00
..

发布前端到端冒烟测试(E2E-Smoke.ps1)

发布新版本前跑一遍,确认服务端 + 客户端的基础功能没有被改坏。

它做什么

  1. 启动 Debug 服务端 Bin\Yama_x64d.exe(读 Bin\settings.ini,客户端端口 6543);
  2. 起测试客户端:
    • 默认:服务端内置的「运行测试程序」(菜单命令 ID_TOOL_RUN_TEST=33106,进程内);
    • -ExternalClient:启动 x64\Debug\ghost.exe 127.0.0.1 6543;
  3. 等它出现在在线列表(控件 IDC_ONLINE=1001),选中第一行;
  4. 按工具栏的真实命令 ID 逐个触发(见下表),断言每个命令在超时内弹出新的 #32770 对话框;
  5. 每条命令后检查服务端/客户端进程是否还活着——像「点视频管理客户端崩溃」 这类回归会直接判 FAIL;
  6. 输出 PASS/FAIL/WARN/SKIP 汇总表,有 FAIL 时退出码为 1。

用法

:: 全部功能(默认用内置测试客户端)
powershell -NoProfile -File test\e2e\E2E-Smoke.ps1

:: 先重新编译 Debug 服务端/客户端再测
powershell -NoProfile -File test\e2e\E2E-Smoke.ps1 -Build

:: 只测部分功能
powershell -NoProfile -File test\e2e\E2E-Smoke.ps1 -Only Terminal,Desktop,File,Video

:: 用独立的 Debug 客户端(能单独抓到客户端崩溃)
powershell -NoProfile -File test\e2e\E2E-Smoke.ps1 -ExternalClient

:: 有摄像头的机器上,把「视频管理弹窗」设为必须
powershell -NoProfile -File test\e2e\E2E-Smoke.ps1 -RequireVideo

:: 保留测试实例,人工点一遍
powershell -NoProfile -File test\e2e\E2E-Smoke.ps1 -KeepOpen

也可以直接双击 run-e2e.cmd(等价于全部功能)。

以管理员身份运行可覆盖「服务管理」(服务枚举需要提权);不提权时该项自动 SKIP。

覆盖的功能与命令 ID

功能 命令 ID 依赖
Terminal 终端管理 32776 客户端
Process 进程管理 32777 客户端
Window 窗口管理 32778 客户端
Desktop 桌面管理 32779 客户端
File 文件管理 32780 客户端
Audio 语音管理 32781 客户端 + 录音设备
Video 视频管理 32782 客户端 + 摄像头(默认可选)
Services 服务管理 32783 客户端 + 管理员权限
Registry 注册表管理 32784 客户端
Keylogger 键盘记录 2117 客户端
Settings 参数设置 32794 无
BuildClient 生成服务端 32786 无
Search 搜索 32788 无(弹搜索栏)
About 帮助 32787 无
McpSettings MCP 33077 无
Connections 连接管理 33086 客户端
Talk 远程交谈 33089 客户端(会先弹确认框)
MachineManage 主机管理 32931 客户端

新增功能:在脚本的 $features 数组里加一行 @{ Name='X'; Id=<命令ID>; Timeout=<秒> } 即可。

结果怎么读

状态 含义
PASS 点击后弹出了功能对话框
FAIL 超时没有弹窗(点击无反应),或进程崩溃/退出 → 需要修
WARN 弹出了提示/错误框(标题为 Notice/提示/Error 等),报告里会带上框里的文字,需人工确认
SKIP 环境不具备(无麦克风 / 未提权 / 无摄像头 / 可选功能)

注意事项

  • 脚本只启动 Debug 实例;正在运行的 Release 服务端(443/6544 等)不受影响。
  • 开始前要求 6543 空闲、没有其它 Yama_x64d 在跑。
  • 如果 6545(MCP)/8080(Web)已被占用,脚本会临时在 Bin\settings.ini 里关掉对应监听, 测试结束无条件恢复原文件(包括异常退出/中断时)。
  • 客户端在进程内模式下崩溃会带走服务端,同样会被判 FAIL。
  • 视频管理:没有摄像头的机器无法弹窗,默认 SKIP;这类驱动相关的回归 (例如 IMediaControl::Run 返回 S_FALSE)请在有摄像头的机器上跑, 或加 -RequireVideo 让它变成硬性检查。