[ARVADOS] updated: d43df86ff9b59e73ca3251299303f098946cdc1b
git at public.curoverse.com
git at public.curoverse.com
Sun Jan 4 03:19:14 EST 2015
Summary of changes:
.../test/integration/application_layout_test.rb | 2 +-
.../test/integration/collection_upload_test.rb | 14 ++++----------
apps/workbench/test/integration/collections_test.rb | 2 +-
apps/workbench/test/integration/errors_test.rb | 2 +-
.../integration/filterable_infinite_scroll_test.rb | 2 +-
apps/workbench/test/integration/jobs_test.rb | 6 +++---
apps/workbench/test/integration/logins_test.rb | 2 +-
.../test/integration/pipeline_instances_test.rb | 2 +-
.../test/integration/pipeline_templates_test.rb | 4 ++--
apps/workbench/test/integration/projects_test.rb | 2 +-
apps/workbench/test/integration/report_issue_test.rb | 2 +-
apps/workbench/test/integration/search_box_test.rb | 2 +-
apps/workbench/test/integration/smoke_test.rb | 2 +-
.../test/integration/user_agreements_test.rb | 2 +-
.../test/integration/user_manage_account_test.rb | 2 +-
apps/workbench/test/integration/user_profile_test.rb | 2 +-
apps/workbench/test/integration/users_test.rb | 10 +++++-----
.../test/integration/virtual_machines_test.rb | 2 +-
apps/workbench/test/integration/websockets_test.rb | 2 +-
apps/workbench/test/integration_helper.rb | 20 ++++++++++++++++++++
20 files changed, 49 insertions(+), 35 deletions(-)
via d43df86ff9b59e73ca3251299303f098946cdc1b (commit)
from 90cfbd0a9326dcbb9b58c85cbabe4d32596cf665 (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 d43df86ff9b59e73ca3251299303f098946cdc1b
Author: Tom Clegg <tom at curoverse.com>
Date: Sun Jan 4 03:17:45 2015 -0500
3021: Clean up headless/selenium/javascript choices.
diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index 6949072..8a2906a 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -7,7 +7,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
reset_api_fixtures :after_suite, true
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
def verify_homepage user, invited, has_profile
diff --git a/apps/workbench/test/integration/collection_upload_test.rb b/apps/workbench/test/integration/collection_upload_test.rb
index c4dc184..a240576 100644
--- a/apps/workbench/test/integration/collection_upload_test.rb
+++ b/apps/workbench/test/integration/collection_upload_test.rb
@@ -2,10 +2,6 @@ require 'integration_helper'
class CollectionUploadTest < ActionDispatch::IntegrationTest
setup do
- Headless.new.start
- end
-
- setup do
testfiles.each do |filename, content|
open(testfile_path(filename), 'w') do |io|
io.write content
@@ -20,7 +16,7 @@ class CollectionUploadTest < ActionDispatch::IntegrationTest
end
test "Create new collection using upload button" do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
visit page_with_token 'active', aproject_path
find('.btn', text: 'Add data').click
click_link 'Upload files from my computer'
@@ -32,15 +28,14 @@ class CollectionUploadTest < ActionDispatch::IntegrationTest
end
test "No Upload tab on non-writable collection" do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
visit(page_with_token 'active',
'/collections/'+api_fixture('collections')['user_agreement']['uuid'])
assert_no_selector '.nav-tabs Upload'
end
test "Upload two empty files with the same name" do
- # Selenium is needed because poltergeist/phantomjs can't do file uploads.
- Capybara.current_driver = :selenium
+ need_selenium "to make file uploads work"
visit page_with_token 'active', sandbox_path
find('.nav-tabs a', text: 'Upload').click
attach_file 'file_selector', testfile_path('empty.txt')
@@ -54,8 +49,7 @@ class CollectionUploadTest < ActionDispatch::IntegrationTest
end
test "Upload non-empty files, report errors" do
- # Selenium is needed because poltergeist/phantomjs can't do file uploads.
- Capybara.current_driver = :selenium
+ need_selenium "to make file uploads work"
visit page_with_token 'active', sandbox_path
find('.nav-tabs a', text: 'Upload').click
attach_file 'file_selector', testfile_path('a')
diff --git a/apps/workbench/test/integration/collections_test.rb b/apps/workbench/test/integration/collections_test.rb
index 6999b1b..4338d19 100644
--- a/apps/workbench/test/integration/collections_test.rb
+++ b/apps/workbench/test/integration/collections_test.rb
@@ -2,7 +2,7 @@ require 'integration_helper'
class CollectionsTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
# check_checkboxes_state asserts that the page holds at least one
diff --git a/apps/workbench/test/integration/errors_test.rb b/apps/workbench/test/integration/errors_test.rb
index 19ed7dc..03c359e 100644
--- a/apps/workbench/test/integration/errors_test.rb
+++ b/apps/workbench/test/integration/errors_test.rb
@@ -2,7 +2,7 @@ require 'integration_helper'
class ErrorsTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
BAD_UUID = "ffffffffffffffffffffffffffffffff+0"
diff --git a/apps/workbench/test/integration/filterable_infinite_scroll_test.rb b/apps/workbench/test/integration/filterable_infinite_scroll_test.rb
index 90b73d5..b4dadcd 100644
--- a/apps/workbench/test/integration/filterable_infinite_scroll_test.rb
+++ b/apps/workbench/test/integration/filterable_infinite_scroll_test.rb
@@ -2,7 +2,7 @@ require 'integration_helper'
class FilterableInfiniteScrollTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
# Chrome remembers what you had in the text field when you hit
diff --git a/apps/workbench/test/integration/jobs_test.rb b/apps/workbench/test/integration/jobs_test.rb
index d1f5e78..716e731 100644
--- a/apps/workbench/test/integration/jobs_test.rb
+++ b/apps/workbench/test/integration/jobs_test.rb
@@ -14,7 +14,7 @@ class JobsTest < ActionDispatch::IntegrationTest
end
test "add job description" do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
visit page_with_token("active", "/jobs")
# go to job running the script "doesnotexist"
@@ -39,7 +39,7 @@ class JobsTest < ActionDispatch::IntegrationTest
end
test "view job log" do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
job = api_fixture('jobs')['job_with_real_log']
IO.expects(:popen).returns(fakepipe_with_log_data)
@@ -58,7 +58,7 @@ class JobsTest < ActionDispatch::IntegrationTest
end
test 'view partial job log' do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
# This config will be restored during teardown by ../test_helper.rb:
Rails.configuration.log_viewer_max_bytes = 100
diff --git a/apps/workbench/test/integration/logins_test.rb b/apps/workbench/test/integration/logins_test.rb
index 9d4e04b..2e2de70 100644
--- a/apps/workbench/test/integration/logins_test.rb
+++ b/apps/workbench/test/integration/logins_test.rb
@@ -2,7 +2,7 @@ require 'integration_helper'
class LoginsTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
test "login with api_token works after redirect" do
diff --git a/apps/workbench/test/integration/pipeline_instances_test.rb b/apps/workbench/test/integration/pipeline_instances_test.rb
index 313bde6..e16cf72 100644
--- a/apps/workbench/test/integration/pipeline_instances_test.rb
+++ b/apps/workbench/test/integration/pipeline_instances_test.rb
@@ -2,7 +2,7 @@ require 'integration_helper'
class PipelineInstancesTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
test 'Create and run a pipeline' do
diff --git a/apps/workbench/test/integration/pipeline_templates_test.rb b/apps/workbench/test/integration/pipeline_templates_test.rb
index b909ac0..19a5109 100644
--- a/apps/workbench/test/integration/pipeline_templates_test.rb
+++ b/apps/workbench/test/integration/pipeline_templates_test.rb
@@ -2,7 +2,7 @@ require 'integration_helper'
class PipelineTemplatesTest < ActionDispatch::IntegrationTest
test "JSON popup available for strange components" do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
uuid = api_fixture("pipeline_templates")["components_is_jobspec"]["uuid"]
visit page_with_token("active", "/pipeline_templates/#{uuid}")
click_on "Components"
@@ -14,7 +14,7 @@ class PipelineTemplatesTest < ActionDispatch::IntegrationTest
end
test "pipeline template description" do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
visit page_with_token("active", "/pipeline_templates")
# go to Two Part pipeline template
diff --git a/apps/workbench/test/integration/projects_test.rb b/apps/workbench/test/integration/projects_test.rb
index 04f99c4..45fa392 100644
--- a/apps/workbench/test/integration/projects_test.rb
+++ b/apps/workbench/test/integration/projects_test.rb
@@ -2,7 +2,7 @@ require 'integration_helper'
class ProjectsTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
test 'Check collection count for A Project in the tab pane titles' do
diff --git a/apps/workbench/test/integration/report_issue_test.rb b/apps/workbench/test/integration/report_issue_test.rb
index 7d050f4..7d4058d 100644
--- a/apps/workbench/test/integration/report_issue_test.rb
+++ b/apps/workbench/test/integration/report_issue_test.rb
@@ -2,7 +2,7 @@ require 'integration_helper'
class ReportIssueTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
@user_profile_form_fields = Rails.configuration.user_profile_form_fields
end
diff --git a/apps/workbench/test/integration/search_box_test.rb b/apps/workbench/test/integration/search_box_test.rb
index 958baf7..05c7f25 100644
--- a/apps/workbench/test/integration/search_box_test.rb
+++ b/apps/workbench/test/integration/search_box_test.rb
@@ -2,7 +2,7 @@ require 'integration_helper'
class SearchBoxTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
# test the search box
diff --git a/apps/workbench/test/integration/smoke_test.rb b/apps/workbench/test/integration/smoke_test.rb
index 1e33370..a626e24 100644
--- a/apps/workbench/test/integration/smoke_test.rb
+++ b/apps/workbench/test/integration/smoke_test.rb
@@ -3,7 +3,7 @@ require 'uri'
class SmokeTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
def assert_visit_success(allowed=[200])
diff --git a/apps/workbench/test/integration/user_agreements_test.rb b/apps/workbench/test/integration/user_agreements_test.rb
index dbd3950..16b3208 100644
--- a/apps/workbench/test/integration/user_agreements_test.rb
+++ b/apps/workbench/test/integration/user_agreements_test.rb
@@ -3,7 +3,7 @@ require 'integration_helper'
class UserAgreementsTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
def continuebutton_selector
diff --git a/apps/workbench/test/integration/user_manage_account_test.rb b/apps/workbench/test/integration/user_manage_account_test.rb
index 664bf99..fae7e62 100644
--- a/apps/workbench/test/integration/user_manage_account_test.rb
+++ b/apps/workbench/test/integration/user_manage_account_test.rb
@@ -2,7 +2,7 @@ require 'integration_helper'
class UserManageAccountTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
# test manage_account page
diff --git a/apps/workbench/test/integration/user_profile_test.rb b/apps/workbench/test/integration/user_profile_test.rb
index 1caa571..cbd591a 100644
--- a/apps/workbench/test/integration/user_profile_test.rb
+++ b/apps/workbench/test/integration/user_profile_test.rb
@@ -2,7 +2,7 @@ require 'integration_helper'
class UserProfileTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
@user_profile_form_fields = Rails.configuration.user_profile_form_fields
end
diff --git a/apps/workbench/test/integration/users_test.rb b/apps/workbench/test/integration/users_test.rb
index 5975395..4a45a6a 100644
--- a/apps/workbench/test/integration/users_test.rb
+++ b/apps/workbench/test/integration/users_test.rb
@@ -3,14 +3,14 @@ require 'integration_helper'
class UsersTest < ActionDispatch::IntegrationTest
test "login as active user but not admin" do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
visit page_with_token('active_trustedclient')
assert page.has_no_link? 'Users' 'Found Users link for non-admin user'
end
test "login as admin user and verify active user data" do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
visit page_with_token('admin_trustedclient')
# go to Users list page
@@ -42,7 +42,7 @@ class UsersTest < ActionDispatch::IntegrationTest
end
test "create a new user" do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
visit page_with_token('admin_trustedclient')
@@ -86,7 +86,7 @@ class UsersTest < ActionDispatch::IntegrationTest
end
test "setup the active user" do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
visit page_with_token('admin_trustedclient')
find('#system-menu').click
@@ -138,7 +138,7 @@ class UsersTest < ActionDispatch::IntegrationTest
end
test "unsetup active user" do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
visit page_with_token('admin_trustedclient')
diff --git a/apps/workbench/test/integration/virtual_machines_test.rb b/apps/workbench/test/integration/virtual_machines_test.rb
index 28763da..1d398a5 100644
--- a/apps/workbench/test/integration/virtual_machines_test.rb
+++ b/apps/workbench/test/integration/virtual_machines_test.rb
@@ -2,7 +2,7 @@ require 'integration_helper'
class VirtualMachinesTest < ActionDispatch::IntegrationTest
test "make and name a new virtual machine" do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
visit page_with_token('admin_trustedclient')
find('#system-menu').click
click_link 'Virtual machines'
diff --git a/apps/workbench/test/integration/websockets_test.rb b/apps/workbench/test/integration/websockets_test.rb
index 6eb4d45..efc2539 100644
--- a/apps/workbench/test/integration/websockets_test.rb
+++ b/apps/workbench/test/integration/websockets_test.rb
@@ -2,7 +2,7 @@ require 'integration_helper'
class WebsocketTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = :selenium
+ need_selenium "to make websockets work"
end
test "test page" do
diff --git a/apps/workbench/test/integration_helper.rb b/apps/workbench/test/integration_helper.rb
index 01e3ff8..e0b82e5 100644
--- a/apps/workbench/test/integration_helper.rb
+++ b/apps/workbench/test/integration_helper.rb
@@ -81,4 +81,24 @@ 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