Commit ec326ecf authored by Ramya Authappan's avatar Ramya Authappan

Merge branch 'qa-ml-approval-rules-tests' into 'master'

CE backport of EE MR approvals E2E test

See merge request gitlab-org/gitlab-ce!32439
parents 5b28b44f 88b727d7
......@@ -167,6 +167,18 @@ There are two supported methods of defining elements within a view.
Any existing `.qa-selector` class should be considered deprecated
and we should prefer the `data-qa-selector` method of definition.
### Exceptions
In some cases it might not be possible or worthwhile to add a selector.
Some UI components use external libraries, including some maintained by third parties.
Even if a library is maintained by GitLab, the selector sanity test only runs
on code within the GitLab project, so it's not possible to specify the path for
the view for code in a library.
In such rare cases it's reasonable to use CSS selectors in page object methods,
with a comment explaining why an `element` can't be added.
## Running the test locally
During development, you can run the `qa:selectors` test by running
......
......@@ -61,6 +61,10 @@ module QA
end
end
def sign_out_if_signed_in
sign_out if has_personal_area?(wait: 0)
end
def click_settings_link
retry_until(reload: false) do
within_user_menu do
......
......@@ -64,3 +64,5 @@ module QA
end
end
end
QA::Page::MergeRequest::New.prepend_if_ee('QA::EE::Page::MergeRequest::New')
......@@ -10,6 +10,7 @@ module QA
end
attribute :id
attribute :name
def initialize
@path = Runtime::Namespace.name
......@@ -47,6 +48,11 @@ module QA
super
end
def add_member(user, access_level = '30')
# 30 = developer access
post Runtime::API::Request.new(api_client, api_members_path).url, { user_id: user.id, access_level: access_level }
end
def api_get_path
"/groups/#{CGI.escape("#{sandbox.path}/#{path}")}"
end
......
......@@ -5,7 +5,8 @@ require 'securerandom'
module QA
module Resource
class MergeRequest < Base
attr_accessor :id,
attr_accessor :approval_rules,
:id,
:title,
:description,
:source_branch,
......@@ -46,6 +47,7 @@ module QA
end
def initialize
@approval_rules = nil
@title = 'QA test - merge request'
@description = 'This is a test merge request'
@source_branch = "qa-test-feature-#{SecureRandom.hex(8)}"
......@@ -63,16 +65,17 @@ module QA
project.visit!
Page::Project::Show.perform(&:new_merge_request)
Page::MergeRequest::New.perform do |page|
page.fill_title(@title)
page.fill_description(@description)
page.choose_milestone(@milestone) if @milestone
page.assign_to_me if @assignee == 'me'
Page::MergeRequest::New.perform do |new|
new.fill_title(@title)
new.fill_description(@description)
new.choose_milestone(@milestone) if @milestone
new.assign_to_me if @assignee == 'me'
labels.each do |label|
page.select_label(label)
new.select_label(label)
end
new.add_approval_rules(approval_rules) if approval_rules
page.create_merge_request
new.create_merge_request
end
end
......
......@@ -75,6 +75,11 @@ module QA
super
end
def add_member(user, access_level = '30')
# 30 = developer access
post Runtime::API::Request.new(api_client, api_members_path).url, { user_id: user.id, access_level: access_level }
end
def api_get_path
"/projects/#{CGI.escape(path_with_namespace)}"
end
......@@ -83,6 +88,10 @@ module QA
"#{api_get_path}/repository/archive.#{type}"
end
def api_members_path
"#{api_get_path}/members"
end
def api_post_path
'/projects'
end
......
......@@ -9,6 +9,7 @@ module QA
attr_writer :username, :password
attr_accessor :provider, :extern_uid
attribute :id
attribute :name
attribute :email
......
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