diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /qa/qa/page/component/snippet.rb | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) | |
download | gitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'qa/qa/page/component/snippet.rb')
-rw-r--r-- | qa/qa/page/component/snippet.rb | 42 |
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 |