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('.arv-folder-list a,button', text: 'A Folder').
14 within('.container-fluid', text: api_fixture('groups')['afolder']['name']) do
15 find('span', text: api_fixture('groups')['afolder']['name']).click
16 within('.arv-description-as-subtitle') do
17 find('.fa-pencil').click
18 find('.editable-input textarea').set('I just edited this.')
19 find('.editable-submit').click
24 assert(find?('.container-fluid', 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(".selection-action-container") do
33 within (first('tr', text: 'Specimen')) do
34 find(".fa-pencil").click
35 find('.editable-input input').set('Now I have a name.')
36 find('.glyphicon-ok').click
37 find('.editable', text: 'Now I have a name.').click
38 find(".fa-pencil").click
39 find('.editable-input input').set('Now I have a new name.')
40 find('.glyphicon-ok').click
43 find('.editable', text: 'Now I have a new name.')
46 within '.selection-action-container' do
47 find '.editable', text: 'Now I have a new name.'
48 page.assert_no_selector '.editable', text: 'Now I have a name.'
52 test 'Create a folder and move it into a different folder' do
53 visit page_with_token 'active', '/folders'
54 find('.btn', text: "Add new folder").click
56 # within('.editable', text: 'New folder') do
58 find('.fa-pencil').click
59 find('.editable-input input').set('Folder 1234')
60 find('.glyphicon-ok').click
65 find('.btn', text: "Add new folder").click
67 find('.fa-pencil').click
68 find('.editable-input input').set('Folder 5678')
69 find('.glyphicon-ok').click
73 click_link 'Permissions'
74 find('input[value="Move to..."]').click
75 find('.selectable', text: 'Folder 1234').click
76 find('a,button', text: 'Move').click
79 # Wait for the page to refresh and show the new parent in Permissions panel
80 click_link 'Permissions'
81 find('.panel', text: 'Folder 1234')
83 assert(find('.panel', text: 'Permissions for this folder are inherited by the owner or parent folder').
84 all('*', text: 'Folder 1234').any?,
85 "Folder 5678 should now be inside folder 1234")