Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/projects/branches')
-rw-r--r--spec/features/projects/branches/user_deletes_branch_spec.rb33
-rw-r--r--spec/features/projects/branches/user_views_branches_spec.rb11
2 files changed, 39 insertions, 5 deletions
diff --git a/spec/features/projects/branches/user_deletes_branch_spec.rb b/spec/features/projects/branches/user_deletes_branch_spec.rb
index 53994ec018e..3b8f49accc5 100644
--- a/spec/features/projects/branches/user_deletes_branch_spec.rb
+++ b/spec/features/projects/branches/user_deletes_branch_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe "User deletes branch", :js do
sign_in(user)
end
- it "deletes branch" do
+ it "deletes branch", :js do
visit(project_branches_path(project))
branch_search = find('input[data-testid="branch-search"]')
@@ -21,11 +21,38 @@ RSpec.describe "User deletes branch", :js do
branch_search.native.send_keys(:enter)
page.within(".js-branch-improve\\/awesome") do
- accept_alert { find(".btn-danger").click }
+ 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_css(".js-branch-improve\\/awesome", visible: :hidden)
+ 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(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
diff --git a/spec/features/projects/branches/user_views_branches_spec.rb b/spec/features/projects/branches/user_views_branches_spec.rb
index 19d96579785..d0c0a0860d9 100644
--- a/spec/features/projects/branches/user_views_branches_spec.rb
+++ b/spec/features/projects/branches/user_views_branches_spec.rb
@@ -2,7 +2,7 @@
require "spec_helper"
-RSpec.describe "User views branches" do
+RSpec.describe "User views branches", :js do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { project.owner }
@@ -10,9 +10,12 @@ RSpec.describe "User views branches" do
sign_in(user)
end
- context "all branches" do
+ context "all branches", :js do
before do
visit(project_branches_path(project))
+ branch_search = find('input[data-testid="branch-search"]')
+ branch_search.set('master')
+ branch_search.native.send_keys(:enter)
end
it "shows branches" do
@@ -20,6 +23,10 @@ RSpec.describe "User views branches" do
expect(page.all(".graph-side")).to all( have_content(/\d+/) )
end
+
+ it "displays a disabled button with a tooltip for the default branch that cannot be deleted", :js do
+ expect(page).to have_button('The default branch cannot be deleted', disabled: true)
+ end
end
context "protected branches" do