wallaby v0.10.0 Wallaby.DSL.Actions

Provides the action DSL.

Actions are used to interact with form elements. They follow the same conventions as Wallaby.Node.Query. Form elements can be found based on their id, name, or label text:

<label for="first_name">
  First Name
</label>
<input id="user_first_name" type="text" name="first_name">
fill_in(page, "First Name", with: "Grace")
fill_in(page, "first_name", with: "Grace")
fill_in(page, "user_first_name", with: "Grace")

Note that the id selector does not need the #. This makes it easier to use with the ids generated by phoenix form helpers.

There are several helpers for different interacting with different form elements.

fill_in(page, "First Name", with: "Chris")
choose(page, "Radio Button 1")
check(page, "Checkbox")
uncheck(page, "Checkbox")
select(page, "My Awesome Select", option: "Option 1")
click_on(page, "Some Button")

Actions return their parent node so that they can be chained together:

page
|> find(".signup-form")
|> fill_in("Name", with: "Grace Hopper")
|> fill_in("Email", with: "grace@hopper.com")
|> click_on("Submit")

Summary

Functions

Checks a checkbox based on id, label text, or name

Chooses a radio button based on id, label text, or name

Clicks the matching button. Buttons can be found based on id, name, or button text

Clicks the matching link. Links can be found based on id, name, or link text

Clicks on the matching button. Alias for click_button

Fills in a “fillable” node with text. Input nodes are looked up by id, label text, or name

Selects an option from a select box. The select box can be found by id, label text, or name. The option can be found by its text

Unchecks a checkbox based on id, label text, or name

Types

Functions

check(parent, locator, opts \\ [])

Specs

check(parent, locator, opts) :: parent

Checks a checkbox based on id, label text, or name.

choose(parent, locator, opts \\ [])

Specs

choose(parent, locator, opts) :: parent

Chooses a radio button based on id, label text, or name.

click_button(parent, locator, opts \\ [])

Specs

click_button(parent, locator, opts) :: parent

Clicks the matching button. Buttons can be found based on id, name, or button text.

click_link(parent, locator, opts \\ [])

Specs

click_link(parent, locator, opts) :: parent

Clicks the matching link. Links can be found based on id, name, or link text.

click_on(parent, locator, opts \\ [])

Specs

click_on(parent, locator, opts) :: parent

Clicks on the matching button. Alias for click_button.

fill_in(parent, locator, opts)

Specs

fill_in(parent, locator, opts) :: parent

Fills in a “fillable” node with text. Input nodes are looked up by id, label text, or name.

select(parent, locator, opts)

Specs

select(parent, locator, [{:option, String.t}]) :: parent

Selects an option from a select box. The select box can be found by id, label text, or name. The option can be found by its text.

uncheck(parent, locator, opts \\ [])

Specs

uncheck(parent, locator, opts) :: parent

Unchecks a checkbox based on id, label text, or name.