Commit 8f8219e8 authored by Anastasia McDonald's avatar Anastasia McDonald

Merge branch 'ml-fix-transient-mwps-test' into 'master'

Wait longer for MWPS and simplify test logic

See merge request gitlab-org/gitlab!80455
parents cfe9ec8e 0e142a20
...@@ -42,7 +42,7 @@ module QA ...@@ -42,7 +42,7 @@ module QA
content: <<~EOF content: <<~EOF
test: test:
tags: ["runner-for-#{project.name}"] tags: ["runner-for-#{project.name}"]
script: sleep 20 script: sleep 30
only: only:
- merge_requests - merge_requests
EOF EOF
...@@ -91,7 +91,7 @@ module QA ...@@ -91,7 +91,7 @@ module QA
end end
Page::MergeRequest::Show.perform do |mr| Page::MergeRequest::Show.perform do |mr|
refresh mr.refresh
# Part of the challenge with this test is that the MR widget has many components that could be displayed # Part of the challenge with this test is that the MR widget has many components that could be displayed
# and many errors states that those components could encounter. Most of the time few of those # and many errors states that those components could encounter. Most of the time few of those
...@@ -104,15 +104,14 @@ module QA ...@@ -104,15 +104,14 @@ module QA
mr.retry_until(reload: true, message: 'Wait until ready to click MWPS') do mr.retry_until(reload: true, message: 'Wait until ready to click MWPS') do
merge_request.reload! merge_request.reload!
# Don't try to click MWPS if the MR is merged or the pipeline is complete # Click the MWPS button if we can
break if merge_request.state == 'merged' || mr.wait_until { project.pipelines.last }[:status] == 'success' break mr.merge_when_pipeline_succeeds! if mr.has_element?(:merge_button, text: 'Merge when pipeline succeeds')
# Try to click MWPS if this is a transient test, or if the MWPS button is visible, # But fail if the button is missing because the pipeline is complete
# otherwise reload the page and retry raise "The pipeline already finished before we could click MWPS" if mr.wait_until { project.pipelines.first }[:status] == 'success'
next false unless transient_test || mr.has_element?(:merge_button, text: 'Merge when pipeline succeeds')
# No need to keep retrying if we can click MWPS # Otherwise, if this is not a transient test reload the page and retry
break mr.merge_when_pipeline_succeeds! next false unless transient_test
end end
aggregate_failures do aggregate_failures do
......
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