Test Steps

A step modifies the browser state and verifies the state using:

  • an optional sequence of actions to be performed to get the browser into a desired state
  • a set of assertions to verify the browser state

Syntax

A step is a YAML object with actions and assertions properties. The actions property is a list of actions. The assertions property is a list of assertions.

Action arguments and assertion values can be represented by named parameters. Values for parameters are provided by test suites.

actions:
  - {action-1}
  ...
  - {action-N}

assertions:
  - {assertion-1}
  ...
  - {assertion-N}

-----------------

action-*:
    <action>

assertion-*:
    <assertion>

Actions are optional. Assertions are non-optional. A step can omit actions.

assertions:
  - {assertion-1}
  ...
  - {assertion-N}

-----------------

assertion-*:
    <assertion>

Examples

Literal Values

# examples/step/google-assert-open-literal.yml
assertions:
  - $page.url is "https://www.google.com"
  - $page.title is "Google"

Parameterised Values

# examples/step/assert-page-open-parameterised.yml
assertions:
  - $page.url is $data.expected_url
  - $page.title is $data.expected_title

Parameterised Elements and Parameterised Values

# examples/step/google-query-parameterised.yml
actions:
  - set $elements.search_input to $data.query_term
  - click $elements.search_button

assertions:
  - $page.title is $data.expected_title

No Actions

# examples/step/google-homepage-assertions.yml
assertions:
  - $"#hplogo" exists
  - $"a[href*='about']" exists