diff options
Diffstat (limited to 'qa/qa/page')
-rw-r--r-- | qa/qa/page/component/design_management.rb | 29 | ||||
-rw-r--r-- | qa/qa/page/component/issuable/sidebar.rb | 33 | ||||
-rw-r--r-- | qa/qa/page/component/new_snippet.rb | 37 | ||||
-rw-r--r-- | qa/qa/page/component/note.rb | 66 | ||||
-rw-r--r-- | qa/qa/page/component/select2.rb | 2 | ||||
-rw-r--r-- | qa/qa/page/component/snippet.rb | 42 | ||||
-rw-r--r-- | qa/qa/page/dashboard/snippet/edit.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/merge_request/show.rb | 80 | ||||
-rw-r--r-- | qa/qa/page/profile/ssh_keys.rb | 15 | ||||
-rw-r--r-- | qa/qa/page/project/issue/show.rb | 12 | ||||
-rw-r--r-- | qa/qa/page/project/operations/kubernetes/index.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/project/packages/index.rb | 2 | ||||
-rw-r--r-- | qa/qa/page/project/pipeline/index.rb | 12 | ||||
-rw-r--r-- | qa/qa/page/project/pipeline/new.rb | 19 | ||||
-rw-r--r-- | qa/qa/page/project/show.rb | 2 | ||||
-rw-r--r-- | qa/qa/page/project/snippet/index.rb | 29 |
16 files changed, 277 insertions, 111 deletions
diff --git a/qa/qa/page/component/design_management.rb b/qa/qa/page/component/design_management.rb index a8a24bd3949..44d6b02ccd8 100644 --- a/qa/qa/page/component/design_management.rb +++ b/qa/qa/page/component/design_management.rb @@ -31,6 +31,16 @@ module QA element :design_file_name element :design_image end + + view 'app/assets/javascripts/design_management/pages/index.vue' do + element :archive_button + element :design_checkbox + element :design_dropzone_content + end + + view 'app/assets/javascripts/design_management/components/delete_button.vue' do + element :confirm_archiving_button + end end end @@ -52,12 +62,14 @@ module QA # It accepts a `class:` option, but that only works for class attributes # It doesn't work as a CSS selector. # So instead we use the name attribute as a locator - page.attach_file("design_file", design_file_path, make_visible: { display: 'block' }) + within_element(:design_dropzone_content) do + page.attach_file("design_file", design_file_path, make_visible: { display: 'block' }) + end filename = ::File.basename(design_file_path) found = wait_until(reload: false, sleep_interval: 1) do - image = find_element(:design_image) + image = find_element(:design_image, filename: filename) has_element?(:design_file_name, text: filename) && image["complete"] && @@ -71,11 +83,24 @@ module QA click_element(:design_file_name, text: filename) end + def select_design(filename) + click_element(:design_checkbox, design: filename) + end + + def archive_selected_designs + click_element(:archive_button) + click_element(:confirm_archiving_button) + end + def has_annotation?(note) within_element_by_index(:design_discussion_content, 0) do has_element?(:note_content, text: note) end end + + def has_design?(filename) + has_element?(:design_file_name, text: filename) + end end end end diff --git a/qa/qa/page/component/issuable/sidebar.rb b/qa/qa/page/component/issuable/sidebar.rb index 4e94049efe7..82347ee209a 100644 --- a/qa/qa/page/component/issuable/sidebar.rb +++ b/qa/qa/page/component/issuable/sidebar.rb @@ -18,16 +18,29 @@ module QA element :more_assignees_link end - base.view 'app/helpers/dropdowns_helper.rb' do + base.view 'app/assets/javascripts/sidebar/components/labels/sidebar_labels.vue' do + element :labels_block + end + + base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_value.vue' do + element :selected_label_content + end + + base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents.vue' do + element :labels_dropdown_content + end + + base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_title.vue' do + element :labels_edit_button + end + + base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view.vue' do element :dropdown_input_field end base.view 'app/views/shared/issuable/_sidebar.html.haml' do element :assignee_block - element :dropdown_menu_labels - element :edit_labels_link element :edit_milestone_link - element :labels_block element :milestone_block element :milestone_link end @@ -64,7 +77,7 @@ module QA def has_label?(label) within_element(:labels_block) do - !!has_element?(:label, label_name: label) + !!has_element?(:selected_label_content, label_name: label) end end @@ -80,23 +93,25 @@ module QA def select_labels_and_refresh(labels) Support::Retrier.retry_until do - click_element(:edit_labels_link) - has_element?(:dropdown_menu_labels, text: labels.first) + click_element(:labels_edit_button) + has_element?(:labels_dropdown_content, text: labels.first) end labels.each do |label| - within_element(:dropdown_menu_labels, text: label) do + within_element(:labels_dropdown_content) do send_keys_to_element(:dropdown_input_field, [label, :enter]) end end - click_element(:edit_labels_link) + click_element(:labels_edit_button) labels.each do |label| has_element?(:labels_block, text: label, wait: 0) end refresh + + wait_for_requests end def toggle_more_assignees_link diff --git a/qa/qa/page/component/new_snippet.rb b/qa/qa/page/component/new_snippet.rb index 3e5ae29177a..ff9ece9ad10 100644 --- a/qa/qa/page/component/new_snippet.rb +++ b/qa/qa/page/component/new_snippet.rb @@ -21,18 +21,11 @@ module QA base.view 'app/assets/javascripts/snippets/components/snippet_blob_edit.vue' do element :file_name_field + element :file_holder_container end - base.view 'app/views/shared/form_elements/_description.html.haml' do - element :issuable_form_description - end - - base.view 'app/views/shared/snippets/_form.html.haml' do - element :snippet_description_field - element :description_placeholder - element :snippet_title_field - element :file_name_field - element :submit_button + base.view 'app/assets/javascripts/snippets/components/snippet_blob_actions_edit.vue' do + element :add_file_button end base.view 'app/views/shared/_zen.html.haml' do @@ -54,12 +47,28 @@ module QA choose visibility end - def fill_file_name(name) - fill_element :file_name_field, name + def fill_file_name(name, file_number = nil) + if file_number + within_element_by_index(:file_holder_container, file_number - 1) do + fill_element(:file_name_field, name) + end + else + fill_element(:file_name_field, name) + end + end + + def fill_file_content(content, file_number = nil) + if file_number + within_element_by_index(:file_holder_container, file_number - 1) do + text_area.set(content) + end + else + text_area.set content + end end - def fill_file_content(content) - text_area.set content + def click_add_file + click_element(:add_file_button) end def click_create_snippet_button diff --git a/qa/qa/page/component/note.rb b/qa/qa/page/component/note.rb index 0e9cdd49519..e6defd2ec0c 100644 --- a/qa/qa/page/component/note.rb +++ b/qa/qa/page/component/note.rb @@ -9,9 +9,18 @@ module QA def self.included(base) super + base.view 'app/assets/javascripts/diffs/components/diff_file_header.vue' do + element :toggle_comments_button + end + + base.view 'app/assets/javascripts/notes/components/discussion_actions.vue' do + element :discussion_reply_tab + element :resolve_discussion_button + end + base.view 'app/assets/javascripts/notes/components/comment_form.vue' do element :note_dropdown - element :discussion_option + element :discussion_menu_item end base.view 'app/assets/javascripts/notes/components/noteable_discussion.vue' do @@ -23,39 +32,32 @@ module QA end base.view 'app/assets/javascripts/notes/components/note_form.vue' do - element :reply_input + element :reply_field element :reply_comment_button end - base.view 'app/assets/javascripts/notes/components/discussion_actions.vue' do - element :discussion_reply_tab - element :resolve_discussion_button - end - base.view 'app/assets/javascripts/notes/components/toggle_replies_widget.vue' do - element :expand_replies - element :collapse_replies + element :expand_replies_button + element :collapse_replies_button end - base.view 'app/assets/javascripts/diffs/components/diff_file_header.vue' do - element :toggle_comments_button + base.view 'app/assets/javascripts/vue_shared/components/notes/skeleton_note.vue' do + element :skeleton_note_placeholder end end - def start_discussion(text) - fill_element :comment_input, text - click_element :note_dropdown - click_element :discussion_option - click_element :comment_button + def collapse_replies + click_element :collapse_replies_button end - def toggle_comments(position) - all_elements(:toggle_comments_button, minimum: position)[position - 1].click + def edit_comment(text) + click_element :note_edit_button + fill_element :reply_field, text + click_element :reply_comment_button end - def type_reply_to_discussion(position, reply_text) - all_elements(:discussion_reply_tab, minimum: position)[position - 1].click - fill_element :reply_input, reply_text + def expand_replies + click_element :expand_replies_button end def reply_to_discussion(position, reply_text) @@ -69,18 +71,24 @@ module QA end end - def collapse_replies - click_element :collapse_replies + def start_discussion(text) + fill_element :comment_field, text + click_element :note_dropdown + click_element :discussion_menu_item + click_element :comment_button end - def expand_replies - click_element :expand_replies + def toggle_comments(position) + all_elements(:toggle_comments_button, minimum: position)[position - 1].click end - def edit_comment(text) - click_element :note_edit_button - fill_element :reply_input, text - click_element :reply_comment_button + def type_reply_to_discussion(position, reply_text) + all_elements(:discussion_reply_tab, minimum: position)[position - 1].click + fill_element :reply_field, reply_text + end + + def wait_for_loading + has_no_element?(:skeleton_note_placeholer) end end end diff --git a/qa/qa/page/component/select2.rb b/qa/qa/page/component/select2.rb index 761bbb17168..87aed0105aa 100644 --- a/qa/qa/page/component/select2.rb +++ b/qa/qa/page/component/select2.rb @@ -43,6 +43,8 @@ module QA end def wait_for_search_to_complete + Support::WaitForRequests.wait_for_requests + has_css?('.select2-active', wait: 1) has_no_css?('.select2-active', wait: 30) end diff --git a/qa/qa/page/component/snippet.rb b/qa/qa/page/component/snippet.rb index 2776b6c078e..7074d7e7649 100644 --- a/qa/qa/page/component/snippet.rb +++ b/qa/qa/page/component/snippet.rb @@ -98,15 +98,39 @@ module QA end end - def has_file_name?(file_name) - within_element(:file_title_content) do - has_text?(file_name) - end - end - - def has_file_content?(file_content) - within_element(:file_content) do - has_text?(file_content) + def has_file_name?(file_name, file_number = nil) + if file_number + within_element_by_index(:file_title_content, file_number - 1) do + has_text?(file_name) + end + else + within_element(:file_title_content) do + has_text?(file_name) + end + end + end + + def has_file_content?(file_content, file_number = nil) + if file_number + within_element_by_index(:file_content, file_number - 1) do + has_text?(file_content) + end + else + within_element(:file_content) do + has_text?(file_content) + end + end + end + + def has_no_file_content?(file_content, file_number = nil) + if file_number + within_element_by_index(:file_content, file_number - 1) do + has_no_text?(file_content) + end + else + within_element(:file_content) do + has_no_text?(file_content) + end end end diff --git a/qa/qa/page/dashboard/snippet/edit.rb b/qa/qa/page/dashboard/snippet/edit.rb index 7802a680c25..31fc69a04cc 100644 --- a/qa/qa/page/dashboard/snippet/edit.rb +++ b/qa/qa/page/dashboard/snippet/edit.rb @@ -5,10 +5,6 @@ module QA module Dashboard module Snippet class Edit < Page::Base - view 'app/views/shared/snippets/_form.html.haml' do - element :submit_button - end - view 'app/assets/javascripts/snippets/components/edit.vue' do element :submit_button end diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index 0b80ba84fa4..164f25389c0 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -44,15 +44,23 @@ module QA element :squash_checkbox end - view 'app/assets/javascripts/vue_shared/components/notes/skeleton_note.vue' do - element :skeleton_note - end - view 'app/views/projects/merge_requests/show.html.haml' do element :notes_tab element :diffs_tab end + view 'app/assets/javascripts/diffs/components/compare_dropdown_layout.vue' do + element :dropdown_content + end + + view 'app/assets/javascripts/diffs/components/compare_versions.vue' do + element :target_version_dropdown + end + + view 'app/assets/javascripts/diffs/components/diff_file_header.vue' do + element :file_name_content + end + view 'app/assets/javascripts/diffs/components/inline_diff_table_row.vue' do element :new_diff_line end @@ -67,15 +75,13 @@ module QA view 'app/assets/javascripts/batch_comments/components/review_bar.vue' do element :review_bar - element :discard_review - element :modal_delete_pending_comments end view 'app/assets/javascripts/notes/components/note_form.vue' do element :unresolve_review_discussion_checkbox element :resolve_review_discussion_checkbox - element :start_review - element :comment_now + element :start_review_button + element :comment_now_button end view 'app/assets/javascripts/batch_comments/components/preview_dropdown.vue' do @@ -83,46 +89,54 @@ module QA end def start_review - click_element :start_review + click_element(:start_review_button) # After clicking the button, wait for it to disappear # before moving on to the next part of the test - has_no_element? :start_review + has_no_element?(:start_review_button) + end + + def click_target_version_dropdown + click_element(:target_version_dropdown) end def comment_now - click_element :comment_now + click_element(:comment_now_button) # After clicking the button, wait for it to disappear # before moving on to the next part of the test - has_no_element? :comment_now + has_no_element?(:comment_now_button) + end + + def version_dropdown_content + find_element(:dropdown_content).text end def submit_pending_reviews - within_element :review_bar do - click_element :review_preview_toggle - click_element :submit_review + within_element(:review_bar) do + click_element(:review_preview_toggle) + click_element(:submit_review) # After clicking the button, wait for it to disappear # before moving on to the next part of the test - has_no_element? :submit_review + has_no_element?(:submit_review) end end def discard_pending_reviews - within_element :review_bar do - click_element :discard_review + within_element(:review_bar) do + click_element(:discard_review) end - click_element :modal_delete_pending_comments + click_element(:modal_delete_pending_comments) end def resolve_review_discussion - scroll_to_element :start_review - check_element :resolve_review_discussion_checkbox + scroll_to_element(:start_review_button) + check_element(:resolve_review_discussion_checkbox) end def unresolve_review_discussion - check_element :unresolve_review_discussion_checkbox + check_element(:unresolve_review_discussion_checkbox) end def add_comment_to_diff(text) @@ -131,7 +145,7 @@ module QA end all_elements(:new_diff_line, minimum: 1).first.hover click_element(:diff_comment) - fill_element(:reply_input, text) + fill_element(:reply_field, text) end def click_discussions_tab @@ -160,6 +174,10 @@ module QA has_no_text?('Fast-forward merge is not possible') end + def has_file?(file_name) + has_element?(:file_name_content, text: file_name) + end + def has_merge_button? refresh @@ -168,7 +186,7 @@ module QA def has_pipeline_status?(text) # Pipelines can be slow, so we wait a bit longer than the usual 10 seconds - has_element?(:merge_request_pipeline_info_content, text: text, wait: 30) + has_element?(:merge_request_pipeline_info_content, text: text, wait: 60) end def has_title?(title) @@ -190,7 +208,7 @@ module QA !find_element(:squash_checkbox).disabled? end - click_element :squash_checkbox + click_element(:squash_checkbox) end def merge! @@ -202,7 +220,7 @@ module QA end def merged? - has_element?(:merged_status_content, text: 'The changes were merged into', wait: 30) + has_element?(:merged_status_content, text: 'The changes were merged into', wait: 60) end # Check if the MR is able to be merged @@ -235,7 +253,7 @@ module QA !find_element(:mr_rebase_button).disabled? end - click_element :mr_rebase_button + click_element(:mr_rebase_button) success = wait_until do has_text?('Fast-forward merge without a merge commit') @@ -251,12 +269,12 @@ module QA end def view_email_patches - click_element :download_dropdown + click_element(:download_dropdown) visit_link_in_element(:download_email_patches) end def view_plain_diff - click_element :download_dropdown + click_element(:download_dropdown) visit_link_in_element(:download_plain_diff) end @@ -266,10 +284,6 @@ module QA end end - def wait_for_loading - has_no_element?(:skeleton_note) - end - def click_open_in_web_ide click_element(:open_in_web_ide_button) wait_for_requests diff --git a/qa/qa/page/profile/ssh_keys.rb b/qa/qa/page/profile/ssh_keys.rb index 810877e21ad..d27e113832c 100644 --- a/qa/qa/page/profile/ssh_keys.rb +++ b/qa/qa/page/profile/ssh_keys.rb @@ -11,8 +11,9 @@ module QA element :add_key_button end - view 'app/views/profiles/keys/_key_details.html.haml' do - element :delete_key_button + view 'app/helpers/profiles_helper.rb' do + element :delete_ssh_key_button + element :ssh_key_delete_modal end view 'app/views/profiles/keys/_key_table.html.haml' do @@ -38,8 +39,14 @@ module QA def remove_key(title) click_link(title) - accept_alert do - click_element(:delete_key_button) + click_element(:delete_ssh_key_button) + + # Retrying due to https://gitlab.com/gitlab-org/gitlab/-/issues/255287 + retry_on_exception do + wait_for_animated_element(:ssh_key_delete_modal) + within_element(:ssh_key_delete_modal) do + click_button('Delete') + end end end diff --git a/qa/qa/page/project/issue/show.rb b/qa/qa/page/project/issue/show.rb index 826acaa2e0a..a02617def9e 100644 --- a/qa/qa/page/project/issue/show.rb +++ b/qa/qa/page/project/issue/show.rb @@ -12,7 +12,7 @@ module QA view 'app/assets/javascripts/notes/components/comment_form.vue' do element :comment_button - element :comment_input + element :comment_field end view 'app/assets/javascripts/notes/components/discussion_filter.vue' do @@ -43,7 +43,7 @@ module QA end view 'app/assets/javascripts/related_issues/components/related_issuable_input.vue' do - element :add_issue_input + element :add_issue_field end view 'app/assets/javascripts/related_issues/components/related_issues_block.vue' do @@ -57,8 +57,8 @@ module QA 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) + fill_element(:add_issue_field, issue.web_url) + send_keys_to_element(:add_issue_field, :enter) end def related_issuable_item @@ -84,7 +84,7 @@ module QA # attachment option should be an absolute path def comment(text, attachment: nil, filter: :all_activities) method("select_#{filter}_filter").call - fill_element :comment_input, "#{text}\n" + fill_element :comment_field, "#{text}\n" unless attachment.nil? QA::Page::Component::Dropzone.new(self, '.new-note') @@ -125,6 +125,8 @@ module QA click_element(:title) click_element :discussion_filter find_element(:filter_options, text: text).click + + wait_for_loading end end end diff --git a/qa/qa/page/project/operations/kubernetes/index.rb b/qa/qa/page/project/operations/kubernetes/index.rb index 0c92f9a9f28..114e3ddd46a 100644 --- a/qa/qa/page/project/operations/kubernetes/index.rb +++ b/qa/qa/page/project/operations/kubernetes/index.rb @@ -7,11 +7,11 @@ module QA module Kubernetes class Index < Page::Base view 'app/views/clusters/clusters/_empty_state.html.haml' do - element :add_kubernetes_cluster_button, "link_to s_('ClusterIntegration|Add Kubernetes cluster')" # rubocop:disable QA/ElementWithPattern + element :add_kubernetes_cluster_button, "link_to s_('ClusterIntegration|Integrate with a cluster certificate')" # rubocop:disable QA/ElementWithPattern end def add_kubernetes_cluster - click_on 'Add Kubernetes cluster' + click_on 'Connect cluster with certificate' end def has_cluster?(cluster) diff --git a/qa/qa/page/project/packages/index.rb b/qa/qa/page/project/packages/index.rb index 6d55d1d04b6..396d3373b8a 100644 --- a/qa/qa/page/project/packages/index.rb +++ b/qa/qa/page/project/packages/index.rb @@ -26,3 +26,5 @@ module QA end end end + +QA::Page::Project::Packages::Index.prepend_if_ee('QA::EE::Page::Project::Packages::Index') diff --git a/qa/qa/page/project/pipeline/index.rb b/qa/qa/page/project/pipeline/index.rb index aa2ef2f058f..b2ecbb2e988 100644 --- a/qa/qa/page/project/pipeline/index.rb +++ b/qa/qa/page/project/pipeline/index.rb @@ -14,6 +14,10 @@ module QA element :pipeline_retry_button end + view 'app/assets/javascripts/pipelines/components/pipelines_list/nav_controls.vue' do + element :run_pipeline_button + end + def click_on_latest_pipeline all_elements(:pipeline_url_link, minimum: 1, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME).first.click end @@ -40,6 +44,14 @@ module QA wait_for_latest_pipeline_success end end + + def has_pipeline? + has_element? :pipeline_url_link + end + + def click_run_pipeline_button + click_element :run_pipeline_button, Page::Project::Pipeline::New + end end end end diff --git a/qa/qa/page/project/pipeline/new.rb b/qa/qa/page/project/pipeline/new.rb new file mode 100644 index 00000000000..644a21b46e9 --- /dev/null +++ b/qa/qa/page/project/pipeline/new.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + module Pipeline + class New < QA::Page::Base + view 'app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue' do + element :run_pipeline_button, required: true + end + + def click_run_pipeline_button + click_element :run_pipeline_button + end + end + end + end + end +end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index c607b35005e..d81be2803bd 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -103,6 +103,8 @@ module QA end def click_commit(commit_msg) + wait_for_requests + within_element(:file_tree_table) do click_on commit_msg end diff --git a/qa/qa/page/project/snippet/index.rb b/qa/qa/page/project/snippet/index.rb new file mode 100644 index 00000000000..a221abc4196 --- /dev/null +++ b/qa/qa/page/project/snippet/index.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + module Snippet + class Index < Page::Base + include Page::Component::Snippet + + view 'app/views/shared/snippets/_snippet.html.haml' do + element :snippet_link + end + + def has_project_snippet?(title) + has_element?(:snippet_link, snippet_title: title) + end + + def click_snippet_link(title) + within_element(:snippet_link, text: title) do + click_link(title) + end + end + end + end + end + end +end + +QA::Page::Project::Snippet::Index.prepend_if_ee('QA::EE::Page::Project::Snippet::Index') |