Skip to content

motus-v1.0.6

Choose a tag to compare

@github-actions github-actions released this 30 Mar 21:23
· 123 commits to main since this release

Feature release with major codegen improvements, trace viewer enhancements, cookie banner removal for screenshot/PDF commands, and colored console output.

New Features

  • Codegen --headed mode - Launch a visible browser with motus codegen --headed, navigate to any page yourself, then press Enter to analyze. Supports providing URLs upfront (navigates then waits for Enter) or no URLs (opens a blank tab for free navigation).
  • Codegen --connect mode - Attach to an already-running browser with motus codegen --connect ws://localhost:9222 to analyze the active tab without launching a new browser instance. Works with or without URLs.
  • Codegen --scope option - Limit element discovery to a specific container with a CSS selector (e.g. --scope "#login-form", --scope ".modal-dialog"). Only elements inside the scoped container are analyzed and emitted.
  • Cookie banner removal - motus screenshot and motus pdf now support --hide-banners to remove cookie consent, privacy, and overlay banners before capture. Targets well-known selectors (OneTrust, CookieBot, Usercentrics, generic patterns) and clears body scroll locks.
  • Screenshot and PDF options - Both commands gained --timeout, --wait-until, and --delay options for better control over navigation and rendering. motus pdf also gained --width for viewport control.
  • Colored console reporter - Test results now display with ANSI color codes (green for pass, red for fail, gray for duration). Colors are automatically disabled when output is redirected.

Improvements

  • Codegen selector generation - Significantly improved selector hit rate through three changes:
    • Element handles are now stored at crawl time (window.__mtusElements), preventing stale references when the DOM mutates between discovery and resolution
    • Per-strategy error handling prevents one slow or failing strategy from blocking all remaining elements
    • Attribute-based CSS fallback generates selectors from name, placeholder, href, type, and aria-label when all strategies fail, verified for uniqueness before emitting
  • Implicit ARIA role inference - The role selector strategy now infers implicit roles from HTML semantics (<button> as button, <a href> as link, <input type="checkbox"> as checkbox, <select> as listbox, text inputs as textbox). This produces more stable selectors like role=button[name="Submit"] instead of falling through to text or CSS.
  • Trace viewer - Rewrote the trace viewer service to extract real timestamps, durations, and human-readable action labels from CDP trace events. Screenshots are aligned to timeline events via binary search. HAR network requests are loaded and matched to events by time window. The viewer now filters to significant events only.
  • Trace viewer layout - The sidebar and test explorer are hidden in trace mode since there are no tests to discover. The toolbar shows the trace filename and event count instead of run controls.
  • Browser launch timing - The visual runner now opens the browser after the server is fully listening (ApplicationStarted callback) instead of before, eliminating the need for a manual refresh on startup.

Bug Fixes

  • Null-check in MotusTestBase cleanup - TestContext.CurrentTestOutcome could throw a NullReferenceException during test cleanup if the TestContext was not initialized. Added a null-conditional check.