summaryrefslogtreecommitdiff
path: root/qa/qa/page/component/snippet.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/page/component/snippet.rb')
-rw-r--r--qa/qa/page/component/snippet.rb42
1 files changed, 39 insertions, 3 deletions
diff --git a/qa/qa/page/component/snippet.rb b/qa/qa/page/component/snippet.rb
index 459c02ec883..b98c429df8c 100644
--- a/qa/qa/page/component/snippet.rb
+++ b/qa/qa/page/component/snippet.rb
@@ -78,6 +78,11 @@ module QA
base.view 'app/assets/javascripts/snippets/components/embed_dropdown.vue' do
element :copy_button
end
+
+ base.view 'app/assets/javascripts/blob/components/blob_header_default_actions.vue' do
+ element :default_actions_container
+ element :copy_contents_button
+ end
end
def has_snippet_title?(snippet_title)
@@ -182,7 +187,10 @@ module QA
def add_comment(comment)
fill_element(:note_field, comment)
click_element(:comment_button)
- wait_until(reload: false) { has_element?(:note_author_content) }
+
+ unless has_element?(:note_author_content)
+ raise ElementNotFound, "Comment did not appear as expected"
+ end
end
def has_comment_author?(author_username)
@@ -207,7 +215,10 @@ module QA
click_element(:edit_comment_button)
fill_element(:edit_note_field, comment)
click_element(:save_comment_button)
- wait_until(reload: false) { has_element?(:note_author_content) }
+
+ unless has_element?(:note_author_content)
+ raise ElementNotFound, "Comment did not appear as expected"
+ end
end
def delete_comment(comment)
@@ -215,7 +226,32 @@ module QA
accept_alert do
click_element(:delete_comment_button)
end
- wait_until(reload: false) { has_no_text?(comment) }
+
+ unless has_no_element?(:note_content, text: comment)
+ raise ElementNotFound, "Comment was not removed as expected"
+ end
+ end
+
+ def click_copy_file_contents(file_number = nil)
+ if file_number
+ within_element_by_index(:default_actions_container, file_number - 1) do
+ click_element(:copy_contents_button)
+ end
+ else
+ within_element(:default_actions_container) do
+ click_element(:copy_contents_button)
+ end
+ end
+ end
+
+ def copy_file_contents_to_comment(file_number = nil)
+ click_copy_file_contents(file_number)
+ send_keys_to_element(:note_field, [:shift, :insert])
+ click_element(:comment_button)
+
+ unless has_element?(:note_author_content)
+ raise ElementNotFound, "Comment did not appear as expected"
+ end
end
end
end