1 require 'integration_helper'
3 class ContainerRequestsTest < ActionDispatch::IntegrationTest
10 ['ex_string_opt', 'abc'],
14 ['ex_double', '12.34', 12.34],
15 ['ex_float', '12.34', 12.34],
16 ].each do |input_id, input_value, expected_value|
17 test "set input #{input_id} with #{input_value}" do
18 request_uuid = api_fixture("container_requests", "uncommitted", "uuid")
19 visit page_with_token("active", "/container_requests/#{request_uuid}")
20 selector = ".editable[data-name='[mounts][/var/lib/cwl/cwl.input.json][content][#{input_id}]']"
22 find(".editable-input input").set(input_value)
23 find("#editable-submit").click
24 assert_no_selector(".editable-popup")
25 assert_selector(selector, text: expected_value || input_value)
29 test "select value for boolean input" do
30 request_uuid = api_fixture("container_requests", "uncommitted", "uuid")
31 visit page_with_token("active", "/container_requests/#{request_uuid}")
32 selector = ".editable[data-name='[mounts][/var/lib/cwl/cwl.input.json][content][ex_boolean]']"
34 within(".editable-input") do
37 find("#editable-submit").click
38 assert_no_selector(".editable-popup")
39 assert_selector(selector, text: "true")
42 test "select value for enum typed input" do
43 request_uuid = api_fixture("container_requests", "uncommitted", "uuid")
44 visit page_with_token("active", "/container_requests/#{request_uuid}")
45 selector = ".editable[data-name='[mounts][/var/lib/cwl/cwl.input.json][content][ex_enum]']"
47 within(".editable-input") do
48 select "b" # second value
50 find("#editable-submit").click
51 assert_no_selector(".editable-popup")
52 assert_selector(selector, text: "b")
59 test "select value for #{type} input" do
60 request_uuid = api_fixture("container_requests", "uncommitted-with-directory-input", "uuid")
61 visit page_with_token("active", "/container_requests/#{request_uuid}")
62 assert_text 'Provide a value for the following parameter'
64 within('.modal-dialog') do
66 collection = api_fixture('collections', 'collection_with_one_property', 'uuid')
67 find("div[data-object-uuid=#{collection}]").click
70 find('.preview-selectable', text: 'bar').click
72 find('button', text: 'OK').click
74 page.assert_no_selector 'a.disabled,button.disabled', text: 'Run'
75 assert_text 'This workflow does not need any further inputs'
78 assert_text 'This container is committed'
82 test "Run button enabled once all required inputs are provided" do
83 request_uuid = api_fixture("container_requests", "uncommitted-with-required-and-optional-inputs", "uuid")
84 visit page_with_token("active", "/container_requests/#{request_uuid}")
85 assert_text 'Provide a value for the following parameter'
87 page.assert_selector 'a.disabled,button.disabled', text: 'Run'
89 selector = ".editable[data-name='[mounts][/var/lib/cwl/cwl.input.json][content][int_required]']"
91 find(".editable-input input").set(2016)
92 find("#editable-submit").click
94 page.assert_no_selector 'a.disabled,button.disabled', text: 'Run'
97 assert_text 'This container is committed'