Merge branch '11917-dont-clear-cache'
[arvados.git] / apps / workbench / test / integration / application_layout_test.rb
index 4685b0cec918bd374aa9ac175c967143442ee29f..7692d8e5dc1b0df9a50c1dae8d258eb298e36e33 100644 (file)
@@ -1,3 +1,7 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 require 'integration_helper'
 
 class ApplicationLayoutTest < ActionDispatch::IntegrationTest
@@ -52,7 +56,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
 
             assert_selector "a[href=\"/projects/#{user['uuid']}\"]", text: 'Home project'
             assert_selector "a[href=\"/users/#{user['uuid']}/virtual_machines\"]", text: 'Virtual machines'
-            assert_selector "a[href=\"/users/#{user['uuid']}/repositories\"]", text: 'Repositories'
+            assert_selector "a[href=\"/repositories\"]", text: 'Repositories'
             assert_selector "a[href=\"/current_token\"]", text: 'Current token'
             assert_selector "a[href=\"/users/#{user['uuid']}/ssh_keys\"]", text: 'SSH keys'
 
@@ -179,7 +183,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
 
         first('button', text: 'x').click
       end
-      assert_text 'Active processes' # seeing dashboard now
+      assert_text 'Recent pipelines and processes' # seeing dashboard now
     end
   end
 
@@ -210,7 +214,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
   end
 
    [
-    ['Repositories', nil, 's0uqq'],
+    ['Repositories', nil, 'active/crunchdispatchtest'],
     ['Virtual machines', nil, 'testvm.shell'],
     ['SSH keys', nil, 'public_key'],
     ['Links', nil, 'link_class'],
@@ -242,30 +246,49 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
     end
   end
 
-  test "dashboard panes" do
-    visit page_with_token('active')
+  [
+    ['active', false],
+    ['admin', true],
+  ].each do |token, is_admin|
+    test "visit dashboard as #{token}" do
+      visit page_with_token(token)
 
-    assert_text 'Active processes' # seeing dashboard now
-    within('.active-processes') do
-      assert_text 'zzzzz-dz642-runningcontainr'
-      assert_text 'zzzzz-dz642-runningcontain2'
-      assert_text 'zzzzz-d1hrv-partdonepipelin'
-      assert_no_text 'zzzzz-d1hrv-twodonepipeline'
-      assert_no_text 'zzzzz-xvhdp-cr4queuedcontnr'
-    end
-    within('.finished-processes') do
-      assert_text 'zzzzz-d1hrv-twodonepipeline'
-      assert_text 'zzzzz-dz642-compltcontainer'
-      assert_text 'zzzzz-dz642-compltcontainr2'
-      assert_no_text 'zzzzz-d1hrv-partdonepipelin'
-      assert_no_text 'zzzzz-dz642-runningcontainr'
-    end
+      assert_text 'Recent pipelines and processes' # seeing dashboard now
+      within('.recent-processes-actions') do
+        assert page.has_link?('Run a process')
+        assert page.has_link?('All processes')
+      end
+
+      within('.recent-processes') do
+        assert_text 'running'
+
+        within('.row-zzzzz-xvhdp-cr4runningcntnr') do
+          assert_text 'requester_for_running_cr'
+        end
 
-    within('.compute-node-summary-pane') do
-      click_link 'Details'
-      assert_text 'zzzzz-dz642-lockedcontainer'
-      assert_text 'zzzzz-dz642-queuedcontainer'
-      assert_text '"foo" job submitted'
+        assert_text 'zzzzz-d1hrv-twodonepipeline'
+        within('.row-zzzzz-d1hrv-twodonepipeline')do
+          assert_text 'No output'
+        end
+
+        assert_text 'completed container request'
+        within('.row-zzzzz-xvhdp-cr4completedctr')do
+          assert page.has_link? 'foo_file'
+        end
+      end
+
+      within('.compute-node-actions') do
+        if is_admin
+          assert page.has_link?('All nodes')
+        else
+          assert page.has_no_link?('All nodes')
+        end
+      end
+
+      within('.compute-node-summary-pane') do
+        click_link 'Details'
+        assert_text 'compute0'
+      end
     end
   end
 end