diff options
Diffstat (limited to 'qa/qa/page')
31 files changed, 346 insertions, 141 deletions
diff --git a/qa/qa/page/admin/settings/component/sign_up_restrictions.rb b/qa/qa/page/admin/settings/component/sign_up_restrictions.rb index 9909155641f..8b0d420d00a 100644 --- a/qa/qa/page/admin/settings/component/sign_up_restrictions.rb +++ b/qa/qa/page/admin/settings/component/sign_up_restrictions.rb @@ -6,19 +6,19 @@ module QA module Settings module Component class SignUpRestrictions < Page::Base - view 'app/views/admin/application_settings/_signup.html.haml' do + view 'app/assets/javascripts/pages/admin/application_settings/general/components/signup_form.vue' do element :require_admin_approval_after_user_signup_checkbox element :signup_enabled_checkbox element :save_changes_button end def require_admin_approval_after_user_signup - check_element(:require_admin_approval_after_user_signup_checkbox) + click_element_coordinates(:require_admin_approval_after_user_signup_checkbox, visible: false) click_element(:save_changes_button) end def disable_signups - uncheck_element(:signup_enabled_checkbox) + click_element_coordinates(:signup_enabled_checkbox, visible: false) click_element(:save_changes_button) end end diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index d1b556b58fb..289094268b6 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -132,7 +132,7 @@ module QA all(element_selector_css(name), **kwargs) end - def check_element(name) + def check_element(name, click_by_js = false) if find_element(name, visible: false).checked? QA::Runtime::Logger.debug("#{name} is already checked") @@ -140,7 +140,7 @@ module QA end retry_until(sleep_interval: 1) do - find_element(name, visible: false).click + click_checkbox_or_radio(name, click_by_js) checked = find_element(name, visible: false).checked? QA::Runtime::Logger.debug(checked ? "#{name} was checked" : "#{name} was not checked") @@ -149,7 +149,7 @@ module QA end end - def uncheck_element(name) + def uncheck_element(name, click_by_js = false) unless find_element(name, visible: false).checked? QA::Runtime::Logger.debug("#{name} is already unchecked") @@ -157,7 +157,7 @@ module QA end retry_until(sleep_interval: 1) do - find_element(name, visible: false).click + click_checkbox_or_radio(name, click_by_js) unchecked = !find_element(name, visible: false).checked? QA::Runtime::Logger.debug(unchecked ? "#{name} was unchecked" : "#{name} was not unchecked") @@ -166,13 +166,31 @@ module QA end end + # Method for selecting radios + def choose_element(name, click_by_js = false) + if find_element(name, visible: false).checked? + QA::Runtime::Logger.debug("#{name} is already selected") + + return + end + + retry_until(sleep_interval: 1) do + click_checkbox_or_radio(name, click_by_js) + selected = find_element(name, visible: false).checked? + + QA::Runtime::Logger.debug(selected ? "#{name} was selected" : "#{name} was not selected") + + selected + end + end + # Use this to simulate moving the pointer to an element's coordinate # and sending a click event. # This is a helpful workaround when there is a transparent element overlapping # the target element and so, normal `click_element` on target would raise # Selenium::WebDriver::Error::ElementClickInterceptedError - def click_element_coordinates(name) - page.driver.browser.action.move_to(find_element(name).native).click.perform + def click_element_coordinates(name, **kwargs) + page.driver.browser.action.move_to(find_element(name, **kwargs).native).click.perform end # replace with (..., page = self.class) @@ -403,6 +421,14 @@ module QA end end end + + private + + def click_checkbox_or_radio(name, click_by_js) + box = find_element(name, visible: false) + # Some checkboxes and radio buttons are hidden by their labels and cannot be clicked directly + click_by_js ? page.execute_script("arguments[0].click();", box) : box.click + end end end end diff --git a/qa/qa/page/component/access_tokens.rb b/qa/qa/page/component/access_tokens.rb new file mode 100644 index 00000000000..d8e3d12b38b --- /dev/null +++ b/qa/qa/page/component/access_tokens.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +module QA + module Page + module Component + module AccessTokens + extend QA::Page::PageConcern + + def self.included(base) + super + + base.view 'app/assets/javascripts/access_tokens/components/expires_at_field.vue' do + element :expiry_date_field + end + + base.view 'app/views/shared/access_tokens/_form.html.haml' do + element :access_token_name_field + element :create_token_button + end + + base.view 'app/views/shared/tokens/_scopes_form.html.haml' do + element :api_radio, 'qa-#{scope}-radio' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck + end + + base.view 'app/views/shared/access_tokens/_created_container.html.haml' do + element :created_access_token + end + + base.view 'app/views/shared/access_tokens/_table.html.haml' do + element :revoke_button + end + end + + def fill_token_name(name) + fill_element(:access_token_name_field, name) + end + + def check_api + check_element(:api_radio) + end + + def click_create_token_button + click_element(:create_token_button) + end + + def created_access_token + find_element(:created_access_token, wait: 30).value + end + + def fill_expiry_date(date) + date = date.to_s if date.is_a?(Date) + Date.strptime(date, '%Y-%m-%d') rescue ArgumentError raise "Expiry date must be in YYYY-MM-DD format" + + fill_element(:expiry_date_field, date) + end + + def has_token_row_for_name?(token_name) + page.has_css?('tr', text: token_name, wait: 1.0) + end + + def first_token_row_for_name(token_name) + page.find('tr', text: token_name, match: :first, wait: 1.0) + end + + def revoke_first_token_with_name(token_name) + within first_token_row_for_name(token_name) do + accept_confirm do + click_element(:revoke_button) + end + end + end + end + end + end +end diff --git a/qa/qa/page/component/commit_modal.rb b/qa/qa/page/component/commit_modal.rb new file mode 100644 index 00000000000..7192e8bafb5 --- /dev/null +++ b/qa/qa/page/component/commit_modal.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module QA + module Page + module Component + class CommitModal < Page::Base + view 'app/assets/javascripts/projects/commit/components/form_modal.vue' do + element :submit_commit_button, required: true + end + end + end + end +end diff --git a/qa/qa/page/component/invite_members_modal.rb b/qa/qa/page/component/invite_members_modal.rb index fbddb37f15e..9883ef22029 100644 --- a/qa/qa/page/component/invite_members_modal.rb +++ b/qa/qa/page/component/invite_members_modal.rb @@ -42,7 +42,7 @@ module QA within_element(:invite_members_modal_content) do fill_element :access_level_dropdown, with: access_level - fill_in 'Search for members to invite', with: username + fill_in 'Select members or type email addresses', with: username Support::WaitForRequests.wait_for_requests diff --git a/qa/qa/page/component/issue_board/show.rb b/qa/qa/page/component/issue_board/show.rb index d7dfb0757bc..dbf4dc30116 100644 --- a/qa/qa/page/component/issue_board/show.rb +++ b/qa/qa/page/component/issue_board/show.rb @@ -11,6 +11,7 @@ module QA view 'app/assets/javascripts/boards/components/board_form.vue' do element :board_name_field + element :save_changes_button end view 'app/assets/javascripts/boards/components/board_list.vue' do @@ -23,10 +24,6 @@ module QA element :create_new_board_button end - view 'app/assets/javascripts/vue_shared/components/deprecated_modal.vue' do - element :save_changes_button - end - view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue' do element :labels_dropdown_content end @@ -35,7 +32,7 @@ module QA element :labels_edit_button end - view 'app/views/shared/boards/_show.html.haml' do + view 'app/assets/javascripts/boards/components/board_content.vue' do element :boards_list end diff --git a/qa/qa/page/component/snippet.rb b/qa/qa/page/component/snippet.rb index b98c429df8c..73f41e0aa51 100644 --- a/qa/qa/page/component/snippet.rb +++ b/qa/qa/page/component/snippet.rb @@ -25,10 +25,6 @@ module QA element :file_title_content end - base.view 'app/assets/javascripts/vue_shared/components/blob_viewers/simple_viewer.vue' do - element :file_content - end - base.view 'app/assets/javascripts/blob/components/blob_content.vue' do element :file_content end diff --git a/qa/qa/page/component/wiki_page_form.rb b/qa/qa/page/component/wiki_page_form.rb index e24b1b67af1..bb22b7da003 100644 --- a/qa/qa/page/component/wiki_page_form.rb +++ b/qa/qa/page/component/wiki_page_form.rb @@ -9,12 +9,11 @@ module QA def self.included(base) super - base.view 'app/views/shared/wikis/_form.html.haml' do + base.view 'app/assets/javascripts/pages/shared/wikis/components/wiki_form.vue' do element :wiki_title_textbox element :wiki_content_textarea element :wiki_message_textbox - element :save_changes_button - element :create_page_button + element :wiki_submit_button end base.view 'app/assets/javascripts/pages/shared/wikis/components/delete_wiki_modal.vue' do @@ -34,12 +33,8 @@ module QA fill_element(:wiki_message_textbox, message) end - def click_save_changes - click_element(:save_changes_button) - end - - def click_create_page - click_element(:create_page_button) + def click_submit + click_element(:wiki_submit_button) end def delete_page diff --git a/qa/qa/page/dashboard/snippet/index.rb b/qa/qa/page/dashboard/snippet/index.rb index 1f467fda9e1..8c4abfdf606 100644 --- a/qa/qa/page/dashboard/snippet/index.rb +++ b/qa/qa/page/dashboard/snippet/index.rb @@ -5,7 +5,7 @@ module QA module Dashboard module Snippet class Index < Page::Base - view 'app/views/layouts/header/_new_dropdown.haml' do + view 'app/views/layouts/header/_new_dropdown.html.haml' do element :new_menu_toggle element :global_new_snippet_link end diff --git a/qa/qa/page/group/settings/general.rb b/qa/qa/page/group/settings/general.rb index ced8bd5c812..1ab849d10b1 100644 --- a/qa/qa/page/group/settings/general.rb +++ b/qa/qa/page/group/settings/general.rb @@ -9,6 +9,7 @@ module QA view 'app/views/groups/edit.html.haml' do element :permission_lfs_2fa_content + element :advanced_settings_content end view 'app/views/groups/settings/_permissions.html.haml' do @@ -40,6 +41,16 @@ module QA element :project_creation_level_dropdown end + view 'app/views/groups/settings/_advanced.html.haml' do + element :select_group_dropdown + element :transfer_group_button + end + + view 'app/helpers/dropdowns_helper.rb' do + element :dropdown_input_field + element :dropdown_list_content + end + def set_group_name(name) find_element(:group_name_field).send_keys([:command, 'a'], :backspace) find_element(:group_name_field).set name @@ -106,6 +117,19 @@ module QA click_element(:save_permissions_changes_button) end + + def transfer_group(target_group) + expand_content :advanced_settings_content + + click_element :select_group_dropdown + fill_element(:dropdown_input_field, target_group) + + within_element(:dropdown_list_content) do + click_on target_group + end + + click_element :transfer_group_button + end end end end diff --git a/qa/qa/page/merge_request/new.rb b/qa/qa/page/merge_request/new.rb index 8d0914bac4c..46b7bbeed84 100644 --- a/qa/qa/page/merge_request/new.rb +++ b/qa/qa/page/merge_request/new.rb @@ -8,8 +8,33 @@ module QA element :issuable_create_button, required: true end + view 'app/views/shared/form_elements/_description.html.haml' do + element :issuable_form_description + end + + view 'app/views/projects/merge_requests/show.html.haml' do + element :diffs_tab + end + + view 'app/assets/javascripts/diffs/components/diff_file_header.vue' do + element :file_name_content + end + def create_merge_request - click_element :issuable_create_button, Page::MergeRequest::Show + click_element(:issuable_create_button, Page::MergeRequest::Show) + end + + def has_description?(description) + has_element?(:issuable_form_description, text: description) + end + + def click_diffs_tab + click_element(:diffs_tab) + click_element(:dismiss_popover_button) if has_element?(:dismiss_popover_button, wait: 1) + end + + def has_file?(file_name) + has_element?(:file_name_content, text: file_name) end end end diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index 0b6a3085a3a..e1790deb3ec 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -49,6 +49,7 @@ module QA view 'app/views/projects/merge_requests/show.html.haml' do element :notes_tab + element :commits_tab element :diffs_tab end @@ -67,8 +68,11 @@ module QA element :edit_in_ide_button end - view 'app/assets/javascripts/diffs/components/inline_diff_table_row.vue' do + view 'app/assets/javascripts/diffs/components/diff_row.vue' do element :diff_comment_button + end + + view 'app/assets/javascripts/diffs/components/inline_diff_table_row.vue' do element :new_diff_line_link end @@ -104,6 +108,17 @@ module QA element :suggestion_button end + view 'app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.vue' do + element :revert_button + element :cherry_pick_button + end + + view 'app/assets/javascripts/vue_shared/components/markdown/apply_suggestion.vue' do + element :apply_suggestion_button + element :commit_message_textbox + element :commit_with_custom_message_button + end + def start_review click_element(:start_review_button) @@ -170,6 +185,10 @@ module QA wait_for_requests end + def click_commits_tab + click_element(:commits_tab) + end + def click_diffs_tab click_element(:diffs_tab) click_element(:dismiss_popover_button) if has_element?(:dismiss_popover_button, wait: 1) @@ -219,18 +238,12 @@ module QA end def mark_to_squash - # The squash checkbox is disabled on load - wait_until do - has_element?(:squash_checkbox) - end - # The squash checkbox is enabled via JS wait_until(reload: false) do - !find_element(:squash_checkbox).disabled? + !find_element(:squash_checkbox, visible: false).disabled? end - # TODO: Fix workaround for data-qa-selector failure - click_element(:squash_checkbox) + check_element(:squash_checkbox, true) end def merge! @@ -349,6 +362,12 @@ module QA click_element(:comment_now_button) end + def apply_suggestion_with_message(message) + click_element(:apply_suggestion_button) + fill_element(:commit_message_textbox, message) + click_element(:commit_with_custom_message_button) + end + def add_suggestion_to_batch all_elements(:add_suggestion_batch_button, minimum: 1).first.click end @@ -356,6 +375,16 @@ module QA def apply_suggestions_batch all_elements(:apply_suggestions_batch_button, minimum: 1).first.click end + + def cherry_pick! + click_element(:cherry_pick_button, Page::Component::CommitModal) + click_element(:submit_commit_button) + end + + def revert_change! + click_element(:revert_button, Page::Component::CommitModal) + click_element(:submit_commit_button) + end end end end diff --git a/qa/qa/page/profile/personal_access_tokens.rb b/qa/qa/page/profile/personal_access_tokens.rb index caa8c0ceb40..75ba69bafa6 100644 --- a/qa/qa/page/profile/personal_access_tokens.rb +++ b/qa/qa/page/profile/personal_access_tokens.rb @@ -6,64 +6,7 @@ module QA module Page module Profile class PersonalAccessTokens < Page::Base - view 'app/assets/javascripts/access_tokens/components/expires_at_field.vue' do - element :expiry_date_field - end - - view 'app/views/shared/access_tokens/_form.html.haml' do - element :access_token_name_field - element :create_token_button - end - - view 'app/views/shared/tokens/_scopes_form.html.haml' do - element :api_radio, 'qa-#{scope}-radio' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck - end - - view 'app/views/shared/access_tokens/_created_container.html.haml' do - element :created_access_token - end - view 'app/views/shared/access_tokens/_table.html.haml' do - element :revoke_button - end - - def fill_token_name(name) - fill_element(:access_token_name_field, name) - end - - def check_api - check_element(:api_radio) - end - - def click_create_token_button - click_element(:create_token_button) - end - - def created_access_token - find_element(:created_access_token, wait: 30).value - end - - def fill_expiry_date(date) - date = date.to_s if date.is_a?(Date) - Date.strptime(date, '%Y-%m-%d') rescue ArgumentError raise "Expiry date must be in YYYY-MM-DD format" - - fill_element(:expiry_date_field, date) - end - - def has_token_row_for_name?(token_name) - page.has_css?('tr', text: token_name, wait: 1.0) - end - - def first_token_row_for_name(token_name) - page.find('tr', text: token_name, match: :first, wait: 1.0) - end - - def revoke_first_token_with_name(token_name) - within first_token_row_for_name(token_name) do - accept_confirm do - click_element(:revoke_button) - end - end - end + include Page::Component::AccessTokens end end end diff --git a/qa/qa/page/project/commit/show.rb b/qa/qa/page/project/commit/show.rb index 8ece81f7088..f732eb6565e 100644 --- a/qa/qa/page/project/commit/show.rb +++ b/qa/qa/page/project/commit/show.rb @@ -6,10 +6,20 @@ module QA module Commit class Show < Page::Base view 'app/views/projects/commit/_commit_box.html.haml' do + element :commit_sha_content + end + + view 'app/assets/javascripts/projects/commit/components/commit_options_dropdown.vue' do element :options_button + element :cherry_pick_button element :email_patches element :plain_diff - element :commit_sha_content + end + + def cherry_pick_commit + click_element(:options_button) + click_element(:cherry_pick_button, Page::Component::CommitModal) + click_element(:submit_commit_button) end def select_email_patches diff --git a/qa/qa/page/project/fork/new.rb b/qa/qa/page/project/fork/new.rb index bbdd4748f5c..5a08f6a3cbd 100644 --- a/qa/qa/page/project/fork/new.rb +++ b/qa/qa/page/project/fork/new.rb @@ -13,8 +13,18 @@ module QA element :fork_groups_list_search_field end - def choose_namespace(namespace = Runtime::Namespace.path) - click_element(:fork_namespace_button, name: namespace) + view 'app/assets/javascripts/pages/projects/forks/new/components/fork_form.vue' do + element :fork_namespace_dropdown + element :fork_project_button + end + + def fork_project(namespace = Runtime::Namespace.path) + if has_element?(:fork_namespace_button, wait: 0) + click_element(:fork_namespace_button, name: namespace) + else + select_element(:fork_namespace_dropdown, namespace) + click_element(:fork_project_button) + end end def search_for_group(group_name) diff --git a/qa/qa/page/project/menu.rb b/qa/qa/page/project/menu.rb index 16c66ea5761..cb7323ac62d 100644 --- a/qa/qa/page/project/menu.rb +++ b/qa/qa/page/project/menu.rb @@ -13,8 +13,7 @@ module QA include SubMenus::Settings include SubMenus::Packages - view 'app/views/layouts/nav/sidebar/_project.html.haml' do - element :activity_link + view 'app/views/layouts/nav/sidebar/_project_menus.html.haml' do element :merge_requests_link element :snippets_link element :members_link @@ -24,6 +23,10 @@ module QA element :wiki_link end + view 'app/views/shared/nav/_sidebar_menu_item.html.haml' do + element :sidebar_menu_item_link + end + def click_merge_requests within_sidebar do click_element(:merge_requests_link) @@ -38,7 +41,7 @@ module QA def click_activity within_sidebar do - click_element(:activity_link) + click_element(:sidebar_menu_item_link, menu_item: 'Activity') end end diff --git a/qa/qa/page/project/pipeline/index.rb b/qa/qa/page/project/pipeline/index.rb index 0f5a7e8c801..3cb466abce9 100644 --- a/qa/qa/page/project/pipeline/index.rb +++ b/qa/qa/page/project/pipeline/index.rb @@ -9,8 +9,11 @@ module QA element :pipeline_url_link end - view 'app/assets/javascripts/pipelines/components/pipelines_list/pipelines_table_row.vue' do + view 'app/assets/javascripts/pipelines/components/pipelines_list/pipelines_status_badge.vue' do element :pipeline_commit_status + end + + view 'app/assets/javascripts/pipelines/components/pipelines_list/pipeline_operations.vue' do element :pipeline_retry_button end @@ -31,7 +34,7 @@ module QA end def wait_for_latest_pipeline_status - wait_until(max_duration: 30, reload: true, sleep_interval: 5) { has_pipeline? } + wait_until(max_duration: 90, reload: true, sleep_interval: 5) { has_pipeline? } wait_until(reload: false, max_duration: 360) do within_element_by_index(:pipeline_commit_status, 0) { yield } diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb index 994b1c02a3d..c5887b84be6 100644 --- a/qa/qa/page/project/pipeline/show.rb +++ b/qa/qa/page/project/pipeline/show.rb @@ -68,20 +68,30 @@ module QA end end - def has_child_pipeline? - has_element? :child_pipeline + def has_child_pipeline?(title: nil) + title ? find_child_pipeline_by_title(title) : has_element?(:child_pipeline) end def has_no_child_pipeline? - has_no_element? :child_pipeline + has_no_element?(:child_pipeline) end def click_job(job_name) click_element(:job_link, Project::Job::Show, text: job_name) end - def expand_child_pipeline - within_element(:child_pipeline) do + def child_pipelines + all_elements(:child_pipeline, minimum: 1) + end + + def find_child_pipeline_by_title(title) + child_pipelines.find { |pipeline| pipeline[:title].include?(title) } + end + + def expand_child_pipeline(title: nil) + child_pipeline = title ? find_child_pipeline_by_title(title) : child_pipelines.first + + within_element_by_index(:child_pipeline, child_pipelines.index(child_pipeline)) do click_element(:expand_pipeline_button) end end diff --git a/qa/qa/page/project/settings/access_tokens.rb b/qa/qa/page/project/settings/access_tokens.rb new file mode 100644 index 00000000000..d559ca4daaa --- /dev/null +++ b/qa/qa/page/project/settings/access_tokens.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require 'date' + +module QA + module Page + module Project + module Settings + class AccessTokens < Page::Base + include Page::Component::AccessTokens + end + end + end + end +end diff --git a/qa/qa/page/project/settings/ci_cd.rb b/qa/qa/page/project/settings/ci_cd.rb index 7a910233d12..7224fdae10e 100644 --- a/qa/qa/page/project/settings/ci_cd.rb +++ b/qa/qa/page/project/settings/ci_cd.rb @@ -42,3 +42,5 @@ module QA end end end + +QA::Page::Project::Settings::CICD.prepend_if_ee("QA::EE::Page::Project::Settings::CICD") diff --git a/qa/qa/page/project/settings/integrations.rb b/qa/qa/page/project/settings/integrations.rb index dd676c86486..6f5c50eac52 100644 --- a/qa/qa/page/project/settings/integrations.rb +++ b/qa/qa/page/project/settings/integrations.rb @@ -5,9 +5,9 @@ module QA module Project module Settings class Integrations < QA::Page::Base - view 'app/views/shared/integrations/_index.html.haml' do - element :prometheus_link, 'data: { qa_selector: "#{integration.to_param' # rubocop:disable QA/ElementWithPattern - element :jira_link, 'data: { qa_selector: "#{integration.to_param' # rubocop:disable QA/ElementWithPattern + view 'app/assets/javascripts/integrations/index/components/integrations_table.vue' do + element :prometheus_link, %q(:data-qa-selector="`${item.name}_link`") # rubocop:disable QA/ElementWithPattern + element :jira_link, %q(:data-qa-selector="`${item.name}_link`") # rubocop:disable QA/ElementWithPattern end def click_on_prometheus_integration diff --git a/qa/qa/page/project/settings/merge_request.rb b/qa/qa/page/project/settings/merge_request.rb index fe5d629effe..0b4a12dbb2e 100644 --- a/qa/qa/page/project/settings/merge_request.rb +++ b/qa/qa/page/project/settings/merge_request.rb @@ -20,11 +20,11 @@ module QA end def click_save_changes - click_element :save_merge_request_changes_button + click_element(:save_merge_request_changes_button) end def enable_ff_only - click_element :merge_ff_radio_button + click_element(:merge_ff_radio_button) click_save_changes end diff --git a/qa/qa/page/project/settings/runners.rb b/qa/qa/page/project/settings/runners.rb index af4dbb08430..aa1ac216ae2 100644 --- a/qa/qa/page/project/settings/runners.rb +++ b/qa/qa/page/project/settings/runners.rb @@ -10,12 +10,9 @@ module QA element :coordinator_address, '%code#coordinator_address' # rubocop:disable QA/ElementWithPattern end - ## - # TODO, phase-out CSS classes added in Ruby helpers. - # view 'app/helpers/ci/runners_helper.rb' do # rubocop:disable Lint/InterpolationCheck - element :runner_status, 'runner-status-#{status}' # rubocop:disable QA/ElementWithPattern + element :runner_status_icon, 'qa_selector: "runner_status_#{status}_content"' # rubocop:disable QA/ElementWithPattern # rubocop:enable Lint/InterpolationCheck end @@ -28,7 +25,7 @@ module QA end def has_online_runner? - page.has_css?('.runner-status-online') + has_element?(:runner_status_online_content) end end end diff --git a/qa/qa/page/project/settings/services/jira.rb b/qa/qa/page/project/settings/services/jira.rb index eaa3e90db78..0a56aaa758e 100644 --- a/qa/qa/page/project/settings/services/jira.rb +++ b/qa/qa/page/project/settings/services/jira.rb @@ -10,7 +10,13 @@ module QA element :service_url_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern element :service_username_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern element :service_password_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern - element :service_jira_issue_transition_id_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern + end + + view 'app/assets/javascripts/integrations/edit/components/jira_trigger_fields.vue' do + element :service_jira_issue_transition_enabled_checkbox + element :service_jira_issue_transition_automatic_true_radio, ':data-qa-selector="`service_jira_issue_transition_automatic_${issueTransitionOption.value}_radio`"' # rubocop:disable QA/ElementWithPattern + element :service_jira_issue_transition_automatic_false_radio, ':data-qa-selector="`service_jira_issue_transition_automatic_${issueTransitionOption.value}_radio`"' # rubocop:disable QA/ElementWithPattern + element :service_jira_issue_transition_id_field end view 'app/assets/javascripts/integrations/edit/components/integration_form.vue' do @@ -23,7 +29,10 @@ module QA set_jira_server_url(url) set_username(Runtime::Env.jira_admin_username) set_password(Runtime::Env.jira_admin_password) - set_transaction_ids('11,21,31,41') + + enable_transitions + use_custom_transitions + set_transition_ids('11,21,31,41') click_save_changes_button wait_until(reload: false) do @@ -45,12 +54,24 @@ module QA fill_element(:service_password_field, password) end - def set_transaction_ids(transaction_ids) - fill_element(:service_jira_issue_transition_id_field, transaction_ids) + def enable_transitions + check_element(:service_jira_issue_transition_enabled_checkbox, true) + end + + def use_automatic_transitions + choose_element(:service_jira_issue_transition_automatic_true_radio, true) + end + + def use_custom_transitions + choose_element(:service_jira_issue_transition_automatic_false_radio, true) + end + + def set_transition_ids(transition_ids) + fill_element(:service_jira_issue_transition_id_field, transition_ids) end def click_save_changes_button - click_element :save_changes_button + click_element(:save_changes_button) end end end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index d2c258b90b5..d8c6b3881bd 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -22,7 +22,7 @@ module QA element :file_tree_table end - view 'app/views/layouts/header/_new_dropdown.haml' do + view 'app/views/layouts/header/_new_dropdown.html.haml' do element :new_menu_toggle element :new_issue_link, "link_to _('New issue'), new_project_issue_path(@project)" # rubocop:disable QA/ElementWithPattern end diff --git a/qa/qa/page/project/sub_menus/ci_cd.rb b/qa/qa/page/project/sub_menus/ci_cd.rb index 9405ea97fff..398712c04d2 100644 --- a/qa/qa/page/project/sub_menus/ci_cd.rb +++ b/qa/qa/page/project/sub_menus/ci_cd.rb @@ -13,7 +13,7 @@ module QA base.class_eval do include QA::Page::Project::SubMenus::Common - view 'app/views/layouts/nav/sidebar/_project.html.haml' do + view 'app/views/layouts/nav/sidebar/_project_menus.html.haml' do element :link_pipelines end end diff --git a/qa/qa/page/project/sub_menus/issues.rb b/qa/qa/page/project/sub_menus/issues.rb index 124faf0d346..384af3fb53e 100644 --- a/qa/qa/page/project/sub_menus/issues.rb +++ b/qa/qa/page/project/sub_menus/issues.rb @@ -13,7 +13,7 @@ module QA base.class_eval do include QA::Page::Project::SubMenus::Common - view 'app/views/layouts/nav/sidebar/_project.html.haml' do + view 'app/views/layouts/nav/sidebar/_project_menus.html.haml' do element :issue_boards_link element :issues_item element :labels_link diff --git a/qa/qa/page/project/sub_menus/operations.rb b/qa/qa/page/project/sub_menus/operations.rb index 042994062c7..af716d1af0d 100644 --- a/qa/qa/page/project/sub_menus/operations.rb +++ b/qa/qa/page/project/sub_menus/operations.rb @@ -13,7 +13,7 @@ module QA base.class_eval do include QA::Page::Project::SubMenus::Common - view 'app/views/layouts/nav/sidebar/_project.html.haml' do + view 'app/views/layouts/nav/sidebar/_project_menus.html.haml' do element :operations_link element :operations_environments_link element :operations_metrics_link diff --git a/qa/qa/page/project/sub_menus/project.rb b/qa/qa/page/project/sub_menus/project.rb index 4af640301b9..ecb3148b486 100644 --- a/qa/qa/page/project/sub_menus/project.rb +++ b/qa/qa/page/project/sub_menus/project.rb @@ -13,8 +13,8 @@ module QA base.class_eval do include QA::Page::Project::SubMenus::Common - view 'app/views/layouts/nav/sidebar/_project.html.haml' do - element :project_link + view 'app/views/shared/nav/_sidebar_menu.html.haml' do + element :sidebar_menu_link end end end @@ -22,7 +22,7 @@ module QA def click_project retry_on_exception do within_sidebar do - click_element(:project_link) + click_element(:sidebar_menu_link, menu_item: 'Project overview') end end end diff --git a/qa/qa/page/project/sub_menus/repository.rb b/qa/qa/page/project/sub_menus/repository.rb index c78c7521b64..458f0cddab6 100644 --- a/qa/qa/page/project/sub_menus/repository.rb +++ b/qa/qa/page/project/sub_menus/repository.rb @@ -13,24 +13,26 @@ module QA base.class_eval do include QA::Page::Project::SubMenus::Common - view 'app/views/layouts/nav/sidebar/_project.html.haml' do - element :repository_link - element :branches_link - element :tags_link + view 'app/views/shared/nav/_sidebar_menu_item.html.haml' do + element :sidebar_menu_item_link + end + + view 'app/views/shared/nav/_sidebar_menu.html.haml' do + element :sidebar_menu_link end end end def click_repository within_sidebar do - click_element(:repository_link) + click_element(:sidebar_menu_link, menu_item: 'Repository') end end def go_to_repository_branches hover_repository do within_submenu do - click_element(:branches_link) + click_element(:sidebar_menu_item_link, menu_item: 'Branches') end end end @@ -38,7 +40,7 @@ module QA def go_to_repository_tags hover_repository do within_submenu do - click_element(:tags_link) + click_element(:sidebar_menu_item_link, menu_item: 'Tags') end end end @@ -47,7 +49,7 @@ module QA def hover_repository within_sidebar do - find_element(:repository_link).hover + find_element(:sidebar_menu_link, menu_item: 'Repository').hover yield end diff --git a/qa/qa/page/project/sub_menus/settings.rb b/qa/qa/page/project/sub_menus/settings.rb index b5058bacccd..531c4686345 100644 --- a/qa/qa/page/project/sub_menus/settings.rb +++ b/qa/qa/page/project/sub_menus/settings.rb @@ -13,11 +13,12 @@ module QA base.class_eval do include QA::Page::Project::SubMenus::Common - view 'app/views/layouts/nav/sidebar/_project.html.haml' do + view 'app/views/layouts/nav/sidebar/_project_menus.html.haml' do element :settings_item element :general_settings_link element :integrations_settings_link element :operations_settings_link + element :access_tokens_settings_link end end end @@ -68,6 +69,14 @@ module QA end end + def go_to_access_token_settings + hover_settings do + within_submenu do + click_element :access_tokens_settings_link + end + end + end + private def hover_settings |