1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 require 'integration_helper'
7 class TrashTest < ActionDispatch::IntegrationTest
13 deleted = api_fixture('collections')['deleted_on_next_sweep']
14 expired1 = api_fixture('collections')['unique_expired_collection']
15 expired2 = api_fixture('collections')['unique_expired_collection2']
18 visit page_with_token('active', "/trash")
20 assert_text deleted['name']
21 assert_text deleted['uuid']
22 assert_text deleted['portable_data_hash']
23 assert_text expired1['name']
24 assert_no_text expired2['name'] # not readable by this user
25 assert_no_text 'foo_file' # not trash
27 # Un-trash one item using selection dropdown
28 within('tr', text: deleted['name']) do
32 click_button 'Selection...'
33 within('.selection-action-container') do
34 click_link 'Un-trash selected items'
39 assert_text expired1['name'] # this should still be there
40 assert_no_text deleted['name'] # this should no longer be here
42 # Un-trash another item using the recycle button
43 within('tr', text: expired1['name']) do
44 first('.fa-recycle').click
49 assert_no_text expired1['name']
51 # verify that the two un-trashed items are now shown in /collections page
52 visit page_with_token('active', "/collections")
53 assert_text deleted['uuid']
54 assert_text expired1['uuid']
55 assert_no_text expired2['uuid']
58 test "trash page with search" do
59 deleted = api_fixture('collections')['deleted_on_next_sweep']
60 expired = api_fixture('collections')['unique_expired_collection']
62 visit page_with_token('active', "/trash")
64 assert_text deleted['name']
65 assert_text deleted['uuid']
66 assert_text deleted['portable_data_hash']
67 assert_text expired['name']
69 page.find_field('Search trash').set 'expired'
71 assert_no_text deleted['name']
72 assert_text expired['name']
74 page.find_field('Search trash').set deleted['portable_data_hash'][0..9]
76 assert_no_text expired['name']
77 assert_text deleted['name']
78 assert_text deleted['uuid']
79 assert_text deleted['portable_data_hash']
81 click_button 'Selection...'
82 within('.selection-action-container') do
83 assert_selector 'li.disabled', text: 'Un-trash selected items'
88 click_button 'Selection...'
89 within('.selection-action-container') do
90 assert_selector 'li', text: 'Un-trash selected items'
91 assert_selector 'li.disabled', text: 'Un-trash selected items'