MDL-48778 mod_assign: behat tests for group submission
[moodle.git] / mod / assign / tests / behat / allow_another_attempt.feature
CommitLineData
e9fe65d5
DW
1@mod @mod_assign
2Feature: In an assignment, students start a new attempt based on their previous one
3 In order to improve my submission
4 As a student
5 I need to submit my assignment editing an online form, receive feedback, and then improve my submission.
6
7 @javascript
8 Scenario: Submit a text online and edit the submission
759b323e 9 Given the following "courses" exist:
e9fe65d5
DW
10 | fullname | shortname | category | groupmode |
11 | Course 1 | C1 | 0 | 1 |
759b323e 12 And the following "users" exist:
e9fe65d5 13 | username | firstname | lastname | email |
0fe86bbd
RT
14 | teacher1 | Teacher | 1 | teacher1@example.com |
15 | student1 | Student | 1 | student1@example.com |
759b323e 16 And the following "course enrolments" exist:
e9fe65d5
DW
17 | user | course | role |
18 | teacher1 | C1 | editingteacher |
19 | student1 | C1 | student |
20 And I log in as "teacher1"
21 And I follow "Course 1"
22 And I turn editing mode on
23 And I add a "Assignment" to section "1" and I fill the form with:
24 | Assignment name | Test assignment name |
25 | Description | Submit your online text |
26 | assignsubmission_onlinetext_enabled | 1 |
27 | assignsubmission_file_enabled | 0 |
28 | Attempts reopened | Manually |
29 And I log out
30 And I log in as "student1"
31 And I follow "Course 1"
32 And I follow "Test assignment name"
33 When I press "Add submission"
f083d614 34 And I set the following fields to these values:
e9fe65d5
DW
35 | Online text | I'm the student first submission |
36 And I press "Save changes"
37 And I log out
38 And I log in as "teacher1"
39 And I follow "Course 1"
40 And I follow "Test assignment name"
41 And I follow "View/grade all submissions"
42 And I click on "Grade Student 1" "link" in the "Student 1" "table_row"
f083d614 43 And I set the following fields to these values:
e9fe65d5
DW
44 | Allow another attempt | 1 |
45 And I press "Save changes"
46 And I log out
47 And I log in as "student1"
48 And I follow "Course 1"
49 And I follow "Test assignment name"
50 And I press "Add a new attempt based on previous submission"
51 And I press "Save changes"
52 Then I log out
53 And I log in as "teacher1"
54 And I follow "Course 1"
55 And I follow "Test assignment name"
56 And I follow "View/grade all submissions"
57 And I click on "Grade Student 1" "link" in the "Student 1" "table_row"
58 And I should see "I'm the student first submission"
2b10cf43
SL
59
60 @javascript @_alert
61 Scenario: Allow new attempt does not display incorrect error message on group submission
62 Given the following "courses" exist:
63 | fullname | shortname | category | groupmode |
64 | Course 1 | C1 | 0 | 1 |
65 And the following "users" exist:
66 | username | firstname | lastname | email |
67 | teacher1 | Teacher | 1 | teacher1@example.com |
68 | student1 | Student | 1 | student1@example.com |
69 | student2 | Student | 2 | student2@example.com |
70 | student3 | Student | 3 | student3@example.com |
71 | student4 | Student | 4 | student4@example.com |
72 And the following "course enrolments" exist:
73 | user | course | role |
74 | teacher1 | C1 | editingteacher |
75 | student1 | C1 | student |
76 | student2 | C1 | student |
77 | student3 | C1 | student |
78 | student4 | C1 | student |
79 And the following "groups" exist:
80 | name | course | idnumber |
81 | Group 1 | C1 | G1 |
82 | Group 2 | C1 | G2 |
83 And the following "group members" exist:
84 | user | group |
85 | student1 | G1 |
86 | student2 | G1 |
87 | student3 | G2 |
88 | student4 | G2 |
89 And I log in as "teacher1"
90 And I follow "Course 1"
91 And I turn editing mode on
92 And I add a "Assignment" to section "1" and I fill the form with:
93 | Assignment name | Test assignment name |
94 | Description | Test assignment description |
95 | assignsubmission_onlinetext_enabled | 1 |
96 | assignsubmission_file_enabled | 0 |
97 | Students submit in groups | Yes |
98 | Attempts reopened | Manually |
99 | Maximum attempts | 3 |
100 | Group mode | Separate groups |
101 And I log out
102 And I log in as "student1"
103 And I follow "Course 1"
104 And I follow "Test assignment name"
105 And I press "Add submission"
106 And I set the following fields to these values:
107 | Online text | I'm the student's first submission |
108 And I press "Save changes"
109 And I log out
110 And I log in as "teacher1"
111 And I follow "Course 1"
112 And I follow "Test assignment name"
113 When I follow "View/grade all submissions"
114 Then "Student 1" row "Status" column of "generaltable" table should contain "Submitted for grading"
115 And "Student 2" row "Status" column of "generaltable" table should contain "Submitted for grading"
116 And "Student 3" row "Status" column of "generaltable" table should contain "No submission"
117 And "Student 4" row "Status" column of "generaltable" table should contain "No submission"
118 And I click on "Quick grading" "checkbox"
119 And I click on "Student 1" "checkbox"
120 And I set the field "User grade" to "60.0"
121 And I press "Save all quick grading changes"
122 And I should see "The grade changes were saved"
123 And I press "Continue"
124 And I click on "Student 1" "checkbox"
125 And I set the following fields to these values:
126 | operation | Allow another attempt |
127 And I click on "Go" "button" confirming the dialogue
128 And I should not see "The grades were not saved because someone has modified one or more records more recently than when you loaded the page."
129# Behat tests for the group submission, should be uncommented once the MDL-48216 is fixed.
130# And I log out
131# And I log in as "student3"
132# And I follow "Course 1"
133# And I follow "Test assignment name"
134# #And I should see "This is attempt 1 ( 3 attempts allowed )."
135# And I press "Add submission"
136# And I set the following fields to these values:
137# | Online text | I'm the student's 3 group 2 first attempt |
138# And I press "Save changes"
139# And I log out
140# And I log in as "teacher1"
141# And I follow "Course 1"
142# And I follow "Test assignment name"
143# And I follow "View/grade all submissions"
144# And "Student 1" row "Status" column of "generaltable" table should contain "Reopened"
145# And "Student 2" row "Status" column of "generaltable" table should contain "Reopened"
146# And "Student 3" row "Status" column of "generaltable" table should contain "Submitted for grading"
147# And "Student 4" row "Status" column of "generaltable" table should contain "Submitted for grading"
148# And I click on "Grade Student 3" "link" in the "Student 3" "table_row"
149# And I set the following fields to these values:
150# | Allow another attempt | 1 |
151# And I press "Save changes"
152# And I log out
153# And I log in as "student4"
154# And I follow "Course 1"
155# And I follow "Test assignment name"
156# #And I should see "This is attempt 2 ( 3 attempts allowed )."
157# And I press "Add submission"
158# And I set the following fields to these values:
159# | Online text | I'm the student's 4 group 2 second attempt |
160# And I press "Save changes"
161# And I log out
162# And I log in as "teacher1"
163# And I follow "Course 1"
164# And I follow "Test assignment name"
165# And I follow "View/grade all submissions"
166# And I click on "Grade Student 4" "link" in the "Student 1" "table_row"
167 #And I should see "This is attempt 2 (3 attempts allowed)"