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,9 +34,6 @@ RSpec.describe 'Projects > Show > User uploads files' do ...@@ -34,9 +34,6 @@ 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
let(:project) { create(:project, :empty_repo, creator: user) }
context 'when in the empty_repo_upload experiment' do context 'when in the empty_repo_upload experiment' do
before do before do
stub_experiments(empty_repo_upload: :candidate) stub_experiments(empty_repo_upload: :candidate)
...@@ -44,23 +41,16 @@ RSpec.describe 'Projects > Show > User uploads files' do ...@@ -44,23 +41,16 @@ RSpec.describe 'Projects > Show > User uploads files' do
visit(project_path(project)) visit(project_path(project))
end end
it 'uploads and commits a new text file', :js do context 'with an empty repo' do
click_link('Upload file') let(:project) { create(:project, :empty_repo, creator: user) }
drop_in_dropzone(File.join(Rails.root, 'spec', 'fixtures', 'doc_sample.txt'))
page.within('#modal-upload-blob') do include_examples 'uploads and commits a new text file via "upload file" button'
fill_in(:commit_message, with: 'New commit message')
end end
click_button('Upload file') context 'with a nonempty repo' do
let(:project) { create(:project, :repository, creator: user) }
wait_for_requests include_examples 'uploads and commits a new text file via "upload file" button'
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 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