[ARVADOS] updated: 7b5c84ead3ac279088a02ae07f3354d5bba9c9aa
git at public.curoverse.com
git at public.curoverse.com
Tue Jan 6 01:51:28 EST 2015
Summary of changes:
apps/workbench/test/diagnostics/pipeline_test.rb | 6 +--
apps/workbench/test/integration_helper.rb | 61 ++++++++++++++++--------
apps/workbench/test/performance/browsing_test.rb | 5 +-
3 files changed, 43 insertions(+), 29 deletions(-)
via 7b5c84ead3ac279088a02ae07f3354d5bba9c9aa (commit)
via 412fdae03f818a3190f20fd08a6836355ee5f220 (commit)
from d43df86ff9b59e73ca3251299303f098946cdc1b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 7b5c84ead3ac279088a02ae07f3354d5bba9c9aa
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Jan 6 01:02:06 2015 -0500
3021: Use headless helper in performance and diagnostics tests, too.
diff --git a/apps/workbench/test/diagnostics/pipeline_test.rb b/apps/workbench/test/diagnostics/pipeline_test.rb
index fbc144a..3a4ad64 100644
--- a/apps/workbench/test/diagnostics/pipeline_test.rb
+++ b/apps/workbench/test/diagnostics/pipeline_test.rb
@@ -1,14 +1,10 @@
require 'diagnostics_test_helper'
-require 'selenium-webdriver'
-require 'headless'
class PipelineTest < DiagnosticsTest
pipelines_to_test = Rails.configuration.pipelines_to_test.andand.keys
setup do
- headless = Headless.new
- headless.start
- Capybara.current_driver = :selenium
+ need_javascript
end
pipelines_to_test.andand.each do |pipeline_to_test|
diff --git a/apps/workbench/test/performance/browsing_test.rb b/apps/workbench/test/performance/browsing_test.rb
index ec299e2..f15e3ea 100644
--- a/apps/workbench/test/performance/browsing_test.rb
+++ b/apps/workbench/test/performance/browsing_test.rb
@@ -13,10 +13,7 @@ class BrowsingTest < WorkbenchPerformanceTest
:formats => [:flat] }
setup do
- headless = Headless.new
- headless.start
- Capybara.current_driver = :selenium
- Capybara.current_session.driver.browser.manage.window.resize_to(1024, 768)
+ need_javascript
end
test "home page" do
commit 412fdae03f818a3190f20fd08a6836355ee5f220
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Jan 6 00:59:02 2015 -0500
3021: 4399: Refactor headless stuff into a module. Clear up new/start/stop use.
* Create one Headless per test process, when encountering the first
test case that needs one.
* Call headless.start & stop exactly once for each test case that uses
it.
diff --git a/apps/workbench/test/integration_helper.rb b/apps/workbench/test/integration_helper.rb
index e0b82e5..4c1d505 100644
--- a/apps/workbench/test/integration_helper.rb
+++ b/apps/workbench/test/integration_helper.rb
@@ -27,11 +27,52 @@ module WaitForAjax
end
end
+module HeadlessHelper
+ class HeadlessSingleton
+ def self.get
+ @headless ||= Headless.new reuse: false
+ end
+ end
+
+ Capybara.default_driver = :rack_test
+
+ def self.included base
+ base.class_eval do
+ setup do
+ Capybara.use_default_driver
+ @headless = false
+ end
+
+ teardown do
+ if @headless
+ @headless.stop
+ @headless = false
+ end
+ end
+ end
+ end
+
+ def need_selenium reason=nil
+ Capybara.current_driver = :selenium
+ unless ENV['ARVADOS_TEST_HEADFUL'] or @headless
+ @headless = HeadlessSingleton.get
+ @headless.start
+ end
+ end
+
+ def need_javascript reason=nil
+ unless Capybara.current_driver == :selenium
+ Capybara.current_driver = :poltergeist
+ end
+ end
+end
+
class ActionDispatch::IntegrationTest
# Make the Capybara DSL available in all integration tests
include Capybara::DSL
include ApiFixtureLoader
include WaitForAjax
+ include HeadlessHelper
@@API_AUTHS = self.api_fixture('api_client_authorizations')
@@ -81,24 +122,4 @@ class ActionDispatch::IntegrationTest
end
Capybara.reset_sessions!
end
-
- Capybara.default_driver = :rack_test
-
- setup do
- Capybara.use_default_driver
- end
-
- def need_selenium reason=nil
- Capybara.current_driver = :selenium
- unless ENV['ARVADOS_TEST_HEADFUL'] or @headless
- @headless = Headless.new(display: 101, reuse: true)
- @headless.start
- end
- end
-
- def need_javascript reason=nil
- unless Capybara.current_driver == :selenium
- Capybara.current_driver = :poltergeist
- end
- end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list