diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-28 15:09:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-28 15:09:41 +0300 |
commit | 72ba138510cad0a8c4819ef0512153dd4dbced7f (patch) | |
tree | 51038f89acce6787dfaa1e04b33f25b4bbeee2a8 /spec/features | |
parent | 8ce5735a199949ad19db9e83544875cd81562c69 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
18 files changed, 191 insertions, 138 deletions
diff --git a/spec/features/merge_request/maintainer_edits_fork_spec.rb b/spec/features/merge_request/maintainer_edits_fork_spec.rb index c9aa22e396b..7603696c60c 100644 --- a/spec/features/merge_request/maintainer_edits_fork_spec.rb +++ b/spec/features/merge_request/maintainer_edits_fork_spec.rb @@ -3,7 +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, -feature_category: :code_review_workflow do + feature_category: :code_review_workflow do include Features::SourceEditorSpecHelpers include ProjectForksHelper let(:user) { create(:user, username: 'the-maintainer') } @@ -12,13 +12,15 @@ feature_category: :code_review_workflow do let(:source_project) { fork_project(target_project, author, repository: true) } let(:merge_request) do - create(:merge_request, - source_project: source_project, - target_project: target_project, - source_branch: 'fix', - target_branch: 'master', - author: author, - allow_collaboration: true) + create( + :merge_request, + source_project: source_project, + target_project: target_project, + source_branch: 'fix', + target_branch: 'master', + author: author, + allow_collaboration: true + ) end before do diff --git a/spec/features/merge_request/user_allows_commits_from_memebers_who_can_merge_spec.rb b/spec/features/merge_request/user_allows_commits_from_memebers_who_can_merge_spec.rb index 0ff773ef02d..149b2e2bb0f 100644 --- a/spec/features/merge_request/user_allows_commits_from_memebers_who_can_merge_spec.rb +++ b/spec/features/merge_request/user_allows_commits_from_memebers_who_can_merge_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'create a merge request, allowing commits from members who can merge to the target branch', :js, -feature_category: :code_review_workflow do + feature_category: :code_review_workflow do include ProjectForksHelper let(:user) { create(:user) } let(:target_project) { create(:project, :public, :repository) } @@ -67,10 +67,12 @@ feature_category: :code_review_workflow do context 'when a member who can merge tries to edit the option' do let(:member) { create(:user) } let(:merge_request) do - create(:merge_request, - source_project: source_project, - target_project: target_project, - source_branch: 'fixes') + create( + :merge_request, + source_project: source_project, + target_project: target_project, + source_branch: 'fixes' + ) end before do diff --git a/spec/features/merge_request/user_closes_reopens_merge_request_state_spec.rb b/spec/features/merge_request/user_closes_reopens_merge_request_state_spec.rb index 537702df12d..446f6a470de 100644 --- a/spec/features/merge_request/user_closes_reopens_merge_request_state_spec.rb +++ b/spec/features/merge_request/user_closes_reopens_merge_request_state_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'User closes/reopens a merge request', :js, quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/297500', - feature_category: :code_review_workflow do + feature_category: :code_review_workflow do let_it_be(:project) { create(:project, :repository) } let_it_be(:user) { create(:user) } diff --git a/spec/features/merge_request/user_creates_merge_request_spec.rb b/spec/features/merge_request/user_creates_merge_request_spec.rb index 97b423f2cc2..eab5cee976e 100644 --- a/spec/features/merge_request/user_creates_merge_request_spec.rb +++ b/spec/features/merge_request/user_creates_merge_request_spec.rb @@ -110,11 +110,13 @@ RSpec.describe 'User creates a merge request', :js, feature_category: :code_revi context 'when project is public and merge requests are private' do let_it_be(:project) do - create(:project, - :public, - :repository, - group: group, - merge_requests_access_level: ProjectFeature::DISABLED) + create( + :project, + :public, + :repository, + group: group, + merge_requests_access_level: ProjectFeature::DISABLED + ) end context 'and user is a guest' do diff --git a/spec/features/merge_request/user_interacts_with_batched_mr_diffs_spec.rb b/spec/features/merge_request/user_interacts_with_batched_mr_diffs_spec.rb index a013666a496..a96ec1f68aa 100644 --- a/spec/features/merge_request/user_interacts_with_batched_mr_diffs_spec.rb +++ b/spec/features/merge_request/user_interacts_with_batched_mr_diffs_spec.rb @@ -64,7 +64,7 @@ RSpec.describe 'Batch diffs', :js, feature_category: :code_review_workflow do context 'which is in at least page 2 of the batched pages of diffs' do it 'scrolls to the correct discussion', - quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/293814' } do + quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/293814' } do page.within get_first_diff do click_link('just now') end diff --git a/spec/features/merge_request/user_merges_immediately_spec.rb b/spec/features/merge_request/user_merges_immediately_spec.rb index d47968ebc6b..71af2045bab 100644 --- a/spec/features/merge_request/user_merges_immediately_spec.rb +++ b/spec/features/merge_request/user_merges_immediately_spec.rb @@ -6,17 +6,23 @@ RSpec.describe 'Merge requests > User merges immediately', :js, feature_category let(:project) { create(:project, :public, :repository) } let(:user) { project.creator } let!(:merge_request) do - create(:merge_request_with_diffs, source_project: project, - author: user, - title: 'Bug NS-04', - head_pipeline: pipeline, - source_branch: pipeline.ref) + create( + :merge_request_with_diffs, + source_project: project, + author: user, + title: 'Bug NS-04', + head_pipeline: pipeline, + source_branch: pipeline.ref + ) end let(:pipeline) do - create(:ci_pipeline, project: project, - ref: 'master', - sha: project.repository.commit('master').id) + create( + :ci_pipeline, + project: project, + ref: 'master', + sha: project.repository.commit('master').id + ) end context 'when there is active pipeline for merge request' do diff --git a/spec/features/merge_request/user_merges_only_if_pipeline_succeeds_spec.rb b/spec/features/merge_request/user_merges_only_if_pipeline_succeeds_spec.rb index a4c03dc4e73..78814e36cfe 100644 --- a/spec/features/merge_request/user_merges_only_if_pipeline_succeeds_spec.rb +++ b/spec/features/merge_request/user_merges_only_if_pipeline_succeeds_spec.rb @@ -25,11 +25,14 @@ RSpec.describe 'Merge request > User merges only if pipeline succeeds', :js, fea context 'when project has CI enabled' do let!(:pipeline) do - create(:ci_empty_pipeline, - project: project, - sha: merge_request.diff_head_sha, - ref: merge_request.source_branch, - status: status, head_pipeline_of: merge_request) + create( + :ci_empty_pipeline, + project: project, + sha: merge_request.diff_head_sha, + ref: merge_request.source_branch, + status: status, + head_pipeline_of: merge_request + ) end context 'when merge requests can only be merged if the pipeline succeeds' do diff --git a/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb b/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb index 9a8384bfc9f..ebec8a6d2ea 100644 --- a/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb +++ b/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb @@ -6,17 +6,23 @@ RSpec.describe 'Merge request > User merges when pipeline succeeds', :js, featur let(:project) { create(:project, :public, :repository) } let(:user) { project.creator } let(:merge_request) do - create(:merge_request_with_diffs, source_project: project, - author: user, - title: 'Bug NS-04', - merge_params: { force_remove_source_branch: '1' }) + create( + :merge_request_with_diffs, + source_project: project, + author: user, + title: 'Bug NS-04', + merge_params: { force_remove_source_branch: '1' } + ) end let(:pipeline) do - create(:ci_pipeline, project: project, - sha: merge_request.diff_head_sha, - ref: merge_request.source_branch, - head_pipeline_of: merge_request) + create( + :ci_pipeline, + project: project, + sha: merge_request.diff_head_sha, + ref: merge_request.source_branch, + head_pipeline_of: merge_request + ) end before do @@ -67,12 +73,14 @@ RSpec.describe 'Merge request > User merges when pipeline succeeds', :js, featur context 'when it was enabled and then canceled' do let(:merge_request) do - create(:merge_request_with_diffs, - :merge_when_pipeline_succeeds, - source_project: project, - title: 'Bug NS-04', - author: user, - merge_user: user) + create( + :merge_request_with_diffs, + :merge_when_pipeline_succeeds, + source_project: project, + title: 'Bug NS-04', + author: user, + merge_user: user + ) end before do @@ -88,11 +96,15 @@ RSpec.describe 'Merge request > User merges when pipeline succeeds', :js, featur context 'when merge when pipeline succeeds is enabled' do let(:merge_request) do - create(:merge_request_with_diffs, :simple, :merge_when_pipeline_succeeds, - source_project: project, - author: user, - merge_user: user, - title: 'MepMep') + create( + :merge_request_with_diffs, + :simple, + :merge_when_pipeline_succeeds, + source_project: project, + author: user, + merge_user: user, + title: 'MepMep' + ) end let!(:build) do diff --git a/spec/features/merge_request/user_opens_checkout_branch_modal_spec.rb b/spec/features/merge_request/user_opens_checkout_branch_modal_spec.rb index 601310cbacf..63f03ae64e0 100644 --- a/spec/features/merge_request/user_opens_checkout_branch_modal_spec.rb +++ b/spec/features/merge_request/user_opens_checkout_branch_modal_spec.rb @@ -20,13 +20,15 @@ RSpec.describe 'Merge request > User opens checkout branch modal', :js, feature_ let(:source_project) { fork_project(project, author, repository: true) } let(:merge_request) do - create(:merge_request, - source_project: source_project, - target_project: project, - source_branch: 'fix', - target_branch: 'master', - author: author, - allow_collaboration: true) + create( + :merge_request, + source_project: source_project, + target_project: project, + source_branch: 'fix', + target_branch: 'master', + author: author, + allow_collaboration: true + ) end it 'shows instructions' do diff --git a/spec/features/merge_request/user_posts_notes_spec.rb b/spec/features/merge_request/user_posts_notes_spec.rb index d31777db42e..d1e00d730b7 100644 --- a/spec/features/merge_request/user_posts_notes_spec.rb +++ b/spec/features/merge_request/user_posts_notes_spec.rb @@ -13,8 +13,7 @@ RSpec.describe 'Merge request > User posts notes', :js, feature_category: :code_ end let!(:note) do - create(:note_on_merge_request, :with_attachment, noteable: merge_request, - project: project) + create(:note_on_merge_request, :with_attachment, noteable: merge_request, project: project) end before do diff --git a/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb b/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb index dae28cbb05c..e3be99254dc 100644 --- a/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb +++ b/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb @@ -144,9 +144,7 @@ RSpec.describe 'Merge request > User selects branches for new MR', :js, feature_ context 'when a new merge request has a pipeline' do let!(:pipeline) do - create(:ci_pipeline, sha: project.commit('fix').id, - ref: 'fix', - project: project) + create(:ci_pipeline, sha: project.commit('fix').id, ref: 'fix', project: project) end it 'shows pipelines for a new merge request' do diff --git a/spec/features/merge_request/user_squashes_merge_request_spec.rb b/spec/features/merge_request/user_squashes_merge_request_spec.rb index 63faf830f7e..5fd0f353e56 100644 --- a/spec/features/merge_request/user_squashes_merge_request_spec.rb +++ b/spec/features/merge_request/user_squashes_merge_request_spec.rb @@ -16,15 +16,19 @@ RSpec.describe 'User squashes a merge request', :js, feature_category: :code_rev latest_master_commits = project.repository.commits_between(original_head.sha, 'master').map(&:raw) - squash_commit = an_object_having_attributes(sha: a_string_matching(/\h{40}/), - message: a_string_starting_with(project.merge_requests.first.default_squash_commit_message), - author_name: user.name, - committer_name: user.name) - - merge_commit = an_object_having_attributes(sha: a_string_matching(/\h{40}/), - message: a_string_starting_with("Merge branch '#{source_branch}' into 'master'"), - author_name: user.name, - committer_name: user.name) + squash_commit = an_object_having_attributes( + sha: a_string_matching(/\h{40}/), + message: a_string_starting_with(project.merge_requests.first.default_squash_commit_message), + author_name: user.name, + committer_name: user.name + ) + + merge_commit = an_object_having_attributes( + sha: a_string_matching(/\h{40}/), + message: a_string_starting_with("Merge branch '#{source_branch}' into 'master'"), + author_name: user.name, + committer_name: user.name + ) expect(project.repository).not_to be_merged_to_root_ref(source_branch) expect(latest_master_commits).to match([squash_commit, merge_commit]) 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 efd88df0f97..6152d9f8259 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 @@ -303,13 +303,17 @@ RSpec.describe 'User comments on a diff', :js, feature_category: :code_review_wo "5 # heh" ] - expect_suggestion_has_content(suggestion_1, - suggestion_1_expected_changing_content, - suggestion_1_expected_suggested_content) - - expect_suggestion_has_content(suggestion_2, - suggestion_2_expected_changing_content, - suggestion_2_expected_suggested_content) + expect_suggestion_has_content( + suggestion_1, + suggestion_1_expected_changing_content, + suggestion_1_expected_suggested_content + ) + + expect_suggestion_has_content( + suggestion_2, + suggestion_2_expected_changing_content, + suggestion_2_expected_suggested_content + ) end end end diff --git a/spec/features/merge_request/user_tries_to_access_private_project_info_through_new_mr_spec.rb b/spec/features/merge_request/user_tries_to_access_private_project_info_through_new_mr_spec.rb index 5770f5ab94d..1232e19d22b 100644 --- a/spec/features/merge_request/user_tries_to_access_private_project_info_through_new_mr_spec.rb +++ b/spec/features/merge_request/user_tries_to_access_private_project_info_through_new_mr_spec.rb @@ -3,19 +3,27 @@ require 'spec_helper' RSpec.describe 'Merge Request > User tries to access private project information through the new mr page', -feature_category: :code_review_workflow do + feature_category: :code_review_workflow do let(:current_user) { create(:user) } let(:private_project) do - create(:project, :public, :repository, - path: 'nothing-to-see-here', - name: 'nothing to see here', - repository_access_level: ProjectFeature::PRIVATE) + create( + :project, + :public, + :repository, + path: 'nothing-to-see-here', + name: 'nothing to see here', + repository_access_level: ProjectFeature::PRIVATE + ) end let(:owned_project) do - create(:project, :public, :repository, - namespace: current_user.namespace, - creator: current_user) + create( + :project, + :public, + :repository, + namespace: current_user.namespace, + creator: current_user + ) end context 'when the user enters the querystring info for the other project' do 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 1ec86948065..1c63f5b56b0 100644 --- a/spec/features/merge_request/user_uses_quick_actions_spec.rb +++ b/spec/features/merge_request/user_uses_quick_actions_spec.rb @@ -8,7 +8,7 @@ require 'spec_helper' # Because this kind of spec takes more time to run there is no need to add new ones # for each existing quick action unless they test something not tested by existing tests. RSpec.describe 'Merge request > User uses quick actions', :js, :use_clean_rails_redis_caching, -feature_category: :code_review_workflow do + feature_category: :code_review_workflow do include Features::NotesHelpers let(:project) { create(:project, :public, :repository) } diff --git a/spec/features/merge_requests/user_lists_merge_requests_spec.rb b/spec/features/merge_requests/user_lists_merge_requests_spec.rb index 371c40b40a5..f594e39b2b7 100644 --- a/spec/features/merge_requests/user_lists_merge_requests_spec.rb +++ b/spec/features/merge_requests/user_lists_merge_requests_spec.rb @@ -14,44 +14,52 @@ RSpec.describe 'Merge requests > User lists merge requests', feature_category: : let(:user5) { create(:user) } before do - @fix = create(:merge_request, - title: 'fix', - source_project: project, - source_branch: 'fix', - assignees: [user], - reviewers: [user, user2, user3, user4, user5], - milestone: create(:milestone, project: project, due_date: '2013-12-11'), - created_at: 1.minute.ago, - updated_at: 1.minute.ago) + @fix = create( + :merge_request, + title: 'fix', + source_project: project, + source_branch: 'fix', + assignees: [user], + reviewers: [user, user2, user3, user4, user5], + milestone: create(:milestone, project: project, due_date: '2013-12-11'), + created_at: 1.minute.ago, + updated_at: 1.minute.ago + ) @fix.metrics.update!(merged_at: 10.seconds.ago, latest_closed_at: 20.seconds.ago) - @markdown = create(:merge_request, - title: 'markdown', - source_project: project, - source_branch: 'markdown', - assignees: [user], - reviewers: [user, user2, user3, user4], - milestone: create(:milestone, project: project, due_date: '2013-12-12'), - created_at: 2.minutes.ago, - updated_at: 2.minutes.ago, - state: 'merged') + @markdown = create( + :merge_request, + title: 'markdown', + source_project: project, + source_branch: 'markdown', + assignees: [user], + reviewers: [user, user2, user3, user4], + milestone: create(:milestone, project: project, due_date: '2013-12-12'), + created_at: 2.minutes.ago, + updated_at: 2.minutes.ago, + state: 'merged' + ) @markdown.metrics.update!(merged_at: 10.minutes.ago, latest_closed_at: 10.seconds.ago) - @merge_test = create(:merge_request, - title: 'merge-test', - source_project: project, - source_branch: 'merge-test', - created_at: 3.minutes.ago, - updated_at: 10.seconds.ago) + @merge_test = create( + :merge_request, + title: 'merge-test', + source_project: project, + source_branch: 'merge-test', + created_at: 3.minutes.ago, + updated_at: 10.seconds.ago + ) @merge_test.metrics.update!(merged_at: 10.seconds.ago, latest_closed_at: 10.seconds.ago) - @feature = create(:merge_request, - title: 'feature', - source_project: project, - source_branch: 'feautre', - created_at: 2.minutes.ago, - updated_at: 1.minute.ago, - state: 'merged') + @feature = create( + :merge_request, + title: 'feature', + source_project: project, + source_branch: 'feautre', + created_at: 2.minutes.ago, + updated_at: 1.minute.ago, + state: 'merged' + ) @feature.metrics.update!(merged_at: 10.seconds.ago, latest_closed_at: 10.minutes.ago) end @@ -134,8 +142,7 @@ RSpec.describe 'Merge requests > User lists merge requests', feature_category: : label = create(:label, project: project) create(:label_link, label: label, target: @fix) - visit_merge_requests(project, label_name: [label.name], - sort: sort_value_milestone) + visit_merge_requests(project, label_name: [label.name], sort: sort_value_milestone) expect(first_merge_request).to include('fix') expect(count_merge_requests).to eq(1) @@ -160,8 +167,7 @@ RSpec.describe 'Merge requests > User lists merge requests', feature_category: : end it 'sorts by milestone due date' do - visit_merge_requests(project, label_name: [label.name, label2.name], - sort: sort_value_milestone) + visit_merge_requests(project, label_name: [label.name, label2.name], sort: sort_value_milestone) expect(first_merge_request).to include('fix') expect(count_merge_requests).to eq(1) @@ -169,9 +175,12 @@ RSpec.describe 'Merge requests > User lists merge requests', feature_category: : context 'filter on assignee and' do it 'sorts by milestone due date' do - visit_merge_requests(project, label_name: [label.name, label2.name], - assignee_id: user.id, - sort: sort_value_milestone) + visit_merge_requests( + project, + label_name: [label.name, label2.name], + assignee_id: user.id, + sort: sort_value_milestone + ) expect(first_merge_request).to include('fix') expect(count_merge_requests).to eq(1) diff --git a/spec/features/merge_requests/user_views_open_merge_requests_spec.rb b/spec/features/merge_requests/user_views_open_merge_requests_spec.rb index 1a2024a5511..0021f701290 100644 --- a/spec/features/merge_requests/user_views_open_merge_requests_spec.rb +++ b/spec/features/merge_requests/user_views_open_merge_requests_spec.rb @@ -57,10 +57,12 @@ RSpec.describe 'User views open merge requests', feature_category: :code_review_ let!(:build) { create :ci_build, pipeline: pipeline } let(:merge_request) do - create(:merge_request_with_diffs, - source_project: project, - target_project: project, - source_branch: 'merge-test') + create( + :merge_request_with_diffs, + source_project: project, + target_project: project, + source_branch: 'merge-test' + ) end let(:pipeline) do diff --git a/spec/features/projects/compare_spec.rb b/spec/features/projects/compare_spec.rb index beb5fa7822b..eff538513c1 100644 --- a/spec/features/projects/compare_spec.rb +++ b/spec/features/projects/compare_spec.rb @@ -24,7 +24,7 @@ RSpec.describe "Compare", :js, feature_category: :groups_and_projects do click_button 'Compare' - expect(page).to have_content 'Commits' + expect(page).to have_content 'Commits on Source' expect(page).to have_link 'Create merge request' end end @@ -53,7 +53,7 @@ RSpec.describe "Compare", :js, feature_category: :groups_and_projects do select_using_dropdown('to', RepoHelpers.sample_commit.id, commit: true) click_button 'Compare' - expect(page).to have_content 'Commits (1)' + expect(page).to have_content 'Commits on Source (1)' expect(page).to have_content "Showing 2 changed files" diff = first('.js-unfold') @@ -85,7 +85,7 @@ RSpec.describe "Compare", :js, feature_category: :groups_and_projects do click_button 'Compare' - expect(page).to have_content 'Commits (1)' + expect(page).to have_content 'Commits on Source (1)' expect(page).to have_content 'Showing 1 changed file with 5 additions and 0 deletions' expect(page).to have_link 'View open merge request', href: project_merge_request_path(project, merge_request) expect(page).not_to have_link 'Create merge request' @@ -136,14 +136,14 @@ RSpec.describe "Compare", :js, feature_category: :groups_and_projects do visit project_compare_index_path(project, from: "feature", to: "master") click_button('Compare') - expect(page).to have_content 'Commits (29)' + expect(page).to have_content 'Commits on Source (29)' # go to the second page within(".files .gl-pagination") do click_on("2") end - expect(page).not_to have_content 'Commits (29)' + expect(page).not_to have_content 'Commits on Source (29)' end end end @@ -159,7 +159,7 @@ RSpec.describe "Compare", :js, feature_category: :groups_and_projects do expect(find(".js-compare-to-dropdown .gl-dropdown-button-text")).to have_content("v1.1.0") click_button "Compare" - expect(page).to have_content "Commits" + expect(page).to have_content "Commits on Source" end end |