diff options
Diffstat (limited to 'spec/features/merge_request')
16 files changed, 99 insertions, 37 deletions
diff --git a/spec/features/merge_request/batch_comments_spec.rb b/spec/features/merge_request/batch_comments_spec.rb index fafaea8ac68..f892b01e624 100644 --- a/spec/features/merge_request/batch_comments_spec.rb +++ b/spec/features/merge_request/batch_comments_spec.rb @@ -101,7 +101,7 @@ RSpec.describe 'Merge request > Batch comments', :js do write_diff_comment - visit_overview + visit_overview_with_pending_comment end it 'can add comment to review' do @@ -232,6 +232,14 @@ RSpec.describe 'Merge request > Batch comments', :js do wait_for_requests end + def visit_overview_with_pending_comment + accept_alert do + visit project_merge_request_path(merge_request.project, merge_request) + end + + wait_for_requests + end + def write_diff_comment(**params) click_diff_line(find_by_scrolling("[id='#{sample_compare.changes[0][:line_code]}']")) diff --git a/spec/features/merge_request/maintainer_edits_fork_spec.rb b/spec/features/merge_request/maintainer_edits_fork_spec.rb index a98bfd1c8a4..39d948bb6fb 100644 --- a/spec/features/merge_request/maintainer_edits_fork_spec.rb +++ b/spec/features/merge_request/maintainer_edits_fork_spec.rb @@ -3,6 +3,7 @@ require 'spec_helper' RSpec.describe 'a maintainer edits files on a source-branch of an MR from a fork', :js, :sidekiq_might_not_need_inline do + include Spec::Support::Helpers::Features::SourceEditorSpecHelpers include ProjectForksHelper let(:user) { create(:user, username: 'the-maintainer') } let(:target_project) { create(:project, :public, :repository) } @@ -40,12 +41,13 @@ RSpec.describe 'a maintainer edits files on a source-branch of an MR from a fork end it 'allows committing to the source branch' do - execute_script("monaco.editor.getModels()[0].setValue('Updated the readme')") + content = 'Updated the readme' + editor_set_value(content) click_button 'Commit changes' wait_for_requests expect(page).to have_content('Your changes have been successfully committed') - expect(page).to have_content('Updated the readme') + expect(page).to have_content(content) end end diff --git a/spec/features/merge_request/user_approves_spec.rb b/spec/features/merge_request/user_approves_spec.rb index 4f7bcb58551..9670012803e 100644 --- a/spec/features/merge_request/user_approves_spec.rb +++ b/spec/features/merge_request/user_approves_spec.rb @@ -27,7 +27,7 @@ RSpec.describe 'Merge request > User approves', :js do def verify_approvals_count_on_index! visit(project_merge_requests_path(project, state: :all)) - expect(page.all('li').any? { |item| item["title"] == "1 approver (you've approved)"}).to be true + expect(page.all('li').any? { |item| item["title"] == "1 approver (you've approved)" }).to be true visit project_merge_request_path(project, merge_request) end diff --git a/spec/features/merge_request/user_comments_on_merge_request_spec.rb b/spec/features/merge_request/user_comments_on_merge_request_spec.rb index 43096f8e7f9..dbcfc2b968f 100644 --- a/spec/features/merge_request/user_comments_on_merge_request_spec.rb +++ b/spec/features/merge_request/user_comments_on_merge_request_spec.rb @@ -51,6 +51,45 @@ RSpec.describe 'User comments on a merge request', :js do expect(page).to have_button('Resolve thread') end + array = [':', '@', '#', '%', '!', '~', '$', '[contact:'] + array.each do |x| + it 'handles esc key correctly when atwho is active' do + page.within('.js-main-target-form') do + fill_in('note[note]', with: 'comment 1') + click_button('Comment') + end + + wait_for_requests + + page.within('.note') do + click_button('Reply to comment') + fill_in('note[note]', with: x) + send_keys :escape + end + + wait_for_requests + expect(page.html).not_to include('Are you sure you want to cancel creating this comment?') + end + end + + it 'handles esc key correctly when atwho is not active' do + page.within('.js-main-target-form') do + fill_in('note[note]', with: 'comment 1') + click_button('Comment') + end + + wait_for_requests + + page.within('.note') do + click_button('Reply to comment') + fill_in('note[note]', with: 'comment 2') + send_keys :escape + end + + wait_for_requests + expect(page.html).to include('Are you sure you want to cancel creating this comment?') + end + it 'loads new comment' do # Add new comment in background in order to check # if it's going to be loaded automatically for current user. diff --git a/spec/features/merge_request/user_customizes_merge_commit_message_spec.rb b/spec/features/merge_request/user_customizes_merge_commit_message_spec.rb index 059e1eb89c5..f0c0142a6cc 100644 --- a/spec/features/merge_request/user_customizes_merge_commit_message_spec.rb +++ b/spec/features/merge_request/user_customizes_merge_commit_message_spec.rb @@ -5,8 +5,8 @@ require 'spec_helper' RSpec.describe 'Merge request < User customizes merge commit message', :js do let(:project) { create(:project, :public, :repository) } let(:user) { project.creator } - let(:issue_1) { create(:issue, project: project)} - let(:issue_2) { create(:issue, project: project)} + let(:issue_1) { create(:issue, project: project) } + let(:issue_2) { create(:issue, project: project) } let(:source_branch) { 'csv' } let(:target_branch) { 'master' } let(:squash) { false } diff --git a/spec/features/merge_request/user_edits_assignees_sidebar_spec.rb b/spec/features/merge_request/user_edits_assignees_sidebar_spec.rb index 92b9b785148..0dd87ac3e24 100644 --- a/spec/features/merge_request/user_edits_assignees_sidebar_spec.rb +++ b/spec/features/merge_request/user_edits_assignees_sidebar_spec.rb @@ -89,7 +89,7 @@ RSpec.describe 'Merge request > User edits assignees sidebar', :js do context 'when GraphQL assignees widget feature flag is enabled' do let(:sidebar_assignee_dropdown_item) { sidebar_assignee_block.find(".dropdown-item", text: assignee.username ) } - let(:sidebar_assignee_dropdown_tooltip) { sidebar_assignee_dropdown_item['title']} + let(:sidebar_assignee_dropdown_tooltip) { sidebar_assignee_dropdown_item['title'] } context 'when user is an owner' do before do 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 6a9a30953df..c91dc7b1c00 100644 --- a/spec/features/merge_request/user_merges_merge_request_spec.rb +++ b/spec/features/merge_request/user_merges_merge_request_spec.rb @@ -21,27 +21,6 @@ RSpec.describe "User merges a merge request", :js do end end - context "ff-only merge" do - let(:project) { create(:project, :public, :repository, merge_requests_ff_only_enabled: true) } - - before do - stub_feature_flags(restructured_mr_widget: false) - visit(merge_request_path(merge_request)) - end - - context "when branch is rebased" do - let!(:merge_request) { create(:merge_request, :rebased, source_project: project) } - - it_behaves_like "fast forward merge a merge request" - end - - context "when branch is merged" do - let!(:merge_request) { create(:merge_request, :merged_target, source_project: project) } - - 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) } diff --git a/spec/features/merge_request/user_opens_context_commits_modal_spec.rb b/spec/features/merge_request/user_opens_context_commits_modal_spec.rb new file mode 100644 index 00000000000..2d574e57fe9 --- /dev/null +++ b/spec/features/merge_request/user_opens_context_commits_modal_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Merge request > Context commits', :js do + let(:user) { create(:user) } + let(:project) { create(:project, :public, :repository) } + let(:merge_request) { create(:merge_request, source_project: project) } + + before do + project.add_developer(user) + + sign_in(user) + + visit commits_project_merge_request_path(project, merge_request) + + wait_for_requests + end + + it 'opens modal' do + click_button 'Add previously merged commits' + + expect(page).to have_selector('#add-review-item') + expect(page).to have_content('Add or remove previously merged commits') + end +end diff --git a/spec/features/merge_request/user_posts_diff_notes_spec.rb b/spec/features/merge_request/user_posts_diff_notes_spec.rb index d461170c990..1eebb6c2e28 100644 --- a/spec/features/merge_request/user_posts_diff_notes_spec.rb +++ b/spec/features/merge_request/user_posts_diff_notes_spec.rb @@ -19,7 +19,6 @@ RSpec.describe 'Merge request > User posts diff notes', :js do project.add_developer(user) sign_in(user) - stub_const('Gitlab::QueryLimiting::Transaction::THRESHOLD', 104) end context 'when hovering over a parallel view diff file' do diff --git a/spec/features/merge_request/user_sees_closing_issues_message_spec.rb b/spec/features/merge_request/user_sees_closing_issues_message_spec.rb index 7b7fff5c936..f56db3d3dbe 100644 --- a/spec/features/merge_request/user_sees_closing_issues_message_spec.rb +++ b/spec/features/merge_request/user_sees_closing_issues_message_spec.rb @@ -5,8 +5,8 @@ require 'spec_helper' RSpec.describe 'Merge request > User sees closing issues message', :js do let(:project) { create(:project, :public, :repository) } let(:user) { project.creator } - let(:issue_1) { create(:issue, project: project)} - let(:issue_2) { create(:issue, project: project)} + let(:issue_1) { create(:issue, project: project) } + let(:issue_2) { create(:issue, project: project) } let(:merge_request) do create( :merge_request, diff --git a/spec/features/merge_request/user_sees_deployment_widget_spec.rb b/spec/features/merge_request/user_sees_deployment_widget_spec.rb index e045f11c0d8..c02149eed87 100644 --- a/spec/features/merge_request/user_sees_deployment_widget_spec.rb +++ b/spec/features/merge_request/user_sees_deployment_widget_spec.rb @@ -14,7 +14,7 @@ RSpec.describe 'Merge request > User sees deployment widget', :js do let(:ref) { merge_request.target_branch } let(:sha) { project.commit(ref).id } let(:pipeline) { create(:ci_pipeline, sha: sha, project: project, ref: ref) } - let!(:manual) { } + let!(:manual) {} let(:build) { create(:ci_build, :with_deployment, environment: environment.name, pipeline: pipeline) } let!(:deployment) { build.deployment } diff --git a/spec/features/merge_request/user_sees_diff_spec.rb b/spec/features/merge_request/user_sees_diff_spec.rb index 50f4cce5c23..2e65183d26f 100644 --- a/spec/features/merge_request/user_sees_diff_spec.rb +++ b/spec/features/merge_request/user_sees_diff_spec.rb @@ -86,7 +86,7 @@ RSpec.describe 'Merge request > User sees diff', :js do context 'when file contains html' do let(:current_user) { project.first_owner } - let(:branch_name) {"test_branch"} + let(:branch_name) { "test_branch" } it 'escapes any HTML special characters in the diff chunk header' do file_content = diff --git a/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb b/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb index 09c6b6bce3b..2a1b9ea6009 100644 --- a/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb +++ b/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb @@ -25,7 +25,7 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request', } end - let(:expected_detached_mr_tag) {'merge request'} + let(:expected_detached_mr_tag) { 'merge request' } before do stub_application_setting(auto_devops_enabled: false) diff --git a/spec/features/merge_request/user_sees_pipelines_spec.rb b/spec/features/merge_request/user_sees_pipelines_spec.rb index 16b1de0393f..11e542916f9 100644 --- a/spec/features/merge_request/user_sees_pipelines_spec.rb +++ b/spec/features/merge_request/user_sees_pipelines_spec.rb @@ -78,9 +78,18 @@ RSpec.describe 'Merge request > User sees pipelines', :js do it 'user visits merge request page' do page.within('.merge-request-tabs') do - expect(page).to have_no_link('Pipelines') + expect(page).to have_link('Pipelines') end end + + it 'shows empty state with run pipeline button' do + page.within('.merge-request-tabs') do + click_link('Pipelines') + end + + expect(page).to have_content('There are currently no pipelines.') + expect(page.find('[data-testid="run_pipeline_button"]')).to have_text('Run pipeline') + end end end diff --git a/spec/features/merge_request/user_sees_versions_spec.rb b/spec/features/merge_request/user_sees_versions_spec.rb index 2c2a2dfd4a8..0e86e970f46 100644 --- a/spec/features/merge_request/user_sees_versions_spec.rb +++ b/spec/features/merge_request/user_sees_versions_spec.rb @@ -232,7 +232,7 @@ RSpec.describe 'Merge request > User sees versions', :js do end it 'only shows diffs from the commit' do - diff_commit_ids = find_all('.diff-file [data-commit-id]').map {|diff| diff['data-commit-id']} + diff_commit_ids = find_all('.diff-file [data-commit-id]').map { |diff| diff['data-commit-id'] } expect(diff_commit_ids).not_to be_empty expect(diff_commit_ids).to all(eq(params[:commit_id])) diff --git a/spec/features/merge_request/user_uses_quick_actions_spec.rb b/spec/features/merge_request/user_uses_quick_actions_spec.rb index b48659353ec..563120fc8b7 100644 --- a/spec/features/merge_request/user_uses_quick_actions_spec.rb +++ b/spec/features/merge_request/user_uses_quick_actions_spec.rb @@ -24,7 +24,7 @@ RSpec.describe 'Merge request > User uses quick actions', :js do let!(:label_feature) { create(:label, project: project, title: 'feature') } let!(:milestone) { create(:milestone, project: project, title: 'ASAP') } let(:issuable) { create(:merge_request, source_project: project) } - let(:source_issuable) { create(:issue, project: project, milestone: milestone, labels: [label_bug, label_feature])} + let(:source_issuable) { create(:issue, project: project, milestone: milestone, labels: [label_bug, label_feature]) } it_behaves_like 'close quick action', :merge_request it_behaves_like 'issuable time tracker', :merge_request |