2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
require "spec_helper"
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe "User deletes branch", :js do
|
2020-04-08 14:13:33 +05:30
|
|
|
let_it_be(:user) { create(:user) }
|
2021-06-08 01:23:25 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
let(:project) { create(:project, :repository) }
|
2018-10-15 14:42:47 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
project.add_developer(user)
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
it "deletes branch", :js do
|
2021-04-29 21:17:54 +05:30
|
|
|
visit(project_branches_path(project))
|
|
|
|
|
|
|
|
branch_search = find('input[data-testid="branch-search"]')
|
|
|
|
|
|
|
|
branch_search.set('improve/awesome')
|
|
|
|
branch_search.native.send_keys(:enter)
|
2018-10-15 14:42:47 +05:30
|
|
|
|
|
|
|
page.within(".js-branch-improve\\/awesome") do
|
2021-09-04 01:27:46 +05:30
|
|
|
find('.js-delete-branch-button').click
|
|
|
|
end
|
|
|
|
|
|
|
|
page.within '.modal-footer' do
|
|
|
|
click_button 'Yes, delete branch'
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
wait_for_requests
|
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
expect(page).to have_content('Branch was deleted')
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when the feature flag :delete_branch_confirmation_modals is disabled' do
|
|
|
|
before do
|
2021-12-11 22:18:48 +05:30
|
|
|
stub_feature_flags(bootstrap_confirmation_modals: false)
|
2021-09-04 01:27:46 +05:30
|
|
|
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
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
end
|