X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/bfa9ee952c1ae3f03fe2f9fa781a132411963030..49b58cc43218106f1633c389598894d59447a26b:/apps/workbench/test/integration_helper.rb diff --git a/apps/workbench/test/integration_helper.rb b/apps/workbench/test/integration_helper.rb index a8788ceb53..febcfcfec0 100644 --- a/apps/workbench/test/integration_helper.rb +++ b/apps/workbench/test/integration_helper.rb @@ -48,4 +48,27 @@ 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 + Capybara.reset_sessions! + end end