diff options
Diffstat (limited to 'spec/support/helpers/features/runners_helpers.rb')
-rw-r--r-- | spec/support/helpers/features/runners_helpers.rb | 92 |
1 files changed, 43 insertions, 49 deletions
diff --git a/spec/support/helpers/features/runners_helpers.rb b/spec/support/helpers/features/runners_helpers.rb index c5d26108953..0504e883b82 100644 --- a/spec/support/helpers/features/runners_helpers.rb +++ b/spec/support/helpers/features/runners_helpers.rb @@ -1,68 +1,62 @@ # frozen_string_literal: true -module Spec - module Support - module Helpers - module Features - module RunnersHelpers - def within_runner_row(runner_id) - within "[data-testid='runner-row-#{runner_id}']" do - yield - end - end - - def search_bar_selector - '[data-testid="runners-filtered-search"]' - end +module Features + module RunnersHelpers + def within_runner_row(runner_id) + within "[data-testid='runner-row-#{runner_id}']" do + yield + end + end - # 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 + def search_bar_selector + '[data-testid="runners-filtered-search"]' + end - def input_filtered_search_keys(search_term) - focus_filtered_search + # 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 - page.within(search_bar_selector) do - page.find('input').send_keys(search_term) - click_on 'Search' - end + def input_filtered_search_keys(search_term) + focus_filtered_search - wait_for_requests - end + page.within(search_bar_selector) do + page.find('input').send_keys(search_term) + click_on 'Search' + end - def open_filtered_search_suggestions(filter) - focus_filtered_search + wait_for_requests + end - page.within(search_bar_selector) do - click_on filter - end + def open_filtered_search_suggestions(filter) + focus_filtered_search - wait_for_requests - end + page.within(search_bar_selector) do + click_on filter + end - def input_filtered_search_filter_is_only(filter, value) - focus_filtered_search + wait_for_requests + end - page.within(search_bar_selector) do - click_on filter + def input_filtered_search_filter_is_only(filter, value) + focus_filtered_search - # For OPERATORS_IS, clicking the filter - # immediately preselects "=" operator + page.within(search_bar_selector) do + click_on filter - page.find('input').send_keys(value) - page.find('input').send_keys(:enter) + # For OPERATORS_IS, clicking the filter + # immediately preselects "=" operator - click_on 'Search' - end + page.find('input').send_keys(value) + page.find('input').send_keys(:enter) - wait_for_requests - end - end + click_on 'Search' end + + wait_for_requests end end end |