AI checks are human-understandable assertions powered by AI that can be used to verify arbitrary facts about the current page. They are more powerful and reliable than the expect or assert statements in traditional testing libraries.

Content-based assertions

When using content-based assertions, our AI has access to the whole page, not just the portion visible in the viewport. This is also significantly faster.

By default, Momentic’s AI uses a processed accessibility tree and text content of your application to make decisions.

CategoryExample
Presence (or absence) of textVerify the page shows 3 search results
Logical statementsThe publish date of this article is more than 30 days ago
General state of pageThere is no error message present on the page

Tables

Content-based assertions are great for analyzing and asserting on tabular data. Our AI can accurately understand data present in a HTML table. You can assert on the content of a table cell, row, or column.

If you are using techniques such as list virtualization where only visible rows are rendered, you will have to use the Scroll step to make sure other rows are shown.

Vision-based assertions

Vision limits our AI to the current visible viewport as it relies on a screenshot of the page.

You can make assertions about visual information on the page. It is effective for assertions that include color, position on the page, or visual information like layout. For example:

CategoryExample
Presence (or absence) of imageryVerify the buy button is blue
Logical statementsThe most expensive item is highest on the list
Generate state of pageThe login page is visible

Data visualizations

  • We support SVG or canvas based data visualizations rendered by libraries such as D3, Hicharts, Recharts, and more.
  • Accuracy improves when there are clear labels and axes within the viewport.
  • For interactive visualizations, use Click or Hover steps to show tooltips and interact with data visualizations.

Tips

Avoid language that is unnecessarily specific for your intended use case. For example, asserting that is the button to submit the form is clickable is better than asserting the button labelled 'Submit!' is clickable since the label may change.

Similarly, asserting that there are 3 search results is better than there are 3 different results if the contents of the results doesn’t actually matter.