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/blob_content.rb86
-rw-r--r--qa/qa/page/component/issuable/common.rb8
-rw-r--r--qa/qa/page/component/issuable/sidebar.rb11
-rw-r--r--qa/qa/page/component/snippet.rb12
-rw-r--r--qa/qa/page/component/wiki.rb5
-rw-r--r--qa/qa/page/component/wiki_page_form.rb21
6 files changed, 118 insertions, 25 deletions
diff --git a/qa/qa/page/component/blob_content.rb b/qa/qa/page/component/blob_content.rb
new file mode 100644
index 00000000000..4d36a6dcefe
--- /dev/null
+++ b/qa/qa/page/component/blob_content.rb
@@ -0,0 +1,86 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module Component
+ module BlobContent
+ extend QA::Page::PageConcern
+
+ def self.included(base)
+ super
+
+ base.view 'app/assets/javascripts/blob/components/blob_header_filepath.vue' do
+ element :file_title_content
+ end
+
+ base.view 'app/assets/javascripts/blob/components/blob_content.vue' do
+ element :blob_viewer_file_content
+ end
+
+ base.view 'app/assets/javascripts/blob/components/blob_header_default_actions.vue' do
+ element :default_actions_container
+ element :copy_contents_button
+ end
+
+ base.view 'app/views/projects/blob/_header_content.html.haml' do
+ element :file_name_content
+ end
+
+ base.view 'app/views/shared/_file_highlight.html.haml' do
+ element :file_content
+ end
+ end
+
+ def has_file?(name)
+ has_file_name?(name)
+ end
+
+ def has_no_file?(name)
+ has_no_file_name?(name)
+ end
+
+ def has_file_name?(file_name, file_number = nil)
+ within_file_by_number(file_name_element, file_number) { has_text?(file_name) }
+ end
+
+ def has_no_file_name?(file_name)
+ within_element(file_name_element) do
+ has_no_text?(file_name)
+ end
+ end
+
+ def has_file_content?(file_content, file_number = nil)
+ within_file_by_number(file_content_element, file_number) { has_text?(file_content) }
+ end
+
+ def has_no_file_content?(file_content)
+ within_element(file_content_element) do
+ has_no_text?(file_content)
+ end
+ end
+
+ def click_copy_file_contents(file_number = nil)
+ within_file_by_number(:default_actions_container, file_number) { click_element(:copy_contents_button) }
+ end
+
+ private
+
+ def file_content_element
+ feature_flag_controlled_element(:refactor_blob_viewer, :blob_viewer_file_content, :file_content)
+ end
+
+ def file_name_element
+ feature_flag_controlled_element(:refactor_blob_viewer, :file_title_content, :file_name_content)
+ end
+
+ def within_file_by_number(element, file_number)
+ if file_number
+ within_element_by_index(element, file_number - 1) { yield }
+ else
+ within_element(element) { yield }
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/component/issuable/common.rb b/qa/qa/page/component/issuable/common.rb
index bbab1746d7a..0d056afd7f0 100644
--- a/qa/qa/page/component/issuable/common.rb
+++ b/qa/qa/page/component/issuable/common.rb
@@ -10,20 +10,20 @@ module QA
def self.included(base)
super
- base.view 'app/assets/javascripts/issue_show/components/title.vue' do
+ base.view 'app/assets/javascripts/issues/show/components/title.vue' do
element :edit_button
element :title, required: true
end
- base.view 'app/assets/javascripts/issue_show/components/fields/title.vue' do
+ base.view 'app/assets/javascripts/issues/show/components/fields/title.vue' do
element :title_input
end
- base.view 'app/assets/javascripts/issue_show/components/fields/description.vue' do
+ base.view 'app/assets/javascripts/issues/show/components/fields/description.vue' do
element :description_textarea
end
- base.view 'app/assets/javascripts/issue_show/components/edit_actions.vue' do
+ base.view 'app/assets/javascripts/issues/show/components/edit_actions.vue' do
element :save_button
element :delete_button
end
diff --git a/qa/qa/page/component/issuable/sidebar.rb b/qa/qa/page/component/issuable/sidebar.rb
index 77962570aed..4a81230499c 100644
--- a/qa/qa/page/component/issuable/sidebar.rb
+++ b/qa/qa/page/component/issuable/sidebar.rb
@@ -18,7 +18,7 @@ module QA
element :more_assignees_link
end
- base.view 'app/assets/javascripts/sidebar/components/labels/sidebar_labels.vue' do
+ base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/labels_select_root.vue' do
element :labels_block
end
@@ -124,15 +124,6 @@ module QA
click_element(:more_assignees_link)
end
- # When the labels_widget feature flag is enabled, wait until the labels widget appears
- def wait_for_labels_widget_feature_flag
- Support::Retrier.retry_until(max_duration: 60, reload_page: page, retry_on_exception: true, sleep_interval: 5) do
- within_element(:labels_block) do
- find_element(:edit_link)
- end
- end
- end
-
private
def wait_assignees_block_finish_loading
diff --git a/qa/qa/page/component/snippet.rb b/qa/qa/page/component/snippet.rb
index ad264bd6d56..34e884f2a08 100644
--- a/qa/qa/page/component/snippet.rb
+++ b/qa/qa/page/component/snippet.rb
@@ -26,7 +26,7 @@ module QA
end
base.view 'app/assets/javascripts/blob/components/blob_content.vue' do
- element :file_content
+ element :blob_viewer_file_content
end
base.view 'app/assets/javascripts/snippets/components/snippet_header.vue' do
@@ -130,11 +130,11 @@ module QA
def has_file_content?(file_content, file_number = nil)
if file_number
- within_element_by_index(:file_content, file_number - 1) do
+ within_element_by_index(:blob_viewer_file_content, file_number - 1) do
has_text?(file_content)
end
else
- within_element(:file_content) do
+ within_element(:blob_viewer_file_content) do
has_text?(file_content)
end
end
@@ -142,11 +142,11 @@ module QA
def has_no_file_content?(file_content, file_number = nil)
if file_number
- within_element_by_index(:file_content, file_number - 1) do
+ within_element_by_index(:blob_viewer_file_content, file_number - 1) do
has_no_text?(file_content)
end
else
- within_element(:file_content) do
+ within_element(:blob_viewer_file_content) do
has_no_text?(file_content)
end
end
@@ -207,7 +207,7 @@ module QA
end
def has_syntax_highlighting?(language)
- within_element(:file_content) do
+ within_element(:blob_viewer_file_content) do
find('.line')['lang'].to_s == language
end
end
diff --git a/qa/qa/page/component/wiki.rb b/qa/qa/page/component/wiki.rb
index c3db1d6c885..ffd31f8d7b7 100644
--- a/qa/qa/page/component/wiki.rb
+++ b/qa/qa/page/component/wiki.rb
@@ -11,10 +11,13 @@ module QA
base.view 'app/views/shared/wikis/show.html.haml' do
element :wiki_page_title
- element :wiki_page_content
element :edit_page_button
end
+ base.view 'app/views/shared/wikis/_wiki_content.html.haml' do
+ element :wiki_page_content
+ end
+
base.view 'app/views/shared/wikis/_main_links.html.haml' do
element :new_page_button
element :page_history_button
diff --git a/qa/qa/page/component/wiki_page_form.rb b/qa/qa/page/component/wiki_page_form.rb
index fd536ff1dd3..bc73fe0c3ab 100644
--- a/qa/qa/page/component/wiki_page_form.rb
+++ b/qa/qa/page/component/wiki_page_form.rb
@@ -15,6 +15,7 @@ module QA
element :wiki_message_textbox
element :wiki_submit_button
element :try_new_editor_container
+ element :editing_mode_button
end
base.view 'app/assets/javascripts/pages/shared/wikis/components/delete_wiki_modal.vue' do
@@ -36,6 +37,10 @@ module QA
def click_submit
click_element(:wiki_submit_button)
+
+ wait_until(reload: false) do
+ has_no_element?(:wiki_title_textbox)
+ end
end
def delete_page
@@ -43,11 +48,19 @@ module QA
Page::Modal::DeleteWiki.perform(&:confirm_deletion)
end
- def use_new_editor
- within_element(:try_new_editor_container) do
- click_button('Use the new editor')
+ def use_new_editor(toggle)
+ # Update once the feature is released, see https://gitlab.com/gitlab-org/gitlab/-/issues/345398
+ if toggle
+ click_element(:editing_mode_button, mode: 'Edit rich text')
+ else
+ within_element(:try_new_editor_container) do
+ click_button('Use the new editor')
+ end
+ end
+
+ wait_until(reload: false) do
+ has_element?(:content_editor_container)
end
- has_element?(:content_editor_container)
end
end
end