2022-06-21 17:19:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
module Features
|
|
|
|
module RunnersHelpers
|
|
|
|
def within_runner_row(runner_id)
|
|
|
|
within "[data-testid='runner-row-#{runner_id}']" do
|
|
|
|
yield
|
|
|
|
end
|
|
|
|
end
|
2022-06-21 17:19:12 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
def search_bar_selector
|
|
|
|
'[data-testid="runners-filtered-search"]'
|
|
|
|
end
|
2022-06-21 17:19:12 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
# The filters must be clicked first to be able to receive events
|
|
|
|
# See: https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1493
|
|
|
|
def focus_filtered_search
|
|
|
|
page.within(search_bar_selector) do
|
|
|
|
page.find('.gl-filtered-search-term-token').click
|
|
|
|
end
|
|
|
|
end
|
2022-06-21 17:19:12 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
def input_filtered_search_keys(search_term)
|
|
|
|
focus_filtered_search
|
2022-06-21 17:19:12 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
page.within(search_bar_selector) do
|
|
|
|
page.find('input').send_keys(search_term)
|
|
|
|
click_on 'Search'
|
|
|
|
end
|
2022-06-21 17:19:12 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
wait_for_requests
|
|
|
|
end
|
2022-06-21 17:19:12 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
def open_filtered_search_suggestions(filter)
|
|
|
|
focus_filtered_search
|
2022-06-21 17:19:12 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
page.within(search_bar_selector) do
|
|
|
|
click_on filter
|
|
|
|
end
|
2022-06-21 17:19:12 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
wait_for_requests
|
|
|
|
end
|
2022-06-21 17:19:12 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
def input_filtered_search_filter_is_only(filter, value)
|
|
|
|
focus_filtered_search
|
2022-06-21 17:19:12 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
page.within(search_bar_selector) do
|
|
|
|
click_on filter
|
2022-06-21 17:19:12 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
# For OPERATORS_IS, clicking the filter
|
|
|
|
# immediately preselects "=" operator
|
2022-06-21 17:19:12 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
page.find('input').send_keys(value)
|
|
|
|
page.find('input').send_keys(:enter)
|
2022-06-21 17:19:12 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
click_on 'Search'
|
2022-06-21 17:19:12 +05:30
|
|
|
end
|
2023-06-20 00:43:36 +05:30
|
|
|
|
|
|
|
wait_for_requests
|
2022-06-21 17:19:12 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|