2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
module SearchHelpers
|
2021-01-03 14:25:43 +05:30
|
|
|
def fill_in_search(text)
|
|
|
|
page.within('.search-input-wrap') do
|
|
|
|
fill_in('search', with: text)
|
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_all_requests
|
|
|
|
end
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
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
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
wait_for_all_requests
|
2019-12-04 20:38:33 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def select_search_scope(scope)
|
|
|
|
page.within '.search-filter' do
|
|
|
|
click_link scope
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_search_scope?(scope)
|
|
|
|
page.within '.search-filter' do
|
|
|
|
has_link?(scope)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def max_limited_count
|
|
|
|
Gitlab::SearchResults::COUNT_LIMIT_MESSAGE
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|