MDL-38330 blog: Behat tests for commenting
[moodle.git] / blog / tests / behat / comment.feature
CommitLineData
b75f1575
FM
1@blog
2Feature: Comment on a blog entry
3 In order to respond to a blog post
4 As a moodle user
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"
36 And I wait "4" seconds
37 Then I should see "$My own >nasty< \"string\"!"
38 And I fill in "content" with "Another $Nasty <string?>"
39 And I follow "Save comment"
40 And I wait "4" seconds
41 And I should see "Comments (2)" in the ".comment-link" "css_element"
42
43 @javascript
44 Scenario: Deleting my own comment
45 Given I am on homepage
46 And I log in as "testuser"
47 And I am on homepage
48 And I expand "My profile" node
49 And I expand "Blogs" node
50 And I follow "View all of my entries"
51 And I follow "Blog post from user 1"
52 And I should see "User 1 blog post content"
53 And I follow "Comments (0)"
54 And I fill in "content" with "$My own >nasty< \"string\"!"
55 And I follow "Save comment"
56 And I wait "4" seconds
57 When I click on ".comment-delete a" "css_element"
58 And I click on "Yes" "link"
59 And I wait "4" seconds
60 Then I should not see "$My own >nasty< \"string\"!"
61 And I follow "Blog post from user 1"
62 And I click on ".comment-link" "css_element"
63 And I should not see "$My own >nasty< \"string\"!"
64 And I should see "Comments (0)" in the ".comment-link" "css_element"
65
66 @javascript
67 Scenario: Commenting on someone's blog post
68 Given I am on homepage
69 And I log in as "testuser2"
70 And I am on homepage
71 And I expand "Site pages" node
72 And I follow "Site blogs"
73 And I follow "Blog post from user 1"
74 When I follow "Comments (0)"
75 And I fill in "content" with "$My own >nasty< \"string\"!"
76 And I follow "Save comment"
77 And I wait "4" seconds
78 Then I should see "$My own >nasty< \"string\"!"