diff options
Diffstat (limited to 'spec/support/features/discussion_comments_shared_example.rb')
-rw-r--r-- | spec/support/features/discussion_comments_shared_example.rb | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/spec/support/features/discussion_comments_shared_example.rb b/spec/support/features/discussion_comments_shared_example.rb index bb4542b1683..81cb94ab8c4 100644 --- a/spec/support/features/discussion_comments_shared_example.rb +++ b/spec/support/features/discussion_comments_shared_example.rb @@ -14,6 +14,8 @@ shared_examples 'discussion comments' do |resource_name| find(submit_selector).click + wait_for_requests + find(comments_selector, match: :first) new_comment = all(comments_selector).last @@ -26,6 +28,7 @@ shared_examples 'discussion comments' do |resource_name| find("#{form_selector} .note-textarea").send_keys('a') find(close_selector).click + wait_for_requests find(comments_selector, match: :first) find("#{comments_selector}.system-note") @@ -76,12 +79,22 @@ shared_examples 'discussion comments' do |resource_name| it 'clicking the ul padding or divider should not change the text' do find(menu_selector).trigger 'click' - expect(page).to have_selector menu_selector - expect(find(dropdown_selector)).to have_content 'Comment' + if resource_name == 'issue' + expect(find(dropdown_selector)).to have_content 'Comment' + + find(toggle_selector).click + find("#{menu_selector} .divider").trigger 'click' + else + find(menu_selector).trigger 'click' - find("#{menu_selector} .divider").trigger 'click' + expect(page).to have_selector menu_selector + expect(find(dropdown_selector)).to have_content 'Comment' + + find("#{menu_selector} .divider").trigger 'click' + + expect(page).to have_selector menu_selector + end - expect(page).to have_selector menu_selector expect(find(dropdown_selector)).to have_content 'Comment' end @@ -91,9 +104,8 @@ shared_examples 'discussion comments' do |resource_name| all("#{menu_selector} li").last.click end - it 'updates the submit button text, note_type input and closes the dropdown' do + it 'updates the submit button text and closes the dropdown' do expect(find(dropdown_selector)).to have_content 'Start discussion' - expect(find("#{form_selector} #note_type", visible: false).value).to eq('DiscussionNote') expect(page).not_to have_selector menu_selector end @@ -157,9 +169,8 @@ shared_examples 'discussion comments' do |resource_name| find("#{menu_selector} li", match: :first).click end - it 'updates the submit button text, clears the note_type input and closes the dropdown' do + it 'updates the submit button text and closes the dropdown' do expect(find(dropdown_selector)).to have_content 'Comment' - expect(find("#{form_selector} #note_type", visible: false).value).to eq('') expect(page).not_to have_selector menu_selector end |