diff options
Diffstat (limited to 'qa/qa/page')
25 files changed, 375 insertions, 130 deletions
diff --git a/qa/qa/page/component/design_management.rb b/qa/qa/page/component/design_management.rb index a8a24bd3949..fafbda58b07 100644 --- a/qa/qa/page/component/design_management.rb +++ b/qa/qa/page/component/design_management.rb @@ -30,6 +30,17 @@ module QA view 'app/assets/javascripts/design_management/components/list/item.vue' do element :design_file_name element :design_image + element :design_status_icon + 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 +63,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"] && @@ -67,15 +80,41 @@ module QA raise ElementNotFound, %Q(Attempted to attach design "#{filename}" but it did not appear) unless found end + def update_design(filename) + filepath = ::File.join('qa', 'fixtures', 'designs', 'update', filename) + add_design(filepath) + end + def click_design(filename) 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 + + def has_created_icon? + has_element?(:design_status_icon, status: 'file-addition-solid') + end + + def has_modified_icon? + has_element?(:design_status_icon, status: 'file-modified-solid') + 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..741a3feb73b 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 @@ -70,7 +79,7 @@ module QA private def text_area - find('#editor textarea', visible: false) + find('.monaco-editor textarea', visible: false) end end end 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..9a4b06d8ac7 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) + 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) - within_element(:file_content) do - has_text?(file_content) + 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 @@ -115,7 +139,7 @@ module QA end def click_edit_button - click_element(:snippet_action_button, action: 'Edit') + click_element(:snippet_action_button, Page::Dashboard::Snippet::Edit, action: 'Edit') end def click_delete_button diff --git a/qa/qa/page/dashboard/snippet/edit.rb b/qa/qa/page/dashboard/snippet/edit.rb index 7802a680c25..37c0747aea4 100644 --- a/qa/qa/page/dashboard/snippet/edit.rb +++ b/qa/qa/page/dashboard/snippet/edit.rb @@ -5,16 +5,11 @@ 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 + element :submit_button, required: true end def add_to_file_content(content) - finished_loading? text_area.set content text_area.has_text?(content) # wait for changes to take effect end @@ -30,7 +25,7 @@ module QA private def text_area - find('#editor textarea', visible: false) + find('.monaco-editor textarea', visible: false) end end end diff --git a/qa/qa/page/dashboard/todos.rb b/qa/qa/page/dashboard/todos.rb new file mode 100644 index 00000000000..d8baadcf73d --- /dev/null +++ b/qa/qa/page/dashboard/todos.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module QA + module Page + module Dashboard + class Todos < Page::Base + include Page::Component::Snippet + + view 'app/views/dashboard/todos/index.html.haml' do + element :todos_list_container, required: true + end + + view 'app/views/dashboard/todos/_todo.html.haml' do + element :todo_item_container + element :todo_action_name_content + element :todo_target_title_content + end + + def has_todo_list? + has_element? :todo_item_container + end + + def has_latest_todo_item_with_content?(action, title) + within_element(:todos_list_container) do + within_element_by_index(:todo_item_container, 0) do + has_element?(:todo_action_name_content, text: action) && has_element?(:todo_target_title_content, text: title) + end + end + end + end + end + end +end diff --git a/qa/qa/page/main/sign_up.rb b/qa/qa/page/main/sign_up.rb index b7808afb209..98bbbc53027 100644 --- a/qa/qa/page/main/sign_up.rb +++ b/qa/qa/page/main/sign_up.rb @@ -5,12 +5,12 @@ module QA module Main class SignUp < Page::Base view 'app/views/devise/shared/_signup_box.html.haml' do - element :new_user_name_field + element :new_user_first_name_field + element :new_user_last_name_field element :new_user_username_field element :new_user_email_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 @@ -18,13 +18,12 @@ module QA end def sign_up!(user) - fill_element :new_user_name_field, user.name + fill_element :new_user_first_name_field, user.first_name + fill_element :new_user_last_name_field, user.last_name fill_element :new_user_username_field, user.username fill_element :new_user_email_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 if has_element?(:new_user_register_button) 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/accounts/show.rb b/qa/qa/page/profile/accounts/show.rb index cf7f7d80cfa..84a34d1da78 100644 --- a/qa/qa/page/profile/accounts/show.rb +++ b/qa/qa/page/profile/accounts/show.rb @@ -7,6 +7,7 @@ module QA class Show < Page::Base view 'app/views/profiles/accounts/show.html.haml' do element :delete_account_button, required: true + element :enable_2fa_button end view 'app/assets/javascripts/profile/account/components/delete_account_modal.vue' do @@ -14,6 +15,10 @@ module QA element :confirm_delete_account_button end + def click_enable_2fa_button + click_element(:enable_2fa_button) + end + def delete_account(password) click_element(:delete_account_button) diff --git a/qa/qa/page/profile/ssh_keys.rb b/qa/qa/page/profile/ssh_keys.rb index 810877e21ad..8da484003f4 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/ssh_keys_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/job/show.rb b/qa/qa/page/project/job/show.rb index 6a657b4ab39..2ecb27e05b2 100644 --- a/qa/qa/page/project/job/show.rb +++ b/qa/qa/page/project/job/show.rb @@ -58,6 +58,10 @@ module QA click_element :retry_button end + def has_job_log? + has_element? :job_log_content + end + private def loaded?(wait: 60) @@ -70,3 +74,5 @@ module QA end end end + +QA::Page::Project::Job::Show.prepend_if_ee('QA::EE::Page::Project::Job::Show') diff --git a/qa/qa/page/project/new.rb b/qa/qa/page/project/new.rb index f6c015f64ea..7e296528795 100644 --- a/qa/qa/page/project/new.rb +++ b/qa/qa/page/project/new.rb @@ -23,11 +23,7 @@ module QA element :visibility_radios, 'visibility_level:' # rubocop:disable QA/ElementWithPattern end - view 'app/views/projects/_import_project_pane.html.haml' do - element :import_github, "icon('github', text: 'GitHub')" # rubocop:disable QA/ElementWithPattern - end - - view 'app/views/projects/project_templates/_built_in_templates.html.haml' do + view 'app/views/projects/project_templates/_template.html.haml' do element :use_template_button element :template_option_row 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..aff2378330a 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,8 +44,18 @@ 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 end end + +QA::Page::Project::Pipeline::Index.prepend_if_ee('QA::EE::Page::Project::Pipeline::Index') 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/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb index 57ab7fb4480..0fb5238a308 100644 --- a/qa/qa/page/project/pipeline/show.rb +++ b/qa/qa/page/project/pipeline/show.rb @@ -8,7 +8,7 @@ module QA include Component::CiBadgeLink view 'app/assets/javascripts/vue_shared/components/header_ci_component.vue' do - element :pipeline_header, /header class.*ci-header-container.*/ # rubocop:disable QA/ElementWithPattern + element :pipeline_header end view 'app/assets/javascripts/pipelines/components/graph/graph_component.vue' do @@ -16,8 +16,9 @@ module QA end view 'app/assets/javascripts/pipelines/components/graph/job_item.vue' do - element :job_component, /class.*ci-job-component.*/ # rubocop:disable QA/ElementWithPattern + element :job_item_container element :job_link + element :action_button end view 'app/assets/javascripts/pipelines/components/graph/linked_pipeline.vue' do @@ -34,16 +35,18 @@ module QA end def running?(wait: 0) - within('.ci-header-container') do + within_element(:pipeline_header) do page.has_content?('running', wait: wait) end end def has_build?(name, status: :success, wait: nil) - within('.pipeline-graph') do - within('.ci-job-component', text: name) do + if status + within_element(:job_item_container, text: name) do has_selector?(".ci-status-icon-#{status}", { wait: wait }.compact) end + else + has_element?(:job_item_container, text: name) end end @@ -78,6 +81,12 @@ module QA def click_on_first_job first('.js-pipeline-graph-job-link', wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME).click end + + def click_job_action(job_name) + within_element(:job_item_container, text: job_name) do + click_element(:action_button) + end + end end end end diff --git a/qa/qa/page/project/settings/ci_variables.rb b/qa/qa/page/project/settings/ci_variables.rb index aef9800e876..f2ced668a60 100644 --- a/qa/qa/page/project/settings/ci_variables.rb +++ b/qa/qa/page/project/settings/ci_variables.rb @@ -26,6 +26,10 @@ module QA within_element(:ci_variable_key_field) { find('input').set key } fill_element :ci_variable_value_field, value click_ci_variable_save_button + + wait_until(reload: false) do + within_element(:ci_variable_table_content) { has_element?(:edit_ci_variable_button) } + end end def click_add_variable 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') diff --git a/qa/qa/page/project/web_ide/edit.rb b/qa/qa/page/project/web_ide/edit.rb index 56c8d343cf5..fc33c753230 100644 --- a/qa/qa/page/project/web_ide/edit.rb +++ b/qa/qa/page/project/web_ide/edit.rb @@ -73,6 +73,10 @@ module QA element :project_path_content end + view 'app/assets/javascripts/ide/components/commit_sidebar/message_field.vue' do + element :ide_commit_message_field + end + def has_file?(file_name) within_element(:file_list) do page.has_content? file_name @@ -83,6 +87,10 @@ module QA has_element?(:project_path_content, project_path: project_path) end + def go_to_project + click_element(:project_path_content, Page::Project::Show) + end + def create_new_file_from_template(file_name, template) click_element(:new_file, Page::Component::WebIDE::Modal::CreateNewFile) @@ -115,7 +123,7 @@ module QA find_element(:commit_sha_content).text end - def commit_changes(open_merge_request: false) + def commit_changes(commit_message = nil, open_merge_request: false) # Clicking :begin_commit_button switches from the # edit to the commit view click_element(:begin_commit_button) @@ -133,6 +141,10 @@ module QA has_element?(:commit_button) end + if commit_message + fill_element(:ide_commit_message_field, commit_message) + end + if open_merge_request click_element(:commit_button, Page::MergeRequest::New) else diff --git a/qa/qa/page/project/wiki/show.rb b/qa/qa/page/project/wiki/show.rb index cdd18e420d1..61b0d202a76 100644 --- a/qa/qa/page/project/wiki/show.rb +++ b/qa/qa/page/project/wiki/show.rb @@ -11,12 +11,12 @@ module QA view 'app/views/shared/wikis/show.html.haml' do element :wiki_page_title element :wiki_page_content + element :edit_page_button end view 'app/views/shared/wikis/_main_links.html.haml' do element :new_page_button element :page_history_button - element :edit_page_button end view 'app/views/shared/empty_states/_wikis.html.haml' do |