From ae9c556899557f64acaa54b339a62c9f5c5966c9 Mon Sep 17 00:00:00 2001 From: radhika Date: Tue, 6 Dec 2016 13:57:04 -0500 Subject: [PATCH] 10241: add a diagnostics test to run a process using a workflow. --- apps/workbench/config/application.default.yml | 5 ++ .../diagnostics/container_request_test.rb | 49 +++++++++++++++++++ .../test/diagnostics/pipeline_test.rb | 45 +---------------- .../workbench/test/diagnostics_test_helper.rb | 43 ++++++++++++++++ 4 files changed, 98 insertions(+), 44 deletions(-) create mode 100644 apps/workbench/test/diagnostics/container_request_test.rb diff --git a/apps/workbench/config/application.default.yml b/apps/workbench/config/application.default.yml index e4e2782986..c2dcba8094 100644 --- a/apps/workbench/config/application.default.yml +++ b/apps/workbench/config/application.default.yml @@ -26,6 +26,11 @@ diagnostics: pipeline_2: template_uuid: zzzzz-p5p6p-1xbobfobk94ppbv input_paths: [zzzzz-4zz18-nz98douzhaa3jh2, zzzzz-4zz18-gpw9o5wpcti3nib] + container_requests_to_test: + container_request_1: + workflow_uuid: zzzzz-7fd4e-60e96shgwspt4mw + input_paths: [] + max_wait_seconds: 10 # Below is a sample setting for performance testing. # Configure workbench URL as "arvados_workbench_url" diff --git a/apps/workbench/test/diagnostics/container_request_test.rb b/apps/workbench/test/diagnostics/container_request_test.rb new file mode 100644 index 0000000000..257159afdd --- /dev/null +++ b/apps/workbench/test/diagnostics/container_request_test.rb @@ -0,0 +1,49 @@ +require 'diagnostics_test_helper' + +# This test assumes that the configured workflow_uuid corresponds to a cwl workflow. +# Ex: configure a workflow using the steps below and use the resulting workflow uuid: +# > cd arvados/doc/user/cwl/bwa-mem +# > arvados-cwl-runner --create-workflow bwa-mem.cwl bwa-mem-input.yml + +class ContainerRequestTest < DiagnosticsTest + crs_to_test = Rails.configuration.container_requests_to_test.andand.keys + + setup do + need_selenium 'to make websockets work' + end + + crs_to_test.andand.each do |cr_to_test| + test "run container_request: #{cr_to_test}" do + cr_config = Rails.configuration.container_requests_to_test[cr_to_test] + + visit_page_with_token 'active' + + find('.btn', text: 'Run a process').click + + within('.modal-dialog') do + page.find_field('Search').set cr_config['workflow_uuid'] + wait_for_ajax + find('.selectable', text: 'bwa-mem.cwl').click + find('.btn', text: 'Next: choose inputs').click + end + + page.assert_selector('a.disabled,button.disabled', text: 'Run') if cr_config['input_paths'].any? + + # Choose input for the workflow + cr_config['input_paths'].each do |look_for| + select_input look_for + end + wait_for_ajax + + # All needed input are already filled in. Run this workflow now + page.assert_no_selector('a.disabled,button.disabled', text: 'Run') + find('a,button', text: 'Run').click + + # container_request is running. Run button is no longer available. + page.assert_no_selector('a', text: 'Run') + + # Wait for container_request run to complete + wait_until_page_has 'completed', cr_config['max_wait_seconds'] + end + end +end diff --git a/apps/workbench/test/diagnostics/pipeline_test.rb b/apps/workbench/test/diagnostics/pipeline_test.rb index d038222cf0..11d0e42629 100644 --- a/apps/workbench/test/diagnostics/pipeline_test.rb +++ b/apps/workbench/test/diagnostics/pipeline_test.rb @@ -42,54 +42,11 @@ class PipelineTest < DiagnosticsTest find('a,button', text: 'Components').click find('a,button', text: 'Run').click - # Pipeline is running. We have a "Stop" button instead now. + # Pipeline is running. We have a "Pause" button instead now. page.assert_selector 'a,button', text: 'Pause' # Wait for pipeline run to complete wait_until_page_has 'completed', pipeline_config['max_wait_seconds'] end end - - def select_input look_for - inputs_needed = page.all('.btn', text: 'Choose') - return if (!inputs_needed || !inputs_needed.any?) - - look_for_uuid = nil - look_for_file = nil - if look_for.andand.index('/').andand.>0 - partitions = look_for.partition('/') - look_for_uuid = partitions[0] - look_for_file = partitions[2] - else - look_for_uuid = look_for - look_for_file = nil - end - - assert_triggers_dom_event 'shown.bs.modal' do - inputs_needed[0].click - end - - within('.modal-dialog') do - if look_for_uuid - fill_in('Search', with: look_for_uuid, exact: true) - wait_for_ajax - end - - page.all('.selectable').first.click - wait_for_ajax - # ajax reload is wiping out input selection after search results; so, select again. - page.all('.selectable').first.click - wait_for_ajax - - if look_for_file - wait_for_ajax - within('.collection_files_name', text: look_for_file) do - find('.fa-file').click - end - end - - find('button', text: 'OK').click - wait_for_ajax - end - end end diff --git a/apps/workbench/test/diagnostics_test_helper.rb b/apps/workbench/test/diagnostics_test_helper.rb index 3587721eda..46b961ae11 100644 --- a/apps/workbench/test/diagnostics_test_helper.rb +++ b/apps/workbench/test/diagnostics_test_helper.rb @@ -21,6 +21,49 @@ class DiagnosticsTest < ActionDispatch::IntegrationTest visit page_with_token(tokens[token_name], (workbench_url + path)) end + def select_input look_for + inputs_needed = page.all('.btn', text: 'Choose') + return if (!inputs_needed || !inputs_needed.any?) + + look_for_uuid = nil + look_for_file = nil + if look_for.andand.index('/').andand.>0 + partitions = look_for.partition('/') + look_for_uuid = partitions[0] + look_for_file = partitions[2] + else + look_for_uuid = look_for + look_for_file = nil + end + + assert_triggers_dom_event 'shown.bs.modal' do + inputs_needed[0].click + end + + within('.modal-dialog') do + if look_for_uuid + fill_in('Search', with: look_for_uuid, exact: true) + wait_for_ajax + end + + page.all('.selectable').first.click + wait_for_ajax + # ajax reload is wiping out input selection after search results; so, select again. + page.all('.selectable').first.click + wait_for_ajax + + if look_for_file + wait_for_ajax + within('.collection_files_name', text: look_for_file) do + find('.fa-file').click + end + end + + find('button', text: 'OK').click + wait_for_ajax + end + end + # Looks for the text_to_look_for for up to the max_time provided def wait_until_page_has text_to_look_for, max_time=30 max_time = 30 if (!max_time || (max_time.to_s != max_time.to_i.to_s)) -- 2.30.2