lib/spreewald/web_steps.rb in spreewald-1.11.6 vs lib/spreewald/web_steps.rb in spreewald-1.12.0
- old
+ new
@@ -449,11 +449,11 @@
# The step 'Then (the tag )?"..." should **not** be visible' is ambiguous. Please use 'Then (the tag )?"..." should be hidden' or 'Then I should not see "..."' instead.
#
# More details [here](https://makandracards.com/makandra/1049-capybara-check-that-a-page-element-is-hidden-via-css)
Then /^(the tag )?"([^\"]+)" should( not)? be visible$/ do |tag, selector_or_text, hidden|
if hidden
- warn "The step 'Then ... should not be visible' is prone to misunderstandgs. Please use 'Then ... should be hidden' or 'Then I should not see ...' instead."
+ warn "The step 'Then ... should not be visible' is prone to misunderstandings. Please use 'Then ... should be hidden' or 'Then I should not see ...' instead."
end
options = {}
tag ? options.store(:selector, selector_or_text) : options.store(:text, selector_or_text)
@@ -661,18 +661,15 @@
# Capybara 2.1+ won't usually interact with hidden elements,
# but we can override this behavior by passing { visible: false }
field = find_field(label, :visible => false)
end
- case Capybara::current_driver
- when :selenium, :webkit
- patiently do
- visibility_detecting_javascript = "$('##{field['id']}').is(':visible')"
- page.evaluate_script(visibility_detecting_javascript).should == !hidden
- end
+ selector = "##{field['id']}"
+
+ if hidden
+ assert_hidden(selector: selector)
else
- expectation = hidden ? :should_not : :should
- field.send(expectation, be_visible)
+ assert_visible(selector: selector)
end
end.overridable
# Waits for the page to finish loading and AJAX requests to finish.
#