Replace unfailable assert() with a comment explaining what it means
[arvados.git] / apps / workbench / test / integration / folders_test.rb
1 require 'integration_helper'
2 require 'selenium-webdriver'
3 require 'headless'
4
5 class FoldersTest < ActionDispatch::IntegrationTest
6
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').
12       click
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'
21     end
22     visit current_path
23     # Raise exception if description update did not survive page refresh:
24     find '.panel', text: 'I just edited this.'
25   end
26
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.')
40     end
41     visit current_path
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.'
45     end
46   end
47
48 end