debian-mirror-gitlab/spec/support/protected_branch_helpers.rb

39 lines
973 B
Ruby
Raw Normal View History

2019-07-31 22:56:46 +05:30
# frozen_string_literal: true
module ProtectedBranchHelpers
def set_allowed_to(operation, option = 'Maintainers', form: '.js-new-protected-branch')
2023-07-09 08:55:56 +05:30
within(form) do
within_select(".js-allowed-to-#{operation}") do
2019-07-31 22:56:46 +05:30
Array(option).each { |opt| click_on(opt) }
end
end
end
def set_protected_branch_name(branch_name)
find('.js-protected-branch-select').click
find('.dropdown-input-field').set(branch_name)
click_on("Create wildcard #{branch_name}")
end
def set_defaults
set_allowed_to('merge')
set_allowed_to('push')
end
2020-10-24 23:57:45 +05:30
def click_on_protect
click_on "Protect"
wait_for_requests
end
2023-07-09 08:55:56 +05:30
def within_select(selector, &block)
select_input = find(selector)
select_input.click
wait_for_requests
within('.dropdown.show .dropdown-menu', &block)
# Enhanced select is used in EE, therefore an extra click is needed.
select_input.click if select_input['aria-expanded'] == 'true'
end
2019-07-31 22:56:46 +05:30
end