comments.feature 3.84 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
@javascript
Feature: commenting
  In order to tell Alice how great the picture of her dog is
  As Alice's friend
  I want to comment on her post

  Background:
    Given following users exist:
      | username    | email             |
      | Bob Jones   | bob@bob.bob       |
      | 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
14
    And I sign in as "bob@bob.bob"
15 16

  Scenario: comment on a post from within a user's stream
17
    When I am on "alice@alice.alice"'s page
18 19 20 21
    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?    |
22
    And I reject the alert after I follow "My activity"
23 24 25 26 27
    And I press "Comment"
    Then I should see "is that a poodle?" within ".comment"
    And I should see "less than a minute ago" within ".comment time"

  Scenario: delete a comment
28
    When "bob@bob.bob" has commented "is that a poodle?" on "Look at this dog"
29
    And I am on "alice@alice.alice"'s page
30 31
    Then I should see "is that a poodle?"
    When I confirm the alert after I click to delete the first comment
32 33 34 35
    Then I should not see "is that a poodle?"

  Scenario: expand the comment form in the main stream and an individual aspect stream
    Then I should see "Look at this dog"
36
    And the first comment field should be closed
37 38 39 40 41
    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"
42
    And the first comment field should be closed
43 44 45 46
    When I focus the comment field
    Then the first comment field should be open

  Scenario: comment on a status show page
47
    When I am on "alice@alice.alice"'s page
48 49 50
    Then I should see "Look at this dog"
    When I follow "less than a minute ago"
    Then I should see "Look at this dog"
51
    When I make a show page comment "I think that’s a cat"
52 53
    Then I should see "less than a minute ago" within "#comments"
    When I go to "alice@alice.alice"'s page
54
    Then I should see "I think that’s a cat"
55 56

  Scenario: permalink to comment from within a users stream
57 58
    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"
59 60
    And I am on "alice@alice.alice"'s page
    Then I should see "Look at this dog"
61
    And I should see "I think that’s a cat" within ".comment:last-child"
62
    When I follow "less than a minute ago" within ".comment:last-child"
63 64
    Then I should see "Look at this dog" within "#single-post-content"
    And I should see "I think that’s a cat" within ".comment .highlighted"
65 66 67
    And I should have scrolled down

  Scenario: permalink to comment from a status show page
68 69
    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"
70 71
    And I am on "alice@alice.alice"'s page
    Then I should see "Look at this dog"
72 73
    When I follow "less than a minute ago" within "span.details.gray"
    Then I should see "I think that’s a cat" within ".comments .comment:last-child"
74
    When I follow "less than a minute ago" within ".comments .comment:last-child"
75
    Then I should see "I think that’s a cat" within ".comments .comment .highlighted"
76
    And I should have scrolled down
77 78 79 80 81 82 83 84 85 86 87 88 89

  Scenario: Show more comments after loading likes
    When "alice@alice.alice" has commented a lot on "Look at this dog"
    And "alice@alice.alice" has liked the post "Look at this dog"
    And I am on "alice@alice.alice"'s page
    Then I should see "Look at this dog"
    And I should not see "Comment 2"

    When I follow "1 Like"
    Then I should not see "1 Like"

    When I click on selector ".toggle_post_comments"
    Then I should see "Comment 2"