diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/features/protected_branches_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/features/protected_branches_spec.rb')
-rw-r--r-- | spec/features/protected_branches_spec.rb | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/spec/features/protected_branches_spec.rb b/spec/features/protected_branches_spec.rb index 207b74c990a..6fbed21acdb 100644 --- a/spec/features/protected_branches_spec.rb +++ b/spec/features/protected_branches_spec.rb @@ -21,13 +21,28 @@ RSpec.describe 'Protected Branches', :js do expect(ProtectedBranch.count).to eq(1) end - it 'does not allow developer to removes protected branch' do + it 'does not allow developer to remove protected branch' do visit project_branches_path(project) find('input[data-testid="branch-search"]').set('fix') find('input[data-testid="branch-search"]').native.send_keys(:enter) - expect(page).to have_css('.btn-danger.disabled') + expect(page).to have_button('Only a project maintainer or owner can delete a protected branch', disabled: true) + end + + context 'when feature flag :delete_branch_confirmation_modals is disabled' do + before do + stub_feature_flags(delete_branch_confirmation_modals: false) + end + + it 'does not allow developer to remove protected branch' do + visit project_branches_path(project) + + find('input[data-testid="branch-search"]').set('fix') + find('input[data-testid="branch-search"]').native.send_keys(:enter) + + expect(page).to have_selector('button[data-testid="remove-protected-branch"][disabled]') + end end end end @@ -52,17 +67,44 @@ RSpec.describe 'Protected Branches', :js do expect(page).to have_content('fix') expect(find('.all-branches')).to have_selector('li', count: 1) - page.find('[data-target="#modal-delete-branch"]').click - expect(page).to have_css('.js-delete-branch[disabled]') + expect(page).to have_button('Delete protected branch', disabled: false) + + page.find('.js-delete-branch-button').click fill_in 'delete_branch_input', with: 'fix' - click_link 'Delete protected branch' + click_button 'Yes, delete protected branch' find('input[data-testid="branch-search"]').set('fix') find('input[data-testid="branch-search"]').native.send_keys(:enter) expect(page).to have_content('No branches to show') end + + context 'when the feature flag :delete_branch_confirmation_modals is disabled' do + before do + stub_feature_flags(delete_branch_confirmation_modals: false) + end + + it 'removes branch after modal confirmation' do + visit project_branches_path(project) + + find('input[data-testid="branch-search"]').set('fix') + find('input[data-testid="branch-search"]').native.send_keys(:enter) + + expect(page).to have_content('fix') + expect(find('.all-branches')).to have_selector('li', count: 1) + page.find('[data-target="#modal-delete-branch"]').click + + expect(page).to have_css('.js-delete-branch[disabled]') + fill_in 'delete_branch_input', with: 'fix' + click_link 'Delete protected branch' + + find('input[data-testid="branch-search"]').set('fix') + find('input[data-testid="branch-search"]').native.send_keys(:enter) + + expect(page).to have_content('No branches to show') + end + end end end |