MDL-42625 behat: Editing .feature files
[moodle.git] / blog / tests / behat / comment.feature
CommitLineData
550d842e 1@core @core_blog
b75f1575
FM
2Feature: Comment on a blog entry
3 In order to respond to a blog post
5d7b6307 4 As a user
b75f1575
FM
5 I need to be able to comment on a blog entry
6
7 Background:
8 Given the following "users" exists:
9 | username | firstname | lastname | email |
10 | testuser | Test | User | moodle@moodlemoodle.com |
11 | testuser2 | Test2 | User2 | moodle2@moodlemoodle.com |
12 And I log in as "testuser"
13 And I am on homepage
14 And I expand "My profile" node
15 And I expand "Blogs" node
16 And I follow "Add a new entry"
17 And I fill the moodle form with:
18 | Entry title | Blog post from user 1 |
19 | Blog entry body | User 1 blog post content |
20 And I press "Save changes"
21 And I log out
22
23 @javascript
24 Scenario: Commenting on my own blog entry
25 Given I am on homepage
26 And I log in as "testuser"
27 And I am on homepage
28 And I expand "My profile" node
29 And I expand "Blogs" node
30 And I follow "View all of my entries"
31 And I follow "Blog post from user 1"
32 And I should see "User 1 blog post content"
33 And I follow "Comments (0)"
34 When I fill in "content" with "$My own >nasty< \"string\"!"
35 And I follow "Save comment"
b75f1575
FM
36 Then I should see "$My own >nasty< \"string\"!"
37 And I fill in "content" with "Another $Nasty <string?>"
38 And I follow "Save comment"
b75f1575
FM
39 And I should see "Comments (2)" in the ".comment-link" "css_element"
40
41 @javascript
42 Scenario: Deleting my own comment
43 Given I am on homepage
44 And I log in as "testuser"
45 And I am on homepage
46 And I expand "My profile" node
47 And I expand "Blogs" node
48 And I follow "View all of my entries"
49 And I follow "Blog post from user 1"
50 And I should see "User 1 blog post content"
51 And I follow "Comments (0)"
52 And I fill in "content" with "$My own >nasty< \"string\"!"
53 And I follow "Save comment"
b75f1575 54 When I click on ".comment-delete a" "css_element"
333db2e9
DM
55 # Waiting for the animation to finish.
56 And I wait "2" seconds
b75f1575
FM
57 Then I should not see "$My own >nasty< \"string\"!"
58 And I follow "Blog post from user 1"
59 And I click on ".comment-link" "css_element"
60 And I should not see "$My own >nasty< \"string\"!"
61 And I should see "Comments (0)" in the ".comment-link" "css_element"
62
63 @javascript
64 Scenario: Commenting on someone's blog post
65 Given I am on homepage
66 And I log in as "testuser2"
67 And I am on homepage
68 And I expand "Site pages" node
69 And I follow "Site blogs"
70 And I follow "Blog post from user 1"
71 When I follow "Comments (0)"
72 And I fill in "content" with "$My own >nasty< \"string\"!"
73 And I follow "Save comment"
550d842e 74 Then I should see "$My own >nasty< \"string\"!"