summaryrefslogtreecommitdiff
path: root/spec/support/features/discussion_comments_shared_example.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/features/discussion_comments_shared_example.rb')
-rw-r--r--spec/support/features/discussion_comments_shared_example.rb19
1 files changed, 14 insertions, 5 deletions
diff --git a/spec/support/features/discussion_comments_shared_example.rb b/spec/support/features/discussion_comments_shared_example.rb
index c8662d41769..80604395adf 100644
--- a/spec/support/features/discussion_comments_shared_example.rb
+++ b/spec/support/features/discussion_comments_shared_example.rb
@@ -81,7 +81,10 @@ shared_examples 'discussion comments' do |resource_name|
# on issues page, the menu closes when clicking anywhere, on other pages it will
# remain open if clicking divider or menu padding, but should not change button action
- if resource_name == 'issue'
+ #
+ # if dropdown menu is not toggled (and also not present),
+ # it's "issue-type" dropdown
+ if first(menu_selector).nil?
expect(find(dropdown_selector)).to have_content 'Comment'
find(toggle_selector).click
@@ -107,8 +110,10 @@ shared_examples 'discussion comments' do |resource_name|
end
it 'updates the submit button text and closes the dropdown' do
+ button = find(submit_selector)
+
# on issues page, the submit input is a <button>, on other pages it is <input>
- if resource_name == 'issue'
+ if button.tag_name == 'button'
expect(find(submit_selector)).to have_content 'Start discussion'
else
expect(find(submit_selector).value).to eq 'Start discussion'
@@ -132,6 +137,8 @@ shared_examples 'discussion comments' do |resource_name|
describe 'creating a discussion' do
before do
find(submit_selector).click
+ wait_for_requests
+
find(comments_selector, match: :first)
end
@@ -197,11 +204,13 @@ shared_examples 'discussion comments' do |resource_name|
end
it 'updates the submit button text and closes the dropdown' do
+ button = find(submit_selector)
+
# on issues page, the submit input is a <button>, on other pages it is <input>
- if resource_name == 'issue'
- expect(find(submit_selector)).to have_content 'Comment'
+ if button.tag_name == 'button'
+ expect(button).to have_content 'Comment'
else
- expect(find(submit_selector).value).to eq 'Comment'
+ expect(button.value).to eq 'Comment'
end
expect(page).not_to have_selector menu_selector