X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7b5729d984a9c516920270250f050bf72f1896d1..0f119f7707d93e90842fce3890deffc59c5e7081:/apps/workbench/test/integration/collection_upload_test.rb diff --git a/apps/workbench/test/integration/collection_upload_test.rb b/apps/workbench/test/integration/collection_upload_test.rb index 9a2637365c..6960d3bc89 100644 --- a/apps/workbench/test/integration/collection_upload_test.rb +++ b/apps/workbench/test/integration/collection_upload_test.rb @@ -1,10 +1,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| @@ -20,26 +16,27 @@ class CollectionUploadTest < ActionDispatch::IntegrationTest end test "Create new collection using upload button" do - Capybara.current_driver = :poltergeist + need_javascript visit page_with_token 'active', aproject_path find('.btn', text: 'Add data').click click_link 'Upload files from my computer' # Should be looking at a new empty collection. assert_text 'New collection' - assert_text 'd41d8cd98f00b204e9800998ecf8427e+0' + assert_text ' 0 files' + assert_text ' 0 bytes' # The "Upload" tab should be active and loaded. assert_selector 'div#Upload.active div.panel' end test "No Upload tab on non-writable collection" do - Capybara.current_driver = :poltergeist + 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 - 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') @@ -53,14 +50,14 @@ class CollectionUploadTest < ActionDispatch::IntegrationTest end test "Upload non-empty files, report errors" do - 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') attach_file 'file_selector', testfile_path('foo.txt') assert_selector 'button:not([disabled])', text: 'Start' click_button 'Start' - if "test environment does not have a keepproxy yet, see #4534" + if "test environment does not have a keepproxy yet, see #4534" != "fixed" using_wait_time 20 do assert_text :visible, 'error' end @@ -71,6 +68,43 @@ class CollectionUploadTest < ActionDispatch::IntegrationTest end end + test "Report mixed-content error" do + skip 'Test suite does not use TLS' + need_selenium "to make file uploads work" + begin + use_token :admin + proxy = KeepService.find(api_fixture('keep_services')['proxy']['uuid']) + proxy.update_attributes service_ssl_flag: false + end + visit page_with_token 'active', sandbox_path + find('.nav-tabs a', text: 'Upload').click + attach_file 'file_selector', testfile_path('foo.txt') + assert_selector 'button:not([disabled])', text: 'Start' + click_button 'Start' + using_wait_time 5 do + assert_text :visible, 'server setup problem' + assert_text :visible, 'cannot be used from origin' + end + end + + test "Report network error" do + need_selenium "to make file uploads work" + begin + use_token :admin + proxy = KeepService.find(api_fixture('keep_services')['proxy']['uuid']) + # Even if you somehow do port>2^16, surely nx.example.net won't respond + proxy.update_attributes service_host: 'nx.example.net', service_port: 99999 + end + visit page_with_token 'active', sandbox_path + find('.nav-tabs a', text: 'Upload').click + attach_file 'file_selector', testfile_path('foo.txt') + assert_selector 'button:not([disabled])', text: 'Start' + click_button 'Start' + using_wait_time 5 do + assert_text :visible, 'network error' + end + end + protected def aproject_path