diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-20 21:08:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-20 21:08:18 +0300 |
commit | 96b01499986c01d0c95176860a7606b7616a3836 (patch) | |
tree | f394d46a0f7043984ddd5d51f8c408df035a5b89 /spec/features | |
parent | 849e6f56ae6d29014a6d73f0533144adc9619e87 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/global_search_spec.rb | 58 | ||||
-rw-r--r-- | spec/features/search/user_searches_for_code_spec.rb | 55 |
2 files changed, 2 insertions, 111 deletions
diff --git a/spec/features/global_search_spec.rb b/spec/features/global_search_spec.rb index 15393ec4cd6..f94f0288f99 100644 --- a/spec/features/global_search_spec.rb +++ b/spec/features/global_search_spec.rb @@ -13,64 +13,8 @@ RSpec.describe 'Global search', :js, feature_category: :global_search do sign_in(user) end - describe 'when new_header_search feature is disabled' do + describe 'when header search' do before do - # TODO: Remove this along with feature flag #339348 - stub_feature_flags(new_header_search: false) - visit dashboard_projects_path - end - - it 'increases usage ping searches counter' do - expect(Gitlab::UsageDataCounters::SearchCounter).to receive(:count).with(:navbar_searches) - expect(Gitlab::UsageDataCounters::SearchCounter).to receive(:count).with(:all_searches) - - submit_search('foobar') - end - - describe 'I search through the issues and I see pagination' do - before do - allow_next(SearchService).to receive(:per_page).and_return(1) - create_list(:issue, 2, project: project, title: 'initial') - end - - it "has a pagination" do - submit_search('initial') - select_search_scope('Issues') - - expect(page).to have_selector('.gl-pagination .next') - end - end - - it 'closes the dropdown on blur' do - find('#search').click - fill_in 'search', with: "a" - - expect(page).to have_selector("div[data-testid='dashboard-search-options'].show") - - find('#search').send_keys(:backspace) - find('body').click - - expect(page).to have_no_selector("div[data-testid='dashboard-search-options'].show") - end - - it 'renders legacy search bar' do - expect(page).to have_selector('.search-form') - expect(page).to have_no_selector('#js-header-search') - end - - it 'focuses search input when shortcut "s" is pressed' do - expect(page).not_to have_selector('#search:focus') - - find('body').native.send_key('s') - - expect(page).to have_selector('#search:focus') - end - end - - describe 'when new_header_search feature is enabled' do - before do - # TODO: Remove this along with feature flag #339348 - stub_feature_flags(new_header_search: true) visit dashboard_projects_path end diff --git a/spec/features/search/user_searches_for_code_spec.rb b/spec/features/search/user_searches_for_code_spec.rb index b7d06a3a962..976324a5032 100644 --- a/spec/features/search/user_searches_for_code_spec.rb +++ b/spec/features/search/user_searches_for_code_spec.rb @@ -99,64 +99,11 @@ RSpec.describe 'User searches for code', :js, :disable_rate_limiter, feature_cat end end - context 'when :new_header_search is true' do + context 'when header search' do context 'search code within refs' do let(:ref_name) { 'v1.0.0' } before do - # This feature is disabled by default in spec_helper.rb. - # We missed a feature breaking bug, so to prevent this regression, testing both scenarios for this spec. - # This can be removed as part of closing https://gitlab.com/gitlab-org/gitlab/-/issues/339348. - stub_feature_flags(new_header_search: true) - visit(project_tree_path(project, ref_name)) - - submit_search('gitlab-grack') - select_search_scope('Code') - end - - it 'shows ref switcher in code result summary' do - expect(find('.ref-selector')).to have_text(ref_name) - end - - it 'persists branch name across search' do - find('.gl-search-box-by-click-search-button').click - expect(find('.ref-selector')).to have_text(ref_name) - end - - # this example is use to test the design that the refs is not - # only represent the branch as well as the tags. - it 'ref switcher list all the branches and tags' do - find('.ref-selector').click - wait_for_requests - - page.within('.ref-selector') do - expect(page).to have_selector('li', text: 'add-ipython-files') - expect(page).to have_selector('li', text: 'v1.0.0') - end - end - - it 'search result changes when refs switched' do - expect(find('.results')).not_to have_content('path = gitlab-grack') - - find('.ref-selector').click - wait_for_requests - - select_listbox_item('add-ipython-files') - - expect(page).to have_selector('.results', text: 'path = gitlab-grack') - end - end - end - - context 'when :new_header_search is false' do - context 'search code within refs' do - let(:ref_name) { 'v1.0.0' } - - before do - # This feature is disabled by default in spec_helper.rb. - # We missed a feature breaking bug, so to prevent this regression, testing both scenarios for this spec. - # This can be removed as part of closing https://gitlab.com/gitlab-org/gitlab/-/issues/339348. - stub_feature_flags(new_header_search: false) visit(project_tree_path(project, ref_name)) submit_search('gitlab-grack') |