diff options
Diffstat (limited to 'qa/qa/page')
25 files changed, 173 insertions, 96 deletions
diff --git a/qa/qa/page/admin/settings/component/repository_storage.rb b/qa/qa/page/admin/settings/component/repository_storage.rb deleted file mode 100644 index 2ed0cd73aa3..00000000000 --- a/qa/qa/page/admin/settings/component/repository_storage.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Admin - module Settings - module Component - class RepositoryStorage < Page::Base - view 'app/views/admin/application_settings/_repository_storage.html.haml' do - element :hashed_storage_checkbox - element :save_changes_button - end - - def enable_hashed_storage - check_element :hashed_storage_checkbox - end - - def save_settings - click_element :save_changes_button - end - end - end - end - end - end -end diff --git a/qa/qa/page/admin/settings/repository.rb b/qa/qa/page/admin/settings/repository.rb deleted file mode 100644 index 82321765e63..00000000000 --- a/qa/qa/page/admin/settings/repository.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Admin - module Settings - class Repository < Page::Base - include QA::Page::Settings::Common - - view 'app/views/admin/application_settings/repository.html.haml' do - element :repository_storage_settings_content - end - - def expand_repository_storage(&block) - expand_content(:repository_storage_settings_content) do - Component::RepositoryStorage.perform(&block) - end - end - end - end - end - end -end diff --git a/qa/qa/page/component/issue_board/show.rb b/qa/qa/page/component/issue_board/show.rb index 9e843630115..15c1c25cbf9 100644 --- a/qa/qa/page/component/issue_board/show.rb +++ b/qa/qa/page/component/issue_board/show.rb @@ -96,6 +96,8 @@ module QA click_boards_config_button click_element(:labels_edit_button) find_element(:labels_dropdown_content).find('li', text: label).click + # Clicking the edit button again closes the dropdown and allows the save button to be clicked + click_element(:labels_edit_button) click_element(:save_changes_button) wait_boards_list_finish_loading end diff --git a/qa/qa/page/component/project_selector.rb b/qa/qa/page/component/project_selector.rb index 80ed6b8e53b..54bd95c5422 100644 --- a/qa/qa/page/component/project_selector.rb +++ b/qa/qa/page/component/project_selector.rb @@ -20,6 +20,9 @@ module QA end def select_project + wait_until(sleep_interval: 2, reload: false) do + has_element? :project_list_item + end click_element :project_list_item end end diff --git a/qa/qa/page/component/select2.rb b/qa/qa/page/component/select2.rb index b8beb64b6bd..761bbb17168 100644 --- a/qa/qa/page/component/select2.rb +++ b/qa/qa/page/component/select2.rb @@ -8,6 +8,10 @@ module QA find('.select2-result-label', text: item_text, match: :prefer_exact).click end + def has_item?(item_text) + has_css?('.select2-result-label', text: item_text, match: :prefer_exact) + end + def current_selection find('.select2-chosen').text end @@ -25,8 +29,12 @@ module QA end def search_and_select(item_text) + QA::Runtime::Logger.info "Searching and selecting: #{item_text}" + search_item(item_text) + raise QA::Page::Base::ElementNotFound, %Q(Couldn't find option named "#{item_text}") unless has_item?(item_text) + select_item(item_text) end diff --git a/qa/qa/page/component/snippet.rb b/qa/qa/page/component/snippet.rb index b84166ccefd..2776b6c078e 100644 --- a/qa/qa/page/component/snippet.rb +++ b/qa/qa/page/component/snippet.rb @@ -40,6 +40,7 @@ module QA base.view 'app/assets/javascripts/snippets/components/show.vue' do element :clone_button + element :snippet_embed_dropdown end base.view 'app/assets/javascripts/vue_shared/components/clone_dropdown.vue' do @@ -73,6 +74,10 @@ module QA element :more_actions_dropdown element :delete_comment_button end + + base.view 'app/assets/javascripts/snippets/components/embed_dropdown.vue' do + element :copy_button + end end def has_snippet_title?(snippet_title) @@ -105,6 +110,10 @@ module QA end end + def has_embed_dropdown? + has_element?(:snippet_embed_dropdown) + end + def click_edit_button click_element(:snippet_action_button, action: 'Edit') end @@ -129,6 +138,11 @@ module QA Git::Location.new(find_element(:copy_ssh_url_button)['data-clipboard-text']).uri.to_s end + def get_sharing_link + click_element(:snippet_embed_dropdown) + find_element(:copy_button, action: 'Share')['data-clipboard-text'] + end + def add_comment(comment) fill_element(:note_field, comment) click_element(:comment_button) diff --git a/qa/qa/page/dashboard/snippet/edit.rb b/qa/qa/page/dashboard/snippet/edit.rb index c650b8e4f90..7802a680c25 100644 --- a/qa/qa/page/dashboard/snippet/edit.rb +++ b/qa/qa/page/dashboard/snippet/edit.rb @@ -19,6 +19,10 @@ module QA text_area.has_text?(content) # wait for changes to take effect end + def change_visibility_to(visibility_type) + choose(visibility_type) + end + def save_changes click_element(:submit_button, Page::Dashboard::Snippet::Show) end diff --git a/qa/qa/page/main/sign_up.rb b/qa/qa/page/main/sign_up.rb index c47d2ce9c74..b7808afb209 100644 --- a/qa/qa/page/main/sign_up.rb +++ b/qa/qa/page/main/sign_up.rb @@ -8,23 +8,27 @@ module QA element :new_user_name_field element :new_user_username_field element :new_user_email_field - element :new_user_email_confirmation_field element :new_user_password_field element :new_user_register_button element :new_user_accept_terms_checkbox end + view 'app/views/registrations/welcome.html.haml' do + element :get_started_button + end + def sign_up!(user) fill_element :new_user_name_field, user.name fill_element :new_user_username_field, user.username fill_element :new_user_email_field, user.email - fill_element :new_user_email_confirmation_field, user.email fill_element :new_user_password_field, user.password check_element :new_user_accept_terms_checkbox if has_element?(:new_user_accept_terms_checkbox) signed_in = retry_until do - click_element :new_user_register_button + click_element :new_user_register_button if has_element?(:new_user_register_button) + + click_element :get_started_button if has_element?(:get_started_button) Page::Main::Menu.perform(&:has_personal_area?) end @@ -35,3 +39,5 @@ module QA end end end + +QA::Page::Main::SignUp.prepend_if_ee('QA::EE::Page::Main::SignUp') diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index 906ad490bb1..0b80ba84fa4 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -8,7 +8,7 @@ module QA include Page::Component::Issuable::Sidebar view 'app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.vue' do - element :dropdown_toggle + element :download_dropdown element :download_email_patches element :download_plain_diff element :open_in_web_ide_button @@ -53,10 +53,6 @@ module QA element :diffs_tab end - view 'app/assets/javascripts/diffs/components/diff_table_cell.vue' do - element :diff_comment - end - view 'app/assets/javascripts/diffs/components/inline_diff_table_row.vue' do element :new_diff_line end @@ -131,7 +127,7 @@ module QA def add_comment_to_diff(text) wait_until(sleep_interval: 5) do - has_text?("No newline at end of file") + has_css?('a[data-linenumber="1"]') end all_elements(:new_diff_line, minimum: 1).first.hover click_element(:diff_comment) @@ -255,12 +251,12 @@ module QA end def view_email_patches - click_element :dropdown_toggle + click_element :download_dropdown visit_link_in_element(:download_email_patches) end def view_plain_diff - click_element :dropdown_toggle + click_element :download_dropdown visit_link_in_element(:download_plain_diff) end @@ -275,7 +271,8 @@ module QA end def click_open_in_web_ide - click_element :open_in_web_ide_button + click_element(:open_in_web_ide_button) + wait_for_requests end end end diff --git a/qa/qa/page/profile/accounts/show.rb b/qa/qa/page/profile/accounts/show.rb index eec4efe1734..cf7f7d80cfa 100644 --- a/qa/qa/page/profile/accounts/show.rb +++ b/qa/qa/page/profile/accounts/show.rb @@ -11,17 +11,14 @@ module QA view 'app/assets/javascripts/profile/account/components/delete_account_modal.vue' do element :password_confirmation_field - end - - view 'app/assets/javascripts/vue_shared/components/deprecated_modal.vue' do - element :save_changes_button + element :confirm_delete_account_button end def delete_account(password) click_element(:delete_account_button) find_element(:password_confirmation_field).set password - click_element(:save_changes_button) + click_element(:confirm_delete_account_button) end end end diff --git a/qa/qa/page/project/issue/index.rb b/qa/qa/page/project/issue/index.rb index 0a64f01fe98..0b47bec2cf1 100644 --- a/qa/qa/page/project/issue/index.rb +++ b/qa/qa/page/project/issue/index.rb @@ -5,7 +5,7 @@ module QA module Project module Issue class Index < Page::Base - view 'app/assets/javascripts/issuables_list/components/issuable.vue' do + view 'app/assets/javascripts/issues_list/components/issuable.vue' do element :issue_container element :issue_link end diff --git a/qa/qa/page/project/issue/show.rb b/qa/qa/page/project/issue/show.rb index 5778d0218a7..826acaa2e0a 100644 --- a/qa/qa/page/project/issue/show.rb +++ b/qa/qa/page/project/issue/show.rb @@ -38,8 +38,42 @@ module QA element :new_note_form, 'attr: :note' # rubocop:disable QA/ElementWithPattern end + view 'app/assets/javascripts/related_issues/components/add_issuable_form.vue' do + element :add_issue_button + end + + view 'app/assets/javascripts/related_issues/components/related_issuable_input.vue' do + element :add_issue_input + end + + view 'app/assets/javascripts/related_issues/components/related_issues_block.vue' do + element :related_issues_plus_button + end + + view 'app/assets/javascripts/related_issues/components/related_issues_list.vue' do + element :related_issuable_item + element :related_issues_loading_icon + end + + def relate_issue(issue) + click_element(:related_issues_plus_button) + fill_element(:add_issue_input, issue.web_url) + send_keys_to_element(:add_issue_input, :enter) + end + + def related_issuable_item + find_element(:related_issuable_item) + end + + def wait_for_related_issues_to_load + has_no_element?(:related_issues_loading_icon, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) + end + def click_remove_related_issue_button - click_element(:remove_related_issue_button) + retry_until(sleep_interval: 5) do + click_element(:remove_related_issue_button) + has_no_element?(:remove_related_issue_button, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) + end end def click_close_issue_button diff --git a/qa/qa/page/project/job/show.rb b/qa/qa/page/project/job/show.rb index 6243dc92b45..6a657b4ab39 100644 --- a/qa/qa/page/project/job/show.rb +++ b/qa/qa/page/project/job/show.rb @@ -19,6 +19,10 @@ module QA element :retry_button end + view 'app/assets/javascripts/jobs/components/artifacts_block.vue' do + element :browse_artifacts_button + end + def successful?(timeout: 60) raise "Timed out waiting for the build trace to load" unless loaded? raise "Timed out waiting for the status to be a valid completed state" unless completed?(timeout: timeout) @@ -42,6 +46,14 @@ module QA result end + def has_browse_button? + has_element? :browse_artifacts_button + end + + def click_browse_button + click_element :browse_artifacts_button + end + def retry! click_element :retry_button end diff --git a/qa/qa/page/project/operations/kubernetes/add.rb b/qa/qa/page/project/operations/kubernetes/add.rb index 785791652ba..9a6ea99ac18 100644 --- a/qa/qa/page/project/operations/kubernetes/add.rb +++ b/qa/qa/page/project/operations/kubernetes/add.rb @@ -7,11 +7,11 @@ module QA module Kubernetes class Add < Page::Base view 'app/views/clusters/clusters/new.html.haml' do - element :add_existing_cluster_button, "Add existing cluster" # rubocop:disable QA/ElementWithPattern + element :add_existing_cluster_tab end def add_existing_cluster - click_on 'Add existing cluster' + click_element(:add_existing_cluster_tab) end end end diff --git a/qa/qa/page/project/operations/metrics/show.rb b/qa/qa/page/project/operations/metrics/show.rb index 22d22af5a9a..35dfd92f119 100644 --- a/qa/qa/page/project/operations/metrics/show.rb +++ b/qa/qa/page/project/operations/metrics/show.rb @@ -41,6 +41,11 @@ module QA element :quick_range_item end + view 'app/assets/javascripts/monitoring/components/variables_section.vue' do + element :variables_content + element :variable_item + end + def wait_for_metrics wait_for_data return if has_metrics? @@ -73,6 +78,14 @@ module QA within('.modal-content') { click_button(class: 'btn-success') } end + def select_dashboard(dashboard_name) + click_element :dashboards_filter_dropdown + + within_element :dashboards_filter_dropdown do + click_on dashboard_name + end + end + def filter_environment(environment = 'production') click_element :environments_dropdown @@ -97,6 +110,18 @@ module QA end end + def has_templating_variable?(variable) + within_element :variables_content do + has_element?(:variable_item, text: variable) + end + end + + def has_template_metric?(metric) + within_element :prometheus_graphs do + has_text?(metric) + end + end + private def wait_for_data diff --git a/qa/qa/page/project/packages/index.rb b/qa/qa/page/project/packages/index.rb index 3f8cc6035bc..6d55d1d04b6 100644 --- a/qa/qa/page/project/packages/index.rb +++ b/qa/qa/page/project/packages/index.rb @@ -5,7 +5,7 @@ module QA module Project module Packages class Index < QA::Page::Base - view 'app/views/projects/packages/packages/_legacy_package_list.html.haml' do + view 'app/assets/javascripts/packages/shared/components/package_list_row.vue' do element :package_row element :package_link end diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb index 43003fe1953..57ab7fb4480 100644 --- a/qa/qa/page/project/pipeline/show.rb +++ b/qa/qa/page/project/pipeline/show.rb @@ -21,7 +21,7 @@ module QA end view 'app/assets/javascripts/pipelines/components/graph/linked_pipeline.vue' do - element :linked_pipeline_button + element :expand_pipeline_button element :child_pipeline end @@ -69,8 +69,10 @@ module QA click_element(:job_link, text: job_name) end - def click_linked_job(project_name) - click_element(:linked_pipeline_button, text: /#{project_name}/) + def expand_child_pipeline + within_element(:child_pipeline) do + click_element(:expand_pipeline_button) + end end def click_on_first_job diff --git a/qa/qa/page/project/settings/advanced.rb b/qa/qa/page/project/settings/advanced.rb index 960d6c221b5..97519c3906c 100644 --- a/qa/qa/page/project/settings/advanced.rb +++ b/qa/qa/page/project/settings/advanced.rb @@ -38,20 +38,16 @@ module QA click_element :change_path_button end - def select_transfer_option(namespace) - search_and_select(namespace) - end - def transfer_project!(project_name, namespace) - # Retry added here due to seldom seen inconsistent UI state issue: - # https://gitlab.com/gitlab-org/gitlab/-/issues/231242 - retry_on_exception do - click_element_coordinates(:archive_project_content) - expand_select_list - # Workaround for a failure to search when there are no spaces around the / - # https://gitlab.com/gitlab-org/gitlab/-/issues/218965 - select_transfer_option(namespace.gsub(/([^\s])\/([^\s])/, '\1 / \2')) - end + QA::Runtime::Logger.info "Transferring project: #{project_name} to namespace: #{namespace}" + + click_element_coordinates(:archive_project_content) + + expand_select_list + + # Workaround for a failure to search when there are no spaces around the / + # https://gitlab.com/gitlab-org/gitlab/-/issues/218965 + search_and_select(namespace.gsub(/([^\s])\/([^\s])/, '\1 / \2')) click_element(:transfer_button) fill_confirmation_text(project_name) diff --git a/qa/qa/page/project/settings/main.rb b/qa/qa/page/project/settings/main.rb index 3cd558691e1..4db66543a25 100644 --- a/qa/qa/page/project/settings/main.rb +++ b/qa/qa/page/project/settings/main.rb @@ -8,6 +8,7 @@ module QA include QA::Page::Settings::Common include Component::Select2 include SubMenus::Project + include Component::Breadcrumbs view 'app/views/projects/edit.html.haml' do element :advanced_settings diff --git a/qa/qa/page/project/settings/merge_request.rb b/qa/qa/page/project/settings/merge_request.rb index 0092426b31f..ec8d73df1b3 100644 --- a/qa/qa/page/project/settings/merge_request.rb +++ b/qa/qa/page/project/settings/merge_request.rb @@ -15,6 +15,10 @@ module QA element :radio_button_merge_ff end + view 'app/views/projects/_merge_request_merge_checks_settings.html.haml' do + element :allow_merge_if_all_discussions_are_resolved_checkbox + end + def click_save_changes click_element :save_merge_request_changes end @@ -23,6 +27,11 @@ module QA click_element :radio_button_merge_ff click_save_changes end + + def enable_merge_if_all_disscussions_are_resolved + click_element :allow_merge_if_all_discussions_are_resolved_checkbox + click_save_changes + end end end end diff --git a/qa/qa/page/project/settings/mirroring_repositories.rb b/qa/qa/page/project/settings/mirroring_repositories.rb index 517163a22f1..ddace6d0533 100644 --- a/qa/qa/page/project/settings/mirroring_repositories.rb +++ b/qa/qa/page/project/settings/mirroring_repositories.rb @@ -77,7 +77,7 @@ module QA # The host key detection process is interrupted if we navigate away # from the page before the fingerprint appears. - find_element(:fingerprints_list, text: /.*/) + find_element(:fingerprints_list, text: /.*/, wait: 60) end def mirror_repository diff --git a/qa/qa/page/project/settings/services/jira.rb b/qa/qa/page/project/settings/services/jira.rb index 75baedb1b0f..eaa3e90db78 100644 --- a/qa/qa/page/project/settings/services/jira.rb +++ b/qa/qa/page/project/settings/services/jira.rb @@ -13,7 +13,7 @@ module QA element :service_jira_issue_transition_id_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern end - view 'app/helpers/services_helper.rb' do + view 'app/assets/javascripts/integrations/edit/components/integration_form.vue' do element :save_changes_button end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 22c2ed2a0c2..c607b35005e 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -56,7 +56,7 @@ module QA element :new_file_option end - view 'app/assets/javascripts/repository/components/web_ide_link.vue' do + view 'app/assets/javascripts/vue_shared/components/web_ide_link.vue' do element :web_ide_button end diff --git a/qa/qa/page/project/web_ide/edit.rb b/qa/qa/page/project/web_ide/edit.rb index b962b0c673b..56c8d343cf5 100644 --- a/qa/qa/page/project/web_ide/edit.rb +++ b/qa/qa/page/project/web_ide/edit.rb @@ -10,6 +10,11 @@ module QA view 'app/assets/javascripts/ide/components/activity_bar.vue' do element :commit_mode_tab + element :edit_mode_tab + end + + view 'app/assets/javascripts/ide/components/ide_status_bar.vue' do + element :commit_sha_content end view 'app/assets/javascripts/ide/components/ide_tree.vue' do @@ -104,11 +109,19 @@ module QA end end + def commit_sha + return unless has_element?(:commit_sha_content, wait: 0) + + find_element(:commit_sha_content).text + end + def commit_changes(open_merge_request: false) # Clicking :begin_commit_button switches from the # edit to the commit view - click_element :begin_commit_button - active_element? :commit_mode_tab + click_element(:begin_commit_button) + active_element?(:commit_mode_tab) + + original_commit = commit_sha # After clicking :begin_commit_button, there is an animation # that hides :begin_commit_button and shows :commit_button @@ -126,16 +139,17 @@ module QA # Click :commit_button and keep retrying just in case part of the # animation is still in process even when the buttons have the # expected visibility. - commit_success_msg_shown = retry_until(sleep_interval: 5) do + commit_success = retry_until(sleep_interval: 5) do click_element(:commit_to_current_branch_radio) if has_element?(:commit_to_current_branch_radio) click_element(:commit_button) if has_element?(:commit_button) - wait_until(reload: false) do - has_text?('Your changes have been committed') + # If this is the first commit, the commit SHA only appears after reloading + wait_until(reload: true) do + active_element?(:edit_mode_tab) && commit_sha != original_commit end end - raise "The changes do not appear to have been committed successfully." unless commit_success_msg_shown + raise "The changes do not appear to have been committed successfully." unless commit_success end end diff --git a/qa/qa/page/sub_menus/common.rb b/qa/qa/page/sub_menus/common.rb index 0eb1b100bd7..2efeeb062e8 100644 --- a/qa/qa/page/sub_menus/common.rb +++ b/qa/qa/page/sub_menus/common.rb @@ -12,6 +12,8 @@ module QA end def within_sidebar + wait_for_requests + within_element(sidebar_element) do yield end |