Skip to content

Commit 60066be

Browse files
larsbrubakerclaudecursoragent
committed
Move tests to MatterCADLib and fix AutomationRunner async
Migrate automation tests from agg-sharp to MatterCADLib for in-process test runner. Fix async/await in ShowWindowAndExecuteTests and WaitforDraw timeout (seconds to milliseconds). Disable aspiratonal tests that aren't ready yet. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent ffaacf3 commit 60066be

14 files changed

Lines changed: 17 additions & 6654 deletions

File tree

GuiAutomation/AutomationRunner.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,10 @@ public AutomationRunner WaitforDraw(SystemWindow containingWindow, int maxSecond
906906
{
907907
// The window appears to be reliably closed already in the SoftwareLevelingTest test.
908908
if (containingWindow.HasBeenClosed)
909+
{
910+
DebugLogger.LogMessage("AutomationRunner", "WaitforDraw: containingWindow.HasBeenClosed IS TRUE");
909911
resetEvent.Set();
912+
}
910913
else
911914
{
912915
containingWindow.AfterDraw += afterDraw;
@@ -915,7 +918,7 @@ public AutomationRunner WaitforDraw(SystemWindow containingWindow, int maxSecond
915918
}
916919
});
917920

918-
resetEvent.WaitOne(maxSeconds);
921+
resetEvent.WaitOne(maxSeconds * 1000);
919922

920923
containingWindow.AfterDraw -= afterDraw;
921924
containingWindow.Closed -= closed;
@@ -1389,7 +1392,7 @@ public AutomationRunner SelectNone()
13891392

13901393
public static bool DrawSimulatedMouse { get; set; } = true;
13911394

1392-
public static Task ShowWindowAndExecuteTests(SystemWindow initialSystemWindow, AutomationTest testMethod, double secondsToTestFailure = 30, string imagesDirectory = "", Action<AutomationRunner> closeWindow = null)
1395+
public static async Task ShowWindowAndExecuteTests(SystemWindow initialSystemWindow, AutomationTest testMethod, double secondsToTestFailure = 30, string imagesDirectory = "", Action<AutomationRunner> closeWindow = null)
13931396
{
13941397
// Enable debug logging for AutomationRunner
13951398
DebugLogger.EnableFilter("AutomationRunner");
@@ -1463,7 +1466,8 @@ public static Task ShowWindowAndExecuteTests(SystemWindow initialSystemWindow, A
14631466
throw;
14641467
}
14651468

1466-
bool timedOut = task.Result == delayTask;
1469+
var completedTask = await task;
1470+
bool timedOut = completedTask == delayTask;
14671471
DebugLogger.LogMessage("AutomationRunner", $"SHOW COMPLETED - TimedOut: {timedOut}");
14681472

14691473
// Wait for CloseOnIdle to complete
@@ -1549,8 +1553,12 @@ public static Task ShowWindowAndExecuteTests(SystemWindow initialSystemWindow, A
15491553
}
15501554

15511555
DebugLogger.LogMessage("AutomationRunner", "=== TEST COMPLETE ===");
1552-
// After the system window is closed return the task and any exception to the calling context
1553-
return task?.Result ?? Task.CompletedTask;
1556+
1557+
// Await the inner task if it was the one that completed, to propagate exceptions
1558+
if (!timedOut && completedTask is Task<Task> outerTask)
1559+
{
1560+
await outerTask.Result;
1561+
}
15541562
}
15551563
}
15561564
}

Tests/Agg.Tests/Agg Automation Tests/AutomationRunnerTests.cs

Lines changed: 0 additions & 130 deletions
This file was deleted.

0 commit comments

Comments
 (0)