1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 require 'integration_helper'
7 class ContainerRequestsTest < ActionDispatch::IntegrationTest
14 ['ex_string_opt', 'abc'],
18 ['ex_double', '12.34', 12.34],
19 ['ex_float', '12.34', 12.34],
20 ].each do |input_id, input_value, expected_value|
21 test "set input #{input_id} with #{input_value}" do
22 request_uuid = api_fixture("container_requests", "uncommitted", "uuid")
23 visit page_with_token("active", "/container_requests/#{request_uuid}")
24 selector = ".editable[data-name='[mounts][/var/lib/cwl/cwl.input.json][content][#{input_id}]']"
26 find(".editable-input input").set(input_value)
27 find("#editable-submit").click
28 assert_no_selector(".editable-popup")
29 assert_selector(selector, text: expected_value || input_value)
33 test "select value for boolean input" do
34 request_uuid = api_fixture("container_requests", "uncommitted", "uuid")
35 visit page_with_token("active", "/container_requests/#{request_uuid}")
36 selector = ".editable[data-name='[mounts][/var/lib/cwl/cwl.input.json][content][ex_boolean]']"
38 within(".editable-input") do
41 find("#editable-submit").click
42 assert_no_selector(".editable-popup")
43 assert_selector(selector, text: "true")
46 test "select value for enum typed input" do
47 request_uuid = api_fixture("container_requests", "uncommitted", "uuid")
48 visit page_with_token("active", "/container_requests/#{request_uuid}")
49 selector = ".editable[data-name='[mounts][/var/lib/cwl/cwl.input.json][content][ex_enum]']"
51 within(".editable-input") do
52 select "b" # second value
54 find("#editable-submit").click
55 assert_no_selector(".editable-popup")
56 assert_selector(selector, text: "b")
63 test "select value for #{type} input" do
64 request_uuid = api_fixture("container_requests", "uncommitted-with-directory-input", "uuid")
65 visit page_with_token("active", "/container_requests/#{request_uuid}")
66 assert_text 'Provide a value for the following parameter'
68 within('.modal-dialog') do
70 collection = api_fixture('collections', 'collection_with_one_property', 'uuid')
71 find("div[data-object-uuid=#{collection}]").click
74 find('.preview-selectable', text: 'bar').click
76 find('button', text: 'OK').click
78 page.assert_no_selector 'a.disabled,button.disabled', text: 'Run'
79 assert_text 'This workflow does not need any further inputs'
82 assert_text 'This container is queued'
86 test "Run button enabled once all required inputs are provided" do
87 request_uuid = api_fixture("container_requests", "uncommitted-with-required-and-optional-inputs", "uuid")
88 visit page_with_token("active", "/container_requests/#{request_uuid}")
89 assert_text 'Provide a value for the following parameter'
91 page.assert_selector 'a.disabled,button.disabled', text: 'Run'
93 selector = ".editable[data-name='[mounts][/var/lib/cwl/cwl.input.json][content][int_required]']"
95 find(".editable-input input").set(2016)
96 find("#editable-submit").click
98 page.assert_no_selector 'a.disabled,button.disabled', text: 'Run'
101 assert_text 'This container is queued'
104 test "Run button enabled when workflow is empty and no inputs are needed" do
105 visit page_with_token("active")
107 find('.btn', text: 'Run a process').click
108 within('.modal-dialog') do
109 find('.selectable', text: 'Valid workflow with no definition yaml').click
110 find('.btn', text: 'Next: choose inputs').click
113 assert_text 'This workflow does not need any further inputs'
114 page.assert_selector 'a', text: 'Run'
117 test "Provenance graph shown on committed container requests" do
118 cr = api_fixture('container_requests', 'completed')
119 visit page_with_token("active", "/container_requests/#{cr['uuid']}")
120 assert page.has_text? 'Provenance'
121 click_link 'Provenance'
123 # Check for provenance graph existance
124 page.assert_selector '#provenance_svg'
125 page.assert_selector 'ellipse+text', text: cr['name'], visible: false
126 page.assert_selector 'g.node>title', text: cr['uuid'], visible: false
130 visit page_with_token("active", "/container_requests")
132 within(".arv-recent-container-requests") do
133 page.execute_script "window.scrollBy(0,999000)"
137 running_owner_active = api_fixture("container_requests", "requester_for_running")
138 anon_accessible_cr = api_fixture("container_requests", "running_anonymous_accessible")
140 # both of these CRs should be accessible to the user
141 assert_selector "a[href=\"/container_requests/#{running_owner_active['uuid']}\"]", text: running_owner_active[:name]
142 assert_selector "a[href=\"/container_requests/#{anon_accessible_cr['uuid']}\"]", text: anon_accessible_cr[:name]
144 # user can delete the "running" container_request
145 within(".cr-#{running_owner_active['uuid']}") do
146 assert_not_nil first('.glyphicon-trash')
149 # user can not delete the anonymously accessible container_request
150 within(".cr-#{anon_accessible_cr['uuid']}") do
151 assert_nil first('.glyphicon-trash')
154 # verify the search box in the page
155 find('.recent-container-requests-filterable-control').set("anonymous")
156 sleep 0.350 # Wait for 250ms debounce timer (see filterable.js)
158 assert_no_selector "a[href=\"/container_requests/#{running_owner_active['uuid']}\"]", text: running_owner_active[:name]
159 assert_selector "a[href=\"/container_requests/#{anon_accessible_cr['uuid']}\"]", text: anon_accessible_cr[:name]