diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/projects/branches_spec.rb | 16 | ||||
-rw-r--r-- | spec/features/projects/environments/environment_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/protected_branches_spec.rb | 17 |
3 files changed, 27 insertions, 10 deletions
diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb index 2fddd274078..375da8d4b3c 100644 --- a/spec/features/projects/branches_spec.rb +++ b/spec/features/projects/branches_spec.rb @@ -67,10 +67,11 @@ describe 'Branches' do expect(page).to have_content('fix') expect(find('.all-branches')).to have_selector('li', count: 1) - accept_confirm { find('.js-branch-fix .btn-remove').click } - expect(page).not_to have_content('fix') - expect(find('.all-branches')).to have_selector('li', count: 0) + delete_branch + wait_for_requests + + expect(all('li .ref-name', text: 'fix').count).to eq 0 end end end @@ -110,4 +111,13 @@ describe 'Branches' do Regexp.new(sorted_branches.join('.*')) end + + def delete_branch + find('#delete-branch-modal.modal', visible: false) # wait for Vue component to be loaded + find(".js-delete-branch").click + + page.within '#delete-branch-modal' do + click_on 'Delete branch' + end + end end diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb index 64e600144e0..5903688b359 100644 --- a/spec/features/projects/environments/environment_spec.rb +++ b/spec/features/projects/environments/environment_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Environment' do +feature 'Environment', :js do given(:project) { create(:project) } given(:user) { create(:user) } given(:role) { :developer } @@ -237,7 +237,7 @@ feature 'Environment' do visit project_branches_path(project, search: 'feature') remove_branch_with_hooks(project, user, 'feature') do - page.within('.js-branch-feature') { find('a.btn-remove').click } + page.within('.js-branch-feature') { find('button.btn-remove').click } end visit_environment(environment) diff --git a/spec/features/protected_branches_spec.rb b/spec/features/protected_branches_spec.rb index a4084818284..1ce341e4d8b 100644 --- a/spec/features/protected_branches_spec.rb +++ b/spec/features/protected_branches_spec.rb @@ -48,11 +48,8 @@ feature '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]') - fill_in 'delete_branch_input', with: 'fix' - click_link 'Delete protected branch' + delete_protected_branch + wait_for_requests fill_in 'branch-search', with: 'fix' find('#branch-search').native.send_keys(:enter) @@ -175,4 +172,14 @@ feature 'Protected Branches', :js do find(".dropdown-input-field").set(branch_name) click_on("Create wildcard #{branch_name}") end + + def delete_protected_branch + find('#delete-branch-modal.modal', visible: false) # wait for Vue component to be loaded + find(".js-delete-branch").click + + page.within '#delete-branch-modal' do + fill_in 'delete-branch-modal-input', with: 'fix' + click_on 'Delete protected branch' + end + end end |