diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /spec/features/merge_request | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'spec/features/merge_request')
4 files changed, 61 insertions, 2 deletions
diff --git a/spec/features/merge_request/user_merges_merge_request_spec.rb b/spec/features/merge_request/user_merges_merge_request_spec.rb index d1be93cae02..a861ca2eea5 100644 --- a/spec/features/merge_request/user_merges_merge_request_spec.rb +++ b/spec/features/merge_request/user_merges_merge_request_spec.rb @@ -10,7 +10,7 @@ RSpec.describe "User merges a merge request", :js do end shared_examples "fast forward merge a merge request" do - it "merges a merge request", :sidekiq_might_not_need_inline do + it "merges a merge request", :sidekiq_inline do expect(page).to have_content("Fast-forward merge without a merge commit").and have_button("Merge") page.within(".mr-state-widget") do @@ -42,4 +42,23 @@ RSpec.describe "User merges a merge request", :js do it_behaves_like "fast forward merge a merge request" end end + + context 'sidebar merge requests counter' do + let(:project) { create(:project, :public, :repository) } + let!(:merge_request) { create(:merge_request, source_project: project) } + + it 'decrements the open MR count', :sidekiq_inline do + create(:merge_request, source_project: project, source_branch: 'branch-1') + + visit(merge_request_path(merge_request)) + + expect(page).to have_css('.js-merge-counter', text: '2') + + page.within(".mr-state-widget") do + click_button("Merge") + end + + expect(page).to have_css('.js-merge-counter', text: '1') + end + end end diff --git a/spec/features/merge_request/user_posts_notes_spec.rb b/spec/features/merge_request/user_posts_notes_spec.rb index 1779567624c..ad602afe68a 100644 --- a/spec/features/merge_request/user_posts_notes_spec.rb +++ b/spec/features/merge_request/user_posts_notes_spec.rb @@ -169,7 +169,7 @@ RSpec.describe 'Merge request > User posts notes', :js do end page.within('.modal') do - click_button('OK', match: :first) + click_button('Cancel editing', match: :first) end expect(find('.js-note-text').text).to eq '' diff --git a/spec/features/merge_request/user_sees_merge_widget_spec.rb b/spec/features/merge_request/user_sees_merge_widget_spec.rb index 27f7c699c50..c9b21d4a4ae 100644 --- a/spec/features/merge_request/user_sees_merge_widget_spec.rb +++ b/spec/features/merge_request/user_sees_merge_widget_spec.rb @@ -17,6 +17,9 @@ RSpec.describe 'Merge request > User sees merge widget', :js do project.add_maintainer(user) project_only_mwps.add_maintainer(user) sign_in(user) + + stub_feature_flags(refactor_mr_widgets_extensions: false) + stub_feature_flags(refactor_mr_widgets_extensions_user: false) end context 'new merge request', :sidekiq_might_not_need_inline do diff --git a/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb b/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb index beb658bb7a0..f77a42ee506 100644 --- a/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb +++ b/spec/features/merge_request/user_suggests_changes_on_diff_spec.rb @@ -379,4 +379,41 @@ RSpec.describe 'User comments on a diff', :js do end end end + + context 'failed to load metadata' do + let(:dummy_controller) do + Class.new(Projects::MergeRequests::DiffsController) do + def diffs_metadata + render json: '', status: :internal_server_error + end + end + end + + before do + stub_const('Projects::MergeRequests::DiffsController', dummy_controller) + + click_diff_line(find_by_scrolling("[id='#{sample_compare.changes[1][:line_code]}']")) + + page.within('.js-discussion-note-form') do + fill_in('note_note', with: "```suggestion\n# change to a comment\n```") + click_button('Add comment now') + end + + wait_for_requests + + visit(project_merge_request_path(project, merge_request)) + + wait_for_requests + end + + it 'displays an error' do + page.within('.discussion-notes') do + click_button('Apply suggestion') + + wait_for_requests + + expect(page).to have_content('Unable to fully load the default commit message. You can still apply this suggestion and the commit message will be correct.') + end + end + end end |