diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-11-02 15:34:30 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-11-02 16:36:36 -0500 |
commit | ed3b23fec9f030fe7868c70265324a732bf34fe9 (patch) | |
tree | 9bb9e1a1f1c76168983dbc2a7aee0360ab5f2cd3 /spec/features/uploads | |
parent | 187a4f6c81ab83945580a45ffe7a9e1bdcb1f192 (diff) | |
download | gitlab-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.rb | 34 |
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 |