Merge branch 'master' of git.curoverse.com:arvados into 13429-cwl-runner-storage...
[arvados.git] / apps / workbench / test / integration / ajax_errors_test.rb
index de2dfc77d8d698e7085e1b770b99fdd4a6512fe6..b3b1f1f57ae9d3d9eb511581d5b700571f79646a 100644 (file)
@@ -1,3 +1,7 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 require 'integration_helper'
 
 class AjaxErrorsTest < ActionDispatch::IntegrationTest
@@ -7,6 +11,7 @@ class AjaxErrorsTest < ActionDispatch::IntegrationTest
   end
 
   test 'load pane with deleted session' do
+    skip 'unreliable test'
     # Simulate loading a page in browser-tab A, hitting "Log out" in
     # browser-tab B, then returning to browser-tab A and choosing a
     # different tab. (Automatic tab refreshes will behave similarly.)
@@ -14,14 +19,15 @@ class AjaxErrorsTest < ActionDispatch::IntegrationTest
     ActionDispatch::Request::Session.any_instance.stubs(:[]).returns(nil)
     click_link "Subprojects"
     wait_for_ajax
-    assert_no_selector '.container-fluid .container-fluid'
-    assert_no_text 'If you have never used'
-    assert_text 'Reload tab'
+    assert_no_double_layout
+    assert_selector 'a,button', text: 'Reload tab'
+    assert_selector '.pane-error-display'
     page.driver.browser.switch_to.frame 0
     assert_text 'You are not logged in.'
   end
 
   test 'load pane with expired token' do
+    skip 'unreliable test'
     # Similar to 'deleted session'. Here, the session cookie is still
     # alive, but it contains a token which has expired. This uses a
     # different code path because Workbench cannot detect that
@@ -36,10 +42,21 @@ class AjaxErrorsTest < ActionDispatch::IntegrationTest
     end
     click_link "Subprojects"
     wait_for_ajax
-    assert_no_selector '.container-fluid .container-fluid'
-    assert_no_text 'If you have never used'
-    assert_text 'Reload tab'
+    assert_no_double_layout
+    assert_selector 'a,button', text: 'Reload tab'
+    assert_selector '.pane-error-display'
     page.driver.browser.switch_to.frame 0
     assert_text 'You are not logged in.'
   end
+
+  protected
+
+  def assert_no_double_layout
+    # Check we're not rendering a full page layout within a tab
+    # pane. Bootstrap responsive layouts require exactly one
+    # div.container-fluid. Checking "body body" would be more generic,
+    # but doesn't work when the browser/driver automatically collapses
+    # syntatically invalid tags.
+    assert_no_selector '.container-fluid .container-fluid'
+  end
 end