Select everything so we could hit protect
Add missing QA selectors as well
This commit is contained in:
parent
c5f6c811ee
commit
9cc2123e47
|
@ -1,8 +1,8 @@
|
||||||
- content_for :merge_access_levels do
|
- content_for :merge_access_levels do
|
||||||
.merge_access_levels-container
|
.merge_access_levels-container
|
||||||
= dropdown_tag('Select',
|
= dropdown_tag('Select',
|
||||||
options: { toggle_class: 'js-allowed-to-merge wide',
|
options: { toggle_class: 'js-allowed-to-merge qa-allowed-to-merge-select wide',
|
||||||
dropdown_class: 'dropdown-menu-selectable capitalize-header',
|
dropdown_class: 'dropdown-menu-selectable qa-allowed-to-merge-dropdown capitalize-header',
|
||||||
data: { field_name: 'protected_branch[merge_access_levels_attributes][0][access_level]', input_id: 'merge_access_levels_attributes' }})
|
data: { field_name: 'protected_branch[merge_access_levels_attributes][0][access_level]', input_id: 'merge_access_levels_attributes' }})
|
||||||
- content_for :push_access_levels do
|
- content_for :push_access_levels do
|
||||||
.push_access_levels-container
|
.push_access_levels-container
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
%td
|
%td
|
||||||
= hidden_field_tag "allowed_to_merge_#{protected_branch.id}", protected_branch.merge_access_levels.first.access_level
|
= hidden_field_tag "allowed_to_merge_#{protected_branch.id}", protected_branch.merge_access_levels.first.access_level
|
||||||
= dropdown_tag( (protected_branch.merge_access_levels.first.humanize || 'Select') ,
|
= dropdown_tag( (protected_branch.merge_access_levels.first.humanize || 'Select') ,
|
||||||
options: { toggle_class: 'js-allowed-to-merge', dropdown_class: 'dropdown-menu-selectable js-allowed-to-merge-container capitalize-header',
|
options: { toggle_class: 'js-allowed-to-merge qa-allowed-to-merge', dropdown_class: 'dropdown-menu-selectable js-allowed-to-merge-container capitalize-header',
|
||||||
data: { field_name: "allowed_to_merge_#{protected_branch.id}", access_level_id: protected_branch.merge_access_levels.first.id }})
|
data: { field_name: "allowed_to_merge_#{protected_branch.id}", access_level_id: protected_branch.merge_access_levels.first.id }})
|
||||||
%td
|
%td
|
||||||
= hidden_field_tag "allowed_to_push_#{protected_branch.id}", protected_branch.push_access_levels.first.access_level
|
= hidden_field_tag "allowed_to_push_#{protected_branch.id}", protected_branch.push_access_levels.first.access_level
|
||||||
|
|
|
@ -2,7 +2,8 @@ module QA
|
||||||
module Factory
|
module Factory
|
||||||
module Resource
|
module Resource
|
||||||
class Branch < Factory::Base
|
class Branch < Factory::Base
|
||||||
attr_accessor :project, :branch_name, :allow_to_push, :protected
|
attr_accessor :project, :branch_name,
|
||||||
|
:allow_to_push, :allow_to_merge, :protected
|
||||||
|
|
||||||
dependency Factory::Resource::Project, as: :project do |project|
|
dependency Factory::Resource::Project, as: :project do |project|
|
||||||
project.name = 'protected-branch-project'
|
project.name = 'protected-branch-project'
|
||||||
|
@ -23,6 +24,7 @@ module QA
|
||||||
def initialize
|
def initialize
|
||||||
@branch_name = 'test/branch'
|
@branch_name = 'test/branch'
|
||||||
@allow_to_push = true
|
@allow_to_push = true
|
||||||
|
@allow_to_merge = true
|
||||||
@protected = false
|
@protected = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,6 +65,16 @@ module QA
|
||||||
page.allow_no_one_to_push
|
page.allow_no_one_to_push
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if allow_to_merge
|
||||||
|
page.allow_devs_and_masters_to_merge
|
||||||
|
else
|
||||||
|
page.allow_no_one_to_merge
|
||||||
|
end
|
||||||
|
|
||||||
|
page.wait(reload: false) do
|
||||||
|
!page.first('.btn-create').disabled?
|
||||||
|
end
|
||||||
|
|
||||||
page.protect_branch
|
page.protect_branch
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,13 @@ module QA
|
||||||
view 'app/views/projects/protected_branches/_create_protected_branch.html.haml' do
|
view 'app/views/projects/protected_branches/_create_protected_branch.html.haml' do
|
||||||
element :allowed_to_push_select
|
element :allowed_to_push_select
|
||||||
element :allowed_to_push_dropdown
|
element :allowed_to_push_dropdown
|
||||||
|
element :allowed_to_merge_select
|
||||||
|
element :allowed_to_merge_dropdown
|
||||||
|
end
|
||||||
|
|
||||||
|
view 'app/views/projects/protected_branches/_update_protected_branch.html.haml' do
|
||||||
|
element :allowed_to_push
|
||||||
|
element :allowed_to_merge
|
||||||
end
|
end
|
||||||
|
|
||||||
view 'app/views/projects/protected_branches/shared/_branches_list.html.haml' do
|
view 'app/views/projects/protected_branches/shared/_branches_list.html.haml' do
|
||||||
|
@ -30,11 +37,19 @@ module QA
|
||||||
end
|
end
|
||||||
|
|
||||||
def allow_no_one_to_push
|
def allow_no_one_to_push
|
||||||
allow_to_push('No one')
|
click_allow(:push, 'No one')
|
||||||
end
|
end
|
||||||
|
|
||||||
def allow_devs_and_masters_to_push
|
def allow_devs_and_masters_to_push
|
||||||
allow_to_push('Developers + Masters')
|
click_allow(:push, 'Developers + Masters')
|
||||||
|
end
|
||||||
|
|
||||||
|
def allow_no_one_to_merge
|
||||||
|
click_allow(:merge, 'No one')
|
||||||
|
end
|
||||||
|
|
||||||
|
def allow_devs_and_masters_to_merge
|
||||||
|
click_allow(:merge, 'Developers + Masters')
|
||||||
end
|
end
|
||||||
|
|
||||||
def protect_branch
|
def protect_branch
|
||||||
|
@ -55,11 +70,16 @@ module QA
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def allow_to_push(text)
|
def click_allow(action, text)
|
||||||
click_element :allowed_to_push_select
|
click_element :"allowed_to_#{action}_select"
|
||||||
|
|
||||||
within_element(:allowed_to_push_dropdown) do
|
|
||||||
|
within_element(:"allowed_to_#{action}_dropdown") do
|
||||||
click_on text
|
click_on text
|
||||||
|
|
||||||
|
wait(reload: false) do
|
||||||
|
has_css?('.is-active')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue