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
22 assert(find?('.panel', text: 'I just edited this.'),
23 "Description update did not survive page refresh")
26 test 'Add a new name, then edit it, without creating a duplicate' do
27 Capybara.current_driver = Capybara.javascript_driver
28 folder_uuid = api_fixture('groups')['afolder']['uuid']
29 specimen_uuid = api_fixture('specimens')['owned_by_afolder_with_no_name_link']['uuid']
30 visit page_with_token 'active', '/folders/' + folder_uuid
31 within('.panel tr', text: specimen_uuid) do
32 find(".editable[data-name='name']").click
33 find('.editable-input input').set('Now I have a name.')
34 find('.glyphicon-ok').click
35 find('.editable', text: 'Now I have a name.').click
36 find('.editable-input input').set('Now I have a new name.')
37 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.'