X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/fa6b0b65fb71b66e36f982f4f25e9751672d0834..30a74a09202eedbea5e5c7bd59768e616cd38c79:/apps/workbench/test/integration_helper.rb diff --git a/apps/workbench/test/integration_helper.rb b/apps/workbench/test/integration_helper.rb index 93455ee782..81ea67c3c5 100644 --- a/apps/workbench/test/integration_helper.rb +++ b/apps/workbench/test/integration_helper.rb @@ -53,4 +53,26 @@ class ActionDispatch::IntegrationTest false end end + + @@screenshot_count = 1 + def screenshot + image_file = "./tmp/workbench-fail-#{@@screenshot_count}.png" + begin + page.save_screenshot image_file + rescue Capybara::NotSupportedByDriverError + # C'est la vie. + else + puts "Saved #{image_file}" + @@screenshot_count += 1 + end + end + + teardown do + if not passed? + screenshot + end + if Capybara.current_driver == :selenium + page.execute_script("window.localStorage.clear()") + end + end end