diff options
Diffstat (limited to 'qa/qa/page')
53 files changed, 1090 insertions, 346 deletions
diff --git a/qa/qa/page/component/ci_badge_link.rb b/qa/qa/page/component/ci_badge_link.rb index 8629399e911..4c053f1d6a9 100644 --- a/qa/qa/page/component/ci_badge_link.rb +++ b/qa/qa/page/component/ci_badge_link.rb @@ -43,7 +43,7 @@ module QA private def completed?(timeout: 60) - wait_until(reload: false, max_duration: timeout) do + wait_until(reload: false, sleep_interval: 3.0, max_duration: timeout) do COMPLETED_STATUSES.include?(status_badge) end end diff --git a/qa/qa/page/component/dropdown_filter.rb b/qa/qa/page/component/dropdown_filter.rb index a39a04a668d..30c6f13eaf7 100644 --- a/qa/qa/page/component/dropdown_filter.rb +++ b/qa/qa/page/component/dropdown_filter.rb @@ -8,7 +8,7 @@ module QA page.has_css?('.dropdown-input-field', wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) find('.dropdown-input-field').set(item) - click_link item + click_on item end end end diff --git a/qa/qa/page/component/issuable/sidebar.rb b/qa/qa/page/component/issuable/sidebar.rb new file mode 100644 index 00000000000..4e94049efe7 --- /dev/null +++ b/qa/qa/page/component/issuable/sidebar.rb @@ -0,0 +1,129 @@ +# frozen_string_literal: true + +module QA + module Page + module Component + module Issuable + module Sidebar + extend QA::Page::PageConcern + + def self.included(base) + super + + base.view 'app/assets/javascripts/sidebar/components/assignees/assignee_avatar.vue' do + element :avatar_image + end + + base.view 'app/assets/javascripts/sidebar/components/assignees/uncollapsed_assignee_list.vue' do + element :more_assignees_link + end + + base.view 'app/helpers/dropdowns_helper.rb' 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 + end + + def assign_milestone(milestone) + click_element(:edit_milestone_link) + within_element(:milestone_block) do + click_link("#{milestone.title}") + end + + wait_until(reload: false) do + has_element?(:milestone_block, text: milestone.title, wait: 0) + end + + refresh + end + + def click_milestone_link + click_element(:milestone_link) + end + + def has_assignee?(username) + page.within(element_selector_css(:assignee_block)) do + has_text?(username) + end + end + + def has_avatar_image_count?(count) + wait_assignees_block_finish_loading do + all_elements(:avatar_image, count: count) + end + end + + def has_label?(label) + within_element(:labels_block) do + !!has_element?(:label, label_name: label) + end + end + + def has_milestone?(milestone_title) + wait_milestone_block_finish_loading do + has_element?(:milestone_link, title: milestone_title) + end + end + + def more_assignees_link + find_element(:more_assignees_link) + end + + def select_labels_and_refresh(labels) + Support::Retrier.retry_until do + click_element(:edit_labels_link) + has_element?(:dropdown_menu_labels, text: labels.first) + end + + labels.each do |label| + within_element(:dropdown_menu_labels, text: label) do + send_keys_to_element(:dropdown_input_field, [label, :enter]) + end + end + + click_element(:edit_labels_link) + + labels.each do |label| + has_element?(:labels_block, text: label, wait: 0) + end + + refresh + end + + def toggle_more_assignees_link + click_element(:more_assignees_link) + end + + private + + def wait_assignees_block_finish_loading + within_element(:assignee_block) do + wait_until(reload: false, max_duration: 10, sleep_interval: 1) do + finished_loading_block? + yield + end + end + end + + def wait_milestone_block_finish_loading + within_element(:milestone_block) do + wait_until(reload: false, max_duration: 10, sleep_interval: 1) do + finished_loading_block? + yield + end + 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 0c840eba7ce..9e843630115 100644 --- a/qa/qa/page/component/issue_board/show.rb +++ b/qa/qa/page/component/issue_board/show.rb @@ -39,11 +39,6 @@ module QA element :boards_list end - view 'app/views/shared/boards/components/_board.html.haml' do - element :board_list - element :board_list_header - end - view 'app/assets/javascripts/boards/toggle_focus.js' do element :focus_mode_button end diff --git a/qa/qa/page/component/new_snippet.rb b/qa/qa/page/component/new_snippet.rb new file mode 100644 index 00000000000..18f2e237097 --- /dev/null +++ b/qa/qa/page/component/new_snippet.rb @@ -0,0 +1,80 @@ +# frozen_string_literal: true + +module QA + module Page + module Component + module NewSnippet + extend QA::Page::PageConcern + + def self.included(base) + super + + base.view 'app/assets/javascripts/snippets/components/edit.vue' do + element :snippet_title_field, required: true + element :submit_button + end + + base.view 'app/assets/javascripts/snippets/components/snippet_description_edit.vue' do + element :snippet_description_field + element :description_placeholder, required: true + end + + base.view 'app/assets/javascripts/snippets/components/snippet_blob_edit.vue' do + element :file_name_field + 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 + end + + base.view 'app/views/shared/_zen.html.haml' do + # This 'element' is here only to ensure the changes in the view source aren't mistakenly changed + element :_, "qa_selector = local_assigns.fetch(:qa_selector, '')" # rubocop:disable QA/ElementWithPattern + end + end + + def fill_title(title) + fill_element :snippet_title_field, title + end + + def fill_description(description) + click_element :description_placeholder + fill_element :snippet_description_field, description + end + + def set_visibility(visibility) + choose visibility + end + + def fill_file_name(name) + finished_loading? + fill_element :file_name_field, name + end + + def fill_file_content(content) + finished_loading? + text_area.set content + end + + def click_create_snippet_button + wait_until(reload: false) { !find_element(:submit_button).disabled? } + click_element(:submit_button, Page::Dashboard::Snippet::Show) + end + + private + + def text_area + find('#editor textarea', visible: false) + end + end + end + end +end diff --git a/qa/qa/page/component/project_selector.rb b/qa/qa/page/component/project_selector.rb new file mode 100644 index 00000000000..80ed6b8e53b --- /dev/null +++ b/qa/qa/page/component/project_selector.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module QA + module Page + module Component + module ProjectSelector + extend QA::Page::PageConcern + + def self.included(base) + super + + base.view 'app/assets/javascripts/vue_shared/components/project_selector/project_selector.vue' do + element :project_search_field + element :project_list_item + end + end + + def fill_project_search_input(project_name) + fill_element :project_search_field, project_name + end + + def select_project + click_element :project_list_item + end + end + end + end +end diff --git a/qa/qa/page/component/snippet.rb b/qa/qa/page/component/snippet.rb new file mode 100644 index 00000000000..4ff19c01f1f --- /dev/null +++ b/qa/qa/page/component/snippet.rb @@ -0,0 +1,180 @@ +# frozen_string_literal: true + +module QA + module Page + module Component + module Snippet + extend QA::Page::PageConcern + + def self.included(base) + super + + base.view 'app/assets/javascripts/snippets/components/snippet_title.vue' do + element :snippet_title_content, required: true + end + + base.view 'app/assets/javascripts/snippets/components/snippet_description_view.vue' do + element :snippet_description_content + end + + base.view 'app/assets/javascripts/snippets/components/snippet_header.vue' do + element :snippet_container + end + + base.view 'app/assets/javascripts/blob/components/blob_header_filepath.vue' do + element :file_title_content + end + + base.view 'app/assets/javascripts/vue_shared/components/blob_viewers/simple_viewer.vue' do + element :file_content + end + + base.view 'app/assets/javascripts/blob/components/blob_content.vue' do + element :file_content + end + + base.view 'app/assets/javascripts/snippets/components/snippet_header.vue' do + element :snippet_action_button + element :delete_snippet_button + end + + base.view 'app/assets/javascripts/snippets/components/snippet_blob_view.vue' do + element :clone_button + end + + base.view 'app/assets/javascripts/vue_shared/components/clone_dropdown.vue' do + element :copy_http_url_button + element :copy_ssh_url_button + end + + base.view 'app/views/shared/notes/_comment_button.html.haml' do + element :comment_button + end + + base.view 'app/views/shared/notes/_form.html.haml' do + element :note_field + end + + base.view 'app/views/snippets/notes/_actions.html.haml' do + element :edit_comment_button + end + + base.view 'app/views/shared/notes/_edit_form.html.haml' do + element :edit_note_field + element :save_comment_button + end + + base.view 'app/views/shared/notes/_note.html.haml' do + element :note_content + element :note_author_content + end + + base.view 'app/views/projects/notes/_more_actions_dropdown.html.haml' do + element :more_actions_dropdown + element :delete_comment_button + end + end + + def has_snippet_title?(snippet_title) + has_element? :snippet_title_content, text: snippet_title + end + + def has_snippet_description?(snippet_description) + has_element? :snippet_description_content, text: snippet_description + end + + def has_no_snippet_description? + has_no_element?(:snippet_description_field) + end + + def has_visibility_type?(visibility_type) + within_element(:snippet_container) do + has_text?(visibility_type) + 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) + finished_loading? + within_element(:file_content) do + has_text?(file_content) + end + end + + def click_edit_button + finished_loading? + click_element(:snippet_action_button, action: 'Edit') + end + + def click_delete_button + finished_loading? + click_element(:snippet_action_button, action: 'Delete') + click_element(:delete_snippet_button) + # wait for the page to reload after deletion + wait_until(reload: false) do + has_no_element?(:delete_snippet_button) && + has_no_element?(:snippet_action_button, action: 'Delete') + end + end + + def get_repository_uri_http + finished_loading? + click_element(:clone_button) + Git::Location.new(find_element(:copy_http_url_button)['data-clipboard-text']).uri.to_s + end + + def get_repository_uri_ssh + finished_loading? + click_element(:clone_button) + Git::Location.new(find_element(:copy_ssh_url_button)['data-clipboard-text']).uri.to_s + end + + def add_comment(comment) + finished_loading? + fill_element(:note_field, comment) + click_element(:comment_button) + end + + def has_comment_author?(author_username) + finished_loading? + within_element(:note_author_content) do + has_text?('@' + author_username) + end + end + + def has_comment_content?(comment_content) + finished_loading? + within_element(:note_content) do + has_text?(comment_content) + end + end + + def has_syntax_highlighting?(language) + within_element(:file_content) do + find('.line')['lang'].to_s == language + end + end + + def edit_comment(comment) + finished_loading? + click_element(:edit_comment_button) + fill_element(:edit_note_field, comment) + click_element(:save_comment_button) + end + + def delete_comment(comment) + finished_loading? + click_element(:more_actions_dropdown) + accept_alert do + click_element(:delete_comment_button) + end + end + end + end + end +end diff --git a/qa/qa/page/component/web_ide/modal/create_new_file.rb b/qa/qa/page/component/web_ide/modal/create_new_file.rb index 48eb32fefd6..7c55f775476 100644 --- a/qa/qa/page/component/web_ide/modal/create_new_file.rb +++ b/qa/qa/page/component/web_ide/modal/create_new_file.rb @@ -9,7 +9,7 @@ module QA view 'app/assets/javascripts/ide/components/new_dropdown/modal.vue' do element :file_name_field, required: true element :new_file_modal, required: true - element :template_list, required: true + element :template_list end end end diff --git a/qa/qa/page/dashboard/snippet/new.rb b/qa/qa/page/dashboard/snippet/new.rb index bcfb4734b59..683e118aa19 100644 --- a/qa/qa/page/dashboard/snippet/new.rb +++ b/qa/qa/page/dashboard/snippet/new.rb @@ -5,70 +5,7 @@ module QA module Dashboard module Snippet class New < Page::Base - view 'app/assets/javascripts/snippets/components/edit.vue' do - element :snippet_title_field, required: true - element :submit_button - end - - view 'app/assets/javascripts/snippets/components/snippet_description_edit.vue' do - element :snippet_description_field - element :description_placeholder, required: true - end - - view 'app/assets/javascripts/snippets/components/snippet_blob_edit.vue' do - element :file_name_field - end - - view 'app/views/shared/form_elements/_description.html.haml' do - element :issuable_form_description - end - - 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 - end - - view 'app/views/shared/_zen.html.haml' do - # This 'element' is here only to ensure the changes in the view source aren't mistakenly changed - element :_, "qa_selector = local_assigns.fetch(:qa_selector, '')" # rubocop:disable QA/ElementWithPattern - end - - def fill_title(title) - fill_element :snippet_title_field, title - end - - def fill_description(description) - click_element :description_placeholder - fill_element :snippet_description_field, description - end - - def set_visibility(visibility) - choose visibility - end - - def fill_file_name(name) - finished_loading? - fill_element :file_name_field, name - end - - def fill_file_content(content) - finished_loading? - text_area.set content - end - - def click_create_snippet_button - wait_until(reload: false) { !find_element(:submit_button).disabled? } - click_element :submit_button - end - - private - - def text_area - find('#editor textarea', visible: false) - end + include Page::Component::NewSnippet end end end diff --git a/qa/qa/page/dashboard/snippet/show.rb b/qa/qa/page/dashboard/snippet/show.rb index da494ae70ec..73e6abe174f 100644 --- a/qa/qa/page/dashboard/snippet/show.rb +++ b/qa/qa/page/dashboard/snippet/show.rb @@ -5,102 +5,7 @@ module QA module Dashboard module Snippet class Show < Page::Base - view 'app/assets/javascripts/snippets/components/snippet_description_view.vue' do - element :snippet_description_content - end - - view 'app/assets/javascripts/snippets/components/snippet_title.vue' do - element :snippet_title_content, required: true - end - - view 'app/assets/javascripts/snippets/components/snippet_header.vue' do - element :snippet_container - end - - view 'app/assets/javascripts/blob/components/blob_header_filepath.vue' do - element :file_title_content - end - - view 'app/assets/javascripts/vue_shared/components/blob_viewers/simple_viewer.vue' do - element :file_content - end - - view 'app/assets/javascripts/blob/components/blob_content.vue' do - element :file_content - end - - view 'app/assets/javascripts/snippets/components/snippet_header.vue' do - element :snippet_action_button - element :delete_snippet_button - end - - view 'app/assets/javascripts/snippets/components/snippet_blob_view.vue' do - element :clone_button - end - - view 'app/assets/javascripts/vue_shared/components/clone_dropdown.vue' do - element :copy_http_url_button - element :copy_ssh_url_button - end - - def has_snippet_title?(snippet_title) - has_element? :snippet_title_content, text: snippet_title - end - - def has_snippet_description?(snippet_description) - has_element? :snippet_description_content, text: snippet_description - end - - def has_no_snippet_description? - has_no_element?(:snippet_description_field) - end - - def has_visibility_type?(visibility_type) - within_element(:snippet_container) do - has_text?(visibility_type) - 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) - finished_loading? - within_element(:file_content) do - has_text?(file_content) - end - end - - def click_edit_button - finished_loading? - click_element(:snippet_action_button, action: 'Edit') - end - - def click_delete_button - finished_loading? - click_element(:snippet_action_button, action: 'Delete') - click_element(:delete_snippet_button) - # wait for the page to reload after deletion - wait_until(reload: false) do - has_no_element?(:delete_snippet_button) && - has_no_element?(:snippet_action_button, action: 'Delete') - end - end - - def get_repository_uri_http - finished_loading? - click_element(:clone_button) - Git::Location.new(find_element(:copy_http_url_button)['data-clipboard-text']).uri.to_s - end - - def get_repository_uri_ssh - finished_loading? - click_element(:clone_button) - Git::Location.new(find_element(:copy_ssh_url_button)['data-clipboard-text']).uri.to_s - end + include Page::Component::Snippet end end end diff --git a/qa/qa/page/group/menu.rb b/qa/qa/page/group/menu.rb index 380984c283e..7689dd7e5c8 100644 --- a/qa/qa/page/group/menu.rb +++ b/qa/qa/page/group/menu.rb @@ -7,9 +7,11 @@ module QA include SubMenus::Common view 'app/views/layouts/nav/sidebar/_group.html.haml' do - element :group_settings_item - element :group_members_item element :general_settings_link + element :group_issues_item + element :group_members_item + element :group_milestones_link + element :group_settings_item end view 'app/views/layouts/nav/sidebar/_analytics_links.html.haml' do @@ -44,6 +46,25 @@ module QA end end end + + def go_to_milestones + hover_issues do + within_submenu do + click_element(:group_milestones_link) + end + end + end + + private + + def hover_issues + within_sidebar do + scroll_to_element(:group_issues_item) + find_element(:group_issues_item).hover + + yield + end + end end end end diff --git a/qa/qa/page/group/milestone/index.rb b/qa/qa/page/group/milestone/index.rb new file mode 100644 index 00000000000..a86772a070d --- /dev/null +++ b/qa/qa/page/group/milestone/index.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module QA + module Page + module Group + module Milestone + class Index < Page::Milestone::Index + view 'app/views/groups/milestones/index.html.haml' do + element :new_group_milestone_link + end + + def click_new_milestone_link + click_element(:new_group_milestone_link) + end + end + end + end + end +end diff --git a/qa/qa/page/group/milestone/new.rb b/qa/qa/page/group/milestone/new.rb new file mode 100644 index 00000000000..451117a2163 --- /dev/null +++ b/qa/qa/page/group/milestone/new.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module QA + module Page + module Group + module Milestone + class New < Page::Milestone::New + view 'app/views/groups/milestones/_form.html.haml' do + element :create_milestone_button + element :milestone_description_field + element :milestone_title_field + end + + def click_create_milestone_button + click_element(:create_milestone_button) + end + + def set_description(description) + fill_element(:milestone_description_field, description) + end + + def set_title(title) + fill_element(:milestone_title_field, title) + end + end + end + end + end +end diff --git a/qa/qa/page/group/sub_menus/members.rb b/qa/qa/page/group/sub_menus/members.rb index 33c4caaddcb..895da639c02 100644 --- a/qa/qa/page/group/sub_menus/members.rb +++ b/qa/qa/page/group/sub_menus/members.rb @@ -7,6 +7,10 @@ module QA class Members < Page::Base include Page::Component::UsersSelect + view 'app/assets/javascripts/vue_shared/components/remove_member_modal.vue' do + element :remove_member_modal_content + end + view 'app/views/shared/members/_invite_member.html.haml' do element :member_select_field element :invite_member_button @@ -32,10 +36,12 @@ module QA end def remove_member(username) - page.accept_confirm do - within_element(:member_row, text: username) do - click_element :delete_member_button - end + within_element(:member_row, text: username) do + click_element :delete_member_button + end + + within_element(:remove_member_modal_content) do + click_button("Remove member") end end end diff --git a/qa/qa/page/issuable/sidebar.rb b/qa/qa/page/issuable/sidebar.rb deleted file mode 100644 index af5eee35a2d..00000000000 --- a/qa/qa/page/issuable/sidebar.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Issuable - class Sidebar < Page::Base - view 'app/views/shared/issuable/_sidebar.html.haml' do - element :labels_block - element :milestone_block - element :milestone_link - end - - def has_label?(label) - within_element(:labels_block) do - has_element?(:label, label_name: label) - end - end - - def has_milestone?(milestone_title) - within_element(:milestone_block) do - has_element?(:milestone_link, title: milestone_title) - end - end - end - end - end -end diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb index 6af18cb1d2b..416946f44f0 100644 --- a/qa/qa/page/main/menu.rb +++ b/qa/qa/page/main/menu.rb @@ -22,6 +22,9 @@ module QA element :groups_dropdown, required: true element :more_dropdown element :snippets_link + element :groups_link + element :activity_link + element :milestones_link end view 'app/views/layouts/nav/projects_dropdown/_show.html.haml' do @@ -53,10 +56,10 @@ module QA end end - def go_to_snippets + def go_to_more_dropdown_option(option_name) within_top_menu do click_element :more_dropdown - click_element :snippets_link + click_element option_name end end @@ -148,3 +151,5 @@ module QA end end end + +QA::Page::Main::Menu.prepend_if_ee('QA::EE::Page::Main::Menu') diff --git a/qa/qa/page/main/two_factor_auth.rb b/qa/qa/page/main/two_factor_auth.rb new file mode 100644 index 00000000000..003bd8dd1b1 --- /dev/null +++ b/qa/qa/page/main/two_factor_auth.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module QA + module Page + module Main + class TwoFactorAuth < Page::Base + view 'app/views/devise/sessions/two_factor.html.haml' do + element :verify_code_button + element :two_fa_code_field + end + + def click_verify_code_button + click_element :verify_code_button + end + + def set_2fa_code(code) + fill_element(:two_fa_code_field, code) + end + end + end + end +end diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index 07f8e568b2a..b9a2bf4ee69 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -5,6 +5,7 @@ module QA module MergeRequest class Show < Page::Base include Page::Component::Note + include Page::Component::Issuable::Sidebar view 'app/assets/javascripts/mr_tabs_popover/components/popover.vue' do element :dismiss_popover_button @@ -64,11 +65,6 @@ module QA element :new_diff_line end - view 'app/views/shared/issuable/_sidebar.html.haml' do - element :assignee_block - element :labels_block - end - view 'app/views/projects/merge_requests/_mr_title.html.haml' do element :edit_button end @@ -178,18 +174,6 @@ module QA has_element?(:merge_button) end - def has_assignee?(username) - page.within(element_selector_css(:assignee_block)) do - has_text?(username) - end - end - - def has_label?(label) - within_element(:labels_block) do - !!has_element?(:label, label_name: label) - end - end - 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) diff --git a/qa/qa/page/milestone/index.rb b/qa/qa/page/milestone/index.rb new file mode 100644 index 00000000000..2e86dd4c0ab --- /dev/null +++ b/qa/qa/page/milestone/index.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module QA + module Page + module Milestone + class Index < Page::Base + view 'app/views/shared/milestones/_milestone.html.haml' do + element :milestone_link + end + + def click_milestone(milestone) + click_element(:milestone_link, milestone_title: milestone.title) + end + + def has_milestone?(milestone) + has_element?(:milestone_link, milestone_title: milestone.title) + end + end + end + end +end diff --git a/qa/qa/page/milestone/new.rb b/qa/qa/page/milestone/new.rb new file mode 100644 index 00000000000..655254d74fa --- /dev/null +++ b/qa/qa/page/milestone/new.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module QA + module Page + module Milestone + class New < Page::Base + view 'app/views/shared/milestones/_form_dates.html.haml' do + element :due_date_field + element :start_date_field + end + + def set_due_date(due_date) + fill_element(:due_date_field, due_date.to_s + "\n") + end + + def set_start_date(start_date) + fill_element(:start_date_field, start_date.to_s + "\n") + end + end + end + end +end diff --git a/qa/qa/page/milestone/show.rb b/qa/qa/page/milestone/show.rb new file mode 100644 index 00000000000..42efbd4ea30 --- /dev/null +++ b/qa/qa/page/milestone/show.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module QA + module Page + module Milestone + class Show < Page::Base + include Support::Dates + + view 'app/views/shared/milestones/_description.html.haml' do + element :milestone_description_content + element :milestone_title_content, required: true + end + + view 'app/views/shared/milestones/_sidebar.html.haml' do + element :due_date_content + element :start_date_content + end + + def has_due_date?(due_date) + formatted_due_date = format_date(due_date) + has_element?(:due_date_content, text: formatted_due_date) + end + + def has_start_date?(start_date) + formatted_start_date = format_date(start_date) + has_element?(:start_date_content, text: formatted_start_date) + end + end + end + end +end + +QA::Page::Milestone::Show.prepend_if_ee('QA::EE::Page::Milestone::Show') diff --git a/qa/qa/page/modal/delete_wiki.rb b/qa/qa/page/modal/delete_wiki.rb new file mode 100644 index 00000000000..4f0bc34ee88 --- /dev/null +++ b/qa/qa/page/modal/delete_wiki.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module QA + module Page + module Modal + class DeleteWiki < Base + view 'app/assets/javascripts/pages/shared/wikis/components/delete_wiki_modal.vue' do + element :confirm_deletion_button, required: true + end + + def confirm_deletion + click_element :confirm_deletion_button + end + end + end + end +end diff --git a/qa/qa/page/profile/two_factor_auth.rb b/qa/qa/page/profile/two_factor_auth.rb index a3ff5f603fa..b5a4d04b377 100644 --- a/qa/qa/page/profile/two_factor_auth.rb +++ b/qa/qa/page/profile/two_factor_auth.rb @@ -8,9 +8,35 @@ module QA element :configure_it_later_button end + view 'app/views/profiles/two_factor_auths/show.html.haml' do + element :otp_secret_content + element :pin_code_field + element :register_2fa_app_button + end + + view 'app/views/profiles/two_factor_auths/_codes.html.haml' do + element :proceed_button + end + def click_configure_it_later_button click_element :configure_it_later_button end + + def otp_secret_content + find_element(:otp_secret_content).text.gsub('Key:', '').delete(' ') + end + + def set_pin_code(pin_code) + fill_element(:pin_code_field, pin_code) + end + + def click_register_2fa_app_button + click_element :register_2fa_app_button + end + + def click_proceed_button + click_element :proceed_button + end end end end diff --git a/qa/qa/page/project/issue/index.rb b/qa/qa/page/project/issue/index.rb index ace2537fc0e..e0c10220fbc 100644 --- a/qa/qa/page/project/issue/index.rb +++ b/qa/qa/page/project/issue/index.rb @@ -18,6 +18,11 @@ module QA element :export_issues_modal end + view 'app/views/projects/issues/import_csv/_button.html.haml' do + element :import_issues_button + element :import_from_jira_link + end + view 'app/views/projects/issues/_issue.html.haml' do element :issue element :issue_link, 'link_to issue.title' # rubocop:disable QA/ElementWithPattern @@ -51,10 +56,25 @@ module QA click_element(:export_issues_button) end + def click_import_from_jira_link + click_element(:import_from_jira_link) + end + + def click_import_issues_dropdown + # When there are no issues, the image that loads causes the buttons to jump + has_loaded_all_images? + click_element(:import_issues_button) + end + def export_issues_modal find_element(:export_issues_modal) end + def go_to_jira_import_form + click_import_issues_dropdown + click_import_from_jira_link + end + def has_assignee_link_count?(count) all_elements(:assignee_link, count: count) end diff --git a/qa/qa/page/project/issue/jira_import.rb b/qa/qa/page/project/issue/jira_import.rb new file mode 100644 index 00000000000..d3be24464ab --- /dev/null +++ b/qa/qa/page/project/issue/jira_import.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + module Issue + class JiraImport < Page::Base + view 'app/assets/javascripts/jira_import/components/jira_import_form.vue' do + element :jira_project_dropdown + element :jira_issues_import_button + end + + def select_jira_project(jira_project) + select_element(:jira_project_dropdown, jira_project) + end + + def select_project_and_import(jira_project) + select_jira_project(jira_project) + click_element(:jira_issues_import_button) + end + end + end + end + end +end diff --git a/qa/qa/page/project/issue/show.rb b/qa/qa/page/project/issue/show.rb index dd74ff28763..04f0f34cbbb 100644 --- a/qa/qa/page/project/issue/show.rb +++ b/qa/qa/page/project/issue/show.rb @@ -8,6 +8,7 @@ module QA include Page::Component::Issuable::Common include Page::Component::Note include Page::Component::DesignManagement + include Page::Component::Issuable::Sidebar view 'app/assets/javascripts/notes/components/comment_form.vue' do element :comment_button @@ -23,45 +24,25 @@ module QA element :noteable_note_item end - view 'app/assets/javascripts/sidebar/components/assignees/assignee_avatar.vue' do - element :avatar_image - end - - view 'app/assets/javascripts/sidebar/components/assignees/uncollapsed_assignee_list.vue' do - element :more_assignees_link - end - view 'app/assets/javascripts/vue_shared/components/issue/related_issuable_item.vue' do element :remove_related_issue_button end - view 'app/helpers/dropdowns_helper.rb' do - element :dropdown_input_field - end - view 'app/views/shared/issuable/_close_reopen_button.html.haml' do element :close_issue_button element :reopen_issue_button end - view 'app/views/shared/issuable/_sidebar.html.haml' do - element :assignee_block - element :labels_block - element :edit_link_labels - element :dropdown_menu_labels - element :milestone_link - end - view 'app/views/shared/notes/_form.html.haml' do element :new_note_form, 'new-note' # rubocop:disable QA/ElementWithPattern element :new_note_form, 'attr: :note' # rubocop:disable QA/ElementWithPattern end view 'app/views/projects/issues/_tabs.html.haml' do - element :discussion_tab_link - element :discussion_tab_content - element :designs_tab_link element :designs_tab_content + element :designs_tab_link + element :discussion_tab_content + element :discussion_tab_link end def click_discussion_tab @@ -74,10 +55,6 @@ module QA active_element?(:designs_tab_content) end - def click_milestone_link - click_element(:milestone_link) - end - def click_remove_related_issue_button click_element(:remove_related_issue_button) end @@ -90,7 +67,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 + fill_element :comment_input, "#{text}\n" unless attachment.nil? QA::Page::Component::Dropzone.new(self, '.new-note') @@ -100,20 +77,10 @@ module QA click_element :comment_button end - def has_avatar_image_count?(count) - wait_assignees_block_finish_loading do - all_elements(:avatar_image, count: count) - end - end - def has_comment?(comment_text) has_element?(:noteable_note_item, text: comment_text, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME) end - def more_assignees_link - find_element(:more_assignees_link) - end - def noteable_note_item find_element(:noteable_note_item) end @@ -130,35 +97,6 @@ module QA select_filter_with_text('Show history only') end - def select_labels_and_refresh(labels) - Support::Retrier.retry_until do - click_element(:edit_link_labels) - has_element?(:dropdown_menu_labels, text: labels.first) - end - - labels.each do |label| - within_element(:dropdown_menu_labels, text: label) do - send_keys_to_element(:dropdown_input_field, [label, :enter]) - end - end - - click_element(:edit_link_labels) - - labels.each do |label| - has_element?(:labels_block, text: label, wait: 0) - end - - refresh - end - - def text_of_labels_block - find_element(:labels_block) - end - - def toggle_more_assignees_link - click_element(:more_assignees_link) - end - private def select_filter_with_text(text) @@ -168,15 +106,6 @@ module QA find_element(:filter_options, text: text).click end end - - def wait_assignees_block_finish_loading - within_element(:assignee_block) do - wait_until(reload: false, max_duration: 10, sleep_interval: 1) do - finished_loading_block? - yield - end - end - end end end end diff --git a/qa/qa/page/project/job/show.rb b/qa/qa/page/project/job/show.rb index 971b8c5e5f8..6243dc92b45 100644 --- a/qa/qa/page/project/job/show.rb +++ b/qa/qa/page/project/job/show.rb @@ -23,6 +23,9 @@ module QA 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) + job_log = find_element(:job_log_content).text + QA::Runtime::Logger.debug(" \n\n ------- Job log: ------- \n\n #{job_log} \n -------") + passed? end diff --git a/qa/qa/page/project/menu.rb b/qa/qa/page/project/menu.rb index 3d4d0ff9d22..9faf1bd5f8f 100644 --- a/qa/qa/page/project/menu.rb +++ b/qa/qa/page/project/menu.rb @@ -15,11 +15,14 @@ module QA view 'app/views/layouts/nav/sidebar/_project.html.haml' do element :activity_link element :merge_requests_link - element :wiki_link element :snippets_link element :members_link end + view 'app/views/layouts/nav/sidebar/_wiki_link.html.haml' do + element :wiki_link + end + def click_merge_requests within_sidebar do click_element(:merge_requests_link) diff --git a/qa/qa/page/project/milestone/index.rb b/qa/qa/page/project/milestone/index.rb index 6895c44f72f..d25a3389ae8 100644 --- a/qa/qa/page/project/milestone/index.rb +++ b/qa/qa/page/project/milestone/index.rb @@ -4,13 +4,25 @@ module QA module Page module Project module Milestone - class Index < Page::Base + class Index < Page::Milestone::Index view 'app/views/projects/milestones/index.html.haml' do - element :new_project_milestone + element :new_project_milestone_link end - def click_new_milestone - click_element :new_project_milestone + view 'app/views/shared/milestones/_milestone.html.haml' do + element :milestone_link + end + + def click_new_milestone_link + click_element :new_project_milestone_link + end + + def has_milestone?(milestone) + has_element? :milestone_link, milestone_title: milestone.title + end + + def click_milestone(milestone) + click_element :milestone_link, milestone_title: milestone.title end end end diff --git a/qa/qa/page/project/milestone/new.rb b/qa/qa/page/project/milestone/new.rb index 751fb141684..98f3a0ef4ab 100644 --- a/qa/qa/page/project/milestone/new.rb +++ b/qa/qa/page/project/milestone/new.rb @@ -4,23 +4,36 @@ module QA module Page module Project module Milestone - class New < Page::Base + class New < Page::Milestone::New view 'app/views/projects/milestones/_form.html.haml' do - element :milestone_create_button - element :milestone_title - element :milestone_description + element :create_milestone_button + element :milestone_description_field + element :milestone_title_field + end + + view 'app/views/shared/milestones/_form_dates.html.haml' do + element :due_date_field + element :start_date_field + end + + def click_create_milestone_button + click_element :create_milestone_button end def set_title(title) - fill_element :milestone_title, title + fill_element :milestone_title_field, title end def set_description(description) - fill_element :milestone_description, description + fill_element :milestone_description_field, description + end + + def set_due_date(due_date) + fill_element :due_date_field, due_date.to_s + "\n" end - def click_milestone_create_button - click_element :milestone_create_button + def set_start_date(start_date) + fill_element :start_date_field, start_date.to_s + "\n" end end end diff --git a/qa/qa/page/project/operations/kubernetes/show.rb b/qa/qa/page/project/operations/kubernetes/show.rb index 46fddfa6078..e1612718883 100644 --- a/qa/qa/page/project/operations/kubernetes/show.rb +++ b/qa/qa/page/project/operations/kubernetes/show.rb @@ -29,6 +29,14 @@ module QA element :uninstall_button end + view 'app/views/clusters/clusters/_health.html.haml' do + element :cluster_health_section + end + + view 'app/views/clusters/clusters/_health_tab.html.haml' do + element :health, required: true + end + def open_details has_element?(:details, wait: 30) click_element :details @@ -71,11 +79,32 @@ module QA def save_domain click_element :save_changes_button, Page::Project::Operations::Kubernetes::Show end + + def wait_for_cluster_health + wait_until(max_duration: 120, sleep_interval: 3, reload: true) do + has_cluster_health_graphs? + end + end + + def open_health + has_element?(:health, wait: 30) + click_element :health + end + + def has_cluster_health_graphs? + within_cluster_health_section do + has_text?('CPU Usage') + end + end + + def within_cluster_health_section + within_element :cluster_health_section do + yield + end + end end end end end end end - -QA::Page::Project::Operations::Kubernetes::Show.prepend_if_ee('QA::EE::Page::Project::Operations::Kubernetes::Show') diff --git a/qa/qa/page/project/operations/metrics/show.rb b/qa/qa/page/project/operations/metrics/show.rb index a1c15e72f44..e9e4923a0e2 100644 --- a/qa/qa/page/project/operations/metrics/show.rb +++ b/qa/qa/page/project/operations/metrics/show.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'securerandom' + module QA module Page module Project @@ -60,7 +62,7 @@ module QA def duplicate_dashboard(save_as = 'test_duplication.yml', commit_option = 'Commit to master branch') click_element :dashboards_filter_dropdown click_on 'Duplicate dashboard' - fill_element :duplicate_dashboard_filename_field, save_as + fill_element :duplicate_dashboard_filename_field, "#{SecureRandom.hex(8)}-#{save_as}" choose commit_option within('.modal-content') { click_button(class: 'btn-success') } end diff --git a/qa/qa/page/project/pipeline/index.rb b/qa/qa/page/project/pipeline/index.rb index 54e4d0fb2fc..aa2ef2f058f 100644 --- a/qa/qa/page/project/pipeline/index.rb +++ b/qa/qa/page/project/pipeline/index.rb @@ -5,11 +5,11 @@ module QA module Project module Pipeline class Index < QA::Page::Base - view 'app/assets/javascripts/pipelines/components/pipeline_url.vue' do + view 'app/assets/javascripts/pipelines/components/pipelines_list/pipeline_url.vue' do element :pipeline_url_link end - view 'app/assets/javascripts/pipelines/components/pipelines_table_row.vue' do + view 'app/assets/javascripts/pipelines/components/pipelines_list/pipelines_table_row.vue' do element :pipeline_commit_status element :pipeline_retry_button end diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb index d22dfefc096..43003fe1953 100644 --- a/qa/qa/page/project/pipeline/show.rb +++ b/qa/qa/page/project/pipeline/show.rb @@ -22,6 +22,7 @@ module QA view 'app/assets/javascripts/pipelines/components/graph/linked_pipeline.vue' do element :linked_pipeline_button + element :child_pipeline end view 'app/assets/javascripts/vue_shared/components/ci_icon.vue' do @@ -60,6 +61,10 @@ module QA end end + def has_child_pipeline? + has_element? :child_pipeline + end + def click_job(job_name) click_element(:job_link, text: job_name) end diff --git a/qa/qa/page/project/settings/incidents.rb b/qa/qa/page/project/settings/incidents.rb index 94d5fc369ad..9b523e2aa9e 100644 --- a/qa/qa/page/project/settings/incidents.rb +++ b/qa/qa/page/project/settings/incidents.rb @@ -5,10 +5,11 @@ module QA module Project module Settings class Incidents < Page::Base - view 'app/views/projects/settings/operations/_incidents.html.haml' do + view 'app/assets/javascripts/incidents_settings/components/alerts_form.vue' do element :create_issue_checkbox element :incident_templates_dropdown element :save_changes_button + element :incident_templates_item end def enable_issues_for_incidents @@ -16,8 +17,9 @@ module QA end def select_issue_template(template) + click_element(:incident_templates_dropdown) within_element :incident_templates_dropdown do - find(:option, template).select_option + find_element(:incident_templates_item, text: template).click end end diff --git a/qa/qa/page/project/settings/operations.rb b/qa/qa/page/project/settings/operations.rb index f6e005d3189..b39b8f92cc7 100644 --- a/qa/qa/page/project/settings/operations.rb +++ b/qa/qa/page/project/settings/operations.rb @@ -7,7 +7,7 @@ module QA class Operations < Page::Base include QA::Page::Settings::Common - view 'app/views/projects/settings/operations/_incidents.html.haml' do + view 'app/assets/javascripts/incidents_settings/components/incidents_settings_tabs.vue' do element :incidents_settings_content end diff --git a/qa/qa/page/project/settings/protected_tags.rb b/qa/qa/page/project/settings/protected_tags.rb new file mode 100644 index 00000000000..bf8f349cfd5 --- /dev/null +++ b/qa/qa/page/project/settings/protected_tags.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + module Settings + class ProtectedTags < Page::Base + include Page::Component::DropdownFilter + + view 'app/views/projects/protected_tags/shared/_dropdown.html.haml' do + element :tags_dropdown + end + + view 'app/views/projects/protected_tags/_create_protected_tag.html.haml' do + element :access_levels_content + element :access_levels_dropdown + end + + view 'app/views/projects/protected_tags/shared/_create_protected_tag.html.haml' do + element :protect_tag_button + end + + def set_tag(tag_name) + click_element :tags_dropdown + filter_and_select(tag_name) + end + + def choose_access_level_role(role) + return if find_element(:access_levels_dropdown).text == role + + click_element :access_levels_dropdown + within_element(:access_levels_content) do + click_on role + end + end + + def click_protect_tag_button + click_element :protect_tag_button + end + end + end + end + end +end + +QA::Page::Project::Settings::ProtectedTags.prepend_if_ee('QA::EE::Page::Project::Settings::ProtectedTags') diff --git a/qa/qa/page/project/settings/repository.rb b/qa/qa/page/project/settings/repository.rb index 8e9a24a4741..fd3a590c2c1 100644 --- a/qa/qa/page/project/settings/repository.rb +++ b/qa/qa/page/project/settings/repository.rb @@ -23,6 +23,10 @@ module QA element :deploy_keys_settings end + view 'app/views/projects/protected_tags/shared/_index.html.haml' do + element :protected_tag_settings_content + end + def expand_deploy_tokens(&block) expand_section(:deploy_tokens_settings) do Settings::DeployTokens.perform(&block) @@ -46,6 +50,12 @@ module QA MirroringRepositories.perform(&block) end end + + def expand_protected_tags(&block) + expand_section(:protected_tag_settings_content) do + ProtectedTags.perform(&block) + end + end end end end diff --git a/qa/qa/page/project/settings/runners.rb b/qa/qa/page/project/settings/runners.rb index adc92b4acaf..af4dbb08430 100644 --- a/qa/qa/page/project/settings/runners.rb +++ b/qa/qa/page/project/settings/runners.rb @@ -13,7 +13,7 @@ module QA ## # TODO, phase-out CSS classes added in Ruby helpers. # - view 'app/helpers/runners_helper.rb' do + view 'app/helpers/ci/runners_helper.rb' do # rubocop:disable Lint/InterpolationCheck element :runner_status, 'runner-status-#{status}' # rubocop:disable QA/ElementWithPattern # rubocop:enable Lint/InterpolationCheck diff --git a/qa/qa/page/project/settings/services/jira.rb b/qa/qa/page/project/settings/services/jira.rb index 9f9331bac94..75baedb1b0f 100644 --- a/qa/qa/page/project/settings/services/jira.rb +++ b/qa/qa/page/project/settings/services/jira.rb @@ -6,11 +6,11 @@ module QA module Settings module Services class Jira < QA::Page::Base - view 'app/views/shared/_field.html.haml' do - element :url_field, 'data: { qa_selector: "#{name.downcase.gsub' # rubocop:disable QA/ElementWithPattern - element :username_field, 'data: { qa_selector: "#{name.downcase.gsub' # rubocop:disable QA/ElementWithPattern - element :password_field, 'data: { qa_selector: "#{name.downcase.gsub' # rubocop:disable QA/ElementWithPattern - element :jira_issue_transition_id_field, 'data: { qa_selector: "#{name.downcase.gsub' # rubocop:disable QA/ElementWithPattern + view 'app/assets/javascripts/integrations/edit/components/dynamic_field.vue' do + element :service_url_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern + element :service_username_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern + element :service_password_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern + element :service_jira_issue_transition_id_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern end view 'app/helpers/services_helper.rb' do @@ -34,19 +34,19 @@ module QA private def set_jira_server_url(url) - fill_element(:url_field, url) + fill_element(:service_url_field, url) end def set_username(username) - fill_element(:username_field, username) + fill_element(:service_username_field, username) end def set_password(password) - fill_element(:password_field, password) + fill_element(:service_password_field, password) end def set_transaction_ids(transaction_ids) - fill_element(:jira_issue_transition_id_field, transaction_ids) + fill_element(:service_jira_issue_transition_id_field, transaction_ids) end def click_save_changes_button diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 00298ff9fb5..2354a0d9332 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -51,9 +51,12 @@ module QA element :quick_actions end - view 'app/views/projects/tree/_tree_header.html.haml' do + view 'app/assets/javascripts/repository/components/breadcrumbs.vue' do element :add_to_tree element :new_file_option + end + + view 'app/assets/javascripts/repository/components/web_ide_link.vue' do element :web_ide_button end diff --git a/qa/qa/page/project/snippet/new.rb b/qa/qa/page/project/snippet/new.rb index 1463dfc2c7f..7431d6c1bf8 100644 --- a/qa/qa/page/project/snippet/new.rb +++ b/qa/qa/page/project/snippet/new.rb @@ -4,7 +4,8 @@ module QA module Page module Project module Snippet - class New < Page::Dashboard::Snippet::New + class New < Page::Base + include Page::Component::NewSnippet include Component::LazyLoader view 'app/views/shared/empty_states/_snippets.html.haml' do element :create_first_snippet_link diff --git a/qa/qa/page/project/snippet/show.rb b/qa/qa/page/project/snippet/show.rb new file mode 100644 index 00000000000..f66fa2cbe51 --- /dev/null +++ b/qa/qa/page/project/snippet/show.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + module Snippet + class Show < Page::Base + include Page::Component::Snippet + + view 'app/views/projects/notes/_actions.html.haml' do + element :edit_comment_button + end + end + end + end + end +end diff --git a/qa/qa/page/project/sub_menus/issues.rb b/qa/qa/page/project/sub_menus/issues.rb index c15a8ec4cc7..124faf0d346 100644 --- a/qa/qa/page/project/sub_menus/issues.rb +++ b/qa/qa/page/project/sub_menus/issues.rb @@ -50,6 +50,14 @@ module QA end end + def go_to_milestones + hover_issues do + within_submenu do + click_element(:milestones_link) + end + end + end + private def hover_issues diff --git a/qa/qa/page/project/sub_menus/repository.rb b/qa/qa/page/project/sub_menus/repository.rb index 38d6b8e50f4..c78c7521b64 100644 --- a/qa/qa/page/project/sub_menus/repository.rb +++ b/qa/qa/page/project/sub_menus/repository.rb @@ -14,15 +14,16 @@ module QA include QA::Page::Project::SubMenus::Common view 'app/views/layouts/nav/sidebar/_project.html.haml' do - element :project_menu_repo + element :repository_link element :branches_link + element :tags_link end end end def click_repository within_sidebar do - click_element(:project_menu_repo) + click_element(:repository_link) end end @@ -34,11 +35,19 @@ module QA end end + def go_to_repository_tags + hover_repository do + within_submenu do + click_element(:tags_link) + end + end + end + private def hover_repository within_sidebar do - find_element(:project_menu_repo).hover + find_element(:repository_link).hover yield end diff --git a/qa/qa/page/project/tag/index.rb b/qa/qa/page/project/tag/index.rb new file mode 100644 index 00000000000..b8f7bd3b0b4 --- /dev/null +++ b/qa/qa/page/project/tag/index.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + module Tag + class Index < Page::Base + view 'app/views/projects/tags/index.html.haml' do + element :new_tag_button + end + + def click_new_tag_button + click_element :new_tag_button + end + end + end + end + end +end diff --git a/qa/qa/page/project/tag/new.rb b/qa/qa/page/project/tag/new.rb new file mode 100644 index 00000000000..dc59c07ec98 --- /dev/null +++ b/qa/qa/page/project/tag/new.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + module Tag + class New < Page::Base + view 'app/views/projects/tags/new.html.haml' do + element :tag_name_field + element :tag_message_field + element :release_notes_field + element :create_tag_button + end + + view 'app/views/shared/_zen.html.haml' do + # This partial adds the `release_notes_field` selector passed from 'app/views/projects/tags/new.html.haml' + # The checks below ensure that required lines are not removed without updating this page object + element :_, "qa_selector = local_assigns.fetch(:qa_selector, '')" # rubocop:disable QA/ElementWithPattern + element :_, "text_area_tag attr, current_text, data: { qa_selector: qa_selector }" # rubocop:disable QA/ElementWithPattern + end + + def fill_tag_name(text) + fill_element(:tag_name_field, text) + end + + def fill_tag_message(text) + fill_element(:tag_message_field, text) + end + + def fill_release_notes(text) + fill_element(:release_notes_field, text) + end + + def click_create_tag_button + click_element :create_tag_button + end + end + end + end + end +end diff --git a/qa/qa/page/project/tag/show.rb b/qa/qa/page/project/tag/show.rb new file mode 100644 index 00000000000..1974448a7c5 --- /dev/null +++ b/qa/qa/page/project/tag/show.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + module Tag + class Show < Page::Base + view 'app/views/projects/tags/show.html.haml' do + element :tag_name_content + element :tag_message_content + element :tag_release_notes_content + end + + def has_tag_name?(text) + has_element?(:tag_name_content, text: text) + end + + def has_tag_message?(text) + has_element?(:tag_message_content, text: text) + end + + def has_tag_release_notes?(text) + has_element?(:tag_release_notes_content, text: text) + end + 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 29f431d81df..b46d2d32f1f 100644 --- a/qa/qa/page/project/web_ide/edit.rb +++ b/qa/qa/page/project/web_ide/edit.rb @@ -50,6 +50,15 @@ module QA element :first_file_button end + view 'app/assets/javascripts/vue_shared/components/file_row.vue' do + element :file_name_content + end + + view 'app/assets/javascripts/ide/components/new_dropdown/index.vue' do + element :dropdown_button + element :rename_move_button + end + def has_file?(file_name) within_element(:file_list) do page.has_content? file_name @@ -132,6 +141,14 @@ module QA fill_element(:file_name_field, file_name) click_button('Create file') end + + def rename_file(file_name, new_file_name) + click_element(:file_name_content, text: file_name) + click_element(:dropdown_button) + click_element(:rename_move_button, Page::Component::WebIDE::Modal::CreateNewFile) + fill_element(:file_name_field, new_file_name) + click_button('Rename file') + end end end end diff --git a/qa/qa/page/project/wiki/edit.rb b/qa/qa/page/project/wiki/edit.rb index 96301e33733..6f3be904eb3 100644 --- a/qa/qa/page/project/wiki/edit.rb +++ b/qa/qa/page/project/wiki/edit.rb @@ -4,7 +4,9 @@ module QA module Page module Project module Wiki - class Edit < Page::Base + class Edit < Base + include Wiki::Sidebar + view 'app/views/shared/wikis/_form.html.haml' do element :wiki_title_textbox element :wiki_content_textarea @@ -13,6 +15,10 @@ module QA element :create_page_button end + view 'app/assets/javascripts/pages/shared/wikis/components/delete_wiki_modal.vue' do + element :delete_button + end + def set_title(title) fill_element :wiki_title_textbox, title end @@ -32,6 +38,11 @@ module QA def click_create_page click_element :create_page_button end + + def delete_page + click_element :delete_button, Page::Modal::DeleteWiki + Page::Modal::DeleteWiki.perform(&:confirm_deletion) + end end end end diff --git a/qa/qa/page/project/wiki/list.rb b/qa/qa/page/project/wiki/list.rb new file mode 100644 index 00000000000..785847011bf --- /dev/null +++ b/qa/qa/page/project/wiki/list.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + module Wiki + class List < Base + view 'app/views/shared/wikis/_pages_wiki_page.html.haml' do + element :wiki_page_link + end + + def click_page_link(page_title) + click_element :wiki_page_link, page_name: page_title + end + + def has_page_listed?(page_title) + has_element? :wiki_page_link, page_name: page_title + end + end + end + end + end +end diff --git a/qa/qa/page/project/wiki/show.rb b/qa/qa/page/project/wiki/show.rb index 7e4e714f4a6..cdd18e420d1 100644 --- a/qa/qa/page/project/wiki/show.rb +++ b/qa/qa/page/project/wiki/show.rb @@ -4,13 +4,10 @@ module QA module Page module Project module Wiki - class Show < Page::Base + class Show < Base + include Wiki::Sidebar include Component::LazyLoader - view 'app/views/shared/wikis/_sidebar.html.haml' do - element :clone_repository_link - end - view 'app/views/shared/wikis/show.html.haml' do element :wiki_page_title element :wiki_page_content @@ -54,14 +51,6 @@ module QA click_element(:edit_page_button) end - def click_clone_repository - click_element(:clone_repository_link) - end - - def wiki_text - find_element(:wiki_page_content).text - end - def has_title?(title) has_element?(:wiki_page_title, title) end @@ -69,6 +58,10 @@ module QA def has_content?(content) has_element?(:wiki_page_content, content) end + + def has_no_page? + has_element? :create_first_page_link + end end end end diff --git a/qa/qa/page/project/wiki/sidebar.rb b/qa/qa/page/project/wiki/sidebar.rb new file mode 100644 index 00000000000..dc27c23e4c3 --- /dev/null +++ b/qa/qa/page/project/wiki/sidebar.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + module Wiki + module Sidebar + extend QA::Page::PageConcern + + def self.included(base) + super + + base.view 'app/views/shared/wikis/_sidebar.html.haml' do + element :clone_repository_link + element :view_all_pages_button + end + + base.view 'app/views/shared/wikis/_sidebar_wiki_page.html.haml' do + element :wiki_page_link + end + end + + def click_clone_repository + click_element(:clone_repository_link) + end + + def click_view_all_pages + click_element(:view_all_pages_button) + end + + def click_page_link(page_title) + click_element :wiki_page_link, page_name: page_title + end + + def has_page_listed?(page_title) + has_element? :wiki_page_link, page_name: page_title + end + end + end + end + end +end |