Skip to content
Snippets Groups Projects

Implement tests for FR-19 and FR-20

Merged kerdo requested to merge 29-fr-19-save-last-5-searches into main
4 files
+ 56
1
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -29,6 +29,7 @@ defmodule PropertySearchContext do
:ok,
state
|> Map.put(:email, existing_user[:email])
|> Map.put(:password, existing_user[:password])
}
end
@@ -144,4 +145,34 @@ defmodule PropertySearchContext do
{:ok, state}
end
and_ ~r/^I am logged in$/, fn state ->
setup_session(state[:email], state[:password])
{:ok, state}
end
and_ ~r/^I want to search$/, fn state ->
navigate_to("/")
click({:id, "search"})
{:ok, state}
end
and_ ~r/^I perform a search$/, fn state ->
click({:id, "search_button"})
{:ok, state}
end
then_ ~r/^I should see a saved search query$/, fn state ->
assert visible_in_page? ~r/Previous searches/
el_count = length(find_all_elements(:class, "previous-search"))
assert el_count == 1
{:ok, state}
end
defp setup_session(email, password) do
navigate_to("/login")
fill_field({:id, "email"}, email)
fill_field({:id, "password"}, password)
click({:id, "login_button"})
end
end
Loading