DefactoSoftware / test_selector

Elixir library to help selecting the right elements in your tests.
MIT License
14 stars 2 forks source link

Add retries option to the search and find functions #12

Open sn3p opened 7 years ago

sn3p commented 7 years ago

Just like Hound's find_element/3 I'd like to add the retries option:

def find_test_element(view_module, retries \\ 5)
def search_test_element(view_module, retries \\ 5)

By default Hound retries 5 times. But when I want to make sure a page is lacking an element, I might want to check only once:

assert search_test_element(UserView, "does-not-exist", 1) == {:error, :no_such_element}

Multiple retries significantly increases the testing duration.

Looks like adding an optional attribute will conflict in our function arity, so need to find a workaround.

jessedijkstra commented 7 years ago

Maybe add a method refute_test_element?

This does however pose another problem, if you don't retry 5 times and the element that is searched for is fetched async it might actually appear there, but later.