diff options
Diffstat (limited to 'qa/qa/page')
27 files changed, 641 insertions, 268 deletions
diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index cb3827f8eb1..f0d4ae45ef8 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -99,7 +99,16 @@ module QA def find_element(name, **kwargs) wait_for_requests - find(element_selector_css(name), kwargs) + element_selector = element_selector_css(name, reject_capybara_query_keywords(kwargs)) + find(element_selector, only_capybara_query_keywords(kwargs)) + end + + def only_capybara_query_keywords(kwargs) + kwargs.select { |kwarg| Capybara::Queries::SelectorQuery::VALID_KEYS.include?(kwarg) } + end + + def reject_capybara_query_keywords(kwargs) + kwargs.reject { |kwarg| Capybara::Queries::SelectorQuery::VALID_KEYS.include?(kwarg) } end def active_element?(name) @@ -162,11 +171,17 @@ module QA def has_element?(name, **kwargs) wait_for_requests - wait = kwargs.delete(:wait) || Capybara.default_max_wait_time - text = kwargs.delete(:text) - klass = kwargs.delete(:class) + disabled = kwargs.delete(:disabled) - has_css?(element_selector_css(name, kwargs), text: text, wait: wait, class: klass) + if disabled.nil? + wait = kwargs.delete(:wait) || Capybara.default_max_wait_time + text = kwargs.delete(:text) + klass = kwargs.delete(:class) + + has_css?(element_selector_css(name, kwargs), text: text, wait: wait, class: klass) + else + find_element(name, kwargs).disabled? == disabled + end end def has_no_element?(name, **kwargs) diff --git a/qa/qa/page/component/issue_board/show.rb b/qa/qa/page/component/issue_board/show.rb new file mode 100644 index 00000000000..0c840eba7ce --- /dev/null +++ b/qa/qa/page/component/issue_board/show.rb @@ -0,0 +1,138 @@ +# frozen_string_literal: true + +module QA + module Page + module Component + module IssueBoard + class Show < QA::Page::Base + view 'app/assets/javascripts/boards/components/board_card.vue' do + element :board_card + end + + view 'app/assets/javascripts/boards/components/board_form.vue' do + element :board_name_field + end + + view 'app/assets/javascripts/boards/components/board_list.vue' do + element :board_list_cards_area + end + + view 'app/assets/javascripts/boards/components/boards_selector.vue' do + element :boards_dropdown + element :boards_dropdown_content + element :create_new_board_button + end + + view 'app/assets/javascripts/vue_shared/components/deprecated_modal.vue' do + element :save_changes_button + end + + view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue' do + element :labels_dropdown_content + end + + view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_title.vue' do + element :labels_edit_button + end + + view 'app/views/shared/boards/_show.html.haml' do + 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 + + # The `focused_board` method does not use `find_element` with an element defined + # with the attribute `data-qa-selector` since such element is not unique when the + # `is-focused` class is not set, and it was not possible to find a better solution. + def focused_board + find('.issue-boards-content.js-focus-mode-board.is-focused') + end + + def boards_dropdown + find_element(:boards_dropdown) + end + + def boards_dropdown_content + find_element(:boards_dropdown_content) + end + + def boards_list_cards_area_with_index(index) + wait_boards_list_finish_loading do + within_element_by_index(:board_list, index) do + find_element(:board_list_cards_area) + end + end + end + + def boards_list_header_with_index(index) + wait_boards_list_finish_loading do + within_element_by_index(:board_list, index) do + find_element(:board_list_header) + end + end + end + + def card_of_list_with_index(index) + wait_boards_list_finish_loading do + within_element_by_index(:board_list, index) do + find_element(:board_card) + end + end + end + + def click_boards_dropdown_button + # The dropdown button comes from the `GlDropdown` component of `@gitlab/ui`, + # so it wasn't possible to add a `data-qa-selector` to it. + find_element(:boards_dropdown).find('button').click + end + + def click_focus_mode_button + click_element(:focus_mode_button) + end + + def configure_by_label(label) + click_boards_config_button + click_element(:labels_edit_button) + find_element(:labels_dropdown_content).find('li', text: label).click + click_element(:save_changes_button) + wait_boards_list_finish_loading + end + + def create_new_board(board_name) + click_boards_dropdown_button + click_element(:create_new_board_button) + set_name(board_name) + end + + def has_modal_board_name_field? + has_element?(:board_name_field, wait: 1) + end + + def set_name(name) + find_element(:board_name_field).set(name) + click_element(:save_changes_button) + end + + private + + def wait_boards_list_finish_loading + within_element(:boards_list) do + wait_until(reload: false, max_duration: 5, sleep_interval: 1) do + finished_loading? && (block_given? ? yield : true) + end + end + end + end + end + end + end +end + +QA::Page::Component::IssueBoard::Show.prepend_if_ee('QA::EE::Page::Component::IssueBoard::Show') 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 new file mode 100644 index 00000000000..48eb32fefd6 --- /dev/null +++ b/qa/qa/page/component/web_ide/modal/create_new_file.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module QA + module Page + module Component + module WebIDE + module Modal + class CreateNewFile < Page::Base + 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 + end + end + end + end + end + end +end diff --git a/qa/qa/page/dashboard/snippet/new.rb b/qa/qa/page/dashboard/snippet/new.rb index d1a194ba1db..bcfb4734b59 100644 --- a/qa/qa/page/dashboard/snippet/new.rb +++ b/qa/qa/page/dashboard/snippet/new.rb @@ -6,6 +6,7 @@ module QA 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 @@ -14,12 +15,8 @@ module QA element :description_placeholder, required: true end - view 'app/assets/javascripts/snippets/components/snippet_title.vue' do - element :snippet_title, required: true - end - view 'app/assets/javascripts/snippets/components/snippet_blob_edit.vue' do - element :snippet_file_name + element :file_name_field end view 'app/views/shared/form_elements/_description.html.haml' do @@ -29,18 +26,18 @@ module QA view 'app/views/shared/snippets/_form.html.haml' do element :snippet_description_field element :description_placeholder - element :snippet_title - element :snippet_file_name + element :snippet_title_field + element :file_name_field element :submit_button end - view 'app/views/projects/_zen.html.haml' do + 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, title + fill_element :snippet_title_field, title end def fill_description(description) @@ -54,7 +51,7 @@ module QA def fill_file_name(name) finished_loading? - fill_element :snippet_file_name, name + fill_element :file_name_field, name end def fill_file_content(content) diff --git a/qa/qa/page/dashboard/snippet/show.rb b/qa/qa/page/dashboard/snippet/show.rb index d43b64cd1d4..da494ae70ec 100644 --- a/qa/qa/page/dashboard/snippet/show.rb +++ b/qa/qa/page/dashboard/snippet/show.rb @@ -6,32 +6,26 @@ module QA module Snippet class Show < Page::Base view 'app/assets/javascripts/snippets/components/snippet_description_view.vue' do - element :snippet_description_field + element :snippet_description_content end view 'app/assets/javascripts/snippets/components/snippet_title.vue' do - element :snippet_title, required: true + element :snippet_title_content, required: true end - view 'app/views/shared/snippets/_header.html.haml' do - element :snippet_title, required: true - element :snippet_description_field, required: true - element :snippet_box - end - - view 'app/views/projects/blob/_header_content.html.haml' do - element :file_title_name + 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_name + element :file_title_content end - view 'app/views/shared/_file_highlight.html.haml' do + view 'app/assets/javascripts/vue_shared/components/blob_viewers/simple_viewer.vue' do element :file_content end - view 'app/assets/javascripts/vue_shared/components/blob_viewers/simple_viewer.vue' do + view 'app/assets/javascripts/blob/components/blob_content.vue' do element :file_content end @@ -50,21 +44,25 @@ module QA end def has_snippet_title?(snippet_title) - has_element? :snippet_title, text: snippet_title + has_element? :snippet_title_content, text: snippet_title end def has_snippet_description?(snippet_description) - has_element? :snippet_description_field, text: 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_box) do + within_element(:snippet_container) do has_text?(visibility_type) end end def has_file_name?(file_name) - within_element(:file_title_name) do + within_element(:file_title_content) do has_text?(file_name) end end @@ -85,7 +83,11 @@ module QA finished_loading? click_element(:snippet_action_button, action: 'Delete') click_element(:delete_snippet_button) - finished_loading? # wait for the page to reload after deletion + # 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 diff --git a/qa/qa/page/group/new.rb b/qa/qa/page/group/new.rb index e01b8754d55..88e7121dbe0 100644 --- a/qa/qa/page/group/new.rb +++ b/qa/qa/page/group/new.rb @@ -10,7 +10,7 @@ module QA element :group_description_field, 'text_area :description' # rubocop:disable QA/ElementWithPattern end - view 'app/views/groups/new.html.haml' do + view 'app/views/groups/_new_group_fields.html.haml' do element :create_group_button, "submit _('Create group')" # rubocop:disable QA/ElementWithPattern element :visibility_radios, 'visibility_level:' # rubocop:disable QA/ElementWithPattern end diff --git a/qa/qa/page/issuable/new.rb b/qa/qa/page/issuable/new.rb new file mode 100644 index 00000000000..7891074092e --- /dev/null +++ b/qa/qa/page/issuable/new.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +module QA + module Page + module Issuable + class New < Page::Base + view 'app/views/shared/issuable/form/_title.html.haml' do + element :issuable_form_title + end + + view 'app/views/shared/issuable/form/_metadata.html.haml' do + element :issuable_milestone_dropdown + end + + view 'app/views/shared/form_elements/_description.html.haml' do + element :issuable_form_description + end + + view 'app/views/shared/issuable/_milestone_dropdown.html.haml' do + element :issuable_dropdown_menu_milestone + end + + view 'app/views/shared/issuable/_label_dropdown.html.haml' do + element :issuable_label + end + + view 'app/views/shared/issuable/form/_metadata_issuable_assignee.html.haml' do + element :assign_to_me_link + end + + def fill_title(title) + fill_element :issuable_form_title, title + end + + def fill_description(description) + fill_element :issuable_form_description, description + end + + def choose_milestone(milestone) + click_element :issuable_milestone_dropdown + within_element(:issuable_dropdown_menu_milestone) do + click_on milestone.title + end + end + + def select_label(label) + click_element :issuable_label + + click_link label.title + end + + def assign_to_me + click_element :assign_to_me_link + end + end + end + end +end diff --git a/qa/qa/page/merge_request/new.rb b/qa/qa/page/merge_request/new.rb index f877ba76b38..eda7da89a35 100644 --- a/qa/qa/page/merge_request/new.rb +++ b/qa/qa/page/merge_request/new.rb @@ -3,62 +3,13 @@ module QA module Page module MergeRequest - class New < Page::Base + class New < Page::Issuable::New view 'app/views/shared/issuable/_form.html.haml' do element :issuable_create_button end - view 'app/views/shared/issuable/form/_title.html.haml' do - element :issuable_form_title - end - - view 'app/views/shared/issuable/form/_metadata.html.haml' do - element :issuable_milestone_dropdown - end - - view 'app/views/shared/form_elements/_description.html.haml' do - element :issuable_form_description - end - - view 'app/views/shared/issuable/_milestone_dropdown.html.haml' do - element :issuable_dropdown_menu_milestone - end - - view 'app/views/shared/issuable/_label_dropdown.html.haml' do - element :issuable_label - end - - view 'app/views/shared/issuable/form/_metadata_issuable_assignee.html.haml' do - element :assign_to_me_link - end - def create_merge_request - click_element :issuable_create_button - end - - def fill_title(title) - fill_element :issuable_form_title, title - end - - def fill_description(description) - fill_element :issuable_form_description, description - end - - def choose_milestone(milestone) - click_element :issuable_milestone_dropdown - within_element(:issuable_dropdown_menu_milestone) do - click_on milestone.title - end - end - - def select_label(label) - click_element :issuable_label - - click_link label.title - end - - def assign_to_me - click_element :assign_to_me_link + click_element :issuable_create_button, Page::MergeRequest::Show end end end diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index 0da40b35938..07f8e568b2a 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -73,6 +73,70 @@ module QA element :edit_button end + view 'app/assets/javascripts/batch_comments/components/publish_button.vue' do + element :submit_review + end + + 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 + end + + view 'app/assets/javascripts/batch_comments/components/preview_dropdown.vue' do + element :review_preview_toggle + end + + def start_review + click_element :start_review + + # After clicking the button, wait for it to disappear + # before moving on to the next part of the test + has_no_element? :start_review + end + + def comment_now + click_element :comment_now + + # After clicking the button, wait for it to disappear + # before moving on to the next part of the test + has_no_element? :comment_now + end + + def submit_pending_reviews + 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 + end + end + + def discard_pending_reviews + within_element :review_bar do + click_element :discard_review + end + click_element :modal_delete_pending_comments + end + + def resolve_review_discussion + scroll_to_element :start_review + check_element :resolve_review_discussion_checkbox + end + + def unresolve_review_discussion + check_element :unresolve_review_discussion_checkbox + end + def add_comment_to_diff(text) wait_until(sleep_interval: 5) do has_text?("No newline at end of file") @@ -154,8 +218,8 @@ module QA end def merge! - click_element :merge_button if ready_to_merge? - + wait_until_ready_to_merge + click_element(:merge_button) finished_loading? raise "Merge did not appear to be successful" unless merged? @@ -165,11 +229,18 @@ module QA has_element?(:merged_status_content, text: 'The changes were merged into', wait: 30) end - def ready_to_merge? - # The merge button is disabled on load - wait_until do - has_element?(:merge_button) - end + # Check if the MR is able to be merged + # Waits up 10 seconds and returns false if the MR can't be merged + def mergeable? + # The merge button is enabled via JS, but `has_element?` calls + # `wait_for_requests`, which should ensure the disabled/enabled + # state of the element is reliable + has_element?(:merge_button, disabled: false) + end + + # Waits up 60 seconds and raises an error if unable to merge + def wait_until_ready_to_merge + has_element?(:merge_button) # The merge button is enabled via JS wait_until(reload: false) do @@ -198,7 +269,9 @@ module QA end def try_to_merge! - click_element :merge_button if ready_to_merge? + wait_until_ready_to_merge + + click_element(:merge_button) end def view_email_patches diff --git a/qa/qa/page/project/fork/new.rb b/qa/qa/page/project/fork/new.rb index 1a52c61551d..49c2205fd08 100644 --- a/qa/qa/page/project/fork/new.rb +++ b/qa/qa/page/project/fork/new.rb @@ -6,11 +6,11 @@ module QA module Fork class New < Page::Base view 'app/views/projects/forks/_fork_button.html.haml' do - element :namespace, 'link_to project_forks_path' # rubocop:disable QA/ElementWithPattern + element :fork_namespace_content end def choose_namespace(namespace = Runtime::Namespace.path) - click_on namespace + click_element(:fork_namespace_content, name: namespace) end end end diff --git a/qa/qa/page/project/issue/new.rb b/qa/qa/page/project/issue/new.rb index 65c02801d67..c90a09dce2e 100644 --- a/qa/qa/page/project/issue/new.rb +++ b/qa/qa/page/project/issue/new.rb @@ -4,27 +4,11 @@ module QA module Page module Project module Issue - class New < Page::Base + class New < Page::Issuable::New view 'app/views/shared/issuable/_form.html.haml' do element :issuable_create_button end - view 'app/views/shared/issuable/form/_title.html.haml' do - element :issue_title_textbox, 'form.text_field :title' # rubocop:disable QA/ElementWithPattern - end - - view 'app/views/shared/form_elements/_description.html.haml' do - element :issue_description_textarea, "render 'projects/zen', f: form, attr: :description" # rubocop:disable QA/ElementWithPattern - end - - def add_title(title) - fill_in 'issue_title', with: title - end - - def add_description(description) - fill_in 'issue_description', with: description - end - def create_new_issue click_element :issuable_create_button, Page::Project::Issue::Show end diff --git a/qa/qa/page/project/members.rb b/qa/qa/page/project/members.rb new file mode 100644 index 00000000000..88b05ceb1d1 --- /dev/null +++ b/qa/qa/page/project/members.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + class Members < Page::Base + include QA::Page::Component::Select2 + + view 'app/views/shared/members/_invite_member.html.haml' do + element :member_select_field + element :invite_member_button + end + + view 'app/views/projects/project_members/_team.html.haml' do + element :members_list + end + + view 'app/views/projects/project_members/index.html.haml' do + element :invite_group_tab + end + + view 'app/views/shared/members/_invite_group.html.haml' do + element :group_select_field + element :invite_group_button + end + + view 'app/views/shared/members/_group.html.haml' do + element :group_row + element :delete_group_access_link + end + + def select_group(group_name) + click_element :group_select_field + search_and_select(group_name) + end + + def invite_group(group_name) + click_element :invite_group_tab + select_group(group_name) + click_element :invite_group_button + end + + def add_member(username) + click_element :member_select_field + search_and_select username + click_element :invite_member_button + end + + def remove_group(group_name) + click_element :invite_group_tab + page.accept_alert do + within_element(:group_row, text: group_name) do + click_element :delete_group_access_link + end + end + end + end + end + end +end diff --git a/qa/qa/page/project/menu.rb b/qa/qa/page/project/menu.rb index 5967213a52b..3d4d0ff9d22 100644 --- a/qa/qa/page/project/menu.rb +++ b/qa/qa/page/project/menu.rb @@ -16,6 +16,8 @@ module QA element :activity_link element :merge_requests_link element :wiki_link + element :snippets_link + element :members_link end def click_merge_requests @@ -35,6 +37,18 @@ module QA click_element(:activity_link) end end + + def click_snippets + within_sidebar do + click_element(:snippets_link) + end + end + + def click_members + within_sidebar do + click_element(:members_link) + end + end end end end diff --git a/qa/qa/page/project/new_experiment.rb b/qa/qa/page/project/new_experiment.rb new file mode 100644 index 00000000000..813f7f6cefe --- /dev/null +++ b/qa/qa/page/project/new_experiment.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + class NewExperiment < Page::Base + view 'app/assets/javascripts/projects/experiment_new_project_creation/components/welcome.vue' do + element :blank_project_link, ':data-qa-selector="`${panel.name}_link`"' # rubocop:disable QA/ElementWithPattern + element :create_from_template_link, ':data-qa-selector="`${panel.name}_link`"' # rubocop:disable QA/ElementWithPattern + end + + def shown? + has_element? :blank_project_link + end + + def click_blank_project_link + click_element :blank_project_link + end + + def click_create_from_template_link + click_element :create_from_template_link + end + end + end + end +end diff --git a/qa/qa/page/project/operations/metrics/show.rb b/qa/qa/page/project/operations/metrics/show.rb index 2228cca1d3d..a1c15e72f44 100644 --- a/qa/qa/page/project/operations/metrics/show.rb +++ b/qa/qa/page/project/operations/metrics/show.rb @@ -11,6 +11,9 @@ module QA view 'app/assets/javascripts/monitoring/components/dashboard.vue' do element :prometheus_graphs + end + + view 'app/assets/javascripts/monitoring/components/dashboard_header.vue' do element :dashboards_filter_dropdown element :environments_dropdown element :edit_dashboard_button diff --git a/qa/qa/page/project/settings/advanced.rb b/qa/qa/page/project/settings/advanced.rb index 3bb5181a31c..d6e004e827e 100644 --- a/qa/qa/page/project/settings/advanced.rb +++ b/qa/qa/page/project/settings/advanced.rb @@ -43,7 +43,9 @@ module QA def transfer_project!(project_name, namespace) expand_select_list - select_transfer_option(namespace) + # Workaround for a failure to search when there are no spaces around the / + # https://gitlab.com/gitlab-org/gitlab/-/issues/218965 + select_transfer_option(namespace.gsub(/([^\s])\/([^\s])/, '\1 / \2')) click_element(:transfer_button) fill_confirmation_text(project_name) click_confirm_button diff --git a/qa/qa/page/project/settings/ci_cd.rb b/qa/qa/page/project/settings/ci_cd.rb index aa27c030b78..a7a0f6f57b6 100644 --- a/qa/qa/page/project/settings/ci_cd.rb +++ b/qa/qa/page/project/settings/ci_cd.rb @@ -42,5 +42,3 @@ module QA end end end - -QA::Page::Project::Settings::CICD.prepend_if_ee('QA::EE::Page::Project::Settings::CICD') diff --git a/qa/qa/page/project/settings/integrations.rb b/qa/qa/page/project/settings/integrations.rb index 436a42fb093..e18ff71bcb3 100644 --- a/qa/qa/page/project/settings/integrations.rb +++ b/qa/qa/page/project/settings/integrations.rb @@ -7,13 +7,20 @@ module QA class Integrations < QA::Page::Base view 'app/views/shared/integrations/_index.html.haml' do element :prometheus_link, '{ data: { qa_selector: "#{integration.to_param' # rubocop:disable QA/ElementWithPattern + element :jira_link, '{ data: { qa_selector: "#{integration.to_param' # rubocop:disable QA/ElementWithPattern end def click_on_prometheus_integration click_element :prometheus_link end + + def click_jira_link + click_element :jira_link + end end end end end end + +QA::Page::Project::Settings::Integrations.prepend_if_ee('QA::EE::Page::Project::Settings::Integrations') diff --git a/qa/qa/page/project/settings/main.rb b/qa/qa/page/project/settings/main.rb index efae497b6ba..880711770c0 100644 --- a/qa/qa/page/project/settings/main.rb +++ b/qa/qa/page/project/settings/main.rb @@ -58,3 +58,5 @@ module QA end end end + +QA::Page::Project::Settings::Main.prepend_if_ee("QA::EE::Page::Project::Settings::Main") diff --git a/qa/qa/page/project/settings/members.rb b/qa/qa/page/project/settings/members.rb deleted file mode 100644 index 5dc873750b0..00000000000 --- a/qa/qa/page/project/settings/members.rb +++ /dev/null @@ -1,62 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Project - module Settings - class Members < Page::Base - include QA::Page::Component::Select2 - - view 'app/views/shared/members/_invite_member.html.haml' do - element :member_select_field - element :invite_member_button - end - - view 'app/views/projects/project_members/_team.html.haml' do - element :members_list - end - - view 'app/views/projects/project_members/index.html.haml' do - element :invite_group_tab - end - - view 'app/views/shared/members/_invite_group.html.haml' do - element :group_select_field - element :invite_group_button - end - - view 'app/views/shared/members/_group.html.haml' do - element :group_row - element :delete_group_access_link - end - - def select_group(group_name) - click_element :group_select_field - search_and_select(group_name) - end - - def invite_group(group_name) - click_element :invite_group_tab - select_group(group_name) - click_element :invite_group_button - end - - def add_member(username) - click_element :member_select_field - search_and_select username - click_element :invite_member_button - end - - def remove_group(group_name) - click_element :invite_group_tab - page.accept_alert do - within_element(:group_row, text: group_name) do - click_element :delete_group_access_link - end - end - end - end - end - end - end -end diff --git a/qa/qa/page/project/settings/services/jira.rb b/qa/qa/page/project/settings/services/jira.rb new file mode 100644 index 00000000000..9f9331bac94 --- /dev/null +++ b/qa/qa/page/project/settings/services/jira.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + 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 + end + + view 'app/helpers/services_helper.rb' do + element :save_changes_button + end + + def setup_service_with(url:) + QA::Runtime::Logger.info "Setting up JIRA" + + set_jira_server_url(url) + set_username(Runtime::Env.jira_admin_username) + set_password(Runtime::Env.jira_admin_password) + set_transaction_ids('11,21,31,41') + + click_save_changes_button + wait_until(reload: false) do + has_element?(:save_changes_button, wait: 1) ? !find_element(:save_changes_button).disabled? : true + end + end + + private + + def set_jira_server_url(url) + fill_element(:url_field, url) + end + + def set_username(username) + fill_element(:username_field, username) + end + + def set_password(password) + fill_element(:password_field, password) + end + + def set_transaction_ids(transaction_ids) + fill_element(:jira_issue_transition_id_field, transaction_ids) + end + + def click_save_changes_button + click_element :save_changes_button + end + end + end + end + end + end +end diff --git a/qa/qa/page/project/snippet/new.rb b/qa/qa/page/project/snippet/new.rb new file mode 100644 index 00000000000..1463dfc2c7f --- /dev/null +++ b/qa/qa/page/project/snippet/new.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module QA + module Page + module Project + module Snippet + class New < Page::Dashboard::Snippet::New + include Component::LazyLoader + view 'app/views/shared/empty_states/_snippets.html.haml' do + element :create_first_snippet_link + element :svg_content + end + + def click_create_first_snippet + finished_loading? + # The svg takes a fraction of a second to load after which the + # "New snippet" button shifts up a bit. This can cause + # webdriver to miss the hit so we wait for the svg to load before + # clicking the button. + within_element(:svg_content) do + has_element?(:js_lazy_loaded) + end + click_element(:create_first_snippet_link) + end + end + end + end + end +end diff --git a/qa/qa/page/project/sub_menus/settings.rb b/qa/qa/page/project/sub_menus/settings.rb index 0dd4bd1817a..47274c8db54 100644 --- a/qa/qa/page/project/sub_menus/settings.rb +++ b/qa/qa/page/project/sub_menus/settings.rb @@ -15,7 +15,6 @@ module QA view 'app/views/layouts/nav/sidebar/_project.html.haml' do element :settings_item - element :link_members_settings element :general_settings_link element :integrations_settings_link element :operations_settings_link @@ -31,14 +30,6 @@ module QA end end - def go_to_members_settings - hover_settings do - within_submenu do - click_element :link_members_settings - end - end - end - def go_to_repository_settings hover_settings do within_submenu do diff --git a/qa/qa/page/project/web_ide/edit.rb b/qa/qa/page/project/web_ide/edit.rb index 7809f9246ec..29f431d81df 100644 --- a/qa/qa/page/project/web_ide/edit.rb +++ b/qa/qa/page/project/web_ide/edit.rb @@ -20,12 +20,6 @@ module QA element :file_list end - view 'app/assets/javascripts/ide/components/new_dropdown/modal.vue' do - element :full_file_path - element :new_file_modal - element :template_list - end - view 'app/assets/javascripts/ide/components/file_templates/bar.vue' do element :file_templates_bar element :file_template_dropdown @@ -52,6 +46,10 @@ module QA element :editor_container end + view 'app/assets/javascripts/ide/components/ide.vue' do + element :first_file_button + end + def has_file?(file_name) within_element(:file_list) do page.has_content? file_name @@ -59,10 +57,7 @@ module QA end def create_new_file_from_template(file_name, template) - click_element :new_file - - # Wait for the modal animation to complete before clicking on the file name - wait_for_animated_element(:new_file_modal) + click_element(:new_file, Page::Component::WebIDE::Modal::CreateNewFile) within_element(:template_list) do click_on file_name @@ -130,6 +125,13 @@ module QA find('.modified textarea.inputarea') end end + + def create_first_file(file_name) + finished_loading? + click_element(:first_file_button, Page::Component::WebIDE::Modal::CreateNewFile) + fill_element(:file_name_field, file_name) + click_button('Create file') + end end end end diff --git a/qa/qa/page/project/wiki/edit.rb b/qa/qa/page/project/wiki/edit.rb index f6edc28c41a..96301e33733 100644 --- a/qa/qa/page/project/wiki/edit.rb +++ b/qa/qa/page/project/wiki/edit.rb @@ -5,14 +5,32 @@ module QA module Project module Wiki class Edit < Page::Base - view 'app/views/projects/wikis/_main_links.html.haml' do - element :new_page_link, 'New page' # rubocop:disable QA/ElementWithPattern - element :page_history_link, 'Page history' # rubocop:disable QA/ElementWithPattern - element :edit_page_link, 'Edit' # rubocop:disable QA/ElementWithPattern + view 'app/views/shared/wikis/_form.html.haml' do + element :wiki_title_textbox + element :wiki_content_textarea + element :wiki_message_textbox + element :save_changes_button + element :create_page_button end - def click_edit - click_on 'Edit' + def set_title(title) + fill_element :wiki_title_textbox, title + end + + def set_content(content) + fill_element :wiki_content_textarea, content + end + + def set_message(message) + fill_element :wiki_message_textbox, message + end + + def click_save_changes + click_element :save_changes_button + end + + def click_create_page + click_element :create_page_button end end end diff --git a/qa/qa/page/project/wiki/new.rb b/qa/qa/page/project/wiki/new.rb deleted file mode 100644 index 792eba4bab7..00000000000 --- a/qa/qa/page/project/wiki/new.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -module QA - module Page - module Project - module Wiki - class New < Page::Base - include Component::LazyLoader - - view 'app/views/projects/wikis/_form.html.haml' do - element :wiki_title_textbox - element :wiki_content_textarea - element :wiki_message_textbox - element :save_changes_button - element :create_page_button - end - - view 'app/views/shared/empty_states/_wikis.html.haml' do - element :create_first_page_link - end - - view 'app/views/shared/empty_states/_wikis_layout.html.haml' do - element :svg_content - end - - def click_create_your_first_page_button - # The svg takes a fraction of a second to load after which the - # "Create your first page" button shifts up a bit. This can cause - # webdriver to miss the hit so we wait for the svg to load before - # clicking the button. - within_element(:svg_content) do - has_element? :js_lazy_loaded - end - - click_element :create_first_page_link - end - - def set_title(title) - fill_element :wiki_title_textbox, title - end - - def set_content(content) - fill_element :wiki_content_textarea, content - end - - def set_message(message) - fill_element :wiki_message_textbox, message - end - - def save_changes - click_element :save_changes_button - end - - def create_new_page - click_element :create_page_button - 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 44619d177b1..7e4e714f4a6 100644 --- a/qa/qa/page/project/wiki/show.rb +++ b/qa/qa/page/project/wiki/show.rb @@ -5,23 +5,70 @@ module QA module Project module Wiki class Show < Page::Base - include Page::Component::LegacyClonePanel + include Component::LazyLoader - view 'app/views/projects/wikis/pages.html.haml' do - element :clone_repository_link, 'Clone repository' # rubocop:disable QA/ElementWithPattern + view 'app/views/shared/wikis/_sidebar.html.haml' do + element :clone_repository_link end - view 'app/views/projects/wikis/show.html.haml' do + view 'app/views/shared/wikis/show.html.haml' do + element :wiki_page_title element :wiki_page_content 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 + element :create_first_page_link + end + + view 'app/views/shared/empty_states/_wikis_layout.html.haml' do + element :svg_content + end + + def click_create_your_first_page + # The svg takes a fraction of a second to load after which the + # "Create your first page" button shifts up a bit. This can cause + # webdriver to miss the hit so we wait for the svg to load before + # clicking the button. + within_element(:svg_content) do + has_element? :js_lazy_loaded + end + + click_element :create_first_page_link + end + + def click_new_page + click_element(:new_page_button) + end + + def click_page_history + click_element(:page_history_button) + end + + def click_edit + click_element(:edit_page_button) + end + def click_clone_repository - click_on '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 + + def has_content?(content) + has_element?(:wiki_page_content, content) + end end end end |