Skip to main content
Momentic’s AI evaluates assertions against the DOM, accessibility tree, and a screenshot of the viewport. The same rules from Finding elements apply, plus a few specific to assertions.

Best practices

  • Keep assertions short and specific. Aim for under 20 words; split compound assertions into multiple steps.
  • Provide context. Point at the relevant region of the page and define any non-standard terminology.
  • Remove ambiguity. The answer should be clearly true or false given the page state. When in doubt, use single quotes for exact text matches.

Good assertions

CategoryExample
Presence or absence of textA congratulations message is shown in the modal
Presence or absence of elementsThe page shows 3 search results
Logical statementsThe publish date of this article is more than 30 days ago
Page stateThere is no error message present on the page
ColorThe buy button is blue
LayoutThe ‘XL’ button is the largest button in the submission form
Images and videoThere is a LinkedIn icon on the page

Bad assertions

ProblemBadBetter
MalformedSearch resultsThere are search results displayed on the main body
AmbiguousThe order of the results is correctThe search results are sorted by date
Multiple focusesThe logo is blue, the page shows 4 results, and the last result is more than 30 days oldSplit into 3 separate assertions
Contains an actionWait for the results to appearUse a Wait step, then assert the results appeared
Imperceivable detailThe color of line divider is #ff5733The color of the divider looks red
SubjectiveThe page looks well designedNo text in the table overflows its cell
Time-sensitiveThe video plays a 10-second advertisementAssert on DOM state instead

Pre-trained behavior

Typos

The agent tolerates minor typos. john@@gmail.com will match [email protected]. For exact matching, wrap the expected value in single quotes and instruct the agent explicitly: the username is exactly 'john@@gmail.com'. do not allow any typos. When generating test data programmatically, prefer long, distinct values to avoid accidental matches.