diff options
author | Mark Lapierre <mlapierre@gitlab.com> | 2019-06-18 03:33:13 +0000 |
---|---|---|
committer | Mark Lapierre <mlapierre@gitlab.com> | 2019-06-18 03:33:13 +0000 |
commit | 8ac1ac2b9f1d070eb70bb21e0aa18b421836a48f (patch) | |
tree | 6008878ddec05b44007cc77ed8f346c8573e81f3 /qa | |
parent | db9ef69272155b3c8ead5c0e7d027bda2b623d43 (diff) | |
parent | 6cfab44a58331691f9af57b7c6ad41898e1dfabe (diff) | |
download | gitlab-ce-8ac1ac2b9f1d070eb70bb21e0aa18b421836a48f.tar.gz |
Merge branch 'qa-create-merge-request-tests' into 'master'
Fixing an old quarantined test
Closes gitlab-org/quality/staging#50
See merge request gitlab-org/gitlab-ce!28643
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/page/merge_request/show.rb | 8 | ||||
-rw-r--r-- | qa/qa/resource/label.rb | 2 | ||||
-rw-r--r-- | qa/qa/resource/project_milestone.rb | 15 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb | 80 |
4 files changed, 59 insertions, 46 deletions
diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index 5aef868a805..6a415b56e50 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -111,6 +111,14 @@ module QA end end + def has_title?(title) + has_element?(:title, text: title) + end + + def has_description?(description) + has_element?(:description, text: description) + end + def merge! # The merge button is disabled on load wait do diff --git a/qa/qa/resource/label.rb b/qa/qa/resource/label.rb index 5a681a5fe9f..3750725c440 100644 --- a/qa/qa/resource/label.rb +++ b/qa/qa/resource/label.rb @@ -46,7 +46,7 @@ module QA end def api_post_path - "/projects/#{project}/labels" + "/projects/#{project.id}/labels" end def api_post_body diff --git a/qa/qa/resource/project_milestone.rb b/qa/qa/resource/project_milestone.rb index 8ace75f695a..70640eac095 100644 --- a/qa/qa/resource/project_milestone.rb +++ b/qa/qa/resource/project_milestone.rb @@ -31,6 +31,21 @@ module QA milestone_new.click_milestone_create_button end end + + def api_get_path + "/projects/#{project.id}/milestones/#{id}" + end + + def api_post_path + "/projects/#{project.id}/milestones" + end + + def api_post_body + { + description: @description, + title: @title + } + end end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb index cd1c7545944..6969f123f95 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb @@ -1,74 +1,64 @@ # frozen_string_literal: true module QA - # Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/50 - context 'Create', :quarantine do - describe 'Merge request creation' do - it 'user creates a new merge request', :smoke do + context 'Create' do + describe 'Create a new merge request' do + before do Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } + Page::Main::Login.perform(&:sign_in_using_credentials) - current_project = Resource::Project.fabricate! do |project| - project.name = 'project-with-merge-request' + @project = Resource::Project.fabricate_via_api! do |project| + project.name = 'project' end - merge_request_title = 'This is a merge request' - merge_request_description = 'Great feature' + @merge_request_title = 'One merge request to rule them all' + @merge_request_description = '... to find them, to bring them all, and in the darkness bind them' + end - Resource::MergeRequest.fabricate! do |merge_request| - merge_request.title = merge_request_title - merge_request.description = merge_request_description - merge_request.project = current_project + it 'creates a basic merge request', :smoke do + Resource::MergeRequest.fabricate_via_browser_ui! do |merge_request| + merge_request.project = @project + merge_request.title = @merge_request_title + merge_request.description = @merge_request_description end - expect(page).to have_content(merge_request_title) - expect(page).to have_content(merge_request_description) - expect(page).to have_content('Opened just now') + Page::MergeRequest::Show.perform do |merge_request| + expect(merge_request).to have_title(@merge_request_title) + expect(merge_request).to have_description(@merge_request_description) + end end - it 'user creates a new merge request with a milestone and label' do + it 'creates a merge request with a milestone and label' do gitlab_account_username = "@#{Runtime::User.username}" - Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.act { sign_in_using_credentials } - - current_project = Resource::Project.fabricate! do |project| - project.name = 'project-with-merge-request-and-milestone' - end - - current_milestone = Resource::ProjectMilestone.fabricate! do |milestone| - milestone.title = 'unique-milestone' - milestone.project = current_project + milestone = Resource::ProjectMilestone.fabricate_via_api! do |milestone| + milestone.project = @project + milestone.title = 'milestone' end - new_label = Resource::Label.fabricate_via_browser_ui! do |label| - label.project = current_project - label.title = 'qa-mr-test-label' - label.description = 'Merge Request label' + label = Resource::Label.fabricate_via_api! do |label| + label.project = @project + label.title = 'label' end - merge_request_title = 'This is a merge request with a milestone and a label' - merge_request_description = 'Great feature with milestone' - - Resource::MergeRequest.fabricate! do |merge_request| - merge_request.title = merge_request_title - merge_request.description = merge_request_description - merge_request.project = current_project - merge_request.milestone = current_milestone + Resource::MergeRequest.fabricate_via_browser_ui! do |merge_request| + merge_request.title = @merge_request_title + merge_request.description = @merge_request_description + merge_request.project = @project + merge_request.milestone = milestone merge_request.assignee = 'me' - merge_request.labels.push(new_label) + merge_request.labels.push(label) end Page::MergeRequest::Show.perform do |merge_request| - expect(merge_request).to have_content(merge_request_title) - expect(merge_request).to have_content(merge_request_description) - expect(merge_request).to have_content('Opened just now') + expect(merge_request).to have_title(@merge_request_title) + expect(merge_request).to have_description(@merge_request_description) expect(merge_request).to have_assignee(gitlab_account_username) - expect(merge_request).to have_label(new_label.title) + expect(merge_request).to have_label(label.title) end Page::Issuable::Sidebar.perform do |sidebar| - expect(sidebar).to have_milestone(current_milestone.title) + expect(sidebar).to have_milestone(milestone.title) end end end |