X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/8f1554cf9cfc279e0127d7ea2c7a79a98e323f13..0a78f5a0efe0c88fddcd2ee91065f2a8da79055a:/apps/workbench/test/integration/projects_test.rb diff --git a/apps/workbench/test/integration/projects_test.rb b/apps/workbench/test/integration/projects_test.rb index ae156b8a53..189de02f7c 100644 --- a/apps/workbench/test/integration/projects_test.rb +++ b/apps/workbench/test/integration/projects_test.rb @@ -439,32 +439,44 @@ class ProjectsTest < ActionDispatch::IntegrationTest end end - test "combine selected collections 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("#projects-menu").click - find(".dropdown-menu a", text: my_project['name']).click - assert page.has_text?(my_collection['name']), 'Collection not found in project' + [ + ['active', true], + ['project_viewer', false], + ].each do |user, expect_collection_in_aproject| + test "combine selected collections into new collection #{user} #{expect_collection_in_aproject}" do + my_project = api_fixture('groups')['aproject'] + my_collection = api_fixture('collections')['collection_to_move_around_in_aproject'] + + visit page_with_token user, '/' + find("#projects-menu").click + find(".dropdown-menu a", 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 - within('tr', text: my_collection['name']) do - find('input[type=checkbox]').click - end + click_button 'Selection...' + within('.selection-action-container') do + click_link 'Create new collection with selected collections' + end - click_button 'Selection...' - within('.selection-action-container') do - click_link 'Create new collection with selected collections' + # now in the new collection page + if expect_collection_in_aproject + assert page.has_text?("Created new collection in the project #{my_project['name']}"), + 'Not found flash message that new collection is created in aproject' + else + assert page.has_text?("Created new collection in your Home project"), + 'Not found flash message that new collection is created in Home project' + end + assert page.has_text?('Content hash'), 'Not found content hash in collection page' 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 - [["jobs", "/jobs"], - ["pipelines", "/pipeline_instances"], - ["collections", "/collections"] + [ + ["jobs", "/jobs"], + ["pipelines", "/pipeline_instances"], + ["collections", "/collections"] ].each do |target,path| test "Test dashboard button all #{target}" do visit page_with_token 'active', '/'