Browse Source

Test stabilization: Upload is sometimes faster than the button can be checked.

Thorsten Eckel 6 years ago
parent
commit
5e4958e7ac
1 changed files with 14 additions and 4 deletions
  1. 14 4
      test/browser/agent_ticket_attachment_test.rb

+ 14 - 4
test/browser/agent_ticket_attachment_test.rb

@@ -329,14 +329,15 @@ class AgentTicketAttachmentTest < TestCase
     # First test the attachment uploading for new tickets
     file_upload(
       css:   '.content.active .attachmentPlaceholder-inputHolder input',
-      files: [Rails.root.join('test', 'data', 'upload', 'upload2.jpg')],
+      files: [large_file],
       no_sleep: true,
     )
     exists(
       css: '.content.active .js-submit:disabled',
     )
     watch_for_disappear(
-      css: '.content.active .js-submit:disabled',
+      css:     '.content.active .js-submit:disabled',
+      timeout: 4.minutes,
     )
     exists(
       css: '.content.active .js-submit',
@@ -355,14 +356,23 @@ class AgentTicketAttachmentTest < TestCase
     )
     file_upload(
       css:   '.content.active .attachmentPlaceholder-inputHolder input',
-      files: [Rails.root.join('test', 'data', 'upload', 'upload2.jpg')],
+      files: [large_file],
       no_sleep: true,
     )
     exists(
       css: '.content.active .js-submit:disabled',
     )
     watch_for_disappear(
-      css: '.content.active .js-submit:disabled',
+      css:     '.content.active .js-submit:disabled',
+      timeout: 4.minutes,
     )
   end
+
+  def large_file
+    file = Tempfile.new
+    file.binmode
+    file.write(SecureRandom.random_bytes(6.megabyte))
+    file.close
+    file.path
+  end
 end