MDL-55528 assignfeedback_editpdf: Add step to check all pages loaded
[moodle.git] / mod / assign / feedback / editpdf / tests / behat / annotate_pdf.feature
CommitLineData
ef3bffde 1@mod @mod_assign @assignfeedback @assignfeedback_editpdf @_file_upload
9e103d6e
JM
2Feature: In an assignment, teacher can annotate PDF files during grading
3 In order to provide visual report on a graded PDF
4 As a teacher
5 I need to use the PDF editor
6
7 @javascript
8 Scenario: Submit a PDF file as a student and annotate the PDF as a teacher
9 Given ghostscript is installed
7019e15e 10 And the following "courses" exist:
9e103d6e
JM
11 | fullname | shortname | category | groupmode |
12 | Course 1 | C1 | 0 | 1 |
7019e15e 13 And the following "users" exist:
9e103d6e 14 | username | firstname | lastname | email |
0fe86bbd
RT
15 | teacher1 | Teacher | 1 | teacher1@example.com |
16 | student1 | Student | 1 | student1@example.com |
7019e15e 17 And the following "course enrolments" exist:
9e103d6e
JM
18 | user | course | role |
19 | teacher1 | C1 | editingteacher |
20 | student1 | C1 | student |
21 And I log in as "admin"
f84a0d49 22 And I navigate to "Annotate PDF" node in "Site administration > Plugins > Activity modules > Assignment > Feedback plugins"
9e103d6e
JM
23 And I upload "pix/help.png" file to "" filemanager
24 And I upload "pix/docs.png" file to "" filemanager
25 When I press "Save changes"
26 Then I should see "Changes saved"
27 And I follow "Test ghostscript path"
28 And I should see "The ghostscript path appears to be OK"
9eb8f6ec 29 And I am on site homepage
9e103d6e
JM
30 And I log out
31 And I log in as "teacher1"
32 And I follow "Course 1"
33 And I turn editing mode on
34 And I add a "Assignment" to section "1" and I fill the form with:
35 | Assignment name | Test assignment name |
36 | Description | Submit your PDF file |
37 | assignsubmission_file_enabled | 1 |
38 | Maximum number of uploaded files | 2 |
39 And I log out
40 And I log in as "student1"
41 And I follow "Course 1"
42 And I follow "Test assignment name"
43 And I press "Add submission"
44 And I upload "mod/assign/feedback/editpdf/tests/fixtures/submission.pdf" file to "File submissions" filemanager
45 And I upload "mod/assign/feedback/editpdf/tests/fixtures/testgs.pdf" file to "File submissions" filemanager
46 And I press "Save changes"
47 And I should see "Submitted for grading"
48 And I should see "submission.pdf"
49 And I should see "Not graded"
50 And I log out
51 And I log in as "teacher1"
52 And I follow "Course 1"
53 And I follow "Test assignment name"
e5287f9b 54 And I navigate to "View all submissions" in current page administration
e01012e9 55 And I click on "Edit" "link" in the "Submitted for grading" "table_row"
9e103d6e 56 And I click on "Grade" "link" in the "Submitted for grading" "table_row"
0d5a260e 57 And I should see "Page 1 of 3"
9e103d6e 58 And I click on ".navigate-next-button" "css_element"
0d5a260e 59 And I should see "Page 2 of 3"
9e103d6e
JM
60 And I click on ".stampbutton" "css_element"
61 And I click on ".linebutton" "css_element"
62 And I click on ".commentcolourbutton" "css_element"
380ab95f 63 And I click on "//img[@alt=\"Blue\"]/parent::button" "xpath_element"
f84a0d49 64 And I wait until the page is ready
9e103d6e 65 And I press "Save changes"
bb690849
DW
66 And I wait until the page is ready
67 And I should see "The changes to the grade and feedback were saved"
506df250
DW
68
69 @javascript
70 Scenario: Submit a PDF file as a student in a team and annotate the PDF as a teacher
71 Given ghostscript is installed
72 And the following "courses" exist:
73 | fullname | shortname | category | groupmode |
74 | Course 1 | C1 | 0 | 1 |
75 And the following "users" exist:
76 | username | firstname | lastname | email |
0fe86bbd
RT
77 | teacher1 | Teacher | 1 | teacher1@example.com |
78 | student1 | Student | 1 | student1@example.com |
79 | student2 | Student | 2 | student2@example.com |
80 | student3 | Student | 3 | student3@example.com |
81 | student4 | Student | 4 | student4@example.com |
506df250
DW
82 And the following "course enrolments" exist:
83 | user | course | role |
84 | teacher1 | C1 | editingteacher |
85 | student1 | C1 | student |
86 | student2 | C1 | student |
87 | student3 | C1 | student |
88 | student4 | C1 | student |
89 And the following "groups" exist:
90 | name | course | idnumber |
91 | G1 | C1 | G1 |
92 | G2 | C1 | G2 |
93 And the following "groupings" exist:
94 | name | course | idnumber |
95 | G1 | C1 | G1 |
96 And the following "group members" exist:
97 | user | group |
98 | student1 | G1 |
99 | student2 | G1 |
100 | student3 | G2 |
101 | student4 | G2 |
102 And the following "grouping groups" exist:
103 | grouping | group |
104 | G1 | G1 |
105 | G1 | G2 |
106 And I log in as "teacher1"
107 And I follow "Course 1"
108 And I turn editing mode on
109 And I add a "Assignment" to section "1" and I fill the form with:
110 | Assignment name | Test assignment name |
111 | Description | Submit your PDF file |
112 | assignsubmission_file_enabled | 1 |
113 | Maximum number of uploaded files | 2 |
114 | Students submit in groups | Yes |
115 | Grouping for student groups | G1 |
116 And I log out
117 When I log in as "student1"
118 And I follow "Course 1"
119 And I follow "Test assignment name"
120 And I press "Add submission"
121 And I upload "mod/assign/feedback/editpdf/tests/fixtures/submission.pdf" file to "File submissions" filemanager
122 And I press "Save changes"
123 Then I should see "Submitted for grading"
124 And I should see "submission.pdf"
125 And I should see "Not graded"
126 And I log out
127 And I log in as "teacher1"
128 And I follow "Course 1"
129 And I follow "Test assignment name"
e5287f9b 130 And I navigate to "View all submissions" in current page administration
e01012e9 131 And I click on "Edit" "link" in the "Student 2" "table_row"
506df250 132 And I click on "Grade" "link" in the "Student 2" "table_row"
3bd0d439 133 And I wait for the complete PDF to load
bb690849
DW
134 And I click on ".linebutton" "css_element"
135 And I draw on the pdf
506df250 136 And I press "Save changes"
bb690849
DW
137 And I should see "The changes to the grade and feedback were saved"
138 And I press "Ok"
139 And I click on "Edit settings" "link"
140 And I follow "Test assignment name"
e5287f9b 141 And I navigate to "View all submissions" in current page administration
2a03c5fe 142 And I should see "View annotated PDF..." in the "student2@example.com" "table_row"