Commit 2d087a6f authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'mk/fix-flaky-protected-branch-expectations-ee' into 'master'

[EE Port] QA: Remove flaky and redundant expectations

See merge request gitlab-org/gitlab-ee!6505
parents 69a2acfe ceedec4d
...@@ -6,5 +6,5 @@ ...@@ -6,5 +6,5 @@
%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
= dropdown_tag( (protected_branch.push_access_levels.first.humanize || 'Select') , = dropdown_tag( (protected_branch.push_access_levels.first.humanize || 'Select') ,
options: { toggle_class: 'js-allowed-to-push qa-allowed-to-push', dropdown_class: 'dropdown-menu-selectable js-allowed-to-push-container capitalize-header', options: { toggle_class: 'js-allowed-to-push', dropdown_class: 'dropdown-menu-selectable js-allowed-to-push-container capitalize-header',
data: { field_name: "allowed_to_push_#{protected_branch.id}", access_level_id: protected_branch.push_access_levels.first.id }}) data: { field_name: "allowed_to_push_#{protected_branch.id}", access_level_id: protected_branch.push_access_levels.first.id }})
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
%tr.js-protected-branch-edit-form{ data: { url: namespace_project_protected_branch_path(@project.namespace, @project, protected_branch) } } %tr.js-protected-branch-edit-form{ data: { url: namespace_project_protected_branch_path(@project.namespace, @project, protected_branch) } }
%td %td
%span.ref-name.qa-protected-branch-name= protected_branch.name %span.ref-name= protected_branch.name
- if @project.root_ref?(protected_branch.name) - if @project.root_ref?(protected_branch.name)
%span.badge.badge-info.prepend-left-5 default %span.badge.badge-info.prepend-left-5 default
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
%td %td
= hidden_field_tag "allowed_to_push_#{protected_branch.id}", push_access_level&.access_level = hidden_field_tag "allowed_to_push_#{protected_branch.id}", push_access_level&.access_level
= dropdown_tag( (push_access_level&.humanize || 'Select') , = dropdown_tag( (push_access_level&.humanize || 'Select') ,
options: { toggle_class: 'js-allowed-to-push', dropdown_class: 'dropdown-menu-selectable js-allowed-to-push-container capitalize-header qa-allowed-to-push', options: { toggle_class: 'js-allowed-to-push', dropdown_class: 'dropdown-menu-selectable js-allowed-to-push-container capitalize-header',
data: { field_name: "allowed_to_push_#{protected_branch.id}", access_level_id: push_access_level&.id }}) data: { field_name: "allowed_to_push_#{protected_branch.id}", access_level_id: push_access_level&.id }})
- if user_push_access_levels.any? - if user_push_access_levels.any?
%p.small %p.small
......
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
= render partial: 'projects/settings/ee/access_level_dropdown', locals: { protected_branch: protected_branch, access_levels: protected_branch.merge_access_levels, level_frequencies: access_level_frequencies(protected_branch.merge_access_levels), input_basic_name: 'merge_access_levels', disabled: !can_unprotect, toggle_class: 'js-allowed-to-merge qa-allowed-to-merge' } = render partial: 'projects/settings/ee/access_level_dropdown', locals: { protected_branch: protected_branch, access_levels: protected_branch.merge_access_levels, level_frequencies: access_level_frequencies(protected_branch.merge_access_levels), input_basic_name: 'merge_access_levels', disabled: !can_unprotect, toggle_class: 'js-allowed-to-merge qa-allowed-to-merge' }
%td %td
= render partial: 'projects/settings/ee/access_level_dropdown', locals: { protected_branch: protected_branch, access_levels: protected_branch.push_access_levels, level_frequencies: access_level_frequencies(protected_branch.push_access_levels), input_basic_name: 'push_access_levels', disabled: !can_unprotect, toggle_class: 'js-allowed-to-push qa-allowed-to-push' } = render partial: 'projects/settings/ee/access_level_dropdown', locals: { protected_branch: protected_branch, access_levels: protected_branch.push_access_levels, level_frequencies: access_level_frequencies(protected_branch.push_access_levels), input_basic_name: 'push_access_levels', disabled: !can_unprotect, toggle_class: 'js-allowed-to-push' }
...@@ -14,7 +14,6 @@ module QA ...@@ -14,7 +14,6 @@ module QA
end end
view 'ee/app/views/projects/protected_branches/ee/_protected_branch_access_summary.html.haml' do view 'ee/app/views/projects/protected_branches/ee/_protected_branch_access_summary.html.haml' do
element :allowed_to_push
element :allowed_to_merge element :allowed_to_merge
end end
end end
......
...@@ -9,18 +9,6 @@ module QA ...@@ -9,18 +9,6 @@ module QA
project.name = 'protected-branch-project' project.name = 'protected-branch-project'
end end
product :name do
Page::Project::Settings::Repository.act do
expand_protected_branches(&:last_branch_name)
end
end
product :push_allowance do
Page::Project::Settings::Repository.act do
expand_protected_branches(&:last_push_allowance)
end
end
def initialize def initialize
@branch_name = 'test/branch' @branch_name = 'test/branch'
@allow_to_push = true @allow_to_push = true
...@@ -80,15 +68,6 @@ module QA ...@@ -80,15 +68,6 @@ module QA
end end
page.protect_branch page.protect_branch
# Avoid Selenium::WebDriver::Error::StaleElementReferenceError
# without sleeping. I.e. this completes fast on fast machines.
page.refresh
# It is possible for the protected branch row to "disappear" at first
page.wait do
page.has_content?(branch_name)
end
end end
end end
end end
......
...@@ -18,7 +18,6 @@ module QA ...@@ -18,7 +18,6 @@ module QA
end end
view 'app/views/projects/protected_branches/_update_protected_branch.html.haml' do view 'app/views/projects/protected_branches/_update_protected_branch.html.haml' do
element :allowed_to_push
element :allowed_to_merge element :allowed_to_merge
end end
...@@ -26,10 +25,6 @@ module QA ...@@ -26,10 +25,6 @@ module QA
element :protected_branches_list element :protected_branches_list
end end
view 'app/views/projects/protected_branches/shared/_protected_branch.html.haml' do
element :protected_branch_name
end
def select_branch(branch_name) def select_branch(branch_name)
click_element :protected_branch_select click_element :protected_branch_select
...@@ -64,18 +59,6 @@ module QA ...@@ -64,18 +59,6 @@ module QA
click_on 'Protect' click_on 'Protect'
end end
def last_branch_name
within_element(:protected_branches_list) do
all('.qa-protected-branch-name').last
end
end
def last_push_allowance
within_element(:protected_branches_list) do
all('.qa-allowed-to-push').last
end
end
private private
def click_allow(action, text) def click_allow(action, text)
......
...@@ -21,11 +21,8 @@ module QA ...@@ -21,11 +21,8 @@ module QA
end end
context 'when developers and maintainers are allowed to push to a protected branch' do context 'when developers and maintainers are allowed to push to a protected branch' do
let!(:protected_branch) { create_protected_branch(allow_to_push: true) }
it 'user with push rights successfully pushes to the protected branch' do it 'user with push rights successfully pushes to the protected branch' do
expect(protected_branch.name).to have_content(branch_name) create_protected_branch(allow_to_push: true)
expect(protected_branch.push_allowance).to have_content('Developers + Maintainers')
push = push_new_file(branch_name) push = push_new_file(branch_name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment