1 |
efrain |
1 |
@mod @mod_forum
|
|
|
2 |
Feature: Blog posts are always displayed in reverse chronological order
|
|
|
3 |
In order to use forum as a blog
|
|
|
4 |
As a user
|
|
|
5 |
I need to see most recent blog posts first
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
| student1 | Student | 1 | student1@example.com |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | category |
|
|
|
14 |
| Course 1 | C1 | 0 |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| student1 | C1 | student |
|
|
|
19 |
And the following "activity" exists:
|
|
|
20 |
| course | C1 |
|
|
|
21 |
| activity | forum |
|
|
|
22 |
| name | Course blog forum |
|
|
|
23 |
| type | blog |
|
|
|
24 |
|
|
|
25 |
#
|
|
|
26 |
# We need javascript/wait to prevent creation of the posts in the same second. The threads
|
|
|
27 |
# would then ignore each other in the prev/next navigation as the Forum is unable to compute
|
|
|
28 |
# the correct order.
|
|
|
29 |
#
|
|
|
30 |
@javascript
|
|
|
31 |
Scenario: Replying to a blog post or editing it does not affect its display order
|
|
|
32 |
Given I am on the "Course blog forum" "forum activity" page logged in as student1
|
|
|
33 |
#
|
|
|
34 |
# Add three posts into the blog.
|
|
|
35 |
#
|
|
|
36 |
When I add a new topic to "Course blog forum" forum with:
|
|
|
37 |
| Subject | Blog post 1 |
|
|
|
38 |
| Message | This is the first post |
|
|
|
39 |
And I add a new topic to "Course blog forum" forum with:
|
|
|
40 |
| Subject | Blog post 2 |
|
|
|
41 |
| Message | This is the second post |
|
|
|
42 |
And I add a new topic to "Course blog forum" forum with:
|
|
|
43 |
| Subject | Blog post 3 |
|
|
|
44 |
| Message | This is the third post |
|
|
|
45 |
#
|
|
|
46 |
# Edit one of the blog posts.
|
|
|
47 |
#
|
|
|
48 |
And I click on "Edit" "link" in the "//div[@aria-label='Blog post 2 by Student 1']" "xpath_element"
|
|
|
49 |
And I set the following fields to these values:
|
|
|
50 |
| Subject | Edited blog post 2 |
|
|
|
51 |
And I press "Save changes"
|
|
|
52 |
And I wait to be redirected
|
|
|
53 |
And I log out
|
|
|
54 |
#
|
|
|
55 |
# Reply to another blog post.
|
|
|
56 |
#
|
|
|
57 |
And I am on the "Course blog forum" "forum activity" page logged in as teacher1
|
|
|
58 |
And I click on "Discuss this topic" "link" in the "//div[@aria-label='Blog post 1 by Student 1']" "xpath_element"
|
|
|
59 |
And I reply "Blog post 1" post from "Course blog forum" forum with:
|
|
|
60 |
| Message | Reply to the first post |
|
|
|
61 |
And I am on the "Course blog forum" "forum activity" page
|
|
|
62 |
#
|
|
|
63 |
# Make sure the order of the blog posts is still reverse chronological.
|
|
|
64 |
#
|
|
|
65 |
Then I should see "This is the third post" in the "//article[position()=1]" "xpath_element"
|
|
|
66 |
And I should see "This is the second post" in the "//article[position()=2]" "xpath_element"
|
|
|
67 |
And I should see "This is the first post" in the "//article[position()=3]" "xpath_element"
|
|
|
68 |
#
|
|
|
69 |
# Make sure the next/prev navigation uses the same order of the posts.
|
|
|
70 |
#
|
|
|
71 |
And I click on "Discuss this topic" "link" in the "//div[@aria-label='Edited blog post 2 by Student 1']" "xpath_element"
|
|
|
72 |
And "//a[@aria-label='Next discussion: Blog post 3']" "xpath_element" should exist
|
|
|
73 |
And "//a[@aria-label='Previous discussion: Blog post 1']" "xpath_element" should exist
|