diff options
Diffstat (limited to 'qa/qa/page')
-rw-r--r-- | qa/qa/page/component/badges.rb | 53 | ||||
-rw-r--r-- | qa/qa/page/component/blob_content.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/component/design_management.rb | 2 | ||||
-rw-r--r-- | qa/qa/page/component/invite_members_modal.rb | 6 | ||||
-rw-r--r-- | qa/qa/page/component/issuable/sidebar.rb | 2 | ||||
-rw-r--r-- | qa/qa/page/component/members_filter.rb | 26 | ||||
-rw-r--r-- | qa/qa/page/component/namespace_select.rb | 29 | ||||
-rw-r--r-- | qa/qa/page/component/wiki_page_form.rb | 13 | ||||
-rw-r--r-- | qa/qa/page/group/members.rb | 3 | ||||
-rw-r--r-- | qa/qa/page/group/settings/general.rb | 25 | ||||
-rw-r--r-- | qa/qa/page/main/login.rb | 1 | ||||
-rw-r--r-- | qa/qa/page/merge_request/show.rb | 43 | ||||
-rw-r--r-- | qa/qa/page/project/members.rb | 1 | ||||
-rw-r--r-- | qa/qa/page/project/new.rb | 5 | ||||
-rw-r--r-- | qa/qa/page/project/pipeline/index.rb | 8 | ||||
-rw-r--r-- | qa/qa/page/project/pipeline/show.rb | 25 | ||||
-rw-r--r-- | qa/qa/page/project/settings/advanced.rb | 15 | ||||
-rw-r--r-- | qa/qa/page/project/settings/main.rb | 8 | ||||
-rw-r--r-- | qa/qa/page/project/show.rb | 8 | ||||
-rw-r--r-- | qa/qa/page/project/web_ide/edit.rb | 2 | ||||
-rw-r--r-- | qa/qa/page/trials/new.rb | 1 |
21 files changed, 219 insertions, 61 deletions
diff --git a/qa/qa/page/component/badges.rb b/qa/qa/page/component/badges.rb new file mode 100644 index 00000000000..f2c5f809d8d --- /dev/null +++ b/qa/qa/page/component/badges.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +module QA + module Page + module Component + class Badges < Page::Base + view 'app/assets/javascripts/badges/components/badge_form.vue' do + element :badge_name_field + element :badge_link_url_field + element :badge_image_url_field + element :add_badge_button + end + + view 'app/assets/javascripts/badges/components/badge_list.vue' do + element :badge_list_content + element :badge_list_row + end + + view 'app/assets/javascripts/badges/components/badge.vue' do + element :badge_image_link + end + + def fill_name(name) + fill_element :badge_name_field, name + end + + def fill_link_url(url) + fill_element :badge_link_url_field, url + end + + def fill_image_url(url) + fill_element :badge_image_url_field, url + end + + def click_add_badge_button + click_element :add_badge_button + end + + def has_badge?(badge_name) + within_element(:badge_list_content) do + has_element?(:badge_list_row, badge_name: badge_name) + end + end + + def has_visible_badge_image_link?(link_url) + within_element(:badge_list_content) do + has_element?(:badge_image_link, link_url: link_url) + end + end + end + end + end +end diff --git a/qa/qa/page/component/blob_content.rb b/qa/qa/page/component/blob_content.rb index 4d36a6dcefe..ce743b24dda 100644 --- a/qa/qa/page/component/blob_content.rb +++ b/qa/qa/page/component/blob_content.rb @@ -22,6 +22,10 @@ module QA element :copy_contents_button end + base.view 'app/assets/javascripts/vue_shared/components/source_viewer/source_viewer.vue' do + element :blob_viewer_file_content + end + base.view 'app/views/projects/blob/_header_content.html.haml' do element :file_name_content end diff --git a/qa/qa/page/component/design_management.rb b/qa/qa/page/component/design_management.rb index 1f5620e30c7..73ba5713bda 100644 --- a/qa/qa/page/component/design_management.rb +++ b/qa/qa/page/component/design_management.rb @@ -55,7 +55,7 @@ module QA # wait for the "Save comment" button to disappear saved = has_no_element?(:save_comment_button) - raise ExpectationNotMet, %q(There was a problem while adding the annotation) unless saved + raise RSpec::Expectations::ExpectationNotMetError, %q(There was a problem while adding the annotation) unless saved end def add_design(design_file_path) diff --git a/qa/qa/page/component/invite_members_modal.rb b/qa/qa/page/component/invite_members_modal.rb index ca6862ccb02..7c536ff651b 100644 --- a/qa/qa/page/component/invite_members_modal.rb +++ b/qa/qa/page/component/invite_members_modal.rb @@ -9,7 +9,7 @@ module QA def self.included(base) super - base.view 'app/assets/javascripts/invite_members/components/invite_members_modal.vue' do + base.view 'app/assets/javascripts/invite_members/components/invite_modal_base.vue' do element :invite_button element :access_level_dropdown element :invite_members_modal_content @@ -44,9 +44,9 @@ module QA open_invite_members_modal within_element(:invite_members_modal_content) do - fill_element :members_token_select_input, username + fill_element(:members_token_select_input, username) Support::WaitForRequests.wait_for_requests - click_button username + click_button(username, match: :prefer_exact) set_access_level(access_level) end diff --git a/qa/qa/page/component/issuable/sidebar.rb b/qa/qa/page/component/issuable/sidebar.rb index 4a81230499c..921647eb4cc 100644 --- a/qa/qa/page/component/issuable/sidebar.rb +++ b/qa/qa/page/component/issuable/sidebar.rb @@ -40,7 +40,7 @@ module QA end base.view 'app/assets/javascripts/sidebar/components/sidebar_dropdown_widget.vue' do - element :milestone_link, 'data-qa-selector="`${issuableAttribute}_link`"' # rubocop:disable QA/ElementWithPattern + element :milestone_link, 'data-qa-selector="`${formatIssuableAttribute.snake}_link`"' # rubocop:disable QA/ElementWithPattern end base.view 'app/assets/javascripts/sidebar/components/sidebar_editable_item.vue' do diff --git a/qa/qa/page/component/members_filter.rb b/qa/qa/page/component/members_filter.rb new file mode 100644 index 00000000000..ac07fe7e9fa --- /dev/null +++ b/qa/qa/page/component/members_filter.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module QA + module Page + module Component + module MembersFilter + extend QA::Page::PageConcern + + def self.included(base) + super + + base.view 'app/assets/javascripts/members/components/filter_sort/members_filtered_search_bar.vue' do + element :members_filtered_search_bar_content + end + end + + def search_member(username) + # TODO: Update the two actions below to use direct qa selectors once this is implemented: + # https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1688 + find_element(:members_filtered_search_bar_content).find('input').set(username) + find('.gl-search-box-by-click-search-button').click + end + end + end + end +end diff --git a/qa/qa/page/component/namespace_select.rb b/qa/qa/page/component/namespace_select.rb new file mode 100644 index 00000000000..924e1af876c --- /dev/null +++ b/qa/qa/page/component/namespace_select.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module QA + module Page + module Component + module NamespaceSelect + extend QA::Page::PageConcern + + def self.included(base) + super + + base.view "app/assets/javascripts/vue_shared/components/namespace_select/namespace_select.vue" do + element :namespaces_list + element :namespaces_list_groups + element :namespaces_list_item + end + end + + def select_namespace(item) + click_element :namespaces_list + + within_element(:namespaces_list) do + find_element(:namespaces_list_item, text: item).click + end + end + end + end + end +end diff --git a/qa/qa/page/component/wiki_page_form.rb b/qa/qa/page/component/wiki_page_form.rb index bc73fe0c3ab..8f504b784b2 100644 --- a/qa/qa/page/component/wiki_page_form.rb +++ b/qa/qa/page/component/wiki_page_form.rb @@ -38,7 +38,7 @@ module QA def click_submit click_element(:wiki_submit_button) - wait_until(reload: false) do + QA::Support::Retrier.retry_on_exception do has_no_element?(:wiki_title_textbox) end end @@ -48,15 +48,8 @@ module QA Page::Modal::DeleteWiki.perform(&:confirm_deletion) end - def use_new_editor(toggle) - # Update once the feature is released, see https://gitlab.com/gitlab-org/gitlab/-/issues/345398 - if toggle - click_element(:editing_mode_button, mode: 'Edit rich text') - else - within_element(:try_new_editor_container) do - click_button('Use the new editor') - end - end + def use_new_editor + click_element(:editing_mode_button, mode: 'Edit rich text') wait_until(reload: false) do has_element?(:content_editor_container) diff --git a/qa/qa/page/group/members.rb b/qa/qa/page/group/members.rb index ccc901932f4..c80bdadb11f 100644 --- a/qa/qa/page/group/members.rb +++ b/qa/qa/page/group/members.rb @@ -6,6 +6,7 @@ module QA class Members < Page::Base include Page::Component::InviteMembersModal include Page::Component::UsersSelect + include Page::Component::MembersFilter view 'app/assets/javascripts/members/components/modals/remove_member_modal.vue' do element :remove_member_modal_content @@ -31,6 +32,8 @@ module QA end def update_access_level(username, access_level) + search_member(username) + within_element(:member_row, text: username) do click_element :access_level_dropdown click_element :access_level_link, text: access_level diff --git a/qa/qa/page/group/settings/general.rb b/qa/qa/page/group/settings/general.rb index 2e7ab131225..1877065f478 100644 --- a/qa/qa/page/group/settings/general.rb +++ b/qa/qa/page/group/settings/general.rb @@ -7,6 +7,8 @@ module QA class General < QA::Page::Base include ::QA::Page::Settings::Common include Page::Component::VisibilitySetting + include Page::Component::ConfirmModal + include Page::Component::NamespaceSelect view 'app/views/groups/edit.html.haml' do element :permission_lfs_2fa_content @@ -38,16 +40,6 @@ module QA element :project_creation_level_dropdown end - view 'app/views/groups/settings/_transfer.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 @@ -111,17 +103,14 @@ module QA click_element(:save_permissions_changes_button) end - def transfer_group(target_group) + def transfer_group(target_group, source_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 + select_namespace(target_group) + click_element(:transfer_button) - click_element :transfer_group_button + fill_confirmation_text(source_group) + confirm_transfer end end end diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index f004107d7bd..a5bd37be287 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -157,6 +157,7 @@ module QA end def redirect_to_login_page(address) + Menu.perform(&:sign_out_if_signed_in) desired_host = URI(Runtime::Scenario.send("#{address}_address")).host Runtime::Browser.visit(address, Page::Main::Login) if desired_host != current_host end diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index f8d063ac6bd..d76dfb295a0 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -83,10 +83,18 @@ module QA element :merge_immediately_menu_item end + view 'app/assets/javascripts/vue_merge_request_widget/components/states/sha_mismatch.vue' do + element :head_mismatch_content + end + view 'app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue' do element :squash_checkbox end + view 'app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue' do + element :mr_widget_content + end + view 'app/assets/javascripts/vue_shared/components/markdown/apply_suggestion.vue' do element :apply_suggestion_dropdown element :commit_message_field @@ -255,7 +263,8 @@ module QA # status as unmerged, the test will fail. # Revisit after merge page re-architect is done https://gitlab.com/groups/gitlab-org/-/epics/5598 # To remove page refresh logic if possible - retry_until(max_attempts: 3, reload: true) do + # We don't raise on failure because this method is used as a predicate matcher + retry_until(max_attempts: 3, reload: true, raise_on_failure: false) do has_element?(:merged_status_content, text: 'The changes were merged into', wait: 20) end end @@ -269,13 +278,29 @@ module QA has_element?(:merge_button, disabled: false) end - # Waits up 60 seconds and raises an error if unable to merge - def wait_until_ready_to_merge - has_element?(:merge_button) + # Waits up 60 seconds and raises an error if unable to merge. + # + # If a state is encountered in which a user would typically refresh the page, this will refresh the page and + # then check again if it's ready to merge. For example, it will refresh if a new change was pushed and the page + # needs to be refreshed to show the change. + # + # @param [Boolean] transient_test true if the current test is a transient test (default: false) + def wait_until_ready_to_merge(transient_test: false) + wait_until do + has_element?(:merge_button) - # The merge button is enabled via JS - wait_until(reload: false) do - !find_element(:merge_button).disabled? + break true unless find_element(:merge_button).disabled? + + # If the widget shows "Merge blocked: new changes were just added" we can refresh the page and check again + next false if has_element?(:head_mismatch_content) + + # Stop waiting if we're in a transient test. By this point we're in an unexpected state and should let the + # test fail so we can investigate. If we're not in a transient test we keep trying until we reach timeout. + next true unless transient_test + + QA::Runtime::Logger.debug("MR widget text: #{mr_widget_text}") + + false end end @@ -385,6 +410,10 @@ module QA def cancel_auto_merge! click_element(:cancel_auto_merge_button) end + + def mr_widget_text + find_element(:mr_widget_content).text + end end end end diff --git a/qa/qa/page/project/members.rb b/qa/qa/page/project/members.rb index 1102abd6646..30748ed920b 100644 --- a/qa/qa/page/project/members.rb +++ b/qa/qa/page/project/members.rb @@ -5,6 +5,7 @@ module QA module Project class Members < Page::Base include QA::Page::Component::InviteMembersModal + include QA::Page::Component::MembersFilter view 'app/assets/javascripts/members/components/members_tabs.vue' do element :groups_list_tab diff --git a/qa/qa/page/project/new.rb b/qa/qa/page/project/new.rb index 42baf1f3f87..e061bc52abc 100644 --- a/qa/qa/page/project/new.rb +++ b/qa/qa/page/project/new.rb @@ -13,7 +13,6 @@ module QA view 'app/views/projects/_new_project_fields.html.haml' do element :initialize_with_readme_checkbox - element :initialize_with_sast_checkbox element :project_name, 'text_field :name' # rubocop:disable QA/ElementWithPattern element :project_path, 'text_field :path' # rubocop:disable QA/ElementWithPattern element :project_description, 'text_area :description' # rubocop:disable QA/ElementWithPattern @@ -21,6 +20,10 @@ module QA element :visibility_radios, 'visibility_level:' # rubocop:disable QA/ElementWithPattern end + view 'app/views/projects/_new_project_initialize_with_sast.html.haml' do + element :initialize_with_sast_checkbox + end + view 'app/views/projects/project_templates/_template.html.haml' do element :use_template_button element :template_option_row diff --git a/qa/qa/page/project/pipeline/index.rb b/qa/qa/page/project/pipeline/index.rb index f7c5d149593..d088ba76bc0 100644 --- a/qa/qa/page/project/pipeline/index.rb +++ b/qa/qa/page/project/pipeline/index.rb @@ -26,11 +26,15 @@ module QA end def wait_for_latest_pipeline_succeeded - wait_for_latest_pipeline_status { has_text?('passed') } + wait_for_latest_pipeline_status { has_selector?(".ci-status-icon-success") } end def wait_for_latest_pipeline_completed - wait_for_latest_pipeline_status { has_text?('passed') || has_text?('failed') } + wait_for_latest_pipeline_status { has_selector?(".ci-status-icon-success") || has_selector?(".ci-status-icon-failed") } + end + + def wait_for_latest_pipeline_skipped + wait_for_latest_pipeline_status { has_text?('skipped') } end def wait_for_latest_pipeline_status diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb index 83a49ae6361..6f4757a34e8 100644 --- a/qa/qa/page/project/pipeline/show.rb +++ b/qa/qa/page/project/pipeline/show.rb @@ -18,7 +18,7 @@ module QA view 'app/assets/javascripts/pipelines/components/graph/job_item.vue' do element :job_item_container element :job_link - element :action_button + element :job_action_button end view 'app/assets/javascripts/pipelines/components/graph/linked_pipeline.vue' do @@ -38,6 +38,11 @@ module QA element :pipeline_badges end + view 'app/assets/javascripts/pipelines/components/graph/job_group_dropdown.vue' do + element :job_dropdown_container + element :jobs_dropdown_menu + end + def running?(wait: 0) within_element(:pipeline_header) do page.has_content?('running', wait: wait) @@ -47,7 +52,7 @@ module QA def has_build?(name, status: :success, wait: nil) if status within_element(:job_item_container, text: name) do - has_selector?(".ci-status-icon-#{status}", { wait: wait }.compact) + has_selector?(".ci-status-icon-#{status}", **{ wait: wait }.compact) end else has_element?(:job_item_container, text: name) @@ -110,8 +115,22 @@ module QA end def click_job_action(job_name) + wait_for_requests + within_element(:job_item_container, text: job_name) do - click_element(:action_button) + click_element(:job_action_button) + end + end + + def click_job_dropdown(job_dropdown_name) + click_element(:job_dropdown_container, text: job_dropdown_name) + end + + def has_skipped_job_in_group? + within_element(:jobs_dropdown_menu) do + all_elements(:job_item_container, minimum: 1).all? do + has_selector?('.ci-status-icon-skipped') + end end end end diff --git a/qa/qa/page/project/settings/advanced.rb b/qa/qa/page/project/settings/advanced.rb index da1f16f4cfc..525210a08f6 100644 --- a/qa/qa/page/project/settings/advanced.rb +++ b/qa/qa/page/project/settings/advanced.rb @@ -6,18 +6,13 @@ module QA module Settings class Advanced < Page::Base include Component::ConfirmModal + include Component::NamespaceSelect view 'app/views/projects/edit.html.haml' do element :project_path_field element :change_path_button end - view "app/assets/javascripts/vue_shared/components/namespace_select/namespace_select.vue" do - element :namespaces_list - element :namespaces_list_groups - element :namespaces_list_item - end - view 'app/views/projects/settings/_archive.html.haml' do element :archive_project_link element :unarchive_project_link @@ -43,14 +38,6 @@ module QA click_element :change_path_button end - def select_namespace(item) - click_element :namespaces_list - - within_element(:namespaces_list) do - find_element(:namespaces_list_item, text: item).click - end - end - def transfer_project!(project_name, namespace) QA::Runtime::Logger.info "Transferring project: #{project_name} to namespace: #{namespace}" diff --git a/qa/qa/page/project/settings/main.rb b/qa/qa/page/project/settings/main.rb index 5efcb7bf23c..52ed630ac66 100644 --- a/qa/qa/page/project/settings/main.rb +++ b/qa/qa/page/project/settings/main.rb @@ -9,11 +9,13 @@ module QA include Component::Select2 include SubMenus::Project include Component::Breadcrumbs + include Layout::Flash view 'app/views/projects/edit.html.haml' do element :advanced_settings_content element :merge_request_settings_content element :visibility_features_permissions_content + element :badges_settings_content end view 'app/views/projects/settings/_general.html.haml' do @@ -51,6 +53,12 @@ module QA VisibilityFeaturesPermissions.perform(&block) end end + + def expand_badges_settings(&block) + expand_content(:badges_settings_content) do + Component::Badges.perform(&block) + end + end end end end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 8074b6f833b..4c9df2716e2 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -39,6 +39,8 @@ module QA element :forked_from_link element :project_name_content element :project_id_content + element :project_badges_content + element :badge_image_link end view 'app/views/projects/_files.html.haml' do @@ -179,6 +181,12 @@ module QA has_css?('.tree-holder') end end + + def has_visible_badge_image_link?(link_url) + within_element(:project_badges_content) do + has_element?(:badge_image_link, link_url: link_url) + end + end end end end diff --git a/qa/qa/page/project/web_ide/edit.rb b/qa/qa/page/project/web_ide/edit.rb index 9c0a3ab691c..403c919c6e5 100644 --- a/qa/qa/page/project/web_ide/edit.rb +++ b/qa/qa/page/project/web_ide/edit.rb @@ -68,7 +68,7 @@ module QA element :delete_button end - view 'app/views/shared/_confirm_fork_modal.html.haml' do + view 'app/assets/javascripts/vue_shared/components/confirm_fork_modal.vue' do element :fork_project_button element :confirm_fork_modal end diff --git a/qa/qa/page/trials/new.rb b/qa/qa/page/trials/new.rb index 6e9d7fce688..cd3b145a89e 100644 --- a/qa/qa/page/trials/new.rb +++ b/qa/qa/page/trials/new.rb @@ -12,6 +12,7 @@ module QA select :number_of_employees text_field :telephone_number select :country + select :state, id: 'state' button :continue end end |