-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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] Post Full Page, Then Immediately Comment #8879
Conversation
Codecov Report
|
test/system/comment_test.rb
Outdated
page.evaluate_script("addComment('#{comment_text}', '/comment/create/#{nodes(node_name).nid.to_s}')") | ||
assert_selector('#comments-list .comment-body p', text: comment_text) | ||
end | ||
|
||
test "#{page_type_string}: reply to existing comment" do | ||
node_name == :wiki_page ? (visit nodes(node_name).path + '/comments') : (visit nodes(node_name).path) | ||
visit get_visit_path(node_name, nodes(node_name).path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is repeated 2 times, is it intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Sagarpreet! Which part are you thinking about?
visit get_visit_path
looks a little redundant and confusing, maybe I should rename the method to something like get_path or get_path_string.
- visit is the testing method that visits the page
- get_visit_path is a helper function I wrote to retrieve the path for the testing node. mainly because wiki comments are only viewable at /wiki/wiki-name/comments. (i have to add '/comments' to the end of the path string)
- there were two addComment tests that existed before I was an intern. for some reason, there are two tests for this function. one tests addComment(text, URL), the other just addComment(text).
- I was thinking that maybe these tests aren't necessary, aren't really 'system' tests, and could be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like get_path
here, thanks!
If the 2 old tests are redundant and you're confident we test them in other ways, that's fine. Are they not system tests because they test only the functions and not the full-stack interaction? I think there may be an ambiguity because there wasn't another way to test JS functions, and these would address both JS and Ruby, so they are "mostly-full-stack" still... what do you think?
My apologies for missing this PR i see it's been open a while. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can merge before or after changing to get_path
and if you'd still like to eliminate the old tests we can do that in another PR, perhaps? Thank you!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to get_path
...
Re: addComment
, that's a good point, I guess the JS wouldn't be tested in any other way besides here. They're also pretty lightweight and fast-running (compared to mine 😛).
It seems like addComment
isn't used anywhere on the site besides in these tests... Yet! I guess that'll be one of the things I do, to try to implement it in most comment forms (it's on my to-dos in the planning issue)... I think once that goes live, then these tests could be removed, because the the manual commenting tests would run via addComment
.
@@ -80,8 +85,47 @@ def setup | |||
find("p", text: comment_response_text) | |||
end | |||
|
|||
test "post #{page_type_string}, then comment on FRESH #{page_type_string}" do | |||
title_text, body_text = String.new, String.new | |||
case page_type_string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, this is really cool !!
How is page_type_string
getting substituted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's happening here:
Lines 43 to 50 in 9fb5d65
# used in comment_test.rb | |
def page_types | |
{ | |
:note => :comment_note, | |
:question => :comment_question, | |
:wiki => :wiki_page | |
} | |
end |
Helper function that returns the name of the node fixture :)
Ready to merge! |
Awesome! Just one conflict to resolve!! |
Resolved! |
Code Climate has analyzed commit 9b5632a and detected 0 issues on this pull request. View more on Code Climate. |
Fantastic!!!! |
* new test: post fresh page, then comment on it * refactored get_path method for readability
* new test: post fresh page, then comment on it * refactored get_path method for readability
* new test: post fresh page, then comment on it * refactored get_path method for readability
* new test: post fresh page, then comment on it * refactored get_path method for readability
Merge this PR first! (I have another one open at #8881)
(This PR is part of the larger Comment Editor Overhaul Project with Outreachy. Refer to Planning Issue #9069 for more context)