summaryrefslogtreecommitdiff
path: root/spec/features/uploads
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2017-11-02 15:34:30 -0500
committerMike Greiling <mike@pixelcog.com>2017-11-02 16:36:36 -0500
commited3b23fec9f030fe7868c70265324a732bf34fe9 (patch)
tree9bb9e1a1f1c76168983dbc2a7aee0360ab5f2cd3 /spec/features/uploads
parent187a4f6c81ab83945580a45ffe7a9e1bdcb1f192 (diff)
downloadgitlab-ce-ed3b23fec9f030fe7868c70265324a732bf34fe9.tar.gz
refactor wait_for_requests, add slow_requests block helper
Diffstat (limited to 'spec/features/uploads')
-rw-r--r--spec/features/uploads/user_uploads_file_to_note_spec.rb34
1 files changed, 13 insertions, 21 deletions
diff --git a/spec/features/uploads/user_uploads_file_to_note_spec.rb b/spec/features/uploads/user_uploads_file_to_note_spec.rb
index 47b89d262f3..972c10aaf23 100644
--- a/spec/features/uploads/user_uploads_file_to_note_spec.rb
+++ b/spec/features/uploads/user_uploads_file_to_note_spec.rb
@@ -21,24 +21,12 @@ feature 'User uploads file to note' do
end
context 'uploading is in progress' do
- before do
- Gitlab::Testing::RequestBlockerMiddleware.slow_requests!
- end
-
- after do
- Gitlab::Testing::RequestBlockerMiddleware.allow_requests!
- end
-
- it 'shows "Cancel" button on uploading', :js do
- dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false)
-
- expect(page).to have_button('Cancel')
- end
-
it 'cancels uploading on clicking to "Cancel" button', :js do
- dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false)
+ slow_requests do
+ dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false)
- click_button 'Cancel'
+ click_button 'Cancel'
+ end
expect(page).to have_button('Attach a file')
expect(page).not_to have_button('Cancel')
@@ -46,16 +34,20 @@ feature 'User uploads file to note' do
end
it 'shows "Attaching a file" message on uploading 1 file', :js do
- dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false)
+ slow_requests do
+ dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false)
- expect(page).to have_selector('.attaching-file-message', visible: true, text: 'Attaching a file -')
+ expect(page).to have_selector('.attaching-file-message', visible: true, text: 'Attaching a file -')
+ end
end
it 'shows "Attaching 2 files" message on uploading 2 file', :js do
- dropzone_file([Rails.root.join('spec', 'fixtures', 'video_sample.mp4'),
- Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false)
+ slow_requests do
+ dropzone_file([Rails.root.join('spec', 'fixtures', 'video_sample.mp4'),
+ Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false)
- expect(page).to have_selector('.attaching-file-message', visible: true, text: 'Attaching 2 files -')
+ expect(page).to have_selector('.attaching-file-message', visible: true, text: 'Attaching 2 files -')
+ end
end
it 'shows error message, "retry" and "attach a new file" link a if file is too big', :js do