X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/e2cd53d9007d56e1de4816f6aeab4bd769271162..397981dadc145225c691c8643b10527c9710f1fb:/apps/workbench/test/integration/trash_test.rb diff --git a/apps/workbench/test/integration/trash_test.rb b/apps/workbench/test/integration/trash_test.rb index 857e57a69d..22732a3d95 100644 --- a/apps/workbench/test/integration/trash_test.rb +++ b/apps/workbench/test/integration/trash_test.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'integration_helper' class TrashTest < ActionDispatch::IntegrationTest @@ -14,6 +18,8 @@ class TrashTest < ActionDispatch::IntegrationTest visit page_with_token('active', "/trash") assert_text deleted['name'] + assert_text deleted['uuid'] + assert_text deleted['portable_data_hash'] assert_text expired1['name'] assert_no_text expired2['name'] # not readable by this user assert_no_text 'foo_file' # not trash @@ -40,7 +46,9 @@ class TrashTest < ActionDispatch::IntegrationTest wait_for_ajax - assert_no_text expired1['name'] + assert_text "The collection with UUID #{expired1['uuid']} is in the trash" + + click_on "Click here to untrash '#{expired1['name']}'" # verify that the two un-trashed items are now shown in /collections page visit page_with_token('active', "/collections") @@ -49,6 +57,79 @@ class TrashTest < ActionDispatch::IntegrationTest assert_no_text expired2['uuid'] end + ["button","selection"].each do |method| + test "trashed projects using #{method}" do + deleted = api_fixture('groups')['trashed_project'] + aproject = api_fixture('groups')['aproject'] + + # verify that the un-trashed item are missing in /groups page + visit page_with_token('active', "/projects/zzzzz-tpzed-xurymjxw79nv3jz") + click_on "Subprojects" + assert_no_text deleted['name'] + + # visit trash page + visit page_with_token('active', "/trash") + click_on "Trashed projects" + + assert_text deleted['name'] + assert_text deleted['uuid'] + assert_no_text aproject['name'] + assert_no_text aproject['uuid'] + + # Un-trash item + if method == "button" + within('tr', text: deleted['uuid']) do + first('.fa-recycle').click + end + assert_text "The group with UUID #{deleted['uuid']} is in the trash" + click_on "Click here to untrash '#{deleted['name']}'" + else + within('tr', text: deleted['uuid']) do + first('input').click + end + click_button 'Selection...' + within('.selection-action-container') do + click_link 'Un-trash selected items' + end + wait_for_ajax + assert_no_text deleted['uuid'] + end + + # check that the un-trashed item are now shown on parent project page + visit page_with_token('active', "/projects/zzzzz-tpzed-xurymjxw79nv3jz") + click_on "Subprojects" + assert_text deleted['name'] + assert_text aproject['name'] + + # Trash another item + if method == "button" + within('tr', text: aproject['name']) do + first('.fa-trash-o').click + end + else + within('tr', text: aproject['name']) do + first('input').click + end + click_button 'Selection' + within('.selection-action-container') do + click_link 'Remove selected' + end + end + + wait_for_ajax + assert_no_text aproject['name'] + visit current_path + assert_no_text aproject['name'] + + # visit trash page + visit page_with_token('active', "/trash") + click_on "Trashed projects" + + assert_text aproject['name'] + assert_text aproject['uuid'] + end + end + test "trash page with search" do deleted = api_fixture('collections')['deleted_on_next_sweep'] expired = api_fixture('collections')['unique_expired_collection'] @@ -56,12 +137,21 @@ class TrashTest < ActionDispatch::IntegrationTest visit page_with_token('active', "/trash") assert_text deleted['name'] + assert_text deleted['uuid'] + assert_text deleted['portable_data_hash'] assert_text expired['name'] page.find_field('Search trash').set 'expired' - assert_text expired['name'] assert_no_text deleted['name'] + assert_text expired['name'] + + page.find_field('Search trash').set deleted['portable_data_hash'][0..9] + + assert_no_text expired['name'] + assert_text deleted['name'] + assert_text deleted['uuid'] + assert_text deleted['portable_data_hash'] click_button 'Selection...' within('.selection-action-container') do