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 expired1['name']
22 assert_no_text expired2['name'] # not readable by this user
23 assert_no_text 'foo_file' # not trash
25 # Un-trash one item using selection dropdown
26 within('tr', text: deleted['name']) do
30 click_button 'Selection...'
31 within('.selection-action-container') do
32 click_link 'Un-trash selected items'
37 assert_text expired1['name'] # this should still be there
38 assert_no_text deleted['name'] # this should no longer be here
40 # Un-trash another item using the recycle button
41 within('tr', text: expired1['name']) do
42 first('.fa-recycle').click
47 assert_no_text expired1['name']
49 # verify that the two un-trashed items are now shown in /collections page
50 visit page_with_token('active', "/collections")
51 assert_text deleted['uuid']
52 assert_text expired1['uuid']
53 assert_no_text expired2['uuid']
56 test "trash page with search" do
57 deleted = api_fixture('collections')['deleted_on_next_sweep']
58 expired = api_fixture('collections')['unique_expired_collection']
60 visit page_with_token('active', "/trash")
62 assert_text deleted['name']
63 assert_text expired['name']
65 page.find_field('Search trash').set 'expired'
67 assert_text expired['name']
68 assert_no_text deleted['name']
70 click_button 'Selection...'
71 within('.selection-action-container') do
72 assert_selector 'li.disabled', text: 'Un-trash selected items'
77 click_button 'Selection...'
78 within('.selection-action-container') do
79 assert_selector 'li', text: 'Un-trash selected items'
80 assert_selector 'li.disabled', text: 'Un-trash selected items'