Commit 9c6e38c4 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'jivanvl-remove-gldropdown-branches-ff' into 'master'

Remove gldropdown_branches feature flag [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!59179
parents 448e0ab6 b7fec514
......@@ -12,9 +12,6 @@ class Projects::BranchesController < Projects::ApplicationController
# Support legacy URLs
before_action :redirect_for_legacy_index_sort_or_search, only: [:index]
before_action :limit_diverging_commit_counts!, only: [:diverging_commit_counts]
before_action do
push_frontend_feature_flag(:gldropdown_branches, default_enabled: :yaml)
end
feature_category :source_code_management
......
......@@ -20,10 +20,6 @@ module BranchesHelper
end
end
end
def gldropdrown_branches_enabled?
Feature.enabled?(:gldropdown_branches, default_enabled: :yaml)
end
end
BranchesHelper.prepend_if_ee('EE::BranchesHelper')
......@@ -16,25 +16,7 @@
= link_to s_('Branches|All'), project_branches_filtered_path(@project, state: 'all'), title: s_('Branches|Show all branches')
.nav-controls
- if !gldropdrown_branches_enabled?
= form_tag(project_branches_filtered_path(@project, state: 'all'), method: :get) do
= search_field_tag :search, params[:search], { placeholder: s_('Branches|Filter by branch name'), id: 'branch-search', class: 'form-control search-text-input input-short', spellcheck: false }
- unless @mode == 'overview'
.dropdown.inline>
%button.dropdown-menu-toggle{ type: 'button', 'data-toggle' => 'dropdown' }
%span.light
= branches_sort_options_hash[@sort]
= sprite_icon('chevron-down', css_class: "dropdown-menu-toggle-icon gl-top-3")
%ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable
%li.dropdown-header
= s_('Branches|Sort by')
- branches_sort_options_hash.each do |value, title|
%li
= link_to title, project_branches_filtered_path(@project, state: 'all', search: params[:search], sort: value), class: ("is-active" if @sort == value)
- else
#js-branches-sort-dropdown{ data: { project_branches_filtered_path: project_branches_path(@project, state: 'all'), sort_options: branches_sort_options_hash.to_json, mode: @mode } }
#js-branches-sort-dropdown{ data: { project_branches_filtered_path: project_branches_path(@project, state: 'all'), sort_options: branches_sort_options_hash.to_json, mode: @mode } }
- if can? current_user, :push_code, @project
= link_to project_merged_branches_path(@project),
......
---
title: Remove gldropdown_branches feature flag
merge_request: 59179
author:
type: changed
---
name: gldropdown_branches
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/57760
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/326549
milestone: '13.11'
type: development
group: group::continuous integration
default_enabled: true
......@@ -5319,9 +5319,6 @@ msgstr ""
msgid "Branches|Show stale branches"
msgstr ""
msgid "Branches|Sort by"
msgstr ""
msgid "Branches|Stale"
msgstr ""
......
......@@ -12,10 +12,12 @@ RSpec.describe "User deletes branch", :js do
end
it "deletes branch" do
stub_feature_flags(gldropdown_branches: false)
visit(project_branches_path(project))
fill_in("branch-search", with: "improve/awesome").native.send_keys(:enter)
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 { find(".btn-danger").click }
......@@ -25,23 +27,4 @@ RSpec.describe "User deletes branch", :js do
expect(page).to have_css(".js-branch-improve\\/awesome", visible: :hidden)
end
context 'with gldropdown_branches enabled' do
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 { find(".btn-danger").click }
end
wait_for_requests
expect(page).to have_css(".js-branch-improve\\/awesome", visible: :hidden)
end
end
end
......@@ -86,29 +86,16 @@ RSpec.describe 'Branches' do
describe 'Find branches' do
it 'shows filtered branches', :js do
stub_feature_flags(gldropdown_branches: false)
visit project_branches_path(project)
fill_in 'branch-search', with: 'fix'
find('#branch-search').native.send_keys(:enter)
branch_search = find('input[data-testid="branch-search"]')
branch_search.set('fix')
branch_search.native.send_keys(:enter)
expect(page).to have_content('fix')
expect(find('.all-branches')).to have_selector('li', count: 1)
end
context 'with gldropdown_branches enabled' do
it 'shows filtered branches', :js do
visit project_branches_path(project)
branch_search = find('input[data-testid="branch-search"]')
branch_search.set('fix')
branch_search.native.send_keys(:enter)
expect(page).to have_content('fix')
expect(find('.all-branches')).to have_selector('li', count: 1)
end
end
end
describe 'Delete unprotected branch on Overview' do
......@@ -129,52 +116,28 @@ RSpec.describe 'Branches' do
expect(page).to have_content(sorted_branches(repository, count: 20, sort_by: :updated_desc))
end
it 'sorts the branches by name' do
stub_feature_flags(gldropdown_branches: false)
it 'sorts the branches by name', :js do
visit project_branches_filtered_path(project, state: 'all')
click_button "Last updated" # Open sorting dropdown
click_link "Name"
within '[data-testid="branches-dropdown"]' do
find('p', text: 'Name').click
end
expect(page).to have_content(sorted_branches(repository, count: 20, sort_by: :name))
end
context 'with gldropdown_branches enabled' do
it 'sorts the branches by name', :js do
visit project_branches_filtered_path(project, state: 'all')
click_button "Last updated" # Open sorting dropdown
within '[data-testid="branches-dropdown"]' do
find('p', text: 'Name').click
end
expect(page).to have_content(sorted_branches(repository, count: 20, sort_by: :name))
end
end
it 'sorts the branches by oldest updated' do
stub_feature_flags(gldropdown_branches: false)
it 'sorts the branches by oldest updated', :js do
visit project_branches_filtered_path(project, state: 'all')
click_button "Last updated" # Open sorting dropdown
click_link "Oldest updated"
within '[data-testid="branches-dropdown"]' do
find('p', text: 'Oldest updated').click
end
expect(page).to have_content(sorted_branches(repository, count: 20, sort_by: :updated_asc))
end
context 'with gldropdown_branches enabled' do
it 'sorts the branches by oldest updated', :js do
visit project_branches_filtered_path(project, state: 'all')
click_button "Last updated" # Open sorting dropdown
within '[data-testid="branches-dropdown"]' do
find('p', text: 'Oldest updated').click
end
expect(page).to have_content(sorted_branches(repository, count: 20, sort_by: :updated_asc))
end
end
it 'avoids a N+1 query in branches index' do
control_count = ActiveRecord::QueryRecorder.new { visit project_branches_path(project) }.count
......@@ -186,39 +149,26 @@ RSpec.describe 'Branches' do
describe 'Find branches on All branches' do
it 'shows filtered branches', :js do
stub_feature_flags(gldropdown_branches: false)
visit project_branches_filtered_path(project, state: 'all')
fill_in 'branch-search', with: 'fix'
find('#branch-search').native.send_keys(:enter)
branch_search = find('input[data-testid="branch-search"]')
branch_search.set('fix')
branch_search.native.send_keys(:enter)
expect(page).to have_content('fix')
expect(find('.all-branches')).to have_selector('li', count: 1)
end
context 'with gldropdown_branches enabled' do
it 'shows filtered branches', :js do
visit project_branches_filtered_path(project, state: 'all')
branch_search = find('input[data-testid="branch-search"]')
branch_search.set('fix')
branch_search.native.send_keys(:enter)
expect(page).to have_content('fix')
expect(find('.all-branches')).to have_selector('li', count: 1)
end
end
end
describe 'Delete unprotected branch on All branches' do
it 'removes branch after confirmation', :js do
stub_feature_flags(gldropdown_branches: false)
visit project_branches_filtered_path(project, state: 'all')
fill_in 'branch-search', with: 'fix'
branch_search = find('input[data-testid="branch-search"]')
find('#branch-search').native.send_keys(:enter)
branch_search.set('fix')
branch_search.native.send_keys(:enter)
expect(page).to have_content('fix')
expect(find('.all-branches')).to have_selector('li', count: 1)
......@@ -227,24 +177,6 @@ RSpec.describe 'Branches' do
expect(page).not_to have_content('fix')
expect(find('.all-branches')).to have_selector('li', count: 0)
end
context 'with gldropdown_branches enabled' do
it 'removes branch after confirmation', :js do
visit project_branches_filtered_path(project, state: 'all')
branch_search = find('input[data-testid="branch-search"]')
branch_search.set('fix')
branch_search.native.send_keys(:enter)
expect(page).to have_content('fix')
expect(find('.all-branches')).to have_selector('li', count: 1)
accept_confirm { find('.js-branch-fix .btn-danger').click }
expect(page).not_to have_content('fix')
expect(find('.all-branches')).to have_selector('li', count: 0)
end
end
end
context 'on project with 0 branch' do
......
......@@ -22,25 +22,13 @@ RSpec.describe 'Protected Branches', :js do
end
it 'does not allow developer to removes protected branch' do
stub_feature_flags(gldropdown_branches: false)
visit project_branches_path(project)
fill_in 'branch-search', with: 'fix'
find('#branch-search').native.send_keys(:enter)
find('input[data-testid="branch-search"]').set('fix')
find('input[data-testid="branch-search"]').native.send_keys(:enter)
expect(page).to have_css('.btn-danger.disabled')
end
context 'with gldropdown_branches enabled' do
it 'does not allow developer to removes protected branch' do
visit project_branches_path(project)
find('input[data-testid="branch-search"]').set('fix')
find('input[data-testid="branch-search"]').native.send_keys(:enter)
expect(page).to have_css('.btn-danger.disabled')
end
end
end
end
......@@ -57,11 +45,10 @@ RSpec.describe 'Protected Branches', :js do
end
it 'removes branch after modal confirmation' do
stub_feature_flags(gldropdown_branches: false)
visit project_branches_path(project)
fill_in 'branch-search', with: 'fix'
find('#branch-search').native.send_keys(:enter)
find('input[data-testid="branch-search"]').set('fix')
find('input[data-testid="branch-search"]').native.send_keys(:enter)
expect(page).to have_content('fix')
expect(find('.all-branches')).to have_selector('li', count: 1)
......@@ -71,33 +58,11 @@ RSpec.describe 'Protected Branches', :js do
fill_in 'delete_branch_input', with: 'fix'
click_link 'Delete protected branch'
fill_in 'branch-search', with: 'fix'
find('#branch-search').native.send_keys(:enter)
find('input[data-testid="branch-search"]').set('fix')
find('input[data-testid="branch-search"]').native.send_keys(:enter)
expect(page).to have_content('No branches to show')
end
context 'with gldropdown_branches enabled' do
it 'removes branch after modal confirmation' do
visit project_branches_path(project)
find('input[data-testid="branch-search"]').set('fix')
find('input[data-testid="branch-search"]').native.send_keys(:enter)
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'
find('input[data-testid="branch-search"]').set('fix')
find('input[data-testid="branch-search"]').native.send_keys(:enter)
expect(page).to have_content('No branches to show')
end
end
end
end
......
......@@ -47,19 +47,4 @@ RSpec.describe BranchesHelper do
end
end
end
describe '#gl_dropdown_branches_enabled?' do
context 'when the feature is enabled' do
it 'returns true' do
expect(helper.gldropdrown_branches_enabled?).to be_truthy
end
end
context 'when the feature is disabled' do
it 'returns false' do
stub_feature_flags(gldropdown_branches: false)
expect(helper.gldropdrown_branches_enabled?).to be_falsy
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment