Skip to content

Step Documentation

Tony Gaskell edited this page Mar 23, 2017 · 8 revisions

Supported steps

Navigation

Setting browser location

Type: Automation

Sets the browser location to the provided url.

Step

When I am at "<url>"
variable description example
url A well-formed url http://localhost:8080/

Checking browser location

Type: Assertion

Checks if the browser location is at the provided url.

Step

Then I should be at "<url>"
variable description example
url A well-formed url http://localhost:8080/login

Following links

Type: Automation

Clicks a link based on it's anchor text.

Step

When I click the "<anchorText>" link
variable description example
anchorText The anchor text About us

Target HTML

<a href="/about">About us</a>

User interaction

Click any element on the page

Type: Automation

Click any element given it's CSS or XPath selector.

When I click the "<selector>"
variable description examples
selector The css or xpath selector td:nth-child(3)

Target HTML

<table>
  <tr>
    <td>A</td>
    <td>B</td>
    <td>C</td>  <!-- clicked -->
  </tr>
</table>

Forms

Submit the current form

Type: Automation

To be used in combination with setting form fields. Will submit the form that the driver is currently in

When I submit the form

Text inputs

The descriptor priority is as follows:

  1. CSS or XPath selector
  2. Name attribute value
  3. Surrounding <label> text

Check text input value

Type: Assertion

Will check if the input field's current value is the expected value.

Then the "<descriptor>" input should be "<value>"
variable description examples
descriptor The input descriptor [name='first_name'], first_name, First name
value The input selector Bob

Target HTML

<label>
  First name
  <input name="first_name" type="text" value="Bob">
</label>

Set text input

Type: Automation

Will set an input field's value.

When I enter "<value>" into the "<descriptor>" field
variable description examples
value The input selector Bob
descriptor The input descriptor [name='first_name'], first_name, First name

Target HTML

<label>
  First name
  <input name="first_name" type="text">
</label>

Checking if a field is required

Type: Assertion

Checks whether a field is or is not required.

Step gherkin Then the "" field is (not) required


| variable   | description          | examples                           |
|------------|----------------------|------------------------------------|
| descriptor | The input descriptor | `name=['email']`, `email`, `Email` |

```gherkin```
Then the "email" field is required
 And the "description" field is not required

Target HTML

<label>
  Email
  <input name="email" type="email" required>
</label>
<label>
  Description
  <input name="description" type="text" >
</label>

Checking select options

Type: Assertion

Checks whether a dropdown or multiselect contains specific values or not.

Step

Then the "<descriptor>" (dropdown|multiselect) should (not) have the option(s): "<values>"
variable description examples
descriptor The input descriptor name=['colors'], colors, Colors
values A comma separated list of values Red, Yellow, Blue
Then the "color" dropdown should contain the options: "Red, Yellow, Blue"
 And the "color" dropdown should not contain the option: "Black"

Target HTML

<label>
  Color
  <select name="color">
    <option value="red">Red</option>
    <option value="yellow">Yellow</option>
    <option value="blue">Blue</option>
  </select>
</label>

Asserting the selected select option

Type: Assertion

Checks whether a dropdown has a value selected.

Step

Then the "<descriptor>" dropdown should (not) have the "<value>" option selected
variable description examples
descriptor The input descriptor name=['colors'], colors, Colors
value The asserted value Red
Then the "Color" dropdown should have the "Red" option selected
 And the "Color" dropdown should not have the "Select color" option selected

Target HTML

<label>
  Color
  <select name="color">
    <option value="red" selected>Red</option>
    <option value="yellow">Yellow</option>
    <option value="blue">Blue</option>
  </select>
</label>

Asserting the selected multiselect options

Type: Assertion

Checks whether a multiselect has certain values selected.

Step

Then the "<descriptor>" multiselect should (not) have the "<value>" option(s) selected
variable description examples
descriptor The input descriptor name=['colors'], colors, Colors
values A comma separated list of values Red, Yellow, Blue
Then the "Color" dropdown should have the "Red, Yellow" options selected
 And the "Color" dropdown should not have the "Blue" option selected

Target HTML

<label>
  Color
  <select multiple name="color">
    <option value="red" selected>Red</option>
    <option value="yellow" selected>Yellow</option>
    <option value="blue">Blue</option>
  </select>
</label>