2891: Add Workbench test for expired API token.
[arvados.git] / apps / workbench / test / integration / errors_test.rb
index 8da6de1b8bccf9a71139fa587d1f5e3a53940291..26c8783cd63a2c618e5b263c49d9a118862f2738 100644 (file)
@@ -1,7 +1,7 @@
 require 'integration_helper'
 
 class ErrorsTest < ActionDispatch::IntegrationTest
-  BAD_UUID = "zzzzz-zzzzz-zzzzzzzzzzzzzzz"
+  BAD_UUID = "ffffffffffffffffffffffffffffffff+0"
 
   test "error page renders user navigation" do
     visit(page_with_token("active", "/collections/#{BAD_UUID}"))
@@ -11,9 +11,23 @@ class ErrorsTest < ActionDispatch::IntegrationTest
            "Logged in user prompted to log in on error page")
   end
 
+  test "no user navigation with expired token" do
+    visit(page_with_token("expired", "/collections/#{BAD_UUID}"))
+    assert(page.has_no_text?(api_fixture("users")["active"]["email"]),
+           "Page visited with expired token included user information")
+    assert(page.has_selector?("a", text: /log ?in/i),
+           "Login prompt missing on expired token error page")
+  end
+
   test "error page renders without login" do
     visit "/collections/download/#{BAD_UUID}/#{@@API_AUTHS['active']['api_token']}"
     assert(page.has_no_text?(/\b500\b/),
            "Error page without login returned 500")
   end
+
+  test "'object not found' page includes search link" do
+    visit(page_with_token("active", "/collections/#{BAD_UUID}"))
+    assert(all("a").any? { |a| a[:href] =~ %r{/collections/?(\?|$)} },
+           "no search link found on 404 page")
+  end
 end