Avoid manual commenting in cukes
This commit is contained in:
parent
3bb28ec016
commit
faf23bf68c
5 changed files with 44 additions and 113 deletions
|
|
@ -9,15 +9,9 @@ Feature: The activity stream
|
|||
When "alice@alice.alice" has posted a status message with a photo
|
||||
|
||||
Scenario: delete a comment
|
||||
When I sign in as "bob@bob.bob"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
Then I should see "Look at this dog"
|
||||
When I focus the comment field
|
||||
And I fill in the following:
|
||||
| text | is that a poodle? |
|
||||
And I press "Comment"
|
||||
|
||||
When I go to the activity stream page
|
||||
When "bob@bob.bob" has commented "is that a poodle?" on "Look at this dog"
|
||||
And I sign in as "bob@bob.bob"
|
||||
And I go to the activity stream page
|
||||
Then I should see "Look at this dog"
|
||||
And I should see "is that a poodle?"
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ Feature: commenting
|
|||
| Alice Smith | alice@alice.alice |
|
||||
And a user with email "bob@bob.bob" is connected with "alice@alice.alice"
|
||||
When "alice@alice.alice" has posted a status message with a photo
|
||||
And I sign in as "bob@bob.bob"
|
||||
|
||||
Scenario: comment on a post from within a user's stream
|
||||
When I sign in as "bob@bob.bob"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
When I am on "alice@alice.alice"'s page
|
||||
Then I should see "Look at this dog"
|
||||
When I focus the comment field
|
||||
And I fill in the following:
|
||||
|
|
@ -24,63 +24,52 @@ Feature: commenting
|
|||
And I should see "less than a minute ago" within ".comment time"
|
||||
|
||||
Scenario: delete a comment
|
||||
When I sign in as "bob@bob.bob"
|
||||
When "bob@bob.bob" has commented "is that a poodle?" on "Look at this dog"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
Then I should see "Look at this dog"
|
||||
When I comment "is that a poodle?" on "Look at this dog"
|
||||
And I click to delete the first comment
|
||||
Then I should see "is that a poodle?"
|
||||
When I click to delete the first comment
|
||||
And I confirm the alert
|
||||
Then I should not see "is that a poodle?"
|
||||
|
||||
Scenario: expand the comment form in the main stream and an individual aspect stream
|
||||
When I sign in as "bob@bob.bob"
|
||||
Then I should see "Look at this dog"
|
||||
Then the first comment field should be closed
|
||||
And the first comment field should be closed
|
||||
When I focus the comment field
|
||||
Then the first comment field should be open
|
||||
|
||||
When I select only "Besties" aspect
|
||||
Then I should see "Look at this dog"
|
||||
Then the first comment field should be closed
|
||||
And the first comment field should be closed
|
||||
When I focus the comment field
|
||||
Then the first comment field should be open
|
||||
|
||||
Scenario: comment on a status show page
|
||||
When I sign in as "bob@bob.bob"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
When I am on "alice@alice.alice"'s page
|
||||
Then I should see "Look at this dog"
|
||||
When I follow "less than a minute ago"
|
||||
Then I should see "Look at this dog"
|
||||
And I make a show page comment "I think thats a cat"
|
||||
And I make a show page comment "I think that’s a cat"
|
||||
Then I should see "less than a minute ago" within "#comments"
|
||||
When I go to "alice@alice.alice"'s page
|
||||
Then I should see "I think thats a cat"
|
||||
Then I should see "I think that’s a cat"
|
||||
|
||||
Scenario: permalink to comment from within a users stream
|
||||
When I sign in as "bob@bob.bob"
|
||||
When "bob@bob.bob" has commented a lot on "Look at this dog"
|
||||
And "bob@bob.bob" has commented "I think that’s a cat" on "Look at this dog"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
Then I should see "Look at this dog"
|
||||
When I comment a lot on "Look at this dog"
|
||||
And I focus the comment field
|
||||
And I fill in the following:
|
||||
| text | I think thats a cat |
|
||||
And I press "Comment"
|
||||
Then I should see "I think thats a cat" within ".comment:last-child"
|
||||
And I should see "I think that’s a cat" within ".comment:last-child"
|
||||
When I follow "less than a minute ago" within ".comment:last-child"
|
||||
Then I should see "I think thats a cat" within ".comment .highlighted"
|
||||
Then I should see "I think that’s a cat" within ".comment .highlighted"
|
||||
And I should have scrolled down
|
||||
|
||||
Scenario: permalink to comment from a status show page
|
||||
When I sign in as "bob@bob.bob"
|
||||
When "bob@bob.bob" has commented a lot on "Look at this dog"
|
||||
And "bob@bob.bob" has commented "I think that’s a cat" on "Look at this dog"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
Then I should see "Look at this dog"
|
||||
When I comment a lot on "Look at this dog"
|
||||
When I focus the comment field
|
||||
And I fill in the following:
|
||||
| text | I think thats a cat |
|
||||
And I press "Comment"
|
||||
When I follow "less than a minute ago" within "span.details.gray"
|
||||
Then I should see "I think thats a cat" within ".comments .comment:last-child"
|
||||
Then I should see "I think that’s a cat" within ".comments .comment:last-child"
|
||||
When I follow "less than a minute ago" within ".comments .comment:last-child"
|
||||
Then I should see "I think thats a cat" within ".comments .comment .highlighted"
|
||||
Then I should see "I think that’s a cat" within ".comments .comment .highlighted"
|
||||
And I should have scrolled down
|
||||
|
|
|
|||
|
|
@ -54,14 +54,7 @@ Feature: Notifications
|
|||
Scenario: someone comments on my post
|
||||
Given a user with email "bob@bob.bob" is connected with "alice@alice.alice"
|
||||
And "alice@alice.alice" has a public post with text "check this out!"
|
||||
When I sign in as "bob@bob.bob"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
And I focus the comment field
|
||||
And I fill in the following:
|
||||
| text | great post! |
|
||||
And I press "Comment"
|
||||
Then I should see "less than a minute ago" within ".comment"
|
||||
And I sign out
|
||||
And "bob@bob.bob" has commented "great post!" on "check this out!"
|
||||
When I sign in as "alice@alice.alice"
|
||||
And I follow "Notifications" in the header
|
||||
Then the notification dropdown should be visible
|
||||
|
|
@ -70,23 +63,9 @@ Feature: Notifications
|
|||
|
||||
Scenario: unconnected user comments in reply to comment by another user who commented a post of someone who she shares with
|
||||
Given "alice@alice.alice" has a public post with text "check this out!"
|
||||
And "bob@bob.bob" has commented "great post, alice!" on "check this out!"
|
||||
And "carol@carol.carol" has commented "great comment, bob!" on "check this out!"
|
||||
When I sign in as "bob@bob.bob"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
And I focus the comment field
|
||||
And I fill in the following:
|
||||
| text | great post, alice! |
|
||||
And I press "Comment"
|
||||
Then I should see "less than a minute ago" within ".comment"
|
||||
When I sign out
|
||||
And I sign in as "carol@carol.carol"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
And I focus the comment field
|
||||
And I fill in the following:
|
||||
| text | great comment, bob! |
|
||||
And I press "Comment"
|
||||
Then I should see "less than a minute ago" within ".comment:nth-child(2)"
|
||||
When I sign out
|
||||
And I sign in as "bob@bob.bob"
|
||||
And I follow "Notifications" in the header
|
||||
Then the notification dropdown should be visible
|
||||
And I should see "also commented on"
|
||||
|
|
@ -95,23 +74,9 @@ Feature: Notifications
|
|||
|
||||
Scenario: unconnected user comments in reply to my comment to her post
|
||||
Given "alice@alice.alice" has a public post with text "check this out!"
|
||||
And "carol@carol.carol" has commented "great post, alice!" on "check this out!"
|
||||
And "alice@alice.alice" has commented "great comment, carol!" on "check this out!"
|
||||
When I sign in as "carol@carol.carol"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
And I focus the comment field
|
||||
And I fill in the following:
|
||||
| text | great post, alice! |
|
||||
And I press "Comment"
|
||||
Then I should see "less than a minute ago" within ".comment"
|
||||
When I sign out
|
||||
And I sign in as "alice@alice.alice"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
And I focus the comment field
|
||||
And I fill in the following:
|
||||
| text | great post, carol! |
|
||||
And I press "Comment"
|
||||
Then I should see "less than a minute ago" within ".comment:nth-child(2)"
|
||||
When I sign out
|
||||
And I sign in as "carol@carol.carol"
|
||||
And I follow "Notifications" in the header
|
||||
Then the notification dropdown should be visible
|
||||
And I should see "also commented on"
|
||||
|
|
@ -120,23 +85,9 @@ Feature: Notifications
|
|||
Scenario: connected user comments in reply to my comment to an unconnected user's post
|
||||
Given "alice@alice.alice" has a public post with text "check this out!"
|
||||
And a user with email "bob@bob.bob" is connected with "carol@carol.carol"
|
||||
And "carol@carol.carol" has commented "great post, alice!" on "check this out!"
|
||||
And "bob@bob.bob" has commented "great post!" on "check this out!"
|
||||
When I sign in as "carol@carol.carol"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
And I focus the comment field
|
||||
And I fill in the following:
|
||||
| text | great post! |
|
||||
And I press "Comment"
|
||||
Then I should see "less than a minute ago" within ".comment"
|
||||
When I sign out
|
||||
And I sign in as "bob@bob.bob"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
And I focus the comment field
|
||||
And I fill in the following:
|
||||
| text | great post! |
|
||||
And I press "Comment"
|
||||
Then I should see "less than a minute ago" within ".comment:nth-child(2)"
|
||||
When I sign out
|
||||
And I sign in as "carol@carol.carol"
|
||||
And I follow "Notifications" in the header
|
||||
Then the notification dropdown should be visible
|
||||
And I should see "also commented on"
|
||||
|
|
|
|||
|
|
@ -11,20 +11,25 @@ Then /^the first comment field should be closed$/ do
|
|||
page.should_not have_selector("#main_stream .stream_element .new_comment", match: :first)
|
||||
end
|
||||
|
||||
When /^I comment "([^"]*)" on "([^"]*)"$/ do |comment_text, post_text|
|
||||
comment_on_post(post_text, comment_text)
|
||||
end
|
||||
|
||||
When /^I make a show page comment "([^"]*)"$/ do |comment_text|
|
||||
comment_on_show_page(comment_text)
|
||||
end
|
||||
|
||||
When /^I comment a lot on "([^"]*)"$/ do |post_text|
|
||||
within_post(post_text) do
|
||||
(1..10).each do |n|
|
||||
focus_comment_box
|
||||
make_comment(n)
|
||||
end
|
||||
end
|
||||
Given /^"([^"]*)" has commented "([^"]*)" on "([^"]*)"$/ do |email, comment_text, post_text|
|
||||
user = User.find_by(email: email)
|
||||
post = StatusMessage.find_by(text: post_text)
|
||||
user.comment!(post, comment_text)
|
||||
end
|
||||
|
||||
Given /^"([^"]*)" has commented a lot on "([^"]*)"$/ do |email, post_text|
|
||||
user = User.find_by(email: email)
|
||||
post = StatusMessage.find_by(text: post_text)
|
||||
time = Time.zone.now - 1.year
|
||||
Timecop.freeze do
|
||||
(1..10).each do |n|
|
||||
Timecop.travel time += 1.day
|
||||
user.comment!(post, "Comment #{n}")
|
||||
end
|
||||
end
|
||||
Timecop.return
|
||||
end
|
||||
|
|
|
|||
|
|
@ -110,14 +110,6 @@ module PublishingCukeHelpers
|
|||
all('.stream_element')
|
||||
end
|
||||
|
||||
def comment_on_post(post_text, comment_text)
|
||||
within_post(post_text) do
|
||||
focus_comment_box
|
||||
make_comment(comment_text)
|
||||
end
|
||||
step %Q(I should see "#{comment_text}" within ".comment")
|
||||
end
|
||||
|
||||
def comment_on_show_page(comment_text)
|
||||
within("#single-post-interactions") do
|
||||
make_comment(comment_text)
|
||||
|
|
|
|||
Loading…
Reference in a new issue