-
I have the following in one of my Wallaby tests: retry(fn ->
if current_path(session) == "/" do
IO.puts("At root")
session
|> assert_has(Query.css(".notification.is-info"))
else
{:error, :url_not_refreshed}
end
end) And the test passes, even though the success path is never hit, because the message |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Can you elaborate a little more on the test scenario? I am curious as to why you are resorting to using the retry function. But, the reason why you're test is passing right now is because assert {:ok, _session} =
retry(fn ->
if current_path(session) == "/" do
IO.puts("At root")
{:ok, assert_has(session, Query.css(".notification.is-info"))}
else
{:error, :url_not_refreshed}
end
end) |
Beta Was this translation helpful? Give feedback.
Can you elaborate a little more on the test scenario?
I am curious as to why you are resorting to using the retry function.
But, the reason why you're test is passing right now is because
retry/1
expects the callback to return an ok/error tuple, andretry/1
will then pass that value through, but you aren't asserting on anything. The following would fail your test if the callback passed toretry/1
does not return{:ok, <some value>}
within the timeout.