Wait for the button to be disabled, before checking the tooltip behaviour
Rather than sleeping for a fixed period, we can use Capybara's built-in ability to wait for elements to be present. Since we're only changing the state of existing elements though, we need to wait for their "disabled" property to be set. Fixes some timing-related problems with the test suite.
This commit is contained in:
parent
7d80c7747f
commit
6f471c72c9
1 changed files with 2 additions and 1 deletions
|
@ -71,9 +71,10 @@ class SiteTest < ApplicationSystemTestCase
|
||||||
find("h1").hover # un-hover original element
|
find("h1").hover # un-hover original element
|
||||||
|
|
||||||
visit "#map=10/0/0"
|
visit "#map=10/0/0"
|
||||||
|
find("#{selector}.disabled") # Ensure that capybara has waited for JS to finish processing
|
||||||
|
|
||||||
assert_no_selector ".tooltip"
|
assert_no_selector ".tooltip"
|
||||||
find(selector).hover
|
find(selector).hover
|
||||||
sleep(0.5)
|
|
||||||
assert_selector ".tooltip", :text => "Zoom in"
|
assert_selector ".tooltip", :text => "Zoom in"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue