prevent localStorage.clear from running when it would cause an error

This commit is contained in:
Mike Greiling 2018-02-23 15:50:53 -06:00
parent 296a4e6825
commit c14cb5bff6
No known key found for this signature in database
GPG Key ID: 0303DF507FA67596
1 changed files with 4 additions and 2 deletions

View File

@ -78,8 +78,10 @@ RSpec.configure do |config|
end
config.after(:example, :js) do |example|
# prevent localstorage from introducing side effects based on test order
execute_script("localStorage.clear();")
# prevent localStorage from introducing side effects based on test order
unless ['', 'about:blank', 'data:,'].include? Capybara.current_session.driver.browser.current_url
execute_script("localStorage.clear();")
end
# capybara/rspec already calls Capybara.reset_sessions! in an `after` hook,
# but `block_and_wait_for_requests_complete` is called before it so by