debian-mirror-gitlab/spec/support/helpers/search_helpers.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

53 lines
1.2 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
module SearchHelpers
2021-01-03 14:25:43 +05:30
def fill_in_search(text)
2022-06-21 17:19:12 +05:30
# Once the `new_header_search` feature flag has been removed
# We can remove the `.search-input-wrap` selector
# https://gitlab.com/gitlab-org/gitlab/-/issues/339348
page.within('.header-search-new') do
2021-01-29 00:20:46 +05:30
find('#search').click
2022-06-21 17:19:12 +05:30
fill_in 'search', with: text
2021-01-03 14:25:43 +05:30
end
wait_for_all_requests
end
2021-01-29 00:20:46 +05:30
def submit_search(query)
2022-05-07 20:08:51 +05:30
# Once the `new_header_search` feature flag has been removed
# We can remove the `.search-form` selector
# https://gitlab.com/gitlab-org/gitlab/-/issues/339348
page.within('.header-search, .search-form, .search-page-form') do
2019-12-04 20:38:33 +05:30
field = find_field('search')
2022-05-07 20:08:51 +05:30
field.click
2019-12-04 20:38:33 +05:30
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)
2023-01-13 00:05:48 +05:30
page.within '[data-testid="search-filter"]' do
2019-12-04 20:38:33 +05:30
click_link scope
2023-03-04 22:38:38 +05:30
wait_for_all_requests
2019-12-04 20:38:33 +05:30
end
end
def has_search_scope?(scope)
2023-01-13 00:05:48 +05:30
page.within '[data-testid="search-filter"]' do
2019-12-04 20:38:33 +05:30
has_link?(scope)
end
end
def max_limited_count
Gitlab::SearchResults::COUNT_LIMIT_MESSAGE
2017-08-17 22:00:37 +05:30
end
end