Skip to content

Usage in Tests

Matthijs Kuiper edited this page Jul 19, 2017 · 3 revisions

First import the Helpers:

import TestSelector.TestHelpers

find_test_element()

These helpers work similar as find_element/3 in that they return a Hound.Element.
You need to provide (or pipe) a View or Cell, with an optional name and value.

find_test_element(view_or_cell)
find_test_element(view_or_cell, name)
find_test_element(view_or_cell, name, value)

test_element_value()

test_element_value(Hound.Element)

test_element_value?()

test_element_value?(Hound.Element, value)

Examples:

assert find_test_element(UserListCell)
assert find_test_element(UserListCell, "add-user")
assert find_test_element(UserListCell, "user", user.id)

find_test_element(UserView, "add-user-link")
|> click()
element = find_element(:id, "example")
assert test_element_value(element) == to_string("value")
assert test_element_value?(element, "value")
Clone this wiki locally