1 require 'integration_helper'
2 require 'selenium-webdriver'
5 class FoldersTest < ActionDispatch::IntegrationTest
7 test 'Find a folder and edit its description' do
8 Capybara.current_driver = Capybara.javascript_driver
9 visit page_with_token 'active', '/'
10 find('nav a', text: 'Folders').click
11 find('.side-nav a,button', text: 'A Folder').
13 within('.panel', text: api_fixture('groups')['afolder']['name']) do
14 find('span', text: api_fixture('groups')['afolder']['name']).click
15 find('.glyphicon-ok').click
16 find('.btn', text: 'Edit description').click
17 find('.editable-input textarea').set('I just edited this.')
18 find('.editable-submit').click
19 # Wait for editable popup to go away
20 page.assert_no_selector '.editable-submit'
23 # Raise exception if description update did not survive page refresh:
24 find '.panel', text: 'I just edited this.'
27 test 'Add a new name, then edit it, without creating a duplicate' do
28 Capybara.current_driver = Capybara.javascript_driver
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
39 find('.editable', text: 'Now I have a new name.')
42 within '.panel', text: 'Contents' do
43 find '.editable', text: 'Now I have a new name.'
44 page.assert_no_selector '.editable', text: 'Now I have a name.'