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.

Branching control flow. The body of if declares exactly one condition (assert, assertVisually, checkPageContains, checkPageDoesNotContain, javascript, or any checkElement...) plus a then array. A failing condition skips the then block rather than failing the test.

Parameters

ParameterTypeRequiredDescription
<condition>AssertionConditionYesExactly one assertion condition at the top level. See description.
thenStep[]YesSteps to run when the condition is true.
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.

Examples

- if:
    assert:
      that: the page shows a modal for an event/announcement
      timeout: 20000
    then:
      - act: close the announcement pop up if it is still visible
- if:
    assert: Either of the username and password fields are empty
    then:
      - type:
          text: "{{ env.USERNAME }}"
          into: username field
          clear: inputs
      - type:
          text: "{{ env.PASSWORD }}"
          into: The password input
          clear: inputs
- if:
    checkElementExists: the apply button
    then:
      - navigate: https://www.momentic.ai
- if:
    javascript: return env.IS_PRODUCTION
    then:
      - wait: 20000