if component[:script_parameters]
component[:script_parameters].each do |param, value_info|
if value_info.is_a? Hash
- value_info_class = resource_class_for_uuid(value_info[:value])
+ value_info_partitioned = value_info[:value].partition('/')
+ value_info_class = resource_class_for_uuid(value_info_partitioned[0])
if value_info_class == Link
# Use the link target, not the link itself, as script
# parameter; but keep the link info around as well.
- link = Link.find value_info[:value]
+ link = Link.find value_info_partitioned[0]
value_info[:value] = link.head_uuid
value_info[:link_uuid] = link.uuid
value_info[:link_name] = link.name
# to ensure reproducibility, the script_parameter for a
# collection should be the portable_data_hash
# keep the collection name and uuid for human-readability
- obj = Collection.find value_info[:value]
- value_info[:value] = obj.portable_data_hash
+ obj = Collection.find value_info_partitioned[0]
+ value_info[:value] = obj.portable_data_hash + value_info_partitioned[1] + value_info_partitioned[2]
value_info[:selection_uuid] = obj.uuid
- value_info[:selection_name] = obj.name
+ value_info[:selection_name] = obj.name + value_info_partitioned[1] + value_info_partitioned[2]
end
end
end
instance_page = current_path
- # Go over to the collections page and select something
- visit '/collections'
- within('tr', text: 'GNU_General_Public_License') do
- find('input[type=checkbox]').click
- end
- find('#persistent-selection-count').click
-
# Add this collection to the project
visit '/projects'
find("#projects-menu").click
test 'Create pipeline inside a project and run' do
visit page_with_token('active_trustedclient')
- # Go over to the collections page and select something
- visit '/collections'
- within('tr', text: 'GNU_General_Public_License') do
- find('input[type=checkbox]').click
- end
- find('#persistent-selection-count').click
-
# Add this collection to the project using collections menu from top nav
visit '/projects'
find("#projects-menu").click
click_link 'API response'
api_response = JSON.parse(find('div#advanced_api_response pre').text)
input_params = api_response['components']['part-one']['script_parameters']['input']
- assert_equal input_params['value'], col['portable_data_hash']
- assert_equal input_params['selection_name'], col['name']
- assert_equal input_params['selection_uuid'], col['uuid']
+ assert_equal(input_params['value'], col['portable_data_hash'], "Not found expected input param value")
+ assert_equal(input_params['selection_name'], col['name'], "Not found expected input param name")
+ assert_equal(input_params['selection_uuid'], col['uuid'], "Not found expected input param uuid")
# "Run" button present and enabled
page.assert_no_selector 'a.disabled,button.disabled', text: 'Run'