Skip to content
代码片段 群组 项目
未验证 提交 5da7be94 编辑于 作者: Jay McCure's avatar Jay McCure 提交者: GitLab
浏览文件

E2E tests: remove unnecessary code review tests

上级 777267e8
No related branches found
No related tags found
无相关合并请求
......@@ -2332,7 +2332,6 @@ Layout/LineLength:
- 'qa/qa/service/cluster_provider/k3s.rb'
- 'qa/qa/service/docker_run/gitlab_runner.rb'
- 'qa/qa/service/praefect_manager.rb'
- 'qa/qa/specs/features/api/3_create/merge_request/push_options_labels_spec.rb'
- 'qa/qa/specs/features/api/3_create/merge_request/push_options_mwps_spec.rb'
- 'qa/qa/specs/features/api/3_create/repository/files_spec.rb'
- 'qa/qa/specs/features/api/3_create/repository/push_postreceive_idempotent_spec.rb'
......@@ -2344,9 +2343,7 @@ Layout/LineLength:
- 'qa/qa/specs/features/browser_ui/2_plan/issue/export_as_csv_spec.rb'
- 'qa/qa/specs/features/browser_ui/2_plan/issue/issue_suggestions_spec.rb'
- 'qa/qa/specs/features/browser_ui/2_plan/related_issues/related_issues_spec.rb'
- 'qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_via_template_spec.rb'
- 'qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb'
- 'qa/qa/specs/features/browser_ui/3_create/merge_request/squash_merge_request_spec.rb'
- 'qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_diff_patch_spec.rb'
- 'qa/qa/specs/features/browser_ui/3_create/repository/branch_with_unusual_name_spec.rb'
- 'qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb'
......
......@@ -8,11 +8,13 @@ module QA
# git config --global receive.advertisepushoptions true
let(:branch) { "push-options-test-#{SecureRandom.hex(8)}" }
let(:target_branch) { create(:branch, name: "push-options-test-target-#{SecureRandom.hex(8)}", project: project) }
let(:title) { "MR push options test #{SecureRandom.hex(8)}" }
let(:commit_message) { 'Add README.md' }
let(:project) { create(:project, :with_readme) }
let(:description) { "This is a test of MR push options" }
def create_new_mr_via_push
before do
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.commit_message = commit_message
......@@ -20,47 +22,47 @@ def create_new_mr_via_push
push.merge_request_push_options = {
create: true,
title: title,
label: %w[one two three]
label: %w[one two three],
target: target_branch.name,
description: description
}
end
end
it 'sets labels', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347839' do
create_new_mr_via_push
it 'sets merge request details', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347839' do
merge_request = project.merge_request_with_title(title)
expect(merge_request).not_to be_nil, "There was a problem creating the merge request"
expect(merge_request[:labels]).to include('one').and include('two').and include('three')
aggregate_failures do
expect(merge_request).not_to be_nil, "There was a problem creating the merge request"
expect(merge_request[:labels]).to include('one').and include('two').and include('three')
expect(merge_request[:target_branch]).to eq(target_branch.name)
expect(merge_request[:title]).to eq(title)
expect(merge_request[:description]).to eq(description)
end
end
context 'when labels are set already' do
before do
create_new_mr_via_push
it 'removes labels on subsequent push',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347840' do
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.file_content = "Unlabel test #{SecureRandom.hex(8)}"
push.commit_message = commit_message
push.branch_name = branch
push.new_branch = false
push.merge_request_push_options = {
title: title,
unlabel: %w[one three]
}
end
it 'removes them on subsequent push', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347840' do
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.file_content = "Unlabel test #{SecureRandom.hex(8)}"
push.commit_message = commit_message
push.branch_name = branch
push.new_branch = false
push.merge_request_push_options = {
title: title,
unlabel: %w[one three]
}
end
merge_request = project.merge_request_with_title(title)
merge_request = project.merge_request_with_title(title)
expect(merge_request).not_to be_nil, "There was a problem creating the merge request"
expect(merge_request).not_to be_nil, "There was a problem creating the merge request"
aggregate_failures do
expect(merge_request[:labels]).to include('two')
expect(merge_request[:labels]).not_to include('one')
expect(merge_request[:labels]).not_to include('three')
end
aggregate_failures do
expect(merge_request[:labels]).to include('two')
expect(merge_request[:labels]).not_to include('one')
expect(merge_request[:labels]).not_to include('three')
end
end
end
......
# frozen_string_literal: true
module QA
RSpec.describe 'Create' do
describe 'Merge request push options', :smoke, product_group: :code_review do
# If run locally on GDK, push options need to be enabled on the host with the following command:
#
# git config --global receive.advertisepushoptions true
let(:title) { "MR push options test #{SecureRandom.hex(8)}" }
let(:project) { create(:project, :with_readme, name: 'merge-request-push-options') }
it 'sets a target branch', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347726' do
target_branch = "push-options-test-target-#{SecureRandom.hex(8)}"
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.branch_name = target_branch
push.file_content = "Target branch test target branch #{SecureRandom.hex(8)}"
end
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.branch_name = "push-options-test-#{SecureRandom.hex(8)}"
push.file_content = "Target branch test source branch #{SecureRandom.hex(8)}"
push.merge_request_push_options = {
create: true,
title: title,
target: target_branch
}
end
merge_request = project.merge_request_with_title(title)
expect(merge_request).not_to be_nil, "There was a problem creating the merge request"
expect(merge_request[:target_branch]).to eq(target_branch)
merge_request = create(:merge_request, project: project, iid: merge_request[:iid]).merge_via_api!
expect(merge_request[:state]).to eq('merged')
end
end
end
end
# frozen_string_literal: true
module QA
RSpec.describe 'Create' do
describe 'Merge request push options', :smoke, product_group: :code_review do
# If run locally on GDK, push options need to be enabled on the host with the following command:
#
# git config --global receive.advertisepushoptions true
let(:project) { create(:project, :with_readme, name: 'merge-request-push-options') }
it 'sets title and description', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347844' do
description = "This is a test of MR push options"
title = "MR push options test #{SecureRandom.hex(8)}"
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.branch_name = "push-options-test-#{SecureRandom.hex(8)}"
push.merge_request_push_options = {
create: true,
title: title,
description: description
}
end
merge_request = project.merge_request_with_title(title)
expect(merge_request).not_to be_nil, "There was a problem creating the merge request"
aggregate_failures do
expect(merge_request[:title]).to eq(title)
expect(merge_request[:description]).to eq(description)
end
merge_request = create(:merge_request, project: project, iid: merge_request[:iid]).merge_via_api!
expect(merge_request[:state]).to eq('merged')
end
end
end
end
......@@ -8,7 +8,8 @@ module QA
create(:merge_request, title: 'This is a merge request', description: 'Great feature', project: project)
end
it 'user submits a non-diff review', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347777' do
it 'user submits a non-diff review',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347777' do
Flow::Login.sign_in
merge_request.visit!
......
# frozen_string_literal: true
module QA
RSpec.describe 'Create', product_group: :code_review do
describe 'Merge request custom templates' do
let(:template_name) { 'custom_merge_request_template' }
let(:template_content) { 'This is a custom merge request template test' }
let(:template_project) { create(:project, :with_readme, name: 'custom-mr-template-project') }
let(:merge_request_title) { 'One merge request to rule them all' }
before do
Flow::Login.sign_in
create(:commit, project: template_project, commit_message: 'Add custom merge request template', actions: [
{
action: 'create',
file_path: ".gitlab/merge_request_templates/#{template_name}.md",
content: template_content
}
])
end
it 'creates a merge request via custom template', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347722' do
Resource::MergeRequest.fabricate_via_browser_ui! do |merge_request|
merge_request.project = template_project
merge_request.title = merge_request_title
merge_request.template = template_name
merge_request.target_new_branch = false
end
Page::MergeRequest::Show.perform do |merge_request|
expect(merge_request).to have_title(merge_request_title)
expect(merge_request).to have_description(template_content)
end
end
end
end
end
# frozen_string_literal: true
module QA
RSpec.describe 'Create' do
describe 'Merge request squashing', product_group: :code_review do
let(:project) { create(:project, name: 'squash-before-merge') }
let(:merge_request) { create(:merge_request, project: project, title: 'Squashing commits') }
before do
Flow::Login.sign_in
# Since the test immediately navigates to the MR after pushing a commit,
# the MR is blocked for 10 seconds
# https://gitlab.com/gitlab-org/gitlab/-/issues/431984
project.update_approval_configuration(reset_approvals_on_push: false)
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.commit_message = 'to be squashed'
push.branch_name = merge_request.source_branch
push.new_branch = false
push.file_name = 'other.txt'
push.file_content = "Test with unicode characters ❤✓€❄"
end
merge_request.visit!
end
it 'user squashes commits while merging', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347744' do
Page::MergeRequest::Show.perform do |merge_request_page|
merge_request_page.retry_on_exception(reload: true) do
expect(merge_request_page).to have_text('to be squashed')
end
merge_request_page.mark_to_squash
merge_request_page.merge!
Git::Repository.perform do |repository|
repository.uri = project.repository_http_location.uri
repository.use_default_credentials
repository.clone
expect(repository.commits.size).to eq(3), "Expected 3 commits, got: #{repository.commits.size}"
end
end
end
end
end
end
......@@ -144,7 +144,7 @@
end
end
context 'user creates a merge request using templates' do
context 'user applies template to a merge request' do
let(:template_content) { 'this is a test "feature-proposal" template' }
let(:bug_template_content) { 'this is merge request bug template' }
let(:template_override_warning) { 'Applying a template will replace the existing issue description.' }
......@@ -164,42 +164,62 @@
bug_template_content,
message: 'added merge request bug template',
branch_name: 'master')
visit edit_project_merge_request_path project, merge_request
fill_in :'merge_request[title]', with: 'test merge request title'
end
it 'user selects "feature-proposal" template' do
select_template 'feature-proposal'
wait_for_requests
assert_template
save_changes
end
context 'changes template' do
context 'creating merge request' do
before do
select_template 'bug'
wait_for_requests
fill_in :'merge_request[description]', with: updated_description
select_template 'feature-proposal'
expect(page).to have_content template_override_warning
visit project_new_merge_request_path(project, merge_request: { source_branch: 'feature' })
end
it 'user selects "bug" template, then updates description, then selects "feature-proposal" template, then cancels template change' do
page.find('.js-template-warning .js-close-btn.js-cancel-btn').click
expect(find('textarea')['value']).to eq(updated_description)
expect(page).not_to have_content template_override_warning
it 'user selects "feature-proposal" template' do
select_template 'feature-proposal'
click_button 'Apply template'
wait_for_requests
click_button 'Create merge request'
wait_for_requests
expect(find('.description')).to have_content template_content
end
end
it 'user selects "bug" template, then updates description, then selects "feature-proposal" template, then dismiss the template warning' do
page.find('.js-template-warning .js-close-btn.js-dismiss-btn').click
expect(find('textarea')['value']).to eq(updated_description)
expect(page).not_to have_content template_override_warning
context 'editing merge request' do
before do
visit edit_project_merge_request_path project, merge_request
fill_in :'merge_request[title]', with: 'test merge request title'
end
it 'user selects "bug" template, then updates description, then selects "feature-proposal" template, then applies template change' do
page.find('.js-template-warning .js-override-template').click
it 'user selects "feature-proposal" template for existing merge request' do
select_template 'feature-proposal'
wait_for_requests
assert_template
save_changes
end
context 'changes template' do
before do
select_template 'bug'
wait_for_requests
fill_in :'merge_request[description]', with: updated_description
select_template 'feature-proposal'
expect(page).to have_content template_override_warning
end
it 'user selects "bug" template, then updates description, then selects "feature-proposal" template, then cancels template change' do
page.find('.js-template-warning .js-close-btn.js-cancel-btn').click
expect(find('textarea')['value']).to eq(updated_description)
expect(page).not_to have_content template_override_warning
end
it 'user selects "bug" template, then updates description, then selects "feature-proposal" template, then dismiss the template warning' do
page.find('.js-template-warning .js-close-btn.js-dismiss-btn').click
expect(find('textarea')['value']).to eq(updated_description)
expect(page).not_to have_content template_override_warning
end
it 'user selects "bug" template, then updates description, then selects "feature-proposal" template, then applies template change' do
page.find('.js-template-warning .js-override-template').click
wait_for_requests
assert_template
end
end
end
end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册