Commit 0c590fed authored by Mark Lapierre's avatar Mark Lapierre

Update approval rules page objects

This addresses some UI changes since the approval rules
e2e test was put in quarantine.
parent e8f11cc0
...@@ -638,6 +638,7 @@ export default { ...@@ -638,6 +638,7 @@ export default {
:state="isValidApprovers" :state="isValidApprovers"
:invalid-feedback="invalidApprovers" :invalid-feedback="invalidApprovers"
data-testid="approvers-group" data-testid="approvers-group"
data-qa-selector="member_select_field"
> >
<approvers-select <approvers-select
v-model="approversToAdd" v-model="approversToAdd"
...@@ -645,7 +646,6 @@ export default { ...@@ -645,7 +646,6 @@ export default {
:skip-user-ids="userIds" :skip-user-ids="userIds"
:skip-group-ids="groupIds" :skip-group-ids="groupIds"
:is-invalid="!isValidApprovers" :is-invalid="!isValidApprovers"
data-qa-selector="member_select_field"
/> />
</gl-form-group> </gl-form-group>
<div class="bordered-box overflow-auto h-12em"> <div class="bordered-box overflow-auto h-12em">
......
...@@ -24,6 +24,9 @@ module QA ...@@ -24,6 +24,9 @@ module QA
end end
def add_approval_rules(rules) 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| rules.each do |rule|
click_element :add_approvers_button click_element :add_approvers_button
...@@ -48,7 +51,7 @@ module QA ...@@ -48,7 +51,7 @@ module QA
# add a data attribute to the 'Ok' button without overriding it # 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 # So we break the rules and use a CSS selector instead of an element
def click_approvers_modal_ok_button 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 end
# Select2 is an external library, so we can't add our own selector # Select2 is an external library, so we can't add our own selector
......
...@@ -89,7 +89,7 @@ module QA ...@@ -89,7 +89,7 @@ module QA
end end
def approved? def approved?
approvals_content =~ /Merge request approved/ approvals_content.include?('Approved by') && !approvals_content.match(/Requires \d+ approvals? from/)
end end
def approvers def approvers
...@@ -209,7 +209,7 @@ module QA ...@@ -209,7 +209,7 @@ module QA
end end
def num_approvals_required def num_approvals_required
approvals_content.match(/Requires (\d+) more approvals/)[1].to_i approvals_content.match(/Requires (\d+) approvals/)[1].to_i
end end
def skip_merge_train_and_merge_immediately def skip_merge_train_and_merge_immediately
...@@ -243,17 +243,17 @@ module QA ...@@ -243,17 +243,17 @@ module QA
# for it to include terms from content we expect. The kinds # for it to include terms from content we expect. The kinds
# of content we expect are: # of content we expect are:
# #
# * Requires X more approvals from Quality, UX, and frontend. # * Requires X approvals from Quality, UX, and frontend.
# * Merge request approved # * Approved by you and others
# #
# It can also briefly display cached data while loading so we # It can also briefly display cached data while loading so we
# wait for it to update first # wait for it to update first
sleep 1 sleep 1
text = nil text = nil
wait_until(reload: false) do wait_until(reload: false, sleep_interval: 1) do
text = find_element(:approvals_summary_content).text text = find_element(:approvals_summary_content).text
text =~ /Requires|approved/ text =~ /requires|approved/i
end end
text 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