diff options
author | Mark Lapierre <mlapierre@gitlab.com> | 2019-01-17 09:08:19 -0500 |
---|---|---|
committer | Mark Lapierre <mlapierre@gitlab.com> | 2019-01-17 09:20:39 -0500 |
commit | bc4ba8d4dc0f87a6cd40c28ad49d43f772a514f7 (patch) | |
tree | b147dfe00aad7c8a326a98a2b078310c39f29efd /qa | |
parent | 1d22498251fd728246611be7dd1a19adadbafae6 (diff) | |
download | gitlab-ce-bc4ba8d4dc0f87a6cd40c28ad49d43f772a514f7.tar.gz |
Update merge fork test
Now that Resources don't share attributes, Fork doesn't have Project
attributes. That caused the merge fork test to fail because it no
longer had access to repository_http_location via Fork. Rather than
give Fork Project attributes directly, we add a project attribute to
Fork and populate it via the API at the end of the fabricate! method
after the fork has been created via the UI.
We also update the merge fork test to be slightly more concise and
consistent with newer tests by using perform with proc coercion
instead of act or perform with the full block syntax.
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/resource/fork.rb | 9 | ||||
-rw-r--r-- | qa/qa/resource/merge_request_from_fork.rb | 2 | ||||
-rw-r--r-- | qa/qa/resource/project.rb | 12 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb | 8 |
4 files changed, 25 insertions, 6 deletions
diff --git a/qa/qa/resource/fork.rb b/qa/qa/resource/fork.rb index 9fd66f3a36a..c6243ff43fa 100644 --- a/qa/qa/resource/fork.rb +++ b/qa/qa/resource/fork.rb @@ -3,6 +3,13 @@ module QA module Resource class Fork < Base + attribute :project do + Resource::Project.fabricate! do |resource| + resource.name = push.project.name + resource.path_with_namespace = "#{user.name}/#{push.project.name}" + end + end + attribute :push do Repository::ProjectPush.fabricate! end @@ -37,6 +44,8 @@ module QA Page::Layout::Banner.perform do |page| page.has_notice?('The project was successfully forked.') end + + populate(:project) end end end diff --git a/qa/qa/resource/merge_request_from_fork.rb b/qa/qa/resource/merge_request_from_fork.rb index f91ae299d76..5d20a6e9c75 100644 --- a/qa/qa/resource/merge_request_from_fork.rb +++ b/qa/qa/resource/merge_request_from_fork.rb @@ -11,7 +11,7 @@ module QA attribute :push do Repository::ProjectPush.fabricate! do |resource| - resource.project = fork + resource.project = fork.project resource.branch_name = fork_branch resource.file_name = 'file2.txt' resource.user = fork.user diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb index 1fafbf5d73e..433e5a8f7c9 100644 --- a/qa/qa/resource/project.rb +++ b/qa/qa/resource/project.rb @@ -12,6 +12,10 @@ module QA Group.fabricate! end + attribute :path_with_namespace do + "#{group.sandbox.path}/#{group.path}/#{name}" if group + end + attribute :repository_ssh_location do Page::Project::Show.perform do |page| page.repository_clone_ssh_location @@ -46,8 +50,14 @@ module QA end end + def fabricate_via_api! + resource_web_url(api_get) + rescue ResourceNotFoundError + super + end + def api_get_path - "/projects/#{name}" + "/projects/#{CGI.escape(path_with_namespace)}" end def api_post_path diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb index 6dcd74471fe..6ca7af8a3af 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb @@ -5,18 +5,18 @@ module QA describe 'Merge request creation from fork' do it 'user forks a project, submits a merge request and maintainer merges it' do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } + Page::Main::Login.perform(&:sign_in_using_credentials) merge_request = Resource::MergeRequestFromFork.fabricate! do |merge_request| merge_request.fork_branch = 'feature-branch' end - Page::Main::Menu.perform { |main| main.sign_out } - Page::Main::Login.perform { |login| login.sign_in_using_credentials } + Page::Main::Menu.perform(&:sign_out) + Page::Main::Login.perform(&:sign_in_using_credentials) merge_request.visit! - Page::MergeRequest::Show.perform { |show| show.merge! } + Page::MergeRequest::Show.perform(&:merge!) expect(page).to have_content('The changes were merged') end |