1 |
efrain |
1 |
@mod @mod_forum
|
|
|
2 |
Feature: Students can edit or delete their forum posts within a set time limit
|
|
|
3 |
In order to refine forum posts
|
|
|
4 |
As a user
|
|
|
5 |
I need to edit or delete my forum posts within a certain period of time after posting
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| student1 | Student | 1 | student1@example.com |
|
|
|
11 |
And the following "courses" exist:
|
|
|
12 |
| fullname | shortname | category |
|
|
|
13 |
| Course 1 | C1 | 0 |
|
|
|
14 |
And the following "course enrolments" exist:
|
|
|
15 |
| user | course | role |
|
|
|
16 |
| student1 | C1 | student |
|
|
|
17 |
And the following "activities" exist:
|
|
|
18 |
| activity | name | course | idnumber |
|
|
|
19 |
| forum | Test forum name | C1 | forum |
|
|
|
20 |
|
|
|
21 |
Scenario: Edit forum post
|
|
|
22 |
Given the following "mod_forum > discussions" exist:
|
|
|
23 |
| user | forum | name | message |
|
|
|
24 |
| student1 | forum | Forum post subject | This is the body |
|
|
|
25 |
And I am on the "Test forum name" "forum activity" page logged in as "student1"
|
|
|
26 |
And I follow "Forum post subject"
|
|
|
27 |
And I follow "Edit"
|
|
|
28 |
When I set the following fields to these values:
|
|
|
29 |
| Subject | Edited post subject |
|
|
|
30 |
| Message | Edited post body |
|
|
|
31 |
And I press "Save changes"
|
|
|
32 |
And I wait to be redirected
|
|
|
33 |
Then I should see "Edited post subject"
|
|
|
34 |
And I should see "Edited post body"
|
|
|
35 |
|
|
|
36 |
Scenario: Delete forum post
|
|
|
37 |
Given the following "mod_forum > discussions" exist:
|
|
|
38 |
| user | forum | name | message |
|
|
|
39 |
| student1 | forum | Forum post subject | This is the body |
|
|
|
40 |
And I am on the "Test forum name" "forum activity" page logged in as "student1"
|
|
|
41 |
And I follow "Forum post subject"
|
|
|
42 |
When I follow "Delete"
|
|
|
43 |
And I press "Continue"
|
|
|
44 |
Then I should not see "Forum post subject"
|
|
|
45 |
|
|
|
46 |
@block_recent_activity
|
|
|
47 |
Scenario: Time limit expires
|
|
|
48 |
Given the following "blocks" exist:
|
|
|
49 |
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
|
|
50 |
| recent_activity | Course | C1 | course-view-* | side-pre |
|
|
|
51 |
And the following config values are set as admin:
|
|
|
52 |
| maxeditingtime | 1 |
|
|
|
53 |
And the following "mod_forum > discussions" exist:
|
|
|
54 |
| user | forum | name | message | timemodified |
|
|
|
55 |
| student1 | forum | Forum post subject | This is the body | ##now +1 second## |
|
|
|
56 |
And I am on the "Course 1" course page logged in as student1
|
|
|
57 |
And I should see "New forum posts:" in the "Recent activity" "block"
|
|
|
58 |
And I should see "Forum post subject" in the "Recent activity" "block"
|
|
|
59 |
When I wait "2" seconds
|
|
|
60 |
And I follow "Forum post subject"
|
|
|
61 |
Then I should not see "Edit" in the "region-main" "region"
|
|
|
62 |
And I should not see "Delete" in the "region-main" "region"
|