diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-20 12:11:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-20 12:11:11 +0300 |
commit | 9fa24e4f9c5440e2ddc27cd787df5f5e669bed25 (patch) | |
tree | 6e0d1985050d6ef76ff1e451dce0eebcabc1e43e /spec/support/helpers | |
parent | fe9e084c1de1c8bb98172b7bf7a61ca044878173 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/helpers')
-rw-r--r-- | spec/support/helpers/cycle_analytics_helpers.rb | 25 | ||||
-rw-r--r-- | spec/support/helpers/listbox_helpers.rb | 4 |
2 files changed, 16 insertions, 13 deletions
diff --git a/spec/support/helpers/cycle_analytics_helpers.rb b/spec/support/helpers/cycle_analytics_helpers.rb index 5f60f8a6bfa..890fefcc7de 100644 --- a/spec/support/helpers/cycle_analytics_helpers.rb +++ b/spec/support/helpers/cycle_analytics_helpers.rb @@ -1,6 +1,10 @@ # frozen_string_literal: true +require_relative './listbox_helpers' + module CycleAnalyticsHelpers + include ::ListboxHelpers + def toggle_value_stream_dropdown page.find('[data-testid="dropdown-value-streams"]').click end @@ -16,8 +20,8 @@ module CycleAnalyticsHelpers within last_stage do find('[name*="custom-stage-name-"]').fill_in with: "Cool custom stage - name #{index}" - select_dropdown_option_by_value "custom-stage-start-event-", :merge_request_created - select_dropdown_option_by_value "custom-stage-end-event-", :merge_request_merged + select_dropdown_option_by_value "custom-stage-start-event-", 'Merge request created' + select_dropdown_option_by_value "custom-stage-end-event-", 'Merge request merged' end end @@ -34,8 +38,8 @@ module CycleAnalyticsHelpers within last_stage do find('[name*="custom-stage-name-"]').fill_in with: "Cool custom label stage - name #{index}" - select_dropdown_option_by_value "custom-stage-start-event-", :issue_label_added - select_dropdown_option_by_value "custom-stage-end-event-", :issue_label_removed + select_dropdown_option_by_value "custom-stage-start-event-", 'Issue label was added' + select_dropdown_option_by_value "custom-stage-end-event-", 'Issue label was removed' select_event_label("[data-testid*='custom-stage-start-event-label-']") select_event_label("[data-testid*='custom-stage-end-event-label-']") @@ -102,19 +106,14 @@ module CycleAnalyticsHelpers select_value_stream(custom_value_stream_name) end - def toggle_dropdown(field) - page.within("[data-testid*='#{field}']") do - find('.dropdown-toggle').click + def select_dropdown_option_by_value(name, value) + page.within("[data-testid*='#{name}']") do + toggle_listbox wait_for_requests - - expect(find('.dropdown-menu')).to have_selector('.dropdown-item') end - end - def select_dropdown_option_by_value(name, value, elem = '.dropdown-item') - toggle_dropdown name - page.find("[data-testid*='#{name}'] .dropdown-menu").find("#{elem}[value='#{value}']").click + select_listbox_item(value) end def create_commit_referencing_issue(issue, branch_name: generate(:branch)) diff --git a/spec/support/helpers/listbox_helpers.rb b/spec/support/helpers/listbox_helpers.rb index 7a734d2b097..a8a4c079e3c 100644 --- a/spec/support/helpers/listbox_helpers.rb +++ b/spec/support/helpers/listbox_helpers.rb @@ -14,6 +14,10 @@ module ListboxHelpers find('.gl-new-dropdown-item', text: text, exact_text: exact_text).click end + def toggle_listbox + find('.gl-new-dropdown-toggle').click + end + def expect_listbox_item(text) expect(page).to have_css('.gl-new-dropdown-item[role="option"]', text: text) end |