diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index 71c2aa2d0b3f7badba44cfec00275da2c6b58fcd..fc2494b24730a506bcec77974c15a03f5741c9fe 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -311,13 +311,14 @@ def merged? end end - # Check if the MR is able to be merged - # Waits up 10 seconds and returns false if the MR can't be merged - def mergeable? - # The merge button is enabled via JS, but `has_element?` calls - # `wait_for_requests`, which should ensure the disabled/enabled - # state of the element is reliable - has_element?(:merge_button, disabled: false) + RSpec::Matchers.define :be_mergeable do + match do |page| + page.has_element?(:merge_button, disabled: false) + end + + match_when_negated do |page| + page.has_no_element?(:merge_button, disabled: false) + end end # Waits up 10 seconds and returns false if the Revert button is not enabled