Repository navigation
motus-v1.0.8
·
92 commits
to main
since this release
Performance testing, browser health detection, and reliability improvements across the test execution pipeline.
New Features
- Performance metrics collection - Built-in Core Web Vitals collection via CDP
Performancedomain andPerformanceObserverAPI. Collects LCP, FCP, TTFB, CLS, INP, JS heap size, DOM node count, and individual layout shift entries. Metrics are gathered automatically after each navigation when the performance hook is enabled. - Performance budget assertions - New page-level assertions
ToMeetPerformanceBudgetAsync(),ToHaveLcpBelowAsync(),ToHaveFcpBelowAsync(),ToHaveTtfbBelowAsync(),ToHaveClsBelowAsync(), andToHaveInpBelowAsync()with auto-retry semantics and.Notnegation support. [PerformanceBudget]attribute - Apply to test methods or classes to declare metric thresholds. Budgets resolve from method attribute, class attribute,motus.config.json, orMOTUS_PERFORMANCE_*environment variables. Test framework adapters (MSTest, NUnit, xUnit) resolve the attribute and propagate it to the page automatically.- Performance CLI support -
motus run --perf-budgetenables budget enforcement from the command line. All built-in reporters (Console, HTML, JUnit, TRX) surface collected metrics and budget pass/fail status. - Browser health detection - Background
BrowserHeartbeatpings Chrome every 5 seconds with a 10-second timeout to detect frozen browsers.Process.Exitedevent provides instant crash detection. Both mechanisms are guarded against double-firing and trigger theDisconnectedevent for downstream recovery. IBrowser.IsHealthyproperty - Default interface member that checks both connection state and process liveness. For launched browsers, returnsfalsewhen the process has exited even if the WebSocket has not yet detected the disconnect.- BrowserFixture auto-restart - When Chrome crashes or becomes unresponsive,
BrowserFixtureautomatically disposes the dead browser and launches a replacement with retry. ASemaphoreSlimgate coordinates restart soNewContextAsynccallers block briefly rather than racing against a dead browser. Compatible with parallel test execution across all three frameworks. - BrowserPool proactive replenishment - The browser pool subscribes to each browser's
Disconnectedevent. On crash, the dead browser is disposed, its capacity slot is released, and a replacement is launched if the pool has dropped belowMinInstances.
Improvements
- Performance reporter integration - Reporters implementing
IPerformanceReporterreceive metrics alongside budget evaluation results. The visual runner surfaces metrics in timeline marker tooltips and a dedicated Performance section in the step detail panel. - Test method name propagation -
TestMethodNameContext(AsyncLocal) carries the test method name from the visual runner'sTestExecutionServiceinto test base classes, enabling[PerformanceBudget]attribute resolution when the framework'sTestContextis not injected.
Bug Fixes
- CI test suite slowdown - Performance assertion tests blocked for 60 seconds per test because
RefreshPerformanceMetricsAsyncsent CDP commands withCancellationToken.Noneand no mock response was queued. Fixed by forwarding the assertion retry helper's cancellation token through to the CDP send, and queueing properRuntime.evaluateresponses in all affected tests. ReducedMotus.Tests.dllruntime from 16 minutes back to 2 minutes. - BrowserHeartbeat double-dispose -
CloseAsyncfollowed byDisposeAsyncon a browser threwObjectDisposedExceptionbecause the heartbeat'sCancellationTokenSourcewas disposed twice. Fixed with anInterlocked.CompareExchangeguard on the heartbeat'sDisposeAsync. - Tracing race condition -
PumpTracingCompleteAsyncused a shared_completeTcsfield, allowing a cancelled old pump's cancellation handler to poison the next run'sTaskCompletionSource. Fixed by passing a local TCS as a parameter. - CancellationTokenSource leaks -
WaitForRequestAsyncandWaitForResponseAsyncinNetworkManagercreated linked CTS instances that were never disposed. Fixed withContinueWithdisposal on the returned task. - ScreencastService circular dependency -
OnPageClosecalledStopAsync()which awaited operations that depended on the page being open. Simplified to cancel the pump and unsubscribe the event handler directly.