Add documentation to doc.arvados.org for the local Docker install.
[arvados.git] / apps / workbench / test / integration_helper.rb
index a8788ceb53f6de95cffe0332eadb6dd6d312e808..81ea67c3c5c4bd8925e650501a85a258d6dff855 100644 (file)
@@ -25,6 +25,11 @@ class ActionDispatch::IntegrationTest
 
   @@API_AUTHS = self.api_fixture('api_client_authorizations')
 
+  def setup
+    reset_session!
+    super
+  end
+
   def page_with_token(token, path='/')
     # Generate a page path with an embedded API token.
     # Typical usage: visit page_with_token('token_name', page)
@@ -48,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