reset_api_fixtures :after_suite, true
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
def verify_homepage user, invited, has_profile
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|
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'
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')
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')
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
class ErrorsTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
BAD_UUID = "ffffffffffffffffffffffffffffffff+0"
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
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"
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)
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
class LoginsTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
test "login with api_token works after redirect" do
class PipelineInstancesTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
test 'Create and run a pipeline' do
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"
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
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
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
class SearchBoxTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
# test the search box
class SmokeTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
def assert_visit_success(allowed=[200])
class UserAgreementsTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
def continuebutton_selector
class UserManageAccountTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
end
# test manage_account page
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
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
end
test "create a new user" do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
visit page_with_token('admin_trustedclient')
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
end
test "unsetup active user" do
- Capybara.current_driver = Capybara.javascript_driver
+ need_javascript
visit page_with_token('admin_trustedclient')
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'
class WebsocketTest < ActionDispatch::IntegrationTest
setup do
- Capybara.current_driver = :selenium
+ need_selenium "to make websockets work"
end
test "test page" do
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