1 |
efrain |
1 |
@mod @mod_forum
|
|
|
2 |
Feature: New discussions and discussions with recently added replies are displayed first
|
|
|
3 |
In order to use forum as a discussion tool
|
|
|
4 |
As a user
|
|
|
5 |
I need to see currently active discussions 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 general forum |
|
|
|
23 |
| idnumber | forum1 |
|
|
|
24 |
#
|
|
|
25 |
# Add three posts into the blog.
|
|
|
26 |
#
|
|
|
27 |
And the following "mod_forum > discussions" exist:
|
|
|
28 |
| user | forum | name | message | timemodified |
|
|
|
29 |
| student1 | forum1 | Forum post 1 | This is the first post | ##now +1 second## |
|
|
|
30 |
| student1 | forum1 | Forum post 2 | This is the second post | ##now +2 second## |
|
|
|
31 |
| student1 | forum1 | Forum post 3 | This is the third post | ##now +3 second## |
|
|
|
32 |
|
|
|
33 |
#
|
|
|
34 |
# We need javascript/wait to prevent creation of the posts in the same second. The threads
|
|
|
35 |
# would then ignore each other in the prev/next navigation as the Forum is unable to compute
|
|
|
36 |
# the correct order.
|
|
|
37 |
#
|
|
|
38 |
@javascript
|
|
|
39 |
Scenario: Replying to a forum post or editing it puts the discussion to the front
|
|
|
40 |
Given I am on the "Course general forum" "forum activity" page logged in as student1
|
|
|
41 |
#
|
|
|
42 |
# Edit one of the forum posts.
|
|
|
43 |
#
|
|
|
44 |
And I follow "Forum post 2"
|
|
|
45 |
And I click on "Edit" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Forum post 2')]" "xpath_element"
|
|
|
46 |
And I set the following fields to these values:
|
|
|
47 |
| Subject | Edited forum post 2 |
|
|
|
48 |
And I press "Save changes"
|
|
|
49 |
And I wait to be redirected
|
|
|
50 |
#
|
|
|
51 |
# Reply to another forum post.
|
|
|
52 |
#
|
|
|
53 |
And I am on the "Course general forum" "forum activity" page logged in as teacher1
|
|
|
54 |
And I follow "Forum post 1"
|
|
|
55 |
When I reply "Forum post 1" post from "Course general forum" forum with:
|
|
|
56 |
| Message | Reply to the first post |
|
|
|
57 |
And I am on the "Course general forum" "forum activity" page
|
|
|
58 |
#
|
|
|
59 |
# Make sure the order of the forum posts is as expected, with most recent new participation first (ie excluding edits).
|
|
|
60 |
#
|
|
|
61 |
Then I should see "Forum post 1" in the "//tr[contains(concat(' ', normalize-space(@class), ' '), ' discussion ')][position()=1]" "xpath_element"
|
|
|
62 |
And I should see "Forum post 3" in the "//tr[contains(concat(' ', normalize-space(@class), ' '), ' discussion ')][position()=2]" "xpath_element"
|
|
|
63 |
And I should see "Edited forum post 2" in the "//tr[contains(concat(' ', normalize-space(@class), ' '), ' discussion ')][position()=3]" "xpath_element"
|
|
|
64 |
#
|
|
|
65 |
# Make sure the next/prev navigation uses the same order of the posts.
|
|
|
66 |
#
|
|
|
67 |
And I follow "Forum post 3"
|
|
|
68 |
And "//a[@aria-label='Next discussion: Forum post 1']" "xpath_element" should exist
|
|
|
69 |
And "//a[@aria-label='Previous discussion: Edited forum post 2']" "xpath_element" should exist
|