summaryrefslogtreecommitdiff
path: root/qa/qa/page/component
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/page/component')
-rw-r--r--qa/qa/page/component/breadcrumbs.rb4
-rw-r--r--qa/qa/page/component/ci_badge_link.rb4
-rw-r--r--qa/qa/page/component/clone_panel.rb4
-rw-r--r--qa/qa/page/component/confirm_modal.rb4
-rw-r--r--qa/qa/page/component/custom_metric.rb49
-rw-r--r--qa/qa/page/component/design_management.rb82
-rw-r--r--qa/qa/page/component/groups_filter.rb4
-rw-r--r--qa/qa/page/component/issuable/common.rb4
-rw-r--r--qa/qa/page/component/lazy_loader.rb4
-rw-r--r--qa/qa/page/component/legacy_clone_panel.rb4
-rw-r--r--qa/qa/page/component/note.rb4
-rw-r--r--qa/qa/page/component/project/templates.rb15
-rw-r--r--qa/qa/page/component/select2.rb8
-rw-r--r--qa/qa/page/component/web_ide/alert.rb8
14 files changed, 194 insertions, 4 deletions
diff --git a/qa/qa/page/component/breadcrumbs.rb b/qa/qa/page/component/breadcrumbs.rb
index 656aa380bbd..2576e376e4e 100644
--- a/qa/qa/page/component/breadcrumbs.rb
+++ b/qa/qa/page/component/breadcrumbs.rb
@@ -4,7 +4,11 @@ module QA
module Page
module Component
module Breadcrumbs
+ extend QA::Page::PageConcern
+
def self.included(base)
+ super
+
base.view 'app/views/layouts/nav/_breadcrumbs.html.haml' do
element :breadcrumb_links_content
end
diff --git a/qa/qa/page/component/ci_badge_link.rb b/qa/qa/page/component/ci_badge_link.rb
index 3db675c3a60..8629399e911 100644
--- a/qa/qa/page/component/ci_badge_link.rb
+++ b/qa/qa/page/component/ci_badge_link.rb
@@ -4,6 +4,8 @@ module QA
module Page
module Component
module CiBadgeLink
+ extend QA::Page::PageConcern
+
COMPLETED_STATUSES = %w[passed failed canceled blocked skipped manual].freeze # excludes created, pending, running
INCOMPLETE_STATUSES = %w[pending created running].freeze
@@ -27,6 +29,8 @@ module QA
end
def self.included(base)
+ super
+
base.view 'app/assets/javascripts/vue_shared/components/ci_badge_link.vue' do
element :status_badge
end
diff --git a/qa/qa/page/component/clone_panel.rb b/qa/qa/page/component/clone_panel.rb
index fbe19e5802b..a0aea6fe44d 100644
--- a/qa/qa/page/component/clone_panel.rb
+++ b/qa/qa/page/component/clone_panel.rb
@@ -4,7 +4,11 @@ module QA
module Page
module Component
module ClonePanel
+ extend QA::Page::PageConcern
+
def self.included(base)
+ super
+
base.view 'app/views/projects/buttons/_clone.html.haml' do
element :clone_dropdown
element :clone_options
diff --git a/qa/qa/page/component/confirm_modal.rb b/qa/qa/page/component/confirm_modal.rb
index 355e2783fb7..039640d207a 100644
--- a/qa/qa/page/component/confirm_modal.rb
+++ b/qa/qa/page/component/confirm_modal.rb
@@ -4,7 +4,11 @@ module QA
module Page
module Component
module ConfirmModal
+ extend QA::Page::PageConcern
+
def self.included(base)
+ super
+
base.view 'app/views/shared/_confirm_modal.html.haml' do
element :confirm_modal
element :confirm_input
diff --git a/qa/qa/page/component/custom_metric.rb b/qa/qa/page/component/custom_metric.rb
new file mode 100644
index 00000000000..094979f5e18
--- /dev/null
+++ b/qa/qa/page/component/custom_metric.rb
@@ -0,0 +1,49 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module Component
+ module CustomMetric
+ extend QA::Page::PageConcern
+
+ def self.included(base)
+ super
+
+ base.view 'app/assets/javascripts/custom_metrics/components/custom_metrics_form_fields.vue' do
+ element :custom_metric_prometheus_title_field
+ element :custom_metric_prometheus_query_field
+ element :custom_metric_prometheus_y_label_field
+ element :custom_metric_prometheus_unit_label_field
+ element :custom_metric_prometheus_legend_label_field
+ end
+ end
+
+ def add_custom_metric
+ fill_element :custom_metric_prometheus_title_field, 'HTTP Requests Total'
+ fill_element :custom_metric_prometheus_query_field, 'rate(http_requests_total[5m])'
+ fill_element :custom_metric_prometheus_y_label_field, 'Requests/second'
+ fill_element :custom_metric_prometheus_unit_label_field, 'req/sec'
+ fill_element :custom_metric_prometheus_legend_label_field, 'HTTP requests'
+
+ save_changes
+ end
+
+ def save_changes
+ click_button(class: 'btn-success')
+ end
+
+ def delete_custom_metric
+ click_button(class: 'btn-danger')
+ within('.modal-content') { click_button(class: 'btn-danger') }
+ end
+
+ def edit_custom_metric
+ fill_element :custom_metric_prometheus_title_field, ''
+ fill_element :custom_metric_prometheus_title_field, 'Throughput'
+
+ save_changes
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/component/design_management.rb b/qa/qa/page/component/design_management.rb
new file mode 100644
index 00000000000..a8a24bd3949
--- /dev/null
+++ b/qa/qa/page/component/design_management.rb
@@ -0,0 +1,82 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module Component
+ module DesignManagement
+ extend QA::Page::PageConcern
+
+ def self.included(base)
+ super
+
+ base.class_eval do
+ view 'app/assets/javascripts/design_management/components/design_notes/design_discussion.vue' do
+ element :design_discussion_content
+ end
+
+ view 'app/assets/javascripts/design_management/components/design_notes/design_note.vue' do
+ element :note_content
+ end
+
+ view 'app/assets/javascripts/design_management/components/design_notes/design_reply_form.vue' do
+ element :note_textarea
+ element :save_comment_button
+ end
+
+ view 'app/assets/javascripts/design_management/components/design_overlay.vue' do
+ element :design_image_button
+ end
+
+ view 'app/assets/javascripts/design_management/components/list/item.vue' do
+ element :design_file_name
+ element :design_image
+ end
+ end
+ end
+
+ def add_annotation(note)
+ click_element(:design_image_button)
+ fill_element(:note_textarea, note)
+ click_element(:save_comment_button)
+
+ # It takes a moment for the annotation to be saved.
+ # We'll check for the annotation in a test, but here we'll at least
+ # wait for the "Save comment" button to disappear
+ saved = has_no_element?(:save_comment_button)
+
+ raise ExpectationNotMet, %q(There was a problem while adding the annotation) unless saved
+ end
+
+ def add_design(design_file_path)
+ # `attach_file` doesn't seem able to find element via data attributes.
+ # It accepts a `class:` option, but that only works for class attributes
+ # It doesn't work as a CSS selector.
+ # So instead we use the name attribute as a locator
+ page.attach_file("design_file", design_file_path, make_visible: { display: 'block' })
+
+ filename = ::File.basename(design_file_path)
+
+ found = wait_until(reload: false, sleep_interval: 1) do
+ image = find_element(:design_image)
+
+ has_element?(:design_file_name, text: filename) &&
+ image["complete"] &&
+ image["naturalWidth"].to_i > 0
+ end
+
+ raise ElementNotFound, %Q(Attempted to attach design "#{filename}" but it did not appear) unless found
+ end
+
+ def click_design(filename)
+ click_element(:design_file_name, text: filename)
+ end
+
+ def has_annotation?(note)
+ within_element_by_index(:design_discussion_content, 0) do
+ has_element?(:note_content, text: note)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/component/groups_filter.rb b/qa/qa/page/component/groups_filter.rb
index 7eb1257db71..f82bb81a3fc 100644
--- a/qa/qa/page/component/groups_filter.rb
+++ b/qa/qa/page/component/groups_filter.rb
@@ -4,7 +4,11 @@ module QA
module Page
module Component
module GroupsFilter
+ extend QA::Page::PageConcern
+
def self.included(base)
+ super
+
base.view 'app/views/shared/groups/_search_form.html.haml' do
element :groups_filter
end
diff --git a/qa/qa/page/component/issuable/common.rb b/qa/qa/page/component/issuable/common.rb
index 1155d4da036..bbab1746d7a 100644
--- a/qa/qa/page/component/issuable/common.rb
+++ b/qa/qa/page/component/issuable/common.rb
@@ -5,7 +5,11 @@ module QA
module Component
module Issuable
module Common
+ extend QA::Page::PageConcern
+
def self.included(base)
+ super
+
base.view 'app/assets/javascripts/issue_show/components/title.vue' do
element :edit_button
element :title, required: true
diff --git a/qa/qa/page/component/lazy_loader.rb b/qa/qa/page/component/lazy_loader.rb
index 6f74a4691ba..2123431fc55 100644
--- a/qa/qa/page/component/lazy_loader.rb
+++ b/qa/qa/page/component/lazy_loader.rb
@@ -4,7 +4,11 @@ module QA
module Page
module Component
module LazyLoader
+ extend QA::Page::PageConcern
+
def self.included(base)
+ super
+
base.view 'app/assets/javascripts/lazy_loader.js' do
element :js_lazy_loaded
end
diff --git a/qa/qa/page/component/legacy_clone_panel.rb b/qa/qa/page/component/legacy_clone_panel.rb
index 7b4b30623a6..ebab9fd708c 100644
--- a/qa/qa/page/component/legacy_clone_panel.rb
+++ b/qa/qa/page/component/legacy_clone_panel.rb
@@ -4,7 +4,11 @@ module QA
module Page
module Component
module LegacyClonePanel
+ extend QA::Page::PageConcern
+
def self.included(base)
+ super
+
base.view 'app/views/shared/_clone_panel.html.haml' do
element :clone_dropdown
element :clone_options_dropdown, '.clone-options-dropdown' # rubocop:disable QA/ElementWithPattern
diff --git a/qa/qa/page/component/note.rb b/qa/qa/page/component/note.rb
index 3e8ed9069ce..0e9cdd49519 100644
--- a/qa/qa/page/component/note.rb
+++ b/qa/qa/page/component/note.rb
@@ -4,7 +4,11 @@ module QA
module Page
module Component
module Note
+ extend QA::Page::PageConcern
+
def self.included(base)
+ super
+
base.view 'app/assets/javascripts/notes/components/comment_form.vue' do
element :note_dropdown
element :discussion_option
diff --git a/qa/qa/page/component/project/templates.rb b/qa/qa/page/component/project/templates.rb
new file mode 100644
index 00000000000..8baf15acdff
--- /dev/null
+++ b/qa/qa/page/component/project/templates.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module QA
+ module Page::Component
+ module Project
+ module Templates
+ def use_template_for_project(project_name)
+ within find_element(:template_option_row, text: project_name) do
+ click_element :use_template_button
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/component/select2.rb b/qa/qa/page/component/select2.rb
index e667fad1dd3..b8beb64b6bd 100644
--- a/qa/qa/page/component/select2.rb
+++ b/qa/qa/page/component/select2.rb
@@ -18,10 +18,14 @@ module QA
end
end
- def search_and_select(item_text)
+ def search_item(item_text)
find('.select2-input').set(item_text)
wait_for_search_to_complete
+ end
+
+ def search_and_select(item_text)
+ search_item(item_text)
select_item(item_text)
end
@@ -36,7 +40,7 @@ module QA
end
def dropdown_open?
- has_css?('.select2-input')
+ find('.select2-focusser').disabled?
end
end
end
diff --git a/qa/qa/page/component/web_ide/alert.rb b/qa/qa/page/component/web_ide/alert.rb
index 0f0623d5ebf..c2903662b52 100644
--- a/qa/qa/page/component/web_ide/alert.rb
+++ b/qa/qa/page/component/web_ide/alert.rb
@@ -5,8 +5,12 @@ module QA
module Component
module WebIDE
module Alert
- def self.prepended(page)
- page.module_eval do
+ extend QA::Page::PageConcern
+
+ def self.prepended(base)
+ super
+
+ base.class_eval do
view 'app/assets/javascripts/ide/components/error_message.vue' do
element :flash_alert
end