Commit ea954950 authored by Désirée Chevalier's avatar Désirée Chevalier Committed by Mark Lapierre

Update QA selectors

Update old QA class selectors to data selectors
parent 3b3832c0
...@@ -381,7 +381,8 @@ export default { ...@@ -381,7 +381,8 @@ export default {
dir="auto" dir="auto"
:disabled="isSubmitting" :disabled="isSubmitting"
name="note[note]" name="note[note]"
class="note-textarea js-vue-comment-form js-note-text js-gfm-input js-autosize markdown-area qa-comment-input" class="note-textarea js-vue-comment-form js-note-text js-gfm-input js-autosize markdown-area"
data-qa-selector="comment_field"
data-supports-quick-actions="true" data-supports-quick-actions="true"
:aria-label="__('Description')" :aria-label="__('Description')"
:placeholder="__('Write a comment or drag your files here…')" :placeholder="__('Write a comment or drag your files here…')"
...@@ -426,7 +427,8 @@ export default { ...@@ -426,7 +427,8 @@ export default {
> >
<gl-button <gl-button
:disabled="isSubmitButtonDisabled" :disabled="isSubmitButtonDisabled"
class="js-comment-button js-comment-submit-button qa-comment-button" class="js-comment-button js-comment-submit-button"
data-qa-selector="comment_button"
type="submit" type="submit"
category="primary" category="primary"
variant="success" variant="success"
...@@ -440,7 +442,8 @@ export default { ...@@ -440,7 +442,8 @@ export default {
name="button" name="button"
category="primary" category="primary"
variant="success" variant="success"
class="note-type-toggle js-note-new-discussion dropdown-toggle qa-note-dropdown" class="note-type-toggle js-note-new-discussion dropdown-toggle"
data-qa-selector="note_dropdown"
data-display="static" data-display="static"
data-toggle="dropdown" data-toggle="dropdown"
icon="chevron-down" icon="chevron-down"
...@@ -469,7 +472,10 @@ export default { ...@@ -469,7 +472,10 @@ export default {
</li> </li>
<li class="divider droplab-item-ignore"></li> <li class="divider droplab-item-ignore"></li>
<li :class="{ 'droplab-item-selected': noteType === 'discussion' }"> <li :class="{ 'droplab-item-selected': noteType === 'discussion' }">
<button class="qa-discussion-option" @click.prevent="setNoteType('discussion')"> <button
data-qa-selector="discussion_menu_item"
@click.prevent="setNoteType('discussion')"
>
<i aria-hidden="true" class="fa fa-check icon"></i> <i aria-hidden="true" class="fa fa-check icon"></i>
<div class="description"> <div class="description">
<strong>{{ __('Start thread') }}</strong> <strong>{{ __('Start thread') }}</strong>
......
...@@ -275,7 +275,8 @@ export default { ...@@ -275,7 +275,8 @@ export default {
v-gl-tooltip v-gl-tooltip
type="button" type="button"
title="Edit comment" title="Edit comment"
class="note-action-button js-note-edit btn btn-transparent qa-note-edit-button" class="note-action-button js-note-edit btn btn-transparent"
data-qa-selector="note_edit_button"
@click="onEdit" @click="onEdit"
> >
<gl-icon name="pencil" class="link-highlight" /> <gl-icon name="pencil" class="link-highlight" />
......
...@@ -338,7 +338,8 @@ export default { ...@@ -338,7 +338,8 @@ export default {
v-model="updatedNoteBody" v-model="updatedNoteBody"
:data-supports-quick-actions="!isEditing" :data-supports-quick-actions="!isEditing"
name="note[note]" name="note[note]"
class="note-textarea js-gfm-input js-note-text js-autosize markdown-area js-vue-issue-note-form qa-reply-input" class="note-textarea js-gfm-input js-note-text js-autosize markdown-area js-vue-issue-note-form"
data-qa-selector="reply_field"
dir="auto" dir="auto"
:aria-label="__('Description')" :aria-label="__('Description')"
:placeholder="__('Write a comment or drag your files here…')" :placeholder="__('Write a comment or drag your files here…')"
...@@ -377,7 +378,8 @@ export default { ...@@ -377,7 +378,8 @@ export default {
<button <button
:disabled="isDisabled" :disabled="isDisabled"
type="button" type="button"
class="btn btn-success qa-start-review" class="btn btn-success"
data-qa-selector="start_review_button"
@click="handleAddToReview" @click="handleAddToReview"
> >
<template v-if="hasDrafts">{{ __('Add to review') }}</template> <template v-if="hasDrafts">{{ __('Add to review') }}</template>
...@@ -386,7 +388,8 @@ export default { ...@@ -386,7 +388,8 @@ export default {
<button <button
:disabled="isDisabled" :disabled="isDisabled"
type="button" type="button"
class="btn qa-comment-now js-comment-button" class="btn js-comment-button"
data-qa-selector="comment_now_button"
@click="handleUpdate()" @click="handleUpdate()"
> >
{{ __('Add comment now') }} {{ __('Add comment now') }}
...@@ -405,7 +408,8 @@ export default { ...@@ -405,7 +408,8 @@ export default {
<button <button
:disabled="isDisabled" :disabled="isDisabled"
type="button" type="button"
class="js-vue-issue-save btn btn-success js-comment-button qa-reply-comment-button" class="js-vue-issue-save btn btn-success js-comment-button"
data-qa-selector="reply_comment_button"
@click="handleUpdate()" @click="handleUpdate()"
> >
{{ saveButtonTitle }} {{ saveButtonTitle }}
......
...@@ -57,7 +57,12 @@ export default { ...@@ -57,7 +57,12 @@ export default {
tooltip-placement="bottom" tooltip-placement="bottom"
/> />
</div> </div>
<button class="btn btn-link js-replies-text qa-expand-replies" type="button" @click="toggle"> <button
class="btn btn-link js-replies-text"
data-qa-selector="expand_replies_button"
type="button"
@click="toggle"
>
{{ replies.length }} {{ n__('reply', 'replies', replies.length) }} {{ replies.length }} {{ n__('reply', 'replies', replies.length) }}
</button> </button>
{{ __('Last reply by') }} {{ __('Last reply by') }}
...@@ -68,7 +73,8 @@ export default { ...@@ -68,7 +73,8 @@ export default {
</template> </template>
<span <span
v-else v-else
class="collapse-replies-btn js-collapse-replies qa-collapse-replies" class="collapse-replies-btn js-collapse-replies"
data-qa-selector="collapse_replies_button"
@click="toggle" @click="toggle"
> >
<gl-icon name="chevron-down" /> {{ s__('Notes|Collapse replies') }} <gl-icon name="chevron-down" /> {{ s__('Notes|Collapse replies') }}
......
...@@ -12,7 +12,7 @@ export default { ...@@ -12,7 +12,7 @@ export default {
</script> </script>
<template> <template>
<timeline-entry-item class="note note-wrapper" data-qa-selector="skeleton_note"> <timeline-entry-item class="note note-wrapper" data-qa-selector="skeleton_note_placeholder">
<div class="timeline-icon"></div> <div class="timeline-icon"></div>
<div class="timeline-content"> <div class="timeline-content">
<div class="note-header"></div> <div class="note-header"></div>
......
...@@ -42,7 +42,7 @@ module QA ...@@ -42,7 +42,7 @@ module QA
end end
def add_comment_to_epic(comment) def add_comment_to_epic(comment)
fill_element :comment_input, comment fill_element :comment_field, comment
click_element :comment_button click_element :comment_button
end end
......
...@@ -9,9 +9,18 @@ module QA ...@@ -9,9 +9,18 @@ module QA
def self.included(base) def self.included(base)
super super
base.view 'app/assets/javascripts/diffs/components/diff_file_header.vue' do
element :toggle_comments_button
end
base.view 'app/assets/javascripts/notes/components/discussion_actions.vue' do
element :discussion_reply_tab
element :resolve_discussion_button
end
base.view 'app/assets/javascripts/notes/components/comment_form.vue' do base.view 'app/assets/javascripts/notes/components/comment_form.vue' do
element :note_dropdown element :note_dropdown
element :discussion_option element :discussion_menu_item
end end
base.view 'app/assets/javascripts/notes/components/noteable_discussion.vue' do base.view 'app/assets/javascripts/notes/components/noteable_discussion.vue' do
...@@ -23,39 +32,32 @@ module QA ...@@ -23,39 +32,32 @@ module QA
end end
base.view 'app/assets/javascripts/notes/components/note_form.vue' do base.view 'app/assets/javascripts/notes/components/note_form.vue' do
element :reply_input element :reply_field
element :reply_comment_button element :reply_comment_button
end end
base.view 'app/assets/javascripts/notes/components/discussion_actions.vue' do
element :discussion_reply_tab
element :resolve_discussion_button
end
base.view 'app/assets/javascripts/notes/components/toggle_replies_widget.vue' do base.view 'app/assets/javascripts/notes/components/toggle_replies_widget.vue' do
element :expand_replies element :expand_replies_button
element :collapse_replies element :collapse_replies_button
end end
base.view 'app/assets/javascripts/diffs/components/diff_file_header.vue' do base.view 'app/assets/javascripts/vue_shared/components/notes/skeleton_note.vue' do
element :toggle_comments_button element :skeleton_note_placeholder
end end
end end
def start_discussion(text) def collapse_replies
fill_element :comment_input, text click_element :collapse_replies_button
click_element :note_dropdown
click_element :discussion_option
click_element :comment_button
end end
def toggle_comments(position) def edit_comment(text)
all_elements(:toggle_comments_button, minimum: position)[position - 1].click click_element :note_edit_button
fill_element :reply_field, text
click_element :reply_comment_button
end end
def type_reply_to_discussion(position, reply_text) def expand_replies
all_elements(:discussion_reply_tab, minimum: position)[position - 1].click click_element :expand_replies_button
fill_element :reply_input, reply_text
end end
def reply_to_discussion(position, reply_text) def reply_to_discussion(position, reply_text)
...@@ -69,18 +71,24 @@ module QA ...@@ -69,18 +71,24 @@ module QA
end end
end end
def collapse_replies def start_discussion(text)
click_element :collapse_replies fill_element :comment_field, text
click_element :note_dropdown
click_element :discussion_menu_item
click_element :comment_button
end end
def expand_replies def toggle_comments(position)
click_element :expand_replies all_elements(:toggle_comments_button, minimum: position)[position - 1].click
end end
def edit_comment(text) def type_reply_to_discussion(position, reply_text)
click_element :note_edit_button all_elements(:discussion_reply_tab, minimum: position)[position - 1].click
fill_element :reply_input, text fill_element :reply_field, reply_text
click_element :reply_comment_button end
def wait_for_loading
has_no_element?(:skeleton_note_placeholer)
end end
end end
end end
......
...@@ -44,10 +44,6 @@ module QA ...@@ -44,10 +44,6 @@ module QA
element :squash_checkbox element :squash_checkbox
end end
view 'app/assets/javascripts/vue_shared/components/notes/skeleton_note.vue' do
element :skeleton_note
end
view 'app/views/projects/merge_requests/show.html.haml' do view 'app/views/projects/merge_requests/show.html.haml' do
element :notes_tab element :notes_tab
element :diffs_tab element :diffs_tab
...@@ -74,8 +70,8 @@ module QA ...@@ -74,8 +70,8 @@ module QA
view 'app/assets/javascripts/notes/components/note_form.vue' do view 'app/assets/javascripts/notes/components/note_form.vue' do
element :unresolve_review_discussion_checkbox element :unresolve_review_discussion_checkbox
element :resolve_review_discussion_checkbox element :resolve_review_discussion_checkbox
element :start_review element :start_review_button
element :comment_now element :comment_now_button
end end
view 'app/assets/javascripts/batch_comments/components/preview_dropdown.vue' do view 'app/assets/javascripts/batch_comments/components/preview_dropdown.vue' do
...@@ -83,19 +79,19 @@ module QA ...@@ -83,19 +79,19 @@ module QA
end end
def start_review def start_review
click_element :start_review click_element :start_review_button
# After clicking the button, wait for it to disappear # After clicking the button, wait for it to disappear
# before moving on to the next part of the test # before moving on to the next part of the test
has_no_element? :start_review has_no_element? :start_review_button
end end
def comment_now def comment_now
click_element :comment_now click_element :comment_now_button
# After clicking the button, wait for it to disappear # After clicking the button, wait for it to disappear
# before moving on to the next part of the test # before moving on to the next part of the test
has_no_element? :comment_now has_no_element? :comment_now_button
end end
def submit_pending_reviews def submit_pending_reviews
...@@ -117,7 +113,7 @@ module QA ...@@ -117,7 +113,7 @@ module QA
end end
def resolve_review_discussion def resolve_review_discussion
scroll_to_element :start_review scroll_to_element :start_review_button
check_element :resolve_review_discussion_checkbox check_element :resolve_review_discussion_checkbox
end end
...@@ -131,7 +127,7 @@ module QA ...@@ -131,7 +127,7 @@ module QA
end end
all_elements(:new_diff_line, minimum: 1).first.hover all_elements(:new_diff_line, minimum: 1).first.hover
click_element(:diff_comment) click_element(:diff_comment)
fill_element(:reply_input, text) fill_element(:reply_field, text)
end end
def click_discussions_tab def click_discussions_tab
...@@ -266,10 +262,6 @@ module QA ...@@ -266,10 +262,6 @@ module QA
end end
end end
def wait_for_loading
has_no_element?(:skeleton_note)
end
def click_open_in_web_ide def click_open_in_web_ide
click_element(:open_in_web_ide_button) click_element(:open_in_web_ide_button)
wait_for_requests wait_for_requests
......
...@@ -12,7 +12,7 @@ module QA ...@@ -12,7 +12,7 @@ module QA
view 'app/assets/javascripts/notes/components/comment_form.vue' do view 'app/assets/javascripts/notes/components/comment_form.vue' do
element :comment_button element :comment_button
element :comment_input element :comment_field
end end
view 'app/assets/javascripts/notes/components/discussion_filter.vue' do view 'app/assets/javascripts/notes/components/discussion_filter.vue' do
...@@ -84,7 +84,7 @@ module QA ...@@ -84,7 +84,7 @@ module QA
# attachment option should be an absolute path # attachment option should be an absolute path
def comment(text, attachment: nil, filter: :all_activities) def comment(text, attachment: nil, filter: :all_activities)
method("select_#{filter}_filter").call method("select_#{filter}_filter").call
fill_element :comment_input, "#{text}\n" fill_element :comment_field, "#{text}\n"
unless attachment.nil? unless attachment.nil?
QA::Page::Component::Dropzone.new(self, '.new-note') QA::Page::Component::Dropzone.new(self, '.new-note')
...@@ -125,6 +125,8 @@ module QA ...@@ -125,6 +125,8 @@ module QA
click_element(:title) click_element(:title)
click_element :discussion_filter click_element :discussion_filter
find_element(:filter_options, text: text).click find_element(:filter_options, text: text).click
wait_for_loading
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment