1 |
efrain |
1 |
@mod @mod_forum
|
|
|
2 |
Feature: Teachers can edit or delete any forum post
|
|
|
3 |
In order to refine the forum contents
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to edit or delete any user's forum posts
|
|
|
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 "activities" exist:
|
|
|
20 |
| activity | name | course | idnumber |
|
|
|
21 |
| forum | Test forum name | C1 | forum1 |
|
|
|
22 |
And the following "mod_forum > discussions" exist:
|
|
|
23 |
| forum | course | user | name | message |
|
|
|
24 |
| forum1 | C1 | teacher1 | Teacher post subject | Teacher post message |
|
|
|
25 |
And the following "mod_forum > posts" exist:
|
|
|
26 |
| user | parentsubject | subject | message |
|
|
|
27 |
| student1 | Teacher post subject | Student post subject | Student post message |
|
|
|
28 |
|
|
|
29 |
Scenario: A teacher can delete another user's posts
|
|
|
30 |
When I am on the "Test forum name" "forum activity" page logged in as teacher1
|
|
|
31 |
And I follow "Teacher post subject"
|
|
|
32 |
And I click on "Delete" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Student post subject')]" "xpath_element"
|
|
|
33 |
And I press "Continue"
|
|
|
34 |
Then I should not see "Student post subject"
|
|
|
35 |
And I should not see "Student post message"
|
|
|
36 |
|
|
|
37 |
Scenario: A teacher can edit another user's posts
|
|
|
38 |
When I am on the "Test forum name" "forum activity" page logged in as teacher1
|
|
|
39 |
And I follow "Teacher post subject"
|
|
|
40 |
And I click on "Edit" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Student post subject')]" "xpath_element"
|
|
|
41 |
And I set the following fields to these values:
|
|
|
42 |
| Subject | Edited student subject |
|
|
|
43 |
And I press "Save changes"
|
|
|
44 |
And I wait to be redirected
|
|
|
45 |
Then I should see "Edited student subject"
|
|
|
46 |
And I should see "Edited by Teacher 1 - original submission"
|
|
|
47 |
|
|
|
48 |
Scenario: A student can't edit or delete another user's posts
|
|
|
49 |
When I am on the "Test forum name" "forum activity" page logged in as student1
|
|
|
50 |
And I follow "Teacher post subject"
|
|
|
51 |
Then I should not see "Edit" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Teacher post subject')]" "xpath_element"
|
|
|
52 |
And I should not see "Delete" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Teacher post subject')]" "xpath_element"
|