diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-04-25 19:01:36 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-04-25 22:57:52 +0800 |
commit | 9cc2123e47661db37fbaff96f99999697aa60432 (patch) | |
tree | 67bd24eeee79ac06667aadf3950d9f867ca1e752 /qa | |
parent | c5f6c811eec6bca7952f84af9e30f3fafb848352 (diff) | |
download | gitlab-ce-9cc2123e47661db37fbaff96f99999697aa60432.tar.gz |
Select everything so we could hit protect
Add missing QA selectors as well
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/factory/resource/branch.rb | 14 | ||||
-rw-r--r-- | qa/qa/page/project/settings/protected_branches.rb | 30 |
2 files changed, 38 insertions, 6 deletions
diff --git a/qa/qa/factory/resource/branch.rb b/qa/qa/factory/resource/branch.rb index d0ef142e90d..85ea847b785 100644 --- a/qa/qa/factory/resource/branch.rb +++ b/qa/qa/factory/resource/branch.rb @@ -2,7 +2,8 @@ module QA module Factory module Resource 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| project.name = 'protected-branch-project' @@ -23,6 +24,7 @@ module QA def initialize @branch_name = 'test/branch' @allow_to_push = true + @allow_to_merge = true @protected = false end @@ -63,6 +65,16 @@ module QA page.allow_no_one_to_push 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 end end diff --git a/qa/qa/page/project/settings/protected_branches.rb b/qa/qa/page/project/settings/protected_branches.rb index f3563401124..23c3217d3f7 100644 --- a/qa/qa/page/project/settings/protected_branches.rb +++ b/qa/qa/page/project/settings/protected_branches.rb @@ -11,6 +11,13 @@ module QA view 'app/views/projects/protected_branches/_create_protected_branch.html.haml' do element :allowed_to_push_select 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 view 'app/views/projects/protected_branches/shared/_branches_list.html.haml' do @@ -30,11 +37,19 @@ module QA end def allow_no_one_to_push - allow_to_push('No one') + click_allow(:push, 'No one') end 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 def protect_branch @@ -55,11 +70,16 @@ module QA private - def allow_to_push(text) - click_element :allowed_to_push_select + def click_allow(action, text) + click_element :"allowed_to_#{action}_select" - within_element(:allowed_to_push_dropdown) do + + within_element(:"allowed_to_#{action}_dropdown") do click_on text + + wait(reload: false) do + has_css?('.is-active') + end end end end |