1 require 'integration_helper'
2 require 'selenium-webdriver'
5 class FoldersTest < ActionDispatch::IntegrationTest
7 Capybara.current_driver = Capybara.javascript_driver
10 test 'Find a folder and edit its description' do
11 visit page_with_token 'active', '/'
12 find('nav a', text: 'Folders').click
13 find('.arv-folder-list a,button', text: 'A Folder').
15 within('.panel', text: api_fixture('groups')['afolder']['name']) do
16 find('span', text: api_fixture('groups')['afolder']['name']).click
17 find('.glyphicon-ok').click
18 find('.btn', text: 'Edit description').click
19 find('.editable-input textarea').set('I just edited this.')
20 find('.editable-submit').click
24 assert(find?('.panel', text: 'I just edited this.'),
25 "Description update did not survive page refresh")
28 test 'Add a new name, then edit it, without creating a duplicate' do
29 folder_uuid = api_fixture('groups')['afolder']['uuid']
30 specimen_uuid = api_fixture('specimens')['owned_by_afolder_with_no_name_link']['uuid']
31 visit page_with_token 'active', '/folders/' + folder_uuid
32 within('.panel tr', text: specimen_uuid) do
33 find(".editable[data-name='name']").click
34 find('.editable-input input').set('Now I have a name.')
35 find('.glyphicon-ok').click
36 find('.editable', text: 'Now I have a name.').click
37 find('.editable-input input').set('Now I have a new name.')
38 find('.glyphicon-ok').click
40 find('.editable', text: 'Now I have a new name.')
43 within '.panel', text: 'Contents' do
44 find '.editable', text: 'Now I have a new name.'
45 page.assert_no_selector '.editable', text: 'Now I have a name.'
49 test 'Create a folder and move it into a different folder' do
50 visit page_with_token 'active', '/folders'
51 find('input[value="Add a new folder"]').click
53 within('.panel', text: 'New folder') do
54 find('.panel-title span', text: 'New folder').click
55 find('.editable-input input').set('Folder 1234')
56 find('.glyphicon-ok').click
61 find('input[value="Add a new folder"]').click
62 within('.panel', text: 'New folder') do
63 find('.panel-title span', text: 'New folder').click
64 find('.editable-input input').set('Folder 5678')
65 find('.glyphicon-ok').click
69 find('input[value="Move to..."]').click
70 find('.selectable', text: 'Folder 1234').click
71 find('a,button', text: 'Move').click
74 # Wait for the page to refresh and show the new parent folder in
75 # the Permissions panel:
76 find('.panel', text: 'Folder 1234')
78 assert(find('.panel', text: 'Permissions inherited from').
79 all('*', text: 'Folder 1234').any?,
80 "Folder 5678 should now be inside folder 1234")