elixir-wallaby/wallaby

`has_css?/2` is raising an exception instead of returning `false`

adkron opened this issue · 1 comments

Issue

Description of the issue. Please include browser you're using (phantomjs,
chrome, etc.) elixir and erlang version and any relevant stack traces.

Chome
Wallaby: 0.28.0

Test Code & HTML

refute session
|> visit("/")
|> has_css?("#not_there") 

I get a ** (Wallaby.QueryError) Expected to find any, visible elements that matched the css '#apply_discount_153' but 0, visible elements were found.

has_no_css?/2 works just fine. It looks like has_css?/2 uses count: :any and has_no_css? uses count: 0. Also has_any?/2 uses find/2 which is where the exception originates.

Hi @adkron! I haven't contributed to the project before, so forgive me - I'm not up to date on how to submit solutions or proper processes.

I believe I fixed the problem using has?/1 and added tests for every arity for has_css? and has_no_css?.

#624