Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[System Tests] Comment Reply on Questions #8845

Merged
merged 5 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion test/fixtures/comments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,11 @@ comment_by_first_time_user:
status: 1
comment: This is comment is replied to first
timestamp: <%= Time.now.to_i + 10 %>
thread: /01
thread: /01

reply_to_this_comment:
uid: 1
nid: 37
status: 1
comment: Uhh...
timestamp: <%= Time.now.to_i + 10 %>
7 changes: 7 additions & 0 deletions test/fixtures/node_tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,10 @@ organizers-chapter:
nid: 5
date: <%= DateTime.now.to_i %>

# this tags node 37 as a question
# ultimately, this is for testing comments on that node.
question4:
tid: 35
uid: 2
nid: 37
date: <%= DateTime.now.to_i %>
14 changes: 13 additions & 1 deletion test/fixtures/nodes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -444,4 +444,16 @@ sun_question:
status: 1
type: "note"
cached_likes: 0
slug: "note-tagged-with-question-sun"
slug: "note-tagged-with-question-sun"

question4: # fresh question fixture for testing comments on question pages
nid: 37
uid: 2
title: "Can I post comments here"
path: "/notes/jeff/12-07-2020/can-i-post-comments-here"
created: <%= DateTime.new(2020,12,7).to_i %>
changed: <%= DateTime.new(2020,12,7).to_i %>
status: 1
type: "note"
cached_likes: 0
slug: jeff-12-07-2020-can-i-post-comments-here
8 changes: 8 additions & 0 deletions test/fixtures/revisions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -402,3 +402,11 @@ sun_question:
body: "This is the body"
timestamp: <%= DateTime.new(2020,2,12).to_i %>
status: 1

question4: # fresh question fixture for testing comments on question pages
nid: 37
uid: 2
title: "Can I post comments here"
body: "I'm gonna do it"
timestamp: <%= DateTime.new(2020,12,7).to_i %>
status: 1
6 changes: 6 additions & 0 deletions test/fixtures/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,9 @@ sunny_day:
sun_question:
tid: 34
name: question:sun

# this tags node 37 as a question
# ultimately, this is for testing comments on that node.
question4:
tid: 35
name: question:general
14 changes: 14 additions & 0 deletions test/system/comment_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ def setup
find("p", text: "Awesome Reply")
end

test 'question page: respond to existing comment with addComment' do
visit "/questions/jeff/12-07-2020/can-i-post-comments-here"

# find comment ID of the first comment on page
parent_id = "#" + page.find('#comments-list').first('.comment')[:id]
parent_id_num = /c(\d+)/.match(parent_id)[1] # eg. comment ID format is id="c9834"

# addComment(comment text, submitURL, comment's parent ID)
page.evaluate_script("addComment(\"no you can't\", '/comment/create/37', #{parent_id_num})")

# check for comment text
assert_selector("#{parent_id} .comment .comment-body p", text: 'no you can\'t')
end

test 'comment preview button' do
visit "/wiki/wiki-page-path/comments"

Expand Down