cirandas.net

ref: master

features/comment.feature


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
Feature: comment
  As a visitor
  I want to post comments

  Background:
    Given the following users
      | login   |
      | booking |
    And the following articles
      | owner   | name                 |
      | booking | article to comment   |
      | booking | article with comment |
    And the following comments
      | article              | author  | title | body         |
      | article with comment | booking | hi    | how are you? |
      | article with comment | booking | hello | i am fine    |
    And feature "captcha_for_logged_users" is disabled on environment
    And I am logged in as "booking"

  # This test requires some way to overcome the captcha with unauthenticated
  # user.
  @selenium-fixme
  Scenario: post a comment while not authenticated
    Given I am on /booking/article-to-comment
    And I follow "Post a comment"
    And I fill in "Name" with "Joey Ramone"
    And I fill in "e-mail" with "joey@ramones.com"
    And I fill in "Title" with "Hey ho, let's go!"
    And I fill in "Enter your comment" with "Hey ho, let's go!"
    When I press "Post comment"
    Then I should see "Hey ho, let's go"

  @selenium
  Scenario: post comment while authenticated
    Given I am on /booking/article-to-comment
    And I follow "Post a comment"
    And I fill in "Title" with "Hey ho, let's go!"
    And I fill in "Enter your comment" with "Hey ho, let's go!"
    When I press "Post comment"
    Then I should see "Hey ho, let"

  @selenium-fixme
  Scenario: redirect to right place after comment a picture
    Given the following files
      | owner   | file      | mime      |
      | booking | rails.png | image/png |
    And I am on /booking/rails.png?view=true
    And I follow "Post a comment"
    And I fill in "Title" with "Hey ho, let's go!"
    And I fill in "Enter your comment" with "Hey ho, let's go!"
    When I press "Post comment"
    Then I should be exactly on /booking/rails.png?view=true

  @selenium
  Scenario: show error messages when make a blank comment
    Given I am on /booking/article-to-comment
    And I follow "Post a comment"
    When I press "Post comment"
    Then I should see "Body can't be blank"

  @selenium-fixme
  Scenario: disable post comment button
    Given I am on /booking/article-to-comment
    And I follow "Post a comment"
    And I fill in "Title" with "Hey ho, let's go!"
    And I fill in "Enter your comment" with "Hey ho, let's go!"
    When I press "Post comment"
# Implement these steps...
#    Then "Post comment" button should not be enabled
#    And I should see "Hey ho, let's go"

  @selenium
  Scenario: render comment form and go to bottom
    Given I am on /booking/article-to-comment
    When I follow "Post a comment"
    Then I should see "Enter your comment"
    And I should be on /booking/article-to-comment

  @selenium
  Scenario: keep comments field filled while trying to do a comment
    Given I am on /booking/article-to-comment
    And I follow "Post a comment"
    And I fill in "Title" with "Joey Ramone"
    When I press "Post comment"
    Then the "Title" field should contain "Joey Ramone"
    And I should see "Body can't be blank"

  @selenium
  Scenario: wrong comment doesn't increment comment counter
    Given I am on /booking/article-with-comment
    And I follow "Post a comment"
    When I press "Post comment"
    And I should see "2 comments"

  @selenium
  Scenario: hide post a comment button when clicked
    Given I am on /booking/article-to-comment
    And I follow "Post a comment"
    Then "Post comment" should not be visible within "#article"