From 0d1eb7d638aacccf8efbb6cfc9c62a31d2ba6d5b Mon Sep 17 00:00:00 2001 From: Walmyr Lima Date: Wed, 10 Jul 2019 15:49:28 +0200 Subject: [PATCH 1/3] Update vue component with class for testability --- app/assets/javascripts/notes/components/note_actions.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/notes/components/note_actions.vue b/app/assets/javascripts/notes/components/note_actions.vue index 844d0c3e376..6cc873359da 100644 --- a/app/assets/javascripts/notes/components/note_actions.vue +++ b/app/assets/javascripts/notes/components/note_actions.vue @@ -165,7 +165,7 @@ export default { v-gl-tooltip type="button" title="Edit comment" - class="note-action-button js-note-edit btn btn-transparent" + class="note-action-button js-note-edit btn btn-transparent qa-note-edit-button" @click="onEdit" > From 253bb8db0c525fa93e75da59acea71034649bf11 Mon Sep 17 00:00:00 2001 From: Walmyr Lima Date: Wed, 10 Jul 2019 15:50:21 +0200 Subject: [PATCH 2/3] Update page object with new element and method --- qa/qa/page/component/note.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qa/qa/page/component/note.rb b/qa/qa/page/component/note.rb index 07e191f1c9b..fe324574f4d 100644 --- a/qa/qa/page/component/note.rb +++ b/qa/qa/page/component/note.rb @@ -10,6 +10,10 @@ module QA element :discussion_option end + base.view 'app/assets/javascripts/notes/components/note_actions.vue' do + element :note_edit_button + end + base.view 'app/assets/javascripts/notes/components/note_form.vue' do element :reply_input element :reply_comment_button @@ -49,6 +53,12 @@ module QA def expand_replies click_element :expand_replies end + + def edit_comment(text) + click_element :note_edit_button + fill_element :reply_input, text + click_element :reply_comment_button + end end end end From 0b69edc1713dc0ac4dbaab7f6d900dfc8f4d9217 Mon Sep 17 00:00:00 2001 From: Walmyr Lima Date: Wed, 10 Jul 2019 15:51:16 +0200 Subject: [PATCH 3/3] Add new e2e test for adding and editing comments ...on issues. --- .../2_plan/issue/comment_issue_spec.rb | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb new file mode 100644 index 00000000000..a62a51b11f4 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module QA + context 'Plan' do + describe 'Issue comments' do + it 'user comments on an issue and edits the comment' do + Runtime::Browser.visit(:gitlab, Page::Main::Login) + Page::Main::Login.act { sign_in_using_credentials } + + issue = Resource::Issue.fabricate_via_api! do |issue| + issue.title = 'issue title' + end + issue.visit! + + Page::Project::Issue::Show.perform do |issue_show_page| + first_version_of_comment = 'First version of the comment' + second_version_of_comment = 'Second version of the comment' + + issue_show_page.comment(first_version_of_comment) + + expect(issue_show_page).to have_content(first_version_of_comment) + + issue_show_page.edit_comment(second_version_of_comment) + + expect(issue_show_page).to have_content(second_version_of_comment) + expect(issue_show_page).not_to have_content(first_version_of_comment) + end + end + end + end +end