Commit ba76e8da authored by Sean McGivern's avatar Sean McGivern

Merge branch 'jswain_upload_file_nonempty_repo_feature_spec' into 'master'

Adding additional test case for upload file button

See merge request gitlab-org/gitlab!55688
parents a0a90afc fff1ad81
...@@ -34,33 +34,23 @@ RSpec.describe 'Projects > Show > User uploads files' do ...@@ -34,33 +34,23 @@ RSpec.describe 'Projects > Show > User uploads files' do
include_examples 'it uploads and commit a new file to a forked project' include_examples 'it uploads and commit a new file to a forked project'
end end
context 'with an empty repo' do context 'when in the empty_repo_upload experiment' do
let(:project) { create(:project, :empty_repo, creator: user) } before do
stub_experiments(empty_repo_upload: :candidate)
context 'when in the empty_repo_upload experiment' do
before do
stub_experiments(empty_repo_upload: :candidate)
visit(project_path(project))
end
it 'uploads and commits a new text file', :js do
click_link('Upload file')
drop_in_dropzone(File.join(Rails.root, 'spec', 'fixtures', 'doc_sample.txt')) visit(project_path(project))
end
page.within('#modal-upload-blob') do context 'with an empty repo' do
fill_in(:commit_message, with: 'New commit message') let(:project) { create(:project, :empty_repo, creator: user) }
end
click_button('Upload file') include_examples 'uploads and commits a new text file via "upload file" button'
end
wait_for_requests context 'with a nonempty repo' do
let(:project) { create(:project, :repository, creator: user) }
expect(page).to have_content('New commit message') include_examples 'uploads and commits a new text file via "upload file" button'
expect(page).to have_content('Lorem ipsum dolor sit amet')
expect(page).to have_content('Sed ut perspiciatis unde omnis')
end
end end
end end
end end
...@@ -94,3 +94,23 @@ RSpec.shared_examples 'it uploads and commit a new file to a forked project' do ...@@ -94,3 +94,23 @@ RSpec.shared_examples 'it uploads and commit a new file to a forked project' do
expect(page).to have_content('Sed ut perspiciatis unde omnis') expect(page).to have_content('Sed ut perspiciatis unde omnis')
end end
end end
RSpec.shared_examples 'uploads and commits a new text file via "upload file" button' do
it 'uploads and commits a new text file via "upload file" button', :js do
find('.js-upload-file-experiment-trigger', text: 'Upload file').click
drop_in_dropzone(File.join(Rails.root, 'spec', 'fixtures', 'doc_sample.txt'))
page.within('#modal-upload-blob') do
fill_in(:commit_message, with: 'New commit message')
end
click_button('Upload file')
wait_for_requests
expect(page).to have_content('New commit message')
expect(page).to have_content('Lorem ipsum dolor sit amet')
expect(page).to have_content('Sed ut perspiciatis unde omnis')
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment