2761: diagnostics testing
authorradhika <radhika@curoverse.com>
Tue, 9 Sep 2014 17:23:49 +0000 (13:23 -0400)
committerradhika <radhika@curoverse.com>
Tue, 9 Sep 2014 17:23:49 +0000 (13:23 -0400)
apps/workbench/config/diagnostics.yml [new file with mode: 0644]
apps/workbench/config/diagnostics.yml.example [new file with mode: 0644]
apps/workbench/config/load_config.rb
apps/workbench/test/diagnostics/pipeline_test.rb [new file with mode: 0644]
apps/workbench/test/test_helper.rb

diff --git a/apps/workbench/config/diagnostics.yml b/apps/workbench/config/diagnostics.yml
new file mode 100644 (file)
index 0000000..b3f9b48
--- /dev/null
@@ -0,0 +1,14 @@
+# Do not use this file for diagnostics testing configuration.
+# Instead, create diagnostics.yml by making a copy
+
+development:
+  diagnostics_testing_active_user_token: "eu33jurqntstmwo05h1jr3eblmi961e802703y6657s8zb14r"
+  diagnostics_testing_admin_user_token: false
+
+production:
+  diagnostics_testing_active_user_token: false
+  diagnostics_testing_admin_user_token: false
+
+common:
+  diagnostics_testing_active_user_token: false
+  diagnostics_testing_admin_user_token: false
diff --git a/apps/workbench/config/diagnostics.yml.example b/apps/workbench/config/diagnostics.yml.example
new file mode 100644 (file)
index 0000000..4093e42
--- /dev/null
@@ -0,0 +1,14 @@
+# Do not use this file for diagnostics testing configuration.
+# Instead, create diagnostics.yml by making a copy
+
+development:
+  diagnostics_testing_active_user_token: false
+  diagnostics_testing_admin_user_token: false
+
+production:
+  diagnostics_testing_active_user_token: false
+  diagnostics_testing_admin_user_token: false
+
+common:
+  diagnostics_testing_active_user_token: false
+  diagnostics_testing_admin_user_token: false
index 51fc81ab753d844ae020cda455220d1619a21cbd..f47c8a8a445407412df4ad02bdc0bae7eb88f43b 100644 (file)
@@ -3,7 +3,7 @@
 
 $application_config = {}
 
-%w(application.default application).each do |cfgfile|
+%w(application.default application diagnostics).each do |cfgfile|
   path = "#{::Rails.root.to_s}/config/#{cfgfile}.yml"
   if File.exists? path
     yaml = ERB.new(IO.read path).result(binding)
diff --git a/apps/workbench/test/diagnostics/pipeline_test.rb b/apps/workbench/test/diagnostics/pipeline_test.rb
new file mode 100644 (file)
index 0000000..431719e
--- /dev/null
@@ -0,0 +1,55 @@
+require 'integration_helper'
+require 'selenium-webdriver'
+require 'headless'
+
+class PipelineTest < ActionDispatch::IntegrationTest
+  setup do
+    headless = Headless.new
+    headless.start
+    Capybara.current_driver = :selenium
+  end
+
+  test 'Run tutorial pipeline' do
+    visit page_with_token(Rails.configuration.diagnostics_testing_active_user_token)
+
+    # Search for tutorial template
+    within('.navbar-fixed-top') do
+      page.find_field('search').set 'Diagnostic testing - Tutorial pipeline template'
+      page.find('.glyphicon-search').click
+    end
+
+    within '.modal-content' do
+      find('.selectable', text: 'Diagnostic testing - Tutorial pipeline template').click
+      click_button 'Show'
+    end
+
+    # Tun the pipeline
+    find('a,button', text: 'Run').click
+
+    # Choose project
+    within('.modal-dialog') do
+      find('.selectable', text: 'Home').click
+      find('button', text: 'Choose').click
+    end
+
+    # This pipeline needs input. So, Run should be disabled
+    page.assert_selector 'a.disabled,button.disabled', text: 'Run'
+
+    instance_page = current_path
+
+    # Choose input for the pipeline
+    find('.btn', text: 'Choose').click
+    within('.modal-dialog') do
+      find('.selectable', text: 'Diagnostic testing - Tutorial pipeline input').click
+      find('button', text: 'OK').click
+    end
+    wait_for_ajax
+
+    # Run this pipeline instance
+    find('a,button', text: 'Run').click
+
+    # Pipeline is running. We have a "Stop" button instead now.
+    page.assert_selector 'a,button', text: 'Stop'
+  end
+
+end
index 260bff043c8cfc10cfc08f3d272835c0be214d51..7f23988837b8ced4d4343b16dc3a1993e68c211e 100644 (file)
@@ -1,4 +1,5 @@
-ENV["RAILS_ENV"] = "test"
+ENV["RAILS_ENV"] = "test" if !ENV["RAILS_ENV"]
+
 unless ENV["NO_COVERAGE_TEST"]
   begin
     require 'simplecov'
@@ -151,4 +152,6 @@ class ApiServerForTests
   end
 end
 
-ApiServerForTests.run
+if ENV["RAILS_ENV"].eql? 'test'
+  ApiServerForTests.run
+end