Commit | Line | Data |
---|---|---|
550d842e | 1 | @mod @mod_forum |
2d9cbe88 DM |
2 | Feature: Teachers can edit or delete any forum post |
3 | In order to refine the forum contents | |
5d7b6307 | 4 | As a teacher |
2d9cbe88 DM |
5 | I need to edit or delete any user's forum posts |
6 | ||
7 | Background: | |
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 | | |
14 | | Course 1 | C1 | 0 | | |
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 | |
4d40089d | 22 | And I add a "Forum" to section "1" and I fill the form with: |
2d9cbe88 DM |
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 | | |
28 | And I log out | |
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 | | |
34 | ||
35 | @javascript | |
36 | Scenario: A teacher can delete another user's posts | |
37 | Given I log out | |
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" | |
2d9cbe88 DM |
44 | Then I should not see "Student post subject" |
45 | And I should not see "Student post message" | |
46 | ||
47 | @javascript | |
48 | Scenario: A teacher can edit another user's posts | |
49 | Given I log out | |
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" | |
333db2e9 | 58 | And I wait to be redirected |
2d9cbe88 DM |
59 | Then I should see "Edited student subject" |
60 | And I should see "Edited by Teacher 1 - original submission" | |
61 | ||
62 | @javascript | |
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" |