assert_equal true, found_email, 'Expected email after issue reported'
end
+ test "combine files into new collection" do
+ post(:combine_selected_files_into_collection, {
+ selection: ['zzzzz-4zz18-znfnqtbbv4spc3w/foo',
+ 'zzzzz-4zz18-ehbhgtheo8909or/bar',
+ 'zzzzz-4zz18-y9vne9npefyxh8g/baz',
+ '1fd08fc162a5c6413070a8bd0bffc818+150'],
+ format: "json"},
+ session_for(:active))
+
+ assert_response 302 # collection created and redirected to new collection page
+ new_collection_uuid = response.headers['Location'].split('/')[-1]
+
+ @controller = CollectionsController.new
+
+ get :show, {
+ id: new_collection_uuid
+ }
+ assert_response :success
+
+ collection = assigns(:object)
+ manifest_text = collection['manifest_text']
+ assert manifest_text.include?('foo'), 'Not found foo in new collection manifest text'
+ assert manifest_text.include?('bar'), 'Not found bar in new collection manifest text'
+ assert manifest_text.include?('baz'), 'Not found baz in new collection manifest text'
+ assert manifest_text.include?('0:0:file1 0:0:file2 0:0:file3'),
+ 'Not found 0:0:file1 0:0:file2 0:0:file3 in new collection manifest text'
+ assert manifest_text.include?('dir1/subdir'), 'Not found dir1/subdir in new collection manifest text'
+ assert manifest_text.include?('dir2'), 'Not found dir2 in new collection manifest text'
+ end
+
end
visit page_with_token('active', "/collections/#{uuid}")
assert page.has_text?('This collection is empty')
end
+
+ test "combine selected collections into new collection" do
+ foo_collection_uuid = api_fixture('collections')['foo_file']['uuid']
+ bar_collection_uuid = api_fixture('collections')['bar_file']['uuid']
+
+ visit page_with_token('active', "/collections")
+
+ assert(page.has_text?(foo_collection_uuid), "Collection page did not include foo file")
+ assert(page.has_text?(bar_collection_uuid), "Collection page did not include bar file")
+
+ within('tr', text: foo_collection_uuid) do
+ find('input[type=checkbox]').click
+ end
+
+ within('tr', text: bar_collection_uuid) do
+ find('input[type=checkbox]').click
+ end
+
+ click_button 'Selection...'
+ within('.selection-action-container') do
+ click_link 'Combine selections into a new collection'
+ end
+
+ # back in collections page
+ assert(page.has_text?(foo_collection_uuid), "Collection page did not include foo file")
+ assert(page.has_text?(bar_collection_uuid), "Collection page did not include bar file")
+ end
+
+ test "combine selected collection contents into new collection" do
+ foo_collection = api_fixture('collections')['foo_file']
+ # bar_collection = api_fixture('collections')['bar_file']
+ # pdh_collection = api_fixture('collections')['multilevel_collection_1']
+
+ visit page_with_token('active', "/collections")
+
+ # choose file from foo collection
+ within('tr', text: foo_collection['uuid']) do
+ click_link 'Show'
+ end
+
+ # now in collection page
+ within('tr', text: foo_collection['name'].split('_')[0]) do
+ find('input[type=checkbox]').click
+ end
+
+ click_button 'Selection...'
+ within('.selection-action-container') do
+ click_link 'Combine selections into a new collection'
+ end
+
+ # go back to collections page
+ visit page_with_token('active', "/collections")
+ assert(page.has_text?('sdfsdfsdfsdfsdfsdfsdf'), "Collection page did not include foo file link")
+ end
end
click_button 'Selection...'
within('.selection-action-container') do
+ page.assert_selector 'li.disabled', text: 'Combine selections into a new collection'
page.assert_selector 'li.disabled', text: 'Compare selected'
page.assert_selector 'li.disabled', text: 'Copy selected'
page.assert_selector 'li.disabled', text: 'Move selected'
click_button 'Selection...'
within('.selection-action-container') do
+ page.assert_no_selector 'li.disabled', text: 'Combine selections into a new collection'
+ page.assert_selector 'li', text: 'Combine selections into a new collection'
page.assert_selector 'li.disabled', text: 'Compare selected'
page.assert_no_selector 'li.disabled', text: 'Copy selected'
page.assert_selector 'li', text: 'Copy selected'
click_button 'Selection...'
within('.selection-action-container') do
+ page.assert_selector 'li.disabled', text: 'Combine selections into a new collection'
page.assert_selector 'li.disabled', text: 'Compare selected'
page.assert_selector 'li.disabled', text: 'Copy selected'
page.assert_no_selector 'li.disabled', text: 'Move selected'
click_button 'Selection...'
within('.selection-action-container') do
+ page.assert_selector 'li.disabled', text: 'Combine selections into a new collection'
page.assert_selector 'li.disabled', text: 'Compare selected'
page.assert_selector 'li.disabled', text: 'Copy selected'
page.assert_no_selector 'li.disabled', text: 'Move selected'
end
end
+ test "combine selections into new collection" do
+ my_project = api_fixture('groups')['aproject']
+ my_collection = api_fixture('collections')['collection_to_move_around_in_aproject']
+
+ visit page_with_token 'active', '/'
+ find('.arv-project-list a,button', text: my_project['name']).click
+ assert page.has_text?(my_collection['name']), 'Collection not found in project'
+
+ within('tr', text: my_collection['name']) do
+ find('input[type=checkbox]').click
+ end
+
+ click_button 'Selection...'
+ within('.selection-action-container') do
+ click_link 'Combine selections into a new collection'
+ end
+
+ # back in project page
+ assert page.has_text?(my_collection['name']), 'Collection not found in project'
+ assert page.has_link?('Jobs and pipelines'), 'Jobs and pipelines link not found in project'
+ end
+
end