Merge branch 'MDL-66226-master-2' of https://github.com/snake/moodle
[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:
759b323e 8 Given the following "users" exist:
b75f1575 9 | username | firstname | lastname | email |
0fe86bbd
RT
10 | testuser | Test | User | moodle@example.com |
11 | testuser2 | Test2 | User2 | moodle2@example.com |
7a12a02d
MG
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"
21 And I log out
b75f1575 22 And I log in as "testuser"
02fda279
VDF
23 And I click on "Site pages" "list_item" in the "Navigation" "block"
24 And I click on "Site blogs" "link" in the "Navigation" "block"
b75f1575 25 And I follow "Add a new entry"
f083d614 26 And I set the following fields to these values:
b75f1575
FM
27 | Entry title | Blog post from user 1 |
28 | Blog entry body | User 1 blog post content |
29 And I press "Save changes"
30 And I log out
31
32 @javascript
33 Scenario: Commenting on my own blog entry
ef679672 34 Given I am on site homepage
b75f1575 35 And I log in as "testuser"
02fda279
VDF
36 And I click on "Site pages" "list_item" in the "Navigation" "block"
37 And I click on "Site blogs" "link" in the "Navigation" "block"
b75f1575
FM
38 And I follow "Blog post from user 1"
39 And I should see "User 1 blog post content"
40 And I follow "Comments (0)"
f083d614 41 When I set the field "content" to "$My own >nasty< \"string\"!"
b75f1575 42 And I follow "Save comment"
b75f1575 43 Then I should see "$My own >nasty< \"string\"!"
f083d614 44 And I set the field "content" to "Another $Nasty <string?>"
b75f1575 45 And I follow "Save comment"
b75f1575
FM
46 And I should see "Comments (2)" in the ".comment-link" "css_element"
47
48 @javascript
49 Scenario: Deleting my own comment
ef679672 50 Given I am on site homepage
b75f1575 51 And I log in as "testuser"
02fda279
VDF
52 And I click on "Site pages" "list_item" in the "Navigation" "block"
53 And I click on "Site blogs" "link" in the "Navigation" "block"
b75f1575
FM
54 And I follow "Blog post from user 1"
55 And I should see "User 1 blog post content"
56 And I follow "Comments (0)"
f083d614 57 And I set the field "content" to "$My own >nasty< \"string\"!"
b75f1575 58 And I follow "Save comment"
b75f1575 59 When I click on ".comment-delete a" "css_element"
333db2e9 60 # Waiting for the animation to finish.
d1e55a47 61 And I wait "4" seconds
b75f1575
FM
62 Then I should not see "$My own >nasty< \"string\"!"
63 And I follow "Blog post from user 1"
64 And I click on ".comment-link" "css_element"
65 And I should not see "$My own >nasty< \"string\"!"
66 And I should see "Comments (0)" in the ".comment-link" "css_element"
67
68 @javascript
69 Scenario: Commenting on someone's blog post
ef679672 70 Given I am on site homepage
b75f1575 71 And I log in as "testuser2"
ef679672 72 And I am on site homepage
02fda279
VDF
73 And I click on "Site pages" "list_item" in the "Navigation" "block"
74 And I click on "Site blogs" "link" in the "Navigation" "block"
b75f1575
FM
75 And I follow "Blog post from user 1"
76 When I follow "Comments (0)"
f083d614 77 And I set the field "content" to "$My own >nasty< \"string\"!"
b75f1575 78 And I follow "Save comment"
550d842e 79 Then I should see "$My own >nasty< \"string\"!"