Skip to content

Commit 75a3188

Browse files
committed
Kludge to fix Tubrolinks intermittent test errors
Sometimes Turbolinks hasn't fully loaded before Capybara attempts to call 'Turbolinks.visit'. Adding a brief sleep gives Turbolinks a chance to become availabe to PhantomJS
1 parent 93c0529 commit 75a3188

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/view_helper_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ class ViewHelperTest < ActionDispatch::IntegrationTest
6666
page.execute_script('Turbolinks.visit("/pages/2");')
6767
assert page.has_content?('Hello Alice')
6868

69+
# Sometimes Turbolinks isn't available right away. We need to wait for a brief moment
70+
# for phantomJS to finish loading javascript.
71+
sleep(0.1)
72+
6973
page.execute_script('Turbolinks.visit("/pages/1");')
7074
assert page.has_content?('Hello Bob')
7175

0 commit comments

Comments
 (0)