blob: dd5ce63876e72fc81e7001ae85760aab9b54c9f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# frozen_string_literal: true
module SearchHelpers
def fill_in_search(text)
within_testid('super-sidebar') do
click_button "Search or go to…"
end
fill_in 'search', with: text
wait_for_all_requests
end
def submit_search(query)
# Forms directly on the search page
if page.has_css?('.search-page-form')
search_form = '.search-page-form'
# Open search modal from super sidebar
elsif has_testid?('super-sidebar-search-button')
find_by_testid('super-sidebar-search-button').click
search_form = '#super-sidebar-search-modal'
# Open legacy search dropdown in navigation
else
search_form = '.header-search-form'
end
page.within(search_form) do
field = find_field('search')
field.click
field.fill_in(with: query)
if javascript_test?
field.send_keys(:enter)
else
click_button('Search')
end
wait_for_all_requests
end
end
def select_search_scope(scope)
within_testid('search-filter') do
click_link scope
wait_for_all_requests
end
end
def has_search_scope?(scope)
return false unless has_testid?('search-filter')
within_testid('search-filter') do
has_link?(scope)
end
end
def max_limited_count
Gitlab::SearchResults::COUNT_LIMIT_MESSAGE
end
end
|