X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/19ae770973482257117fe8ded5619c3018c4b60f..4da754586b4529a4480951218a69ec6f41fee98d:/apps/workbench/test/controllers/projects_controller_test.rb diff --git a/apps/workbench/test/controllers/projects_controller_test.rb b/apps/workbench/test/controllers/projects_controller_test.rb index 58914a84ac..d31d6e3458 100644 --- a/apps/workbench/test/controllers/projects_controller_test.rb +++ b/apps/workbench/test/controllers/projects_controller_test.rb @@ -387,14 +387,80 @@ class ProjectsControllerTest < ActionController::TestCase end [ - ["jobs", "/jobs"], - ["pipelines", "/pipeline_instances"], - ["collections", "/collections"], - ].each do |target,path| - test "test dashboard button all #{target}" do - get :index, {}, session_for(:active) - assert_includes @response.body, "href=\"#{path}\"" - assert_includes @response.body, "All #{target}" + [:admin, true], + [:active, false], + ].each do |user, expect_all_nodes| + test "in dashboard other index page links as #{user}" do + get :index, {}, session_for(user) + + [["processes", "/all_processes"], + ["collections", "/collections"], + ].each do |target, path| + assert_includes @response.body, "href=\"#{path}\"" + assert_includes @response.body, "All #{target}" + end + + if expect_all_nodes + assert_includes @response.body, "href=\"/nodes\"" + assert_includes @response.body, "All nodes" + else + assert_not_includes @response.body, "href=\"/nodes\"" + assert_not_includes @response.body, "All nodes" + end + end + end + + test "dashboard should show the correct status for processes" do + get :index, {}, session_for(:active) + assert_select 'div.panel-body.recent-processes' do + [ + { + fixture: 'container_requests', + state: 'completed', + selectors: [['div.progress', false], + ['span.label.label-success', true, 'Complete']] + }, + { + fixture: 'container_requests', + state: 'uncommitted', + selectors: [['div.progress', false], + ['span.label.label-default', true, 'Uncommitted']] + }, + { + fixture: 'container_requests', + state: 'queued', + selectors: [['div.progress', false], + ['span.label.label-default', true, 'Queued']] + }, + { + fixture: 'container_requests', + state: 'running', + selectors: [['div.progress', true]] + }, + { + fixture: 'pipeline_instances', + state: 'new_pipeline', + selectors: [['div.progress', false], + ['span.label.label-default', true, 'Not started']] + }, + { + fixture: 'pipeline_instances', + state: 'pipeline_in_running_state', + selectors: [['div.progress', true]] + }, + ].each do |c| + uuid = api_fixture(c[:fixture])[c[:state]]['uuid'] + assert_select "div.dashboard-panel-info-row.row-#{uuid}" do + if c.include? :selectors + c[:selectors].each do |selector, should_show, label| + assert_select selector, should_show, "UUID #{uuid} should #{should_show ? '' : 'not'} show '#{selector}'" + if should_show and not label.nil? + assert_select selector, label, "UUID #{uuid} state label should show #{label}" + end + end + end + end + end end end @@ -421,7 +487,7 @@ class ProjectsControllerTest < ActionController::TestCase [ ["active", 5, ["aproject", "asubproject"], "anonymously_accessible_project"], - ["user1_with_load", 2, ["project_with_10_collections"], "project_with_2_pipelines_and_60_jobs"], + ["user1_with_load", 2, ["project_with_10_collections"], "project_with_2_pipelines_and_60_crs"], ["admin", 5, ["anonymously_accessible_project", "subproject_in_anonymous_accessible_project"], "aproject"], ].each do |user, page_size, tree_segment, unexpected| test "build my projects tree for #{user} user and verify #{unexpected} is omitted" do