2019-07-25 05:24:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-11-07 18:36:58 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-07-05 06:32:05 +00:00
|
|
|
describe 'Global search' do
|
2016-11-07 18:36:58 +00:00
|
|
|
let(:user) { create(:user) }
|
2017-08-02 19:55:11 +00:00
|
|
|
let(:project) { create(:project, namespace: user.namespace) }
|
2016-11-07 18:36:58 +00:00
|
|
|
|
|
|
|
before do
|
2018-07-11 14:36:08 +00:00
|
|
|
project.add_maintainer(user)
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_in(user)
|
2019-07-29 09:58:58 +00:00
|
|
|
|
|
|
|
visit dashboard_projects_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'increases usage ping searches counter' do
|
|
|
|
expect(Gitlab::UsageDataCounters::SearchCounter).to receive(:increment_navbar_searches_count)
|
|
|
|
|
2019-08-30 09:49:14 +00:00
|
|
|
submit_search('foobar')
|
2016-11-07 18:36:58 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'I search through the issues and I see pagination' do
|
|
|
|
before do
|
2019-11-14 03:06:25 +00:00
|
|
|
allow_next_instance_of(Gitlab::SearchResults) do |instance|
|
|
|
|
allow(instance).to receive(:per_page).and_return(1)
|
|
|
|
end
|
2016-11-07 18:36:58 +00:00
|
|
|
create_list(:issue, 2, project: project, title: 'initial')
|
|
|
|
end
|
|
|
|
|
|
|
|
it "has a pagination" do
|
2019-08-30 09:49:14 +00:00
|
|
|
submit_search('initial')
|
|
|
|
select_search_scope('Issues')
|
2016-11-07 18:36:58 +00:00
|
|
|
|
2018-01-23 11:03:15 +00:00
|
|
|
expect(page).to have_selector('.gl-pagination .next')
|
2016-11-07 18:36:58 +00:00
|
|
|
end
|
|
|
|
end
|
2019-05-24 19:20:05 +00:00
|
|
|
|
|
|
|
it 'closes the dropdown on blur', :js do
|
|
|
|
fill_in 'search', with: "a"
|
|
|
|
dropdown = find('.js-dashboard-search-options')
|
|
|
|
|
|
|
|
expect(dropdown[:class]).to include 'show'
|
|
|
|
|
|
|
|
find('#search').send_keys(:backspace)
|
|
|
|
find('body').click
|
|
|
|
|
|
|
|
expect(dropdown[:class]).not_to include 'show'
|
|
|
|
end
|
2016-11-07 18:36:58 +00:00
|
|
|
end
|