summaryrefslogtreecommitdiff
path: root/spec/features/global_search_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/global_search_spec.rb')
-rw-r--r--spec/features/global_search_spec.rb70
1 files changed, 47 insertions, 23 deletions
diff --git a/spec/features/global_search_spec.rb b/spec/features/global_search_spec.rb
index 19fb8e5f52c..a380edff3a4 100644
--- a/spec/features/global_search_spec.rb
+++ b/spec/features/global_search_spec.rb
@@ -11,40 +11,64 @@ RSpec.describe 'Global search' do
before do
project.add_maintainer(user)
sign_in(user)
-
- 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)
+ describe 'when new_header_search feature is disabled' do
+ before do
+ # TODO: Remove this along with feature flag #339348
+ stub_feature_flags(new_header_search: false)
+ visit dashboard_projects_path
+ end
- submit_search('foobar')
- 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)
- 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')
+ submit_search('foobar')
end
- it "has a pagination" do
- submit_search('initial')
- select_search_scope('Issues')
+ 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')
+ expect(page).to have_selector('.gl-pagination .next')
+ end
end
- end
- it 'closes the dropdown on blur', :js do
- find('#search').click
- fill_in 'search', with: "a"
+ it 'closes the dropdown on blur', :js do
+ find('#search').click
+ fill_in 'search', with: "a"
+
+ expect(page).to have_selector("div[data-testid='dashboard-search-options'].show")
- expect(page).to have_selector("div[data-testid='dashboard-search-options'].show")
+ find('#search').send_keys(:backspace)
+ find('body').click
- 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
+ end
- expect(page).to have_no_selector("div[data-testid='dashboard-search-options'].show")
+ 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
+
+ it 'renders updated search bar' do
+ expect(page).to have_no_selector('.search-form')
+ expect(page).to have_selector('#js-header-search')
+ end
end
end