Merge branch 'master' into 5420-collection-checkbox-selections
[arvados.git] / apps / workbench / test / integration / collection_upload_test.rb
index a2405765b0815fba1d631ec8dbe68e74309c656a..6960d3bc899d47bdfe929719f88dd24615db3f98 100644 (file)
@@ -22,7 +22,8 @@ class CollectionUploadTest < ActionDispatch::IntegrationTest
     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
@@ -67,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