natritmeyer/site_prism

*_visible method doesn't work as documented

rodrigovrm opened this issue · 2 comments

I'm following these instructions: https://github.com/natritmeyer/site_prism#methods-supporting-capybara-options .

According to this, I should be able to wait for a text to appear,

@create_job_page.wait_until_items_modal_visible text: 'Job name'

but it throws this error:

NoMethodError:
       undefined method `zero?' for {:text=>"Job name"}:Hash
     # /Users/rra/.asdf/installs/ruby/2.3.4/lib/ruby/2.3.0/timeout.rb:74:in `timeout'

So, I changed the method call, passing the timeout as the first argument.

@create_job_page.wait_until_items_modal_visible(3, text: 'Job name')

and this generates this warning as SitePrism is passing down an array to Capybara:

Unused parameters passed to Capybara::Queries::SelectorQuery : [{:text=>"Job Name"}]

Looks like the documentation is outdated, correct?
And even passing the timeout as a parameter the method doesn't work. Is this a bug or there is another way to do that?

Can you provide us an SSCCE? http://www.sscce.org
Is the name of your element defined as items_modal - And how is it defined? section / element e.t.c.
Do you know if the item "is" visible / invisible at the point you run the method?

In the docs we don't specify that you can pass a timeout and a query parameter into the wait_until method, But I imagine it would work in the same way.

I know we have a couple of PR's to standardise this area (And add more feature tests, as this is an area that is a bit light).

But yeh some food for thought for now...

please check out #246