fix: 测试 HTTP 请求全程进入自动模式(集成测试窗口零残留)

TestAutomationHttpService.HandleClientAsync 每个请求用
AutomationModeContext.EnterAutomaticMode() 包裹——所有测试端点
(动画/碰撞/批处理)窗口自动选择默认动作并立即关闭:

- CollisionReportDialog(碰撞检测报告):自动跳过(此前仅批处理生效,
  集成测试动画完成后弹报告窗口残留)
- CollisionAnalysisDialog / 重复配置 / MessageBox 等:统一自动处理

验证:集成测试 25/25,跑完后 EnumWindows 确认 NW 仅主窗口(零残留)
This commit is contained in:
tian 2026-08-06 11:39:55 +08:00
parent 5f15eeeb26
commit 2a4ba28fa0

View File

@ -188,6 +188,9 @@ namespace NavisworksTransport.Core.Services
using (var writer = new StreamWriter(stream, new UTF8Encoding(false), 4096, true) { NewLine = "\r\n", AutoFlush = true }) using (var writer = new StreamWriter(stream, new UTF8Encoding(false), 4096, true) { NewLine = "\r\n", AutoFlush = true })
{ {
try try
{
// 自动模式:测试请求全程窗口自动选择默认动作并立即关闭(与批处理一致)
using (AutomationModeContext.EnterAutomaticMode())
{ {
string requestLine = await reader.ReadLineAsync().ConfigureAwait(false); string requestLine = await reader.ReadLineAsync().ConfigureAwait(false);
if (string.IsNullOrWhiteSpace(requestLine)) if (string.IsNullOrWhiteSpace(requestLine))
@ -447,6 +450,7 @@ namespace NavisworksTransport.Core.Services
await WriteJsonResponseAsync(writer, 404, BuildEnvelope(false, error: $"Unknown endpoint: {request.Path}")).ConfigureAwait(false); await WriteJsonResponseAsync(writer, 404, BuildEnvelope(false, error: $"Unknown endpoint: {request.Path}")).ConfigureAwait(false);
} }
}
catch (Exception ex) catch (Exception ex)
{ {
LogManager.Error($"[测试HTTP] 处理请求失败: {ex.Message}", ex); LogManager.Error($"[测试HTTP] 处理请求失败: {ex.Message}", ex);