Commit 2cae176d authored by Tomislav Nikić's avatar Tomislav Nikić Committed by Mark Lapierre

Fixing a fork based merge request test

parent 4fc1e318
...@@ -14,6 +14,7 @@ module QA ...@@ -14,6 +14,7 @@ module QA
resource.add_name_uuid = false resource.add_name_uuid = false
resource.name = name resource.name = name
resource.path_with_namespace = "#{user.username}/#{name}" resource.path_with_namespace = "#{user.username}/#{name}"
resource.api_client = @api_client
end end
end end
...@@ -69,6 +70,12 @@ module QA ...@@ -69,6 +70,12 @@ module QA
populate(:project) populate(:project)
end end
def remove_via_api!
project.remove_via_api!
upstream.remove_via_api!
user.remove_via_api! unless Specs::Helpers::ContextSelector.dot_com?
end
def api_get_path def api_get_path
"/projects/#{CGI.escape(path_with_namespace)}" "/projects/#{CGI.escape(path_with_namespace)}"
end end
......
...@@ -6,7 +6,7 @@ module QA ...@@ -6,7 +6,7 @@ module QA
attr_accessor :fork_branch attr_accessor :fork_branch
attribute :fork do attribute :fork do
Fork.fabricate_via_browser_ui! Fork.fabricate_via_api!
end end
attribute :push do attribute :push do
...@@ -23,8 +23,15 @@ module QA ...@@ -23,8 +23,15 @@ module QA
fork.project.visit! fork.project.visit!
Page::Project::Show.perform(&:new_merge_request) mr_url = Flow::Login.while_signed_in(as: fork.user) do
Page::MergeRequest::New.perform(&:create_merge_request) Page::Project::Show.perform(&:new_merge_request)
Page::MergeRequest::New.perform(&:create_merge_request)
current_url
end
Flow::Login.sign_in
visit(mr_url)
end end
def fabricate_via_api! def fabricate_via_api!
......
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
RSpec.describe 'Create', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/332588', type: :investigating } do RSpec.describe 'Create' do
describe 'Merge request creation from fork' do describe 'Merge request creation from fork' do
# TODO: Please add this back to :smoke suite as soon as https://gitlab.com/gitlab-org/gitlab/-/issues/332588 is addressed let(:merge_request) do
it 'can merge feature branch fork to mainline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1305' do Resource::MergeRequestFromFork.fabricate_via_browser_ui! do |merge_request|
merge_request = Resource::MergeRequestFromFork.fabricate_via_browser_ui! do |merge_request|
merge_request.fork_branch = 'feature-branch' merge_request.fork_branch = 'feature-branch'
end end
end
before do
Flow::Login.sign_in
end
Flow::Login.while_signed_in do after do
merge_request.visit! merge_request.fork.remove_via_api!
end
it 'can merge feature branch fork to mainline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1305' do
merge_request.visit!
Page::MergeRequest::Show.perform do |merge_request| Page::MergeRequest::Show.perform do |merge_request|
merge_request.merge! merge_request.merge!
expect(merge_request).to have_content('The changes were merged') expect(merge_request).to be_merged
end
end end
end end
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