Check a page without stopping at the first mismatch
Keep prerequisite checks hard so their failures stop execution. This example checks independent expectations after confirming that the expected product loaded and the image and size selector are visible:product-details.test.yaml
Enable soft assertions
Use soft assertions for browser AI checks and element checks. Mobile tests don’t support them. Other browser steps, including JavaScript, page checks, and actions, remain hard. Usemomentic@3.65.0 or later for all the examples on this page. Soft AI
assertions require momentic@3.64.0 or later; soft element checks require
momentic@3.65.0.
To update an older project, use
momentic upgrade from the project
root. Start from a clean, backed-up working tree and preview the changes:
In the local editor
Select an AI check or Element check step. In its detail panel, turn on Soft assertion. Leave the switch off for prerequisites. For a screenshot-only AI check, choose Screenshot only under AI context mode. Run the whole test or select a range that includes the checks you want to collect. Running a single soft check executes only that step; it doesn’t start the rest of the test. Soft assertions don’t extend a selected range or override stopping the run.In YAML
Change the command name, not the payload. The soft command takes the same parameters as its hard counterpart, includingtimeout and retries.
The element-check rule includes negated checks and checks on content,
attributes, tag names, and styles. For example,
checkElementNotVisible becomes
softCheckElementNotVisible, and checkElementAttributeDoesNotContain becomes
softCheckElementAttributeDoesNotContain. Keep the existing element or css
target and any name and value fields.
soft: true to a hard command in YAML. Use the soft alias. Soft
assertions can appear as ordinary steps in tests,
modules, and conditional or loop bodies, but can’t
serve as if or while predicates. The editor doesn’t show the switch on those
predicates or an AI action’s embedded success check.
Decide which checks should continue
Use soft assertions when one failed expectation leaves the others meaningful:- Check independent content, layout, and control states after the expected page has loaded.
- Collect several mismatches on a settings page without losing evidence from checks later in the test.
- Add independent validations after hard login, navigation, or setup checks.
aria-pressed attribute. Use AI checks when the expectation needs
semantic or visual judgment, not to obtain soft behavior.
A pause icon alone doesn’t prove playback stopped. Verify playback effects
separately; a JavaScript check on media state doesn’t gain soft continuation
from these aliases.
Timeouts, retries, and stopping
Soft assertions change what happens after a failed check, not how it waits or retries.timeout remains milliseconds in YAML. Momentic applies explicit step
retries before continuing past a failed check.
In the example above, Momentic waits up to 10 seconds for the AI assertion and
retries the step once if it fails. A check that succeeds on retry isn’t listed
as a failed soft assertion in the final report.
Only assertion verdict failures continue. Provider errors, browser errors,
ambiguous selectors, cancellation, and other execution failures remain hard. A
missing element can be a failed soft expectation; an invalid or ambiguous
selector is not. Soft failures don’t invoke failure recovery.
Setup and teardown are
separate from soft continuation. A hard setup failure skips the main steps. A
soft setup failure allows them to run but still fails the test, so keep required
setup hard. Teardown runs after main steps pass or fail during a whole-test run;
it isn’t a way to continue the main body after a hard failure.
A continuous integration (CI) system’s continue-on-failure setting controls what
that system does after the command fails. It doesn’t make an assertion soft or
change the test’s failed result.