2 Feature: Teachers can edit or delete any forum post
3 In order to refine the forum contents
5 I need to edit or delete any user's forum posts
8 Given the following "users" exists:
9 | username | firstname | lastname | email |
10 | teacher1 | Teacher | 1 | teacher1@asd.com |
11 | student1 | Student | 1 | student1@asd.com |
12 And the following "courses" exists:
13 | fullname | shortname | category |
15 And the following "course enrolments" exists:
16 | user | course | role |
17 | teacher1 | C1 | editingteacher |
18 | student1 | C1 | student |
19 And I log in as "teacher1"
20 And I follow "Course 1"
21 And I turn editing mode on
22 And I add a "Forum" to section "1" and I fill the form with:
23 | Forum name | Test forum name |
24 | Description | Test forum description |
25 And I add a new discussion to "Test forum name" forum with:
26 | Subject | Teacher post subject |
27 | Message | Teacher post message |
29 And I log in as "student1"
30 And I follow "Course 1"
31 And I reply "Teacher post subject" post from "Test forum name" forum with:
32 | Subject | Student post subject |
33 | Message | Student post message |
36 Scenario: A teacher can delete another user's posts
38 And I log in as "teacher1"
39 When I follow "Course 1"
40 And I follow "Test forum name"
41 And I follow "Teacher post subject"
42 And I click on "Delete" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Student post subject')]" "xpath_element"
43 And I press "Continue"
44 Then I should not see "Student post subject"
45 And I should not see "Student post message"
48 Scenario: A teacher can edit another user's posts
50 And I log in as "teacher1"
51 When I follow "Course 1"
52 And I follow "Test forum name"
53 And I follow "Teacher post subject"
54 And I click on "Edit" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Student post subject')]" "xpath_element"
55 And I fill the moodle form with:
56 | Subject | Edited student subject |
57 And I press "Save changes"
58 And I wait to be redirected
59 Then I should see "Edited student subject"
60 And I should see "Edited by Teacher 1 - original submission"
63 Scenario: A student can't edit or delete another user's posts
64 When I follow "Teacher post subject"
65 Then I should not see "Edit" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Teacher post subject')]" "xpath_element"
66 And I should not see "Delete" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Teacher post subject')]" "xpath_element"