Commit 46eef996 authored by Mike Greiling's avatar Mike Greiling

Change how reply button placeholder is selected in capybara

utilize find_field instead of class selector
parent ff6e0e26
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
<slot v-if="hasForm" name="form"></slot> <slot v-if="hasForm" name="form"></slot>
<template v-else-if="renderReplyPlaceholder"> <template v-else-if="renderReplyPlaceholder">
<reply-placeholder <reply-placeholder
:placeholder-text="__('Start a new discussion...')" :placeholder-text="__('Start a new discussion')"
@focus="$emit('showNewDiscussionForm')" @focus="$emit('showNewDiscussionForm')"
/> />
</template> </template>
......
...@@ -16,7 +16,6 @@ export default { ...@@ -16,7 +16,6 @@ export default {
rows="1" rows="1"
class="reply-placeholder-text-field js-vue-discussion-reply" class="reply-placeholder-text-field js-vue-discussion-reply"
:placeholder="placeholderText" :placeholder="placeholderText"
:title="__('Reply to comment')"
:aria-label="__('Reply to comment')" :aria-label="__('Reply to comment')"
@focus="$emit('focus')" @focus="$emit('focus')"
></textarea> ></textarea>
......
...@@ -1008,7 +1008,7 @@ RSpec.describe 'GFM autocomplete', :js do ...@@ -1008,7 +1008,7 @@ RSpec.describe 'GFM autocomplete', :js do
end end
def start_and_cancel_discussion def start_and_cancel_discussion
find('.js-vue-discussion-reply').click find_field('Reply…').click
fill_in('note_note', with: 'Whoops!') fill_in('note_note', with: 'Whoops!')
......
...@@ -223,7 +223,7 @@ end ...@@ -223,7 +223,7 @@ end
def write_reply_to_discussion(button_text: 'Start a review', text: 'Line is wrong', resolve: false, unresolve: false) def write_reply_to_discussion(button_text: 'Start a review', text: 'Line is wrong', resolve: false, unresolve: false)
page.within(first('.diff-files-holder .discussion-reply-holder')) do page.within(first('.diff-files-holder .discussion-reply-holder')) do
first('.js-vue-discussion-reply').click find_field('Reply…', match: :first).click
fill_in('note_note', with: text) fill_in('note_note', with: text)
......
...@@ -149,7 +149,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do ...@@ -149,7 +149,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do
it 'allows user to comment' do it 'allows user to comment' do
page.within '.diff-content' do page.within '.diff-content' do
find('.js-vue-discussion-reply').click find_field('Reply…').click
find(".js-unresolve-checkbox").set false find(".js-unresolve-checkbox").set false
find('.js-note-text').set 'testing' find('.js-note-text').set 'testing'
...@@ -179,7 +179,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do ...@@ -179,7 +179,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do
it 'allows user to comment & unresolve thread' do it 'allows user to comment & unresolve thread' do
page.within '.diff-content' do page.within '.diff-content' do
find('.js-vue-discussion-reply').click find_field('Reply…').click
find('.js-note-text').set 'testing' find('.js-note-text').set 'testing'
...@@ -208,7 +208,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do ...@@ -208,7 +208,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do
it 'allows user to comment & resolve thread' do it 'allows user to comment & resolve thread' do
page.within '.diff-content' do page.within '.diff-content' do
find('.js-vue-discussion-reply').click find_field('Reply…').click
find('.js-note-text').set 'testing' find('.js-note-text').set 'testing'
...@@ -442,7 +442,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do ...@@ -442,7 +442,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do
it 'allows user to comment & resolve thread' do it 'allows user to comment & resolve thread' do
page.within '.diff-content' do page.within '.diff-content' do
find('.js-vue-discussion-reply').click find_field('Reply…').click
find('.js-note-text').set 'testing' find('.js-note-text').set 'testing'
...@@ -461,7 +461,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do ...@@ -461,7 +461,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do
page.within '.diff-content' do page.within '.diff-content' do
click_button 'Resolve thread' click_button 'Resolve thread'
find('.js-vue-discussion-reply').click find_field('Reply…').click
find('.js-note-text').set 'testing' find('.js-note-text').set 'testing'
......
...@@ -37,7 +37,7 @@ RSpec.describe 'Merge request > User sees avatars on diff notes', :js do ...@@ -37,7 +37,7 @@ RSpec.describe 'Merge request > User sees avatars on diff notes', :js do
end end
it 'does not render avatars after commenting on discussion tab' do it 'does not render avatars after commenting on discussion tab' do
find('.js-vue-discussion-reply').click find_field('Reply…').click
page.within('.js-discussion-note-form') do page.within('.js-discussion-note-form') do
find('.note-textarea').native.send_keys('Test comment') find('.note-textarea').native.send_keys('Test comment')
...@@ -132,7 +132,7 @@ RSpec.describe 'Merge request > User sees avatars on diff notes', :js do ...@@ -132,7 +132,7 @@ RSpec.describe 'Merge request > User sees avatars on diff notes', :js do
end end
it 'adds avatar when commenting' do it 'adds avatar when commenting' do
first('.js-vue-discussion-reply').click find_field('Reply…', match: :first).click
page.within '.js-discussion-note-form' do page.within '.js-discussion-note-form' do
find('.js-note-text').native.send_keys('Test') find('.js-note-text').native.send_keys('Test')
...@@ -151,7 +151,7 @@ RSpec.describe 'Merge request > User sees avatars on diff notes', :js do ...@@ -151,7 +151,7 @@ RSpec.describe 'Merge request > User sees avatars on diff notes', :js do
it 'adds multiple comments' do it 'adds multiple comments' do
3.times do 3.times do
first('.js-vue-discussion-reply').click find_field('Reply…', match: :first).click
page.within '.js-discussion-note-form' do page.within '.js-discussion-note-form' do
find('.js-note-text').native.send_keys('Test') find('.js-note-text').native.send_keys('Test')
......
...@@ -60,7 +60,7 @@ RSpec.describe 'Merge request > User sees threads', :js do ...@@ -60,7 +60,7 @@ RSpec.describe 'Merge request > User sees threads', :js do
it 'can be replied to' do it 'can be replied to' do
within(".discussion[data-discussion-id='#{discussion_id}']") do within(".discussion[data-discussion-id='#{discussion_id}']") do
find('.js-vue-discussion-reply').click find_field('Reply…').click
fill_in 'note[note]', with: 'Test!' fill_in 'note[note]', with: 'Test!'
click_button 'Comment' click_button 'Comment'
......
...@@ -27,7 +27,7 @@ RSpec.describe 'Merge request > User sees notes from forked project', :js do ...@@ -27,7 +27,7 @@ RSpec.describe 'Merge request > User sees notes from forked project', :js do
expect(page).to have_content('A commit comment') expect(page).to have_content('A commit comment')
page.within('.discussion-notes') do page.within('.discussion-notes') do
find('.js-vue-discussion-reply').click find_field('Reply…').click
scroll_to(page.find('#note_note', visible: false)) scroll_to(page.find('#note_note', visible: false))
find('#note_note').send_keys('A reply comment') find('#note_note').send_keys('A reply comment')
find('.js-comment-button').click find('.js-comment-button').click
......
...@@ -83,7 +83,7 @@ RSpec.describe 'User comments on a diff', :js do ...@@ -83,7 +83,7 @@ RSpec.describe 'User comments on a diff', :js do
wait_for_requests wait_for_requests
first('.js-vue-discussion-reply').click find_field('Reply…', match: :first).click
find('.js-suggestion-btn').click find('.js-suggestion-btn').click
......
...@@ -31,6 +31,6 @@ describe('ReplyPlaceholder', () => { ...@@ -31,6 +31,6 @@ describe('ReplyPlaceholder', () => {
}); });
it('should render reply button', () => { it('should render reply button', () => {
expect(findTextarea().element.placeholder).toEqual(placeholderText); expect(findTextarea().attributes('placeholder')).toEqual(placeholderText);
}); });
}); });
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