2 Feature: Comment on a blog entry
3 In order to respond to a blog post
5 I need to be able to comment on a blog entry
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | testuser | Test | User | moodle@example.com |
11 | testuser2 | Test2 | User2 | moodle2@example.com |
12 And I log in as "admin"
13 And I am on site homepage
14 And I turn editing mode on
15 # TODO MDL-57120 "Site blogs" link not accessible without navigation block.
16 And I add the "Navigation" block if not present
17 And I configure the "Navigation" block
18 And I set the following fields to these values:
19 | Page contexts | Display throughout the entire site |
20 And I press "Save changes"
22 And I log in as "testuser"
23 And I navigate to "Site blogs" node in "Site pages"
24 And I follow "Add a new entry"
25 And I set the following fields to these values:
26 | Entry title | Blog post from user 1 |
27 | Blog entry body | User 1 blog post content |
28 And I press "Save changes"
32 Scenario: Commenting on my own blog entry
33 Given I am on site homepage
34 And I log in as "testuser"
35 And I navigate to "Site blogs" node in "Site pages"
36 And I follow "Blog post from user 1"
37 And I should see "User 1 blog post content"
38 And I follow "Comments (0)"
39 When I set the field "content" to "$My own >nasty< \"string\"!"
40 And I follow "Save comment"
41 Then I should see "$My own >nasty< \"string\"!"
42 And I set the field "content" to "Another $Nasty <string?>"
43 And I follow "Save comment"
44 And I should see "Comments (2)" in the ".comment-link" "css_element"
47 Scenario: Deleting my own comment
48 Given I am on site homepage
49 And I log in as "testuser"
50 And I navigate to "Site blogs" node in "Site pages"
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 set the field "content" to "$My own >nasty< \"string\"!"
55 And I follow "Save comment"
56 When I click on ".comment-delete a" "css_element"
57 # Waiting for the animation to finish.
58 And I wait "4" seconds
59 Then I should not see "$My own >nasty< \"string\"!"
60 And I follow "Blog post from user 1"
61 And I click on ".comment-link" "css_element"
62 And I should not see "$My own >nasty< \"string\"!"
63 And I should see "Comments (0)" in the ".comment-link" "css_element"
66 Scenario: Commenting on someone's blog post
67 Given I am on site homepage
68 And I log in as "testuser2"
69 And I am on site homepage
70 And I navigate to "Site blogs" node in "Site pages"
71 And I follow "Blog post from user 1"
72 When I follow "Comments (0)"
73 And I set the field "content" to "$My own >nasty< \"string\"!"
74 And I follow "Save comment"
75 Then I should see "$My own >nasty< \"string\"!"