2 Feature: Users can comment on wiki pages
3 In order to discuss wiki pages
5 I need to be able to comment on wiki pages as well as editing and deleting comments
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | teacher1 | Teacher | 1 | teacher1@asd.com |
11 | student1 | Student | 1 | student1@asd.com |
12 | student2 | Student | 2 | student2@asd.com |
13 And the following "courses" exist:
14 | fullname | shortname | category |
16 And the following "course enrolments" exist:
17 | user | course | role |
18 | teacher1 | C1 | editingteacher |
19 | student1 | C1 | student |
20 | student2 | C1 | student |
21 And I log in as "teacher1"
22 And I follow "Course 1"
23 And I turn editing mode on
24 And I add a "Wiki" to section "1" and I fill the form with:
25 | Wiki name | Test wiki name |
26 | Description | Test wiki description |
27 | First page name | First page |
28 | Wiki mode | Collaborative wiki |
29 And I follow "Test wiki name"
30 And I press "Create page"
31 And I set the following fields to these values:
32 | HTML format | First edition |
35 And I log in as "student1"
36 And I follow "Course 1"
37 And I follow "Test wiki name"
38 And I follow "Comments"
39 And I follow "Add comment"
40 And I set the following fields to these values:
41 | Comment | student 1 original comment |
45 Scenario: Student can edit and delete their own comment
46 When I click on ".r0 img[title='Edit']" "css_element"
47 And I set the following fields to these values:
48 | Comment | student 1 updated comment |
50 Then I should see "student 1 updated comment"
51 And ".r0 img[title='Edit']" "css_element" should exist
52 And ".r0 img[title='Delete']" "css_element" should exist
53 And I click on ".r0 img[title='Delete']" "css_element"
55 And I should not see "student 1 updated comment"
58 Scenario: Student cannot edit another student's comment
60 And I log in as "student2"
61 And I follow "Course 1"
62 And I follow "Test wiki name"
63 And I follow "Comments"
64 Then ".r0 img[title='Edit']" "css_element" should not exist
65 Then ".r0 img[title='Delete']" "css_element" should not exist
68 Scenario: Teacher can delete a student comment
70 And I log in as "teacher1"
71 And I follow "Course 1"
72 And I follow "Test wiki name"
73 And I follow "Comments"
74 Then ".r0 img[title='Edit']" "css_element" should not exist
75 Then ".r0 img[title='Delete']" "css_element" should exist