2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
require "spec_helper"
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
RSpec.describe "User views branches", :js, feature_category: :projects do
|
2020-04-08 14:13:33 +05:30
|
|
|
let_it_be(:project) { create(:project, :repository) }
|
2022-04-04 11:22:00 +05:30
|
|
|
let_it_be(:user) { project.first_owner }
|
2018-10-15 14:42:47 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
context "all branches", :js do
|
2018-10-15 14:42:47 +05:30
|
|
|
before do
|
|
|
|
visit(project_branches_path(project))
|
2021-09-04 01:27:46 +05:30
|
|
|
branch_search = find('input[data-testid="branch-search"]')
|
|
|
|
branch_search.set('master')
|
|
|
|
branch_search.native.send_keys(:enter)
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it "shows branches" do
|
|
|
|
expect(page).to have_content("Branches").and have_content("master")
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
expect(page.all(".graph-side")).to all(have_content(/\d+/))
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
2021-09-04 01:27:46 +05:30
|
|
|
|
|
|
|
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
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
context "protected branches" do
|
2020-04-08 14:13:33 +05:30
|
|
|
let_it_be(:protected_branch) { create(:protected_branch, project: project) }
|
2018-10-15 14:42:47 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
visit(project_protected_branches_path(project))
|
|
|
|
end
|
|
|
|
|
|
|
|
it "shows branches" do
|
|
|
|
page.within(".protected-branches-list") do
|
|
|
|
expect(page).to have_content(protected_branch.name).and have_no_content("master")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|