gitlab-org--gitlab-foss/spec/support/protected_branch_helpers.rb
Oswaldo Ferreira 8f59ea33e7 Extract EE specific tests for protected branches/tags
We have the spec files containing EE specific code for
spec/features/protected_branches_spec.rb and
spec/features/protected_tags_spec.rb.
This commit deletes / extracts the CE part of it.
2019-04-25 13:06:06 -03:00

30 lines
811 B
Ruby

# frozen_string_literal: true
module ProtectedBranchHelpers
def set_allowed_to(operation, option = 'Maintainers', form: '.js-new-protected-branch')
within form do
select_elem = find(".js-allowed-to-#{operation}")
select_elem.click
wait_for_requests
within('.dropdown-content') do
Array(option).each { |opt| click_on(opt) }
end
# Enhanced select is used in EE, therefore an extra click is needed.
select_elem.click if select_elem['aria-expanded'] == 'true'
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
end