Skip to main content

Documentation Index

Fetch the complete documentation index at: https://momentic.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

On first run, captures the golden image and stores it next to the test. On subsequent runs, fails the step if the rendered region differs by more than threshold. Re-record a golden by deleting it and re-running. The bare form - visualDiff diffs the full viewport.

Parameters

ParameterTypeRequiredDescription
onstringNoDescription of the element to diff against.
cssstringNoCSS selector for the target. Use instead of the description key.
coordsstring | { x, y }NoAbsolute viewport coordinates. Either an x, y string (e.g. 120, 40) or a { x, y } object.
xnumber | stringNoX coordinate. Must be provided together with y.
ynumber | stringNoY coordinate. Must be provided together with x.
useSelectorbooleanNoSkip AI resolution and require the cached selector to match exactly.
forcebooleanNoForce the action even when the element is not actionable.
DANGEROUS_FORCE_DYNAMICbooleanNoBypass the step cache and resolve the target dynamically every run.
iframestringNoDescription of the iframe to scope the action to.
thresholdnumberNoMaximum allowed visual difference. 0 = identical.
screenshotobjectNoOptional fixed golden image ({ data, width, height }).
saveAsstringNoName of the variable to write this step’s return value to.
retriesnumberNoNumber of times to retry the step on failure before failing the test.
skippedbooleanNoSkip this step at execution time.
commentstringNoFree-form annotation kept with the step.

Shorthand

Bare command. Diffs the full viewport.
- visualDiff

Examples

- visualDiff:
    threshold: 0.1
- visualDiff:
    on: the 'Start HTTP upload' button
    threshold: 0.4
    screenshot:
      data: momentic/tests/visual-diff/golden/upload-button.jpg
      width: 125
      height: 20
- visualDiff:
    threshold: 0.1
    screenshot:
      data: https://screenwriter-test-code.s3.us-west-1.amazonaws.com/screenshots/abbd74b9-b4e1-4c70-abd1-56093db36ffe.jpg
      width: 1920
      height: 1080