- ["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 "in dashboard the progress bar should only show on running containers" do
+ get :index, {}, session_for(:active)
+ assert_select 'div.panel-body.recent-processes' do
+ [
+ ['completed', false],
+ ['uncommitted', false],
+ ['queued', false],
+ ['running', true],
+ ].each do |cr_state, should_show|
+ uuid = api_fixture('container_requests')[cr_state]['uuid']
+ assert_select "div.dashboard-panel-info-row.row-#{uuid}" do
+ assert_select 'div.progress', should_show
+ end
+ end