2939: Added a status page for jobs that is similar to the pipeline instance
[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   setup do
7     Capybara.current_driver = Capybara.javascript_driver
8   end
9
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').
14       click
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
21       wait_for_ajax
22     end
23     visit current_path
24     assert(find?('.panel', text: 'I just edited this.'),
25            "Description update did not survive page refresh")
26   end
27
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
39       wait_for_ajax
40       find('.editable', text: 'Now I have a new name.')
41     end
42     visit current_path
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.'
46     end
47   end
48
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
52
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
57     end
58     wait_for_ajax
59
60     visit '/folders'
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
66     end
67     wait_for_ajax
68
69     find('input[value="Move to..."]').click
70     find('.selectable', text: 'Folder 1234').click
71     find('a,button', text: 'Move').click
72     wait_for_ajax
73
74     # Wait for the page to refresh and show the new parent folder in
75     # the Permissions panel:
76     find('.panel', text: 'Folder 1234')
77
78     assert(find('.panel', text: 'Permissions inherited from').
79            all('*', text: 'Folder 1234').any?,
80            "Folder 5678 should now be inside folder 1234")
81   end
82
83 end