Skip to content

motus-v1.0.9

Choose a tag to compare

@github-actions github-actions released this 14 Apr 22:27
· 11 commits to main since this release

Stability and reliability improvements for test execution, focusing on resilience under parallel load and graceful recovery from browser crashes.

Improvements

  • Context concurrency throttle - BrowserFixture now limits concurrent browser contexts to four via a static semaphore, preventing Chrome from becoming unresponsive when too many renderer processes compete for resources during parallel test runs.
  • Fixture reuse support - BrowserFixture.InitializeAsync resets disposed state and the restart semaphore so the fixture can be reused across consecutive runs (e.g. clicking Run All a second time in the visual runner).
  • Transport send serialization - Both CdpTransport and BiDiTransport now serialize WebSocket sends through a SemaphoreSlim, since ClientWebSocket does not support concurrent sends.
  • Transport receive buffer isolation - The CDP and BiDi receive loops now copy incoming WebSocket messages before deserialization so the next ReceiveAsync cannot overwrite data still referenced by in-flight JsonElement values.

Bug Fixes

  • Test setup failures after browser crash - NewContextAsync and NewPageAsync calls in test setup could fail if Chrome was still restarting from a previous crash. Added retry loops (up to three attempts with backoff) in the MSTest and NUnit test bases to ride through the restart window.
  • Cleanup exceptions masking test failures - Test teardown in both MSTest and NUnit now wraps tracing stop and context close in a try/catch so a crashed browser does not throw during cleanup and mask the original test failure. Teardown routes through the new BrowserFixture.CloseContextAsync to properly release the context throttle slot even on failure.
  • Page creation resource leaks - BrowserContext.NewPageAsync could leak Chrome targets and CDP sessions when page initialization timed out or failed partway through. Extracted a CreatePageCoreAsync helper with a 10-second initialization timeout and a catch block that disposes the page, removes the session, and closes the target on any failure.
  • MotusTargetClosedException not caught during shutdown - Browser.CloseAsync, BrowserContext close/dispose, and JsHandle.DisposeAsync only caught CdpDisconnectedException. Broadened the catch filters to also handle MotusTargetClosedException, which Chrome can raise when a target is already gone.
  • ObjectDisposedException on disposed transport - Sending on a disposed CdpTransport or BiDiTransport threw a generic ObjectDisposedException. Now throws the domain-specific CdpDisconnectedException or BiDiDisconnectedException so callers that already catch those types handle the disposed case consistently.