debian-mirror-gitlab/spec/features/global_search_spec.rb

51 lines
1.4 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe 'Global search' do
2017-08-17 22:00:37 +05:30
let(:user) { create(:user) }
2017-09-10 17:25:29 +05:30
let(:project) { create(:project, namespace: user.namespace) }
2017-08-17 22:00:37 +05:30
before do
2018-11-18 11:00:15 +05:30
project.add_maintainer(user)
2017-09-10 17:25:29 +05:30
sign_in(user)
2019-10-12 21:52:04 +05:30
visit dashboard_projects_path
end
it 'increases usage ping searches counter' do
2020-06-23 00:09:42 +05:30
expect(Gitlab::UsageDataCounters::SearchCounter).to receive(:count).with(:navbar_searches)
expect(Gitlab::UsageDataCounters::SearchCounter).to receive(:count).with(:all_searches)
2019-10-12 21:52:04 +05:30
2019-12-04 20:38:33 +05:30
submit_search('foobar')
2017-08-17 22:00:37 +05:30
end
describe 'I search through the issues and I see pagination' do
before do
2020-05-24 23:13:21 +05:30
allow_next_instance_of(SearchService) do |instance|
2019-12-26 22:10:19 +05:30
allow(instance).to receive(:per_page).and_return(1)
end
2017-08-17 22:00:37 +05:30
create_list(:issue, 2, project: project, title: 'initial')
end
it "has a pagination" do
2019-12-04 20:38:33 +05:30
submit_search('initial')
select_search_scope('Issues')
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
expect(page).to have_selector('.gl-pagination .next')
2017-08-17 22:00:37 +05:30
end
end
2019-09-04 21:01:54 +05:30
2020-10-24 23:57:45 +05:30
it 'closes the dropdown on blur', :js, quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/201841' do
2019-09-04 21:01:54 +05:30
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
2017-08-17 22:00:37 +05:30
end