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

This commit is contained in:
Thorsten Eckel 2018-07-20 14:51:00 +02:00
parent 364f74f558
commit 5e4958e7ac

View file

@ -329,7 +329,7 @@ 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(
@ -337,6 +337,7 @@ class AgentTicketAttachmentTest < TestCase
)
watch_for_disappear(
css: '.content.active .js-submit:disabled',
timeout: 4.minutes,
)
exists(
css: '.content.active .js-submit',
@ -355,7 +356,7 @@ 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(
@ -363,6 +364,15 @@ class AgentTicketAttachmentTest < TestCase
)
watch_for_disappear(
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