debian-mirror-gitlab/spec/features/projects/branches/user_deletes_branch_spec.rb
2021-12-11 22:18:48 +05:30

59 lines
1.4 KiB
Ruby

# frozen_string_literal: true
require "spec_helper"
RSpec.describe "User deletes branch", :js do
let_it_be(:user) { create(:user) }
let(:project) { create(:project, :repository) }
before do
project.add_developer(user)
sign_in(user)
end
it "deletes branch", :js do
visit(project_branches_path(project))
branch_search = find('input[data-testid="branch-search"]')
branch_search.set('improve/awesome')
branch_search.native.send_keys(:enter)
page.within(".js-branch-improve\\/awesome") do
find('.js-delete-branch-button').click
end
page.within '.modal-footer' do
click_button 'Yes, delete branch'
end
wait_for_requests
expect(page).to have_content('Branch was deleted')
end
context 'when the feature flag :delete_branch_confirmation_modals is disabled' do
before do
stub_feature_flags(bootstrap_confirmation_modals: false)
stub_feature_flags(delete_branch_confirmation_modals: false)
end
it "deletes branch" do
visit(project_branches_path(project))
branch_search = find('input[data-testid="branch-search"]')
branch_search.set('improve/awesome')
branch_search.native.send_keys(:enter)
page.within(".js-branch-improve\\/awesome") do
accept_alert { click_link(title: 'Delete branch') }
end
wait_for_requests
expect(page).to have_css(".js-branch-improve\\/awesome", visible: :hidden)
end
end
end