Skip to content

Commit

Permalink
[Outreachy Comment Editor] New Test: Respond to Note Comment (publicl…
Browse files Browse the repository at this point in the history
…ab#8844)

* add note fixture 4 testing comments

* add comment 4 testing comment replies

* add new test: respond to note comments

* changed test name: 'respond to existing comment'
  • Loading branch information
noi5e authored and lagunasmel committed Mar 2, 2021
1 parent 10cc235 commit c3b9ed7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/fixtures/comments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,11 @@ reply_to_this_comment:
nid: 37
status: 1
comment: Uhh...
timestamp: <%= Time.now.to_i + 10 %>

note_comment_for_responses:
uid: 1
nid: 38
status: 1
comment: I do what I want!
timestamp: <%= Time.now.to_i + 10 %>
13 changes: 13 additions & 0 deletions test/system/comment_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ def setup
page.evaluate_script("addComment('hahaha', '/comment/create/38')")
assert_selector('#comments-list .comment-body p', text: 'hahaha')
end

test 'note: respond to existing comment' do
visit nodes(:comment_note).path
# find comment ID of the first comment on page
parent_id = "#" + page.find('#comments-list').first('.comment')[:id]
# comment ID format is id="c9834"
# regex to find everything after the "c"
parent_id_num = /c(\d+)/.match(parent_id)[1]
# parameters for addComment: addComment(comment text, submitURL, comment's parent ID)
page.evaluate_script("addComment(\"I admire you\", '/comment/create/#{nodes(:comment_note).nid}', #{parent_id_num})")
# check for comment text
assert_selector("#{parent_id} .comment .comment-body p", text: 'I admire you')
end

test "note: comment manually" do
visit nodes(:one).path
Expand Down

0 comments on commit c3b9ed7

Please sign in to comment.