diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index 4ec8cf27c765223a3d78eeee5c464620152e9518..fc1ccddb3f3ce3e96638f67c4e08fc272f78b2d7 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -310,13 +310,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