1 |
efrain |
1 |
@core @core_blog @javascript
|
|
|
2 |
Feature: Comment on a blog entry
|
|
|
3 |
In order to respond to a blog post
|
|
|
4 |
As a user
|
|
|
5 |
I need to be able to comment on a blog entry
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
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 the following "core_blog > entries" exist:
|
|
|
13 |
| subject | body | user |
|
|
|
14 |
| Blog post from user 1 | User 1 blog post content | testuser |
|
|
|
15 |
And I log in as "admin"
|
|
|
16 |
And I am on site homepage
|
|
|
17 |
And I turn editing mode on
|
|
|
18 |
And the following config values are set as admin:
|
|
|
19 |
| unaddableblocks | | theme_boost|
|
|
|
20 |
# TODO MDL-57120 "Site blogs" link not accessible without navigation block.
|
|
|
21 |
And I add the "Navigation" block if not present
|
|
|
22 |
And I configure the "Navigation" block
|
|
|
23 |
And I set the following fields to these values:
|
|
|
24 |
| Page contexts | Display throughout the entire site |
|
|
|
25 |
And I press "Save changes"
|
|
|
26 |
And I log out
|
|
|
27 |
|
|
|
28 |
Scenario: Commenting on my own blog entry
|
|
|
29 |
Given I log in as "testuser"
|
|
|
30 |
And I click on "Site pages" "list_item" in the "Navigation" "block"
|
|
|
31 |
And I click on "Site blogs" "link" in the "Navigation" "block"
|
|
|
32 |
And I follow "Blog post from user 1"
|
|
|
33 |
And I should see "User 1 blog post content"
|
|
|
34 |
And I follow "Comments (0)"
|
|
|
35 |
When I set the field "content" to "$My own >nasty< \"string\"!"
|
|
|
36 |
And I follow "Save comment"
|
|
|
37 |
Then I should see "$My own >nasty< \"string\"!"
|
|
|
38 |
And I set the field "content" to "Another $Nasty <string?>"
|
|
|
39 |
And I follow "Save comment"
|
|
|
40 |
And I should see "Comments (2)" in the ".comment-link" "css_element"
|
|
|
41 |
|
|
|
42 |
Scenario: Deleting my own comment
|
|
|
43 |
Given I log in as "testuser"
|
|
|
44 |
And I click on "Site pages" "list_item" in the "Navigation" "block"
|
|
|
45 |
And I click on "Site blogs" "link" in the "Navigation" "block"
|
|
|
46 |
And I follow "Blog post from user 1"
|
|
|
47 |
And I should see "User 1 blog post content"
|
|
|
48 |
And I follow "Comments (0)"
|
|
|
49 |
And I set the field "content" to "$My own >nasty< \"string\"!"
|
|
|
50 |
And I follow "Save comment"
|
|
|
51 |
When I click on ".comment-delete a" "css_element"
|
|
|
52 |
# Waiting for the animation to finish.
|
|
|
53 |
And I wait "4" seconds
|
|
|
54 |
Then I should not see "$My own >nasty< \"string\"!"
|
|
|
55 |
And I follow "Blog post from user 1"
|
|
|
56 |
And I click on ".comment-link" "css_element"
|
|
|
57 |
And I should not see "$My own >nasty< \"string\"!"
|
|
|
58 |
And I should see "Comments (0)" in the ".comment-link" "css_element"
|
|
|
59 |
|
|
|
60 |
Scenario: Commenting on someone's blog post
|
|
|
61 |
Given I am on site homepage
|
|
|
62 |
And I log in as "testuser2"
|
|
|
63 |
And I am on site homepage
|
|
|
64 |
And I click on "Site pages" "list_item" in the "Navigation" "block"
|
|
|
65 |
And I click on "Site blogs" "link" in the "Navigation" "block"
|
|
|
66 |
And I follow "Blog post from user 1"
|
|
|
67 |
When I follow "Comments (0)"
|
|
|
68 |
And I set the field "content" to "$My own >nasty< \"string\"!"
|
|
|
69 |
And I follow "Save comment"
|
|
|
70 |
Then I should see "$My own >nasty< \"string\"!"
|