1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
8 require 'integration_helper'
10 class JobsTest < ActionDispatch::IntegrationTest
15 def fakepipe_with_log_data
17 "2014-01-01_12:00:01 zzzzz-8i9sb-0vsrcqi7whchuil 0 log message 1\n" +
18 "2014-01-01_12:00:02 zzzzz-8i9sb-0vsrcqi7whchuil 0 log message 2\n" +
19 "2014-01-01_12:00:03 zzzzz-8i9sb-0vsrcqi7whchuil 0 log message 3\n"
20 StringIO.new content, 'r'
25 ['job_reader2', false],
26 ].each do |user, readable|
27 test "view job with components as #{user} user" do
28 job = api_fixture('jobs')['running_job_with_components']
29 component1 = api_fixture('jobs')['completed_job_in_publicly_accessible_project']
30 component2 = api_fixture('pipeline_instances')['running_pipeline_with_complete_job']
31 component2_child1 = api_fixture('jobs')['previous_job_run']
32 component2_child2 = api_fixture('jobs')['running']
34 visit page_with_token(user, "/jobs/#{job['uuid']}")
35 assert page.has_text? job['script_version']
36 assert page.has_no_text? 'script_parameters'
38 # The job_reader2 is allowed to read job, component2, and component2_child1,
39 # and component2_child2 only as a component of the pipeline component2
41 assert page.has_link? 'component1'
42 assert page.has_link? 'component2'
44 assert page.has_no_link? 'component1'
45 assert page.has_link? 'component2'
49 click_link('component1')
50 within('.panel-collapse') do
51 assert(has_text? component1['uuid'])
52 assert(has_text? component1['script_version'])
53 assert(has_text? 'script_parameters')
55 click_link('component1')
58 click_link('component2')
59 within('.panel-collapse') do
60 assert(has_text? component2['uuid'])
61 assert(has_text? component2['script_version'])
62 assert(has_no_text? 'script_parameters')
63 assert(has_link? 'previous')
64 assert(has_link? 'running')
66 click_link('previous')
67 within('.panel-collapse') do
68 assert(has_text? component2_child1['uuid'])
69 assert(has_text? component2_child1['script_version'])
71 click_link('previous')
74 within('.panel-collapse') do
75 assert(has_text? component2_child2['uuid'])
77 assert(has_text? component2_child2['script_version'])
79 assert(has_no_text? component2_child2['script_version'])