2019-07-25 05:27:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-11-07 18:36:58 +00:00
|
|
|
module SearchHelpers
|
2020-09-18 18:10:26 +00:00
|
|
|
def fill_in_search(text)
|
|
|
|
page.within('.search-input-wrap') do
|
|
|
|
fill_in('search', with: text)
|
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_all_requests
|
|
|
|
end
|
|
|
|
|
2019-08-30 09:49:14 +00:00
|
|
|
def submit_search(query, scope: nil)
|
|
|
|
page.within('.search-form, .search-page-form') do
|
|
|
|
field = find_field('search')
|
|
|
|
field.fill_in(with: query)
|
|
|
|
|
|
|
|
if javascript_test?
|
|
|
|
field.send_keys(:enter)
|
|
|
|
else
|
|
|
|
click_button('Search')
|
|
|
|
end
|
2020-09-18 18:10:26 +00:00
|
|
|
|
|
|
|
wait_for_all_requests
|
2019-08-30 09:49:14 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def select_search_scope(scope)
|
|
|
|
page.within '.search-filter' do
|
|
|
|
click_link scope
|
|
|
|
end
|
2016-11-07 18:36:58 +00:00
|
|
|
end
|
2019-09-09 13:46:24 +00:00
|
|
|
|
2019-11-15 08:21:08 +00:00
|
|
|
def has_search_scope?(scope)
|
|
|
|
page.within '.search-filter' do
|
|
|
|
has_link?(scope)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-09-09 13:46:24 +00:00
|
|
|
def max_limited_count
|
|
|
|
Gitlab::SearchResults::COUNT_LIMIT_MESSAGE
|
|
|
|
end
|
2016-11-07 18:36:58 +00:00
|
|
|
end
|