X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6c40c1c5b000b2eb0967df0f7ebaf613393501bc..e951503aca74be84ea501d4316e38a662210b247:/apps/workbench/test/integration/trash_test.rb?ds=sidebyside diff --git a/apps/workbench/test/integration/trash_test.rb b/apps/workbench/test/integration/trash_test.rb index 6cac1beb2c..3e7d897d0a 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,9 +18,11 @@ 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_text expired2['name'] - assert_no_text 'foo_file' + assert_no_text expired2['name'] # not readable by this user + assert_no_text 'foo_file' # not trash # Un-trash one item using selection dropdown within('tr', text: deleted['name']) do @@ -33,21 +39,13 @@ class TrashTest < ActionDispatch::IntegrationTest assert_text expired1['name'] # this should still be there assert_no_text deleted['name'] # this should no longer be here - # expired2 is not editable by me; checkbox and recycle button shouldn't be offered - within('tr', text: expired2['name']) do - assert_nil first('input') - assert_nil first('.fa-recycle') - end - # Un-trash another item using the recycle button within('tr', text: expired1['name']) do first('.fa-recycle').click - accept_alert end wait_for_ajax - assert_text expired2['name'] assert_no_text expired1['name'] # verify that the two un-trashed items are now shown in /collections page @@ -57,19 +55,56 @@ class TrashTest < ActionDispatch::IntegrationTest assert_no_text expired2['uuid'] end + test "trashed projects" do + deleted = api_fixture('groups')['trashed_project'] + + # verify that the un-trashed item are missing in /groups page + visit page_with_token('active', "/groups") + assert_no_text deleted['uuid'] + + # visit trash page + visit page_with_token('active', "/trash") + click_on "Trashed projects" + + assert_text deleted['name'] + assert_text deleted['uuid'] + + # Un-trash item using the recycle button + within('tr', text: deleted['name']) do + first('.fa-recycle').click + end + + wait_for_ajax + + assert_no_text deleted['uuid'] + + # verify that the un-trashed item are now shown in /groups page + visit page_with_token('active', "/groups") + assert_text deleted['uuid'] + end + test "trash page with search" do deleted = api_fixture('collections')['deleted_on_next_sweep'] - expired = api_fixture('collections')['unique_expired_collection2'] + expired = api_fixture('collections')['unique_expired_collection'] 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