Commit 103a631b authored by Tomislav Nikic's avatar Tomislav Nikic

Created a refreshed create merge request suite

Created a refreshed test suite using api to improve speed.
This was done by adding qa tags to the merge request view.
parent 5eff8dd1
.detail-page-description .detail-page-description
%h2.title %h2.title.qa-title
= markdown_field(@merge_request, :title) = markdown_field(@merge_request, :title)
%div %div
- if @merge_request.description.present? - if @merge_request.description.present?
.description{ class: can?(current_user, :update_merge_request, @merge_request) ? 'js-task-list-container' : '' } .description.qa-description{ class: can?(current_user, :update_merge_request, @merge_request) ? 'js-task-list-container' : '' }
.md .md
= markdown_field(@merge_request, :description) = markdown_field(@merge_request, :description)
%textarea.hidden.js-task-list-field %textarea.hidden.js-task-list-field
......
...@@ -111,6 +111,14 @@ module QA ...@@ -111,6 +111,14 @@ module QA
end end
end end
def has_title?(title)
has_element?(:title, text: title)
end
def has_description?(description)
has_element?(:description, text: description)
end
def merge! def merge!
# The merge button is disabled on load # The merge button is disabled on load
wait do wait do
......
...@@ -46,7 +46,7 @@ module QA ...@@ -46,7 +46,7 @@ module QA
end end
def api_post_path def api_post_path
"/projects/#{project}/labels" "/projects/#{project.id}/labels"
end end
def api_post_body def api_post_body
......
...@@ -31,6 +31,21 @@ module QA ...@@ -31,6 +31,21 @@ module QA
milestone_new.click_milestone_create_button milestone_new.click_milestone_create_button
end end
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 end
end end
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
# Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/50 context 'Create' do
context 'Create', :quarantine do describe 'Create a new merge request' do
describe 'Merge request creation' do before do
it 'user creates a new merge request', :smoke do
Runtime::Browser.visit(:gitlab, Page::Main::Login) 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 = Resource::Project.fabricate_via_api! do |project|
project.name = 'project-with-merge-request' project.name = 'project'
end end
merge_request_title = 'This is a merge request' @merge_request_title = 'One merge request to rule them all'
merge_request_description = 'Great feature' @merge_request_description = '... to find them, to bring them all, and in the darkness bind them'
end
Resource::MergeRequest.fabricate! do |merge_request| it 'creates a basic merge request', :smoke do
merge_request.title = merge_request_title Resource::MergeRequest.fabricate_via_browser_ui! do |merge_request|
merge_request.description = merge_request_description merge_request.project = @project
merge_request.project = current_project merge_request.title = @merge_request_title
merge_request.description = @merge_request_description
end end
expect(page).to have_content(merge_request_title) Page::MergeRequest::Show.perform do |merge_request|
expect(page).to have_content(merge_request_description) expect(merge_request).to have_title(@merge_request_title)
expect(page).to have_content('Opened just now') expect(merge_request).to have_description(@merge_request_description)
end
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}" gitlab_account_username = "@#{Runtime::User.username}"
Runtime::Browser.visit(:gitlab, Page::Main::Login) milestone = Resource::ProjectMilestone.fabricate_via_api! do |milestone|
Page::Main::Login.act { sign_in_using_credentials } milestone.project = @project
milestone.title = 'milestone'
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
end end
new_label = Resource::Label.fabricate_via_browser_ui! do |label| label = Resource::Label.fabricate_via_api! do |label|
label.project = current_project label.project = @project
label.title = 'qa-mr-test-label' label.title = 'label'
label.description = 'Merge Request label'
end end
merge_request_title = 'This is a merge request with a milestone and a label' Resource::MergeRequest.fabricate_via_browser_ui! do |merge_request|
merge_request_description = 'Great feature with milestone' merge_request.title = @merge_request_title
merge_request.description = @merge_request_description
Resource::MergeRequest.fabricate! do |merge_request| merge_request.project = @project
merge_request.title = merge_request_title merge_request.milestone = milestone
merge_request.description = merge_request_description
merge_request.project = current_project
merge_request.milestone = current_milestone
merge_request.assignee = 'me' merge_request.assignee = 'me'
merge_request.labels.push(new_label) merge_request.labels.push(label)
end end
Page::MergeRequest::Show.perform do |merge_request| Page::MergeRequest::Show.perform do |merge_request|
expect(merge_request).to have_content(merge_request_title) expect(merge_request).to have_title(@merge_request_title)
expect(merge_request).to have_content(merge_request_description) expect(merge_request).to have_description(@merge_request_description)
expect(merge_request).to have_content('Opened just now')
expect(merge_request).to have_assignee(gitlab_account_username) 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 end
Page::Issuable::Sidebar.perform do |sidebar| Page::Issuable::Sidebar.perform do |sidebar|
expect(sidebar).to have_milestone(current_milestone.title) expect(sidebar).to have_milestone(milestone.title)
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