84a4af8c96c5ce66f3a4421500755c81b710b7d0
[arvados.git] / apps / workbench / test / integration / pipeline_instances_test.rb
1 require 'integration_helper'
2 require 'selenium-webdriver'
3 require 'headless'
4
5 class PipelineInstancesTest < ActionDispatch::IntegrationTest
6   setup do
7     # Selecting collections requiresLocalStorage
8     headless = Headless.new
9     headless.start
10     Capybara.current_driver = :selenium
11   end
12
13   test 'Create and run a pipeline' do
14     visit page_with_token('active_trustedclient')
15
16     visit '/pipeline_templates'
17     within('tr', text: 'Two Part Pipeline Template') do
18       find('a,button', text: 'Run').click
19     end
20
21     instance_page = current_path
22
23     find('button', text: 'Choose a folder...').click
24     within('.modal-dialog') do
25       find('.selectable', text: 'A Folder').click
26       find('button', text: 'Move').click
27     end
28
29     # Go over to the collections page and select something
30     visit '/collections'
31     within('tr', text: 'GNU_General_Public_License') do
32       find('input[type=checkbox]').click
33     end
34     find('#persistent-selection-count').click
35
36     # Add this collection to the folder
37     visit '/folders'
38     find('.arv-folder-list a,button', text: 'A Folder').click
39     find('.btn', text: 'Add data').click
40     find('span', text: 'foo_tag').click
41     within('.modal-dialog') do
42       find('.btn', text: 'Add').click
43     end
44    
45     find('tr[data-kind="arvados#pipelineInstance"]', text: 'New pipeline instance').
46       find('a', text: 'Show').
47       click
48
49     assert find('p', text: 'Provide a value')
50
51     find('div.form-group', text: 'Foo/bar pair').
52       find('.btn', text: 'Choose').
53       click
54
55     within('.modal-dialog') do
56       find('span', text: 'foo_tag').click
57       find('button', text: 'OK').click
58     end
59
60     wait_for_ajax
61
62     # "Run" button is now enabled
63     page.assert_no_selector 'a.disabled,button.disabled', text: 'Run'
64
65     first('a,button', text: 'Run').click
66
67     # Pipeline is running. We have a "Stop" button instead now.
68     page.assert_selector 'a,button', text: 'Stop'
69     find('a,button', text: 'Stop').click
70
71     # Pipeline is stopped. It should now be in paused state.
72     assert page.has_text? 'Paused'
73     page.assert_selector 'a,button', text: 'Clone and edit'
74
75     # Go over to the graph tab
76 #    click_link 'Advanced'
77 #    click_link 'Graph'
78 #    assert page.has_css? 'div#provenance_graph'
79   end
80 end