Repository navigation
motus-v1.0.10
·
82 commits
to main
since this release
Selector repair and maintenance tooling lands as the headline feature, alongside DOM-scoped locator chains and parent-navigation selectors that bring resolution semantics in line with Playwright.
Improvements
motus check-selectorsCLI command - New command that parsesLocator,GetByRole,GetByText,GetByTestId,GetByLabel,GetByPlaceholder,GetByAltText, andGetByTitlecalls out of C# sources via Roslyn, launches a browser, and reports each selector asHEALTHY,BROKEN,AMBIGUOUS, orSKIPPEDagainst a live page. Supports--base-urlfor simple validation,--manifestfor per-selector URL routing,--cifor non-zero exit on breakage, and--jsonfor machine-readable output.- Selector manifests from
recordandcodegen- Both commands now emit a<TestName>.selectors.jsonsidecar containing each locator's selector string, locator method, source file and line, captured page URL, and aDomFingerprint(tag name, key attributes, visible text, ancestor path, SHA-256 hash) built fromDOM.describeNodeandDOM.getOuterHTML. The manifest is the input that letscheck-selectorsnavigate to the right page per selector and run fingerprint-based repair suggestions. - Repair suggestion pipeline and
--fix- For every broken selector with a fingerprint match on the live page, the repair pipeline runs the DOM element through each registeredISelectorStrategy(testid → role → text → CSS by default) and grades candidates asHigh,Medium, orLowconfidence.motus check-selectors --fixrewrites High-confidence replacements back into source via a RoslynSyntaxRewriterthat preserves trivia and formatting, writing.bakbackups by default (suppressible with--no-backup). - Interactive repair in the visual runner -
motus check-selectors --interactiveopens the Blazor visual runner with a newSelectorRepairPanel. For each broken selector the panel shows the captured page with the candidate element highlighted via CDPDOM.highlightNode, the ranked repair suggestions, and accept/edit/skip controls. Accepted choices are written back to source through the same Roslyn rewriter used by--fix. - DOM-scoped child locators -
page.Locator(parent).Locator(child)now resolves the parent handle first and then runsquerySelectorAllfor the child selector under each parent viaRuntime.callFunctionOn, flattening and deduplicating results in parent-list order. Parents found via non-CSS strategies (xpath=,role=,text=,data-testid=) chain correctly because the parent handle is already materialized before the descendant query runs. Replaces the prior CSS-concatenation model, which silently produced wrong results when a non-CSS parent was chained with a CSS child. - Parent-navigation chains -
Locator(parent).Locator("..").Locator(grandchild)walks from each parent match up oneparentElementhop (or"../.."for two, etc.) before the next descendant query.ElementNotFoundExceptiondiagnostics distinguish "no parent match" from "parent matched but descendant didn't" and hint at portal-rendered DOM when the parent matched. ILocator.EvaluateWithElementAsync- New method matching Playwright's convention whereel => el.fooreceives the element as the first argument, distinct from the existingEvaluateAsyncwhich binds the element asthisforfunction() { ... }literals. Doc comments on both methods now spell out which idiom to use when.- Smarter
Evaluate/WaitForFunctionargument handling -Page.EvaluateAsyncandLocator.EvaluateAsyncnow detect whether the supplied expression is a function literal, identifier arrow, or parenthesized arrow, and only wrap/invoke it when an argument is supplied. Non-function expressions with an argument now throw a clear error instead of producing a confusing CDP failure.
Bug Fixes
WaitForFunctioncancellation handling - The polling loop insideWaitForFunctionno longer leaksOperationCanceledExceptionfromTask.Delay. Cancellation now routes through the page's cancellation token so callers see the same exception type on timeout and on explicit cancel.- Selector manifest tests on Windows - Tests that hardcoded
/tmppaths and bare directory separators now usePath.GetTempPath()andPath.GetFullPathso the assertions pass on both Windows and Unix test runners, including for.g.csgenerated filenames. - Locator scoping tests no longer race under parallel sends -
LocatorDomScopingTestspreviously used a FIFO fake WebSocket, which occasionally paired responses with the wrong in-flight request when the threadpool interleavedcallFunctionOnsends withgetPropertiescontinuations. The tests now use a method-aware fake socket that synthesizes responses from the outbound envelope's method andobjectId, making the suite reliable regardless of send ordering.