Skip to navigation

Interaction options, written as tests

Each example on this page varies one setting in a short procedure, shown as prose, detected tests, inline tests, and a standalone spec. For what each tab holds, see Navigation and interaction.

Detected variants carry a step statement for the varied step when default detection can’t produce it. They also carry a goTo statement, so they still open the page with detection off.

click permutations

Each example clicks a button that counts its clicks by button, then checks the count. See click.

click: "Count clicks"

Varies: click · Value: "Count clicks" · Effect: the step left-clicks the element whose text, selector, or accessible name matches the string.

prose.md
# Click a button by its text
1. Go to [the click counter page](http://localhost:8092/find-click.html).
2. Click **Count clicks**.
3. Check that the button counted the click.

click: { elementText }

Varies: click · Value: { "elementText": "Count clicks" } · Effect: the step left-clicks the element that matches every locator field in the object.

prose.md
# Click a button described by an object
1. Go to [the click counter page](http://localhost:8092/find-click.html).
2. Click **Count clicks**.
3. Check that the button counted the click.

button: "left"

Varies: click.button · Value: "left" · Effect: the step clicks with the primary button, the same as leaving button out.

prose.md
# Left-click a button
1. Go to [the click counter page](http://localhost:8092/find-click.html).
2. Left-click **Count clicks**.
3. Check that the button counted the click.

button: "right"

Varies: click.button · Value: "right" · Effect: the step right-clicks the element.

prose.md
# Right-click a button
1. Go to [the click counter page](http://localhost:8092/find-click.html).
2. Right-click **Count clicks**.
3. Check that the button counted the click.

button: "middle"

Varies: click.button · Value: "middle" · Effect: the step middle-clicks the element.

prose.md
# Middle-click a button
1. Go to [the click counter page](http://localhost:8092/find-click.html).
2. Middle-click **Count clicks**.
3. Check that the button counted the click.

duration: 1000

Varies: click.duration · Value: 1000 · Effect: the step holds the press for one second before it releases the button.

prose.md
# Press and hold a button
1. Go to [the click counter page](http://localhost:8092/find-click.html).
2. Press and hold **Count clicks** for one second.
3. Check that the button counted the click.

type permutations

Each example types into a field that echoes its value below it. See type.

type: "Hello"

Varies: type · Value: "Hello" · Effect: the step types the text into the element that has focus.

prose.md
# Type text
1. Go to [the type echo page](http://localhost:8092/type-echo.html).
2. Click **Type here:**.
3. Type "Hello".
4. Check that the page shows **Hello** below the field.

type: ["Hello", "$ENTER$"]

Varies: type · Value: ["Hello", "$ENTER$"] · Effect: the step types each entry in order, and $ENTER$ presses the Enter key.

prose.md
# Type text and press Enter
1. Go to [the type echo page](http://localhost:8092/type-echo.html).
2. Click **Type here:**.
3. Type `Hello` and press Enter.
4. Check that the page shows **Hello** below the field.

inputDelay: 200

Varies: type.inputDelay · Value: 200 · Effect: the step waits 200 milliseconds between keys in a recording.

prose.md
# Type slowly
1. Go to [the type echo page](http://localhost:8092/type-echo.html).
2. Click **Type here:**.
3. Type `Hello`, one key at a time.
4. Check that the page shows **Hello** below the field.

selector

Varies: type.selector · Value: "#type-input" · Effect: the step finds the field by its selector and types into it, with no click first.

prose.md
# Type into a field by its selector
1. Go to [the type echo page](http://localhost:8092/type-echo.html).
2. Type `Hello` into the **Type here:** field.
3. Check that the page shows **Hello** below the field.

elementId

Varies: type.elementId · Value: "type-input" · Effect: the step finds the field by its id and types into it.

prose.md
# Type into a field by its ID
1. Go to [the type echo page](http://localhost:8092/type-echo.html).
2. Type `Hello` into the **Type here:** field.
3. Check that the page shows **Hello** below the field.

dragAndDrop permutations

Each example drags a widget onto a drop zone. See dragAndDrop.

source: "Table"

Varies: dragAndDrop.source, dragAndDrop.target · Value: source "Table", target a selector string · Effect: the step finds each element by its text or selector, the same way the click string form does.

prose.md
# Drag by text and selector strings
1. Go to [the drag and drop page](http://localhost:8092/drag-drop-test.html).
2. Drag **Table** onto **Drop Zone 1**.
3. Check that **Table (dropped)** appears in the drop zone.

source: { selector, elementText }

Varies: dragAndDrop.source, dragAndDrop.target · Value: objects with selector and elementText · Effect: the step finds each element by every locator field in its object.

prose.md
# Drag by element objects
1. Go to [the drag and drop page](http://localhost:8092/drag-drop-test.html).
2. Drag **Table** onto **Drop Zone 1**.
3. Check that **Table (dropped)** appears in the drop zone.

upload permutations

Each example sets the files of a file input, then checks that the page received them. The files sit next to the example. See upload.

path: "receipt.txt"

Varies: upload.path · Value: "receipt.txt" · Effect: the step sets one file on the input it finds by selector.

prose.md
# Choose one file
1. Go to [the upload page](http://localhost:8092/upload.html).
2. For **Choose a file**, select the receipt file.
3. Check that **Got receipt.txt** appears.

path: ["receipt.txt", "invoice.txt"]

Varies: upload.path · Value: ["receipt.txt", "invoice.txt"] · Effect: the step sets both files, in order, on the input that belongs to the label it finds by text.

prose.md
# Choose several files
1. Go to [the upload page](http://localhost:8092/upload.html).
2. For **Choose files**, select the receipt and the invoice.
3. Check that **Got receipt.txt and invoice.txt** appears.

frame permutations

Each example acts on elements inside an iframe. frame applies to one step, so each step that needs it repeats it. Detection searches only the top page, so the detected variants annotate these steps. See Elements inside an iframe.

frame: "#checkout"

Varies: find.frame, click.frame, type.frame, upload.frame · Value: "#checkout" · Effect: each step finds its element inside the iframe. The last step has no frame, so it checks the top page.

prose.md
# Pay in an embedded form
1. Go to [the checkout page](http://localhost:8092/iframe-parent.html).
2. In the payment form, enter 4242 as the card number.
3. Attach your receipt.
4. Click the form's pay button.
5. Check that the form shows your payment.
6. Check that **Top page not paid** still appears below the page's own button.

frame: ["#checkout", "iframe[name=inner]"]

Varies: find.frame, click.frame, type.frame, upload.frame · Value: ["#checkout", "iframe[name=inner]"] · Effect: each step goes into the first iframe, then into the one inside it.

prose.md
# Confirm in a nested frame
1. Go to [the checkout page](http://localhost:8092/iframe-parent.html).
2. In the innermost frame, enter Thanks as the note.
3. Attach your receipt as proof.
4. Click the confirm button in the innermost frame.
5. Check that the innermost frame shows the confirmation.

swipe permutations

Each example swipes a browser page, then checks that the page still responds. See swipe.

swipe: "up"

Varies: swipe · Value: "up" · Effect: the finger moves up, which scrolls the page down by half the viewport.

prose.md
# Swipe up
1. Go to [the element test page](http://localhost:8092/enhanced-elements.html).
2. Swipe up on the page.
3. Check that **Submit by ID** is still on the page.

swipe: "down"

Varies: swipe · Value: "down" · Effect: the finger moves down, which scrolls the page up by half the viewport.

prose.md
# Swipe down
1. Go to [the element test page](http://localhost:8092/enhanced-elements.html).
2. Swipe down on the page.
3. Check that **Submit by ID** is still on the page.

swipe: "left"

Varies: swipe · Value: "left" · Effect: the finger moves left, which scrolls the page right by half the viewport.

prose.md
# Swipe left
1. Go to [the element test page](http://localhost:8092/enhanced-elements.html).
2. Swipe left on the page.
3. Check that **Submit by ID** is still on the page.

swipe: "right"

Varies: swipe · Value: "right" · Effect: the finger moves right, which scrolls the page left by half the viewport.

prose.md
# Swipe right
1. Go to [the element test page](http://localhost:8092/enhanced-elements.html).
2. Swipe right on the page.
3. Check that **Submit by ID** is still on the page.

distance: 0.8

Varies: swipe.distance · Value: 0.8 · Effect: the swipe covers 80% of the viewport instead of the default half.

prose.md
# Swipe most of the screen
1. Go to [the element test page](http://localhost:8092/enhanced-elements.html).
2. Swipe up across most of the screen.
3. Check that **Submit by ID** is still on the page.

from + to

Varies: swipe.from, swipe.to · Value: { "x": 400, "y": 400 } to { "x": 400, "y": 250 } · Effect: the step drags the pointer between the two pixel coordinates.

prose.md
# Swipe between two points
1. Go to [the element test page](http://localhost:8092/enhanced-elements.html).
2. Swipe from the middle of the page toward the top.
3. Check that **Submit by ID** is still on the page.

wait permutations

Each example opens a page whose message appears two seconds after it loads. See wait.

wait: 3000

Varies: wait · Value: 3000 · Effect: the step pauses for 3000 milliseconds, so a find with timeout: 0 sees the message on its only look.

prose.md
# Pause for a set time
1. Go to [the wait delay page](http://localhost:8092/wait-delay.html).
2. Wait three seconds.
3. Check that the page shows **Loaded after 2 seconds**.

wait: true

Varies: wait · Value: true · Effect: the step pauses for the default 5000 milliseconds.

prose.md
# Pause for the default time
1. Go to [the wait delay page](http://localhost:8092/wait-delay.html).
2. Wait a few seconds.
3. Check that the page shows **Loaded after 2 seconds**.

wait: false

Varies: wait · Value: false · Effect: the step doesn’t pause, and the find that follows waits for the message itself.

prose.md
# Skip a pause
1. Go to [the wait delay page](http://localhost:8092/wait-delay.html).
2. Skip the pause.
3. Check that the page shows **Loaded after 2 seconds**.

Each example checks one link. See checkLink.

Varies: checkLink · Value: "http://localhost:8092/enhanced-elements.html" · Effect: the step passes when the URL returns one of the default status codes.

prose.md
# Check a link
1. Check that [the element test page](http://localhost:8092/enhanced-elements.html) responds.

statusCodes: 200

Varies: checkLink.statusCodes · Value: 200 · Effect: the step passes only when the URL returns 200.

prose.md
# Accept one status code
1. Check that [the element test page](http://localhost:8092/enhanced-elements.html) responds.

statusCodes: [200, 304]

Varies: checkLink.statusCodes · Value: [200, 304] · Effect: the step passes when the URL returns any status code in the list.

prose.md
# Accept several status codes
1. Check that [the element test page](http://localhost:8092/enhanced-elements.html) responds.

headers: "…"

Varies: checkLink.headers · Value: "Accept: application/json\nX-Test: docs" · Effect: the step sends one header per line of the string.

prose.md
# Send headers as text
1. Check that [the API health check](http://localhost:8092/api/health) responds.

headers: { … }

Varies: checkLink.headers · Value: { "Accept": "application/json", "X-Test": "docs" } · Effect: the step sends each key as a header with its value.

prose.md
# Send headers as an object
1. Check that [the API health check](http://localhost:8092/api/health) responds.

origin + url

Varies: checkLink.origin · Value: "http://localhost:8092" with url "/enhanced-elements.html" · Effect: the step joins origin and the relative url into the address it checks.

prose.md
# Check a link by its path
1. Check that [the element test page](http://localhost:8092/enhanced-elements.html) responds.