Commit 28fdda78 authored by Dan Davison's avatar Dan Davison

Merge branch 'ml-update-approval-rules-e2e-test' into 'master'

Update approval rules page objects

See merge request gitlab-org/gitlab!74969
parents 108a1a40 0c590fed
......@@ -638,6 +638,7 @@ export default {
:state="isValidApprovers"
:invalid-feedback="invalidApprovers"
data-testid="approvers-group"
data-qa-selector="member_select_field"
>
<approvers-select
v-model="approversToAdd"
......@@ -645,7 +646,6 @@ export default {
:skip-user-ids="userIds"
:skip-group-ids="groupIds"
:is-invalid="!isValidApprovers"
data-qa-selector="member_select_field"
/>
</gl-form-group>
<div class="bordered-box overflow-auto h-12em">
......
......@@ -24,6 +24,9 @@ module QA
end
def add_approval_rules(rules)
# The Approval rules button/link is a gitlab-ui component that doesn't have a QA selector
click_button('Approval rules')
rules.each do |rule|
click_element :add_approvers_button
......@@ -48,7 +51,7 @@ module QA
# add a data attribute to the 'Ok' button without overriding it
# So we break the rules and use a CSS selector instead of an element
def click_approvers_modal_ok_button
find("#mr-edit-approvals-create-modal footer button.btn-success").click
find("#mr-edit-approvals-create-modal footer button.btn-confirm").click
end
# Select2 is an external library, so we can't add our own selector
......
......@@ -89,7 +89,7 @@ module QA
end
def approved?
approvals_content =~ /Merge request approved/
approvals_content.include?('Approved by') && !approvals_content.match(/Requires \d+ approvals? from/)
end
def approvers
......@@ -209,7 +209,7 @@ module QA
end
def num_approvals_required
approvals_content.match(/Requires (\d+) more approvals/)[1].to_i
approvals_content.match(/Requires (\d+) approvals/)[1].to_i
end
def skip_merge_train_and_merge_immediately
......@@ -243,17 +243,17 @@ module QA
# for it to include terms from content we expect. The kinds
# of content we expect are:
#
# * Requires X more approvals from Quality, UX, and frontend.
# * Merge request approved
# * Requires X approvals from Quality, UX, and frontend.
# * Approved by you and others
#
# It can also briefly display cached data while loading so we
# wait for it to update first
sleep 1
text = nil
wait_until(reload: false) do
wait_until(reload: false, sleep_interval: 1) do
text = find_element(:approvals_summary_content).text
text =~ /Requires|approved/
text =~ /requires|approved/i
end
text
......
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