Last active
December 19, 2019 12:34
-
-
Save ematta/bc0d1e68e0144efeb777 to your computer and use it in GitHub Desktop.
Turbolinks and Selenium Webdriver (Ruby)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
driver.execute_script "$(document).on('page:load', function () { window.turbolink = true; });" | |
driver.execute_script "$(document).on('page:before-change', function () { window.turbolink = false; });" | |
wait = Selenium::WebDriver::Wait.new(:timeout => 10) | |
wait.until { driver.execute_script 'return window.turbolink;' } |
make it easy, using the rspec-wait
gem, just wait for the progress bar to disappear:
And("I wait for turbolinks to load") do
wait(30.seconds).for do
page.has_selector?('.turbolinks-progress-bar')
end.to be false
end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, where in the test did you place this code?