2761: diagnostics testing
[arvados.git] / apps / workbench / test / diagnostics / pipeline_test.rb
1 require 'integration_helper'
2 require 'selenium-webdriver'
3 require 'headless'
4
5 class PipelineTest < ActionDispatch::IntegrationTest
6   setup do
7     headless = Headless.new
8     headless.start
9     Capybara.current_driver = :selenium
10   end
11
12   test 'Run tutorial pipeline' do
13     visit page_with_token(Rails.configuration.diagnostics_testing_active_user_token)
14
15     # Search for tutorial template
16     within('.navbar-fixed-top') do
17       page.find_field('search').set 'Diagnostic testing - Tutorial pipeline template'
18       page.find('.glyphicon-search').click
19     end
20
21     within '.modal-content' do
22       find('.selectable', text: 'Diagnostic testing - Tutorial pipeline template').click
23       click_button 'Show'
24     end
25
26     # Tun the pipeline
27     find('a,button', text: 'Run').click
28
29     # Choose project
30     within('.modal-dialog') do
31       find('.selectable', text: 'Home').click
32       find('button', text: 'Choose').click
33     end
34
35     # This pipeline needs input. So, Run should be disabled
36     page.assert_selector 'a.disabled,button.disabled', text: 'Run'
37
38     instance_page = current_path
39
40     # Choose input for the pipeline
41     find('.btn', text: 'Choose').click
42     within('.modal-dialog') do
43       find('.selectable', text: 'Diagnostic testing - Tutorial pipeline input').click
44       find('button', text: 'OK').click
45     end
46     wait_for_ajax
47
48     # Run this pipeline instance
49     find('a,button', text: 'Run').click
50
51     # Pipeline is running. We have a "Stop" button instead now.
52     page.assert_selector 'a,button', text: 'Stop'
53   end
54
55 end