MDL-55849 mod_assign: Behat update for group submission reopening.
[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"
fdeeaff9 21 And I am on "Course 1" course homepage with editing mode on
e9fe65d5
DW
22 And I add a "Assignment" to section "1" and I fill the form with:
23 | Assignment name | Test assignment name |
24 | Description | Submit your online text |
25 | assignsubmission_onlinetext_enabled | 1 |
26 | assignsubmission_file_enabled | 0 |
27 | Attempts reopened | Manually |
28 And I log out
29 And I log in as "student1"
fdeeaff9 30 And I am on "Course 1" course homepage
e9fe65d5
DW
31 And I follow "Test assignment name"
32 When I press "Add submission"
f083d614 33 And I set the following fields to these values:
e9fe65d5
DW
34 | Online text | I'm the student first submission |
35 And I press "Save changes"
36 And I log out
37 And I log in as "teacher1"
fdeeaff9 38 And I am on "Course 1" course homepage
e9fe65d5 39 And I follow "Test assignment name"
e5287f9b 40 And I navigate to "View all submissions" in current page administration
bb690849 41 And I click on "Grade" "link" in the "Student 1" "table_row"
f083d614 42 And I set the following fields to these values:
e9fe65d5
DW
43 | Allow another attempt | 1 |
44 And I press "Save changes"
bb690849
DW
45 And I press "Ok"
46 And I click on "Edit settings" "link"
e9fe65d5
DW
47 And I log out
48 And I log in as "student1"
fdeeaff9 49 And I am on "Course 1" course homepage
e9fe65d5
DW
50 And I follow "Test assignment name"
51 And I press "Add a new attempt based on previous submission"
52 And I press "Save changes"
53 Then I log out
54 And I log in as "teacher1"
fdeeaff9 55 And I am on "Course 1" course homepage
e9fe65d5 56 And I follow "Test assignment name"
e5287f9b 57 And I navigate to "View all submissions" in current page administration
bb690849 58 And I click on "Grade" "link" in the "Student 1" "table_row"
e9fe65d5 59 And I should see "I'm the student first submission"
2b10cf43
SL
60
61 @javascript @_alert
62 Scenario: Allow new attempt does not display incorrect error message on group submission
63 Given the following "courses" exist:
64 | fullname | shortname | category | groupmode |
65 | Course 1 | C1 | 0 | 1 |
66 And the following "users" exist:
67 | username | firstname | lastname | email |
68 | teacher1 | Teacher | 1 | teacher1@example.com |
69 | student1 | Student | 1 | student1@example.com |
70 | student2 | Student | 2 | student2@example.com |
71 | student3 | Student | 3 | student3@example.com |
72 | student4 | Student | 4 | student4@example.com |
73 And the following "course enrolments" exist:
74 | user | course | role |
75 | teacher1 | C1 | editingteacher |
76 | student1 | C1 | student |
77 | student2 | C1 | student |
78 | student3 | C1 | student |
79 | student4 | C1 | student |
80 And the following "groups" exist:
81 | name | course | idnumber |
82 | Group 1 | C1 | G1 |
83 | Group 2 | C1 | G2 |
84 And the following "group members" exist:
85 | user | group |
86 | student1 | G1 |
87 | student2 | G1 |
88 | student3 | G2 |
89 | student4 | G2 |
90 And I log in as "teacher1"
fdeeaff9 91 And I am on "Course 1" course homepage with editing mode on
2b10cf43
SL
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"
fdeeaff9 103 And I am on "Course 1" course homepage
2b10cf43
SL
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"
fdeeaff9 111 And I am on "Course 1" course homepage
2b10cf43 112 And I follow "Test assignment name"
e5287f9b 113 When I navigate to "View all submissions" in current page administration
2b10cf43
SL
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."
e5e47a4b
AG
129 And I log out
130 And I log in as "student3"
131 And I am on "Course 1" course homepage
132 And I follow "Test assignment name"
133 And I should see "This is attempt 1 ( 3 attempts allowed )."
134 And I press "Add submission"
135 And I set the following fields to these values:
136 | Online text | I'm the student's 3 group 2 first attempt |
137 And I press "Save changes"
138 And I log out
139 And I log in as "teacher1"
140 And I am on "Course 1" course homepage
141 And I follow "Test assignment name"
142 And I navigate to "View all submissions" in current page administration
143 And "Student 1" row "Status" column of "generaltable" table should contain "Reopened"
144 And "Student 2" row "Status" column of "generaltable" table should contain "Reopened"
145 And "Student 3" row "Status" column of "generaltable" table should contain "Submitted for grading"
146 And "Student 4" row "Status" column of "generaltable" table should contain "Submitted for grading"
147 And I click on "Grade" "link" in the "Student 3" "table_row"
148 And I set the following fields to these values:
149 | Allow another attempt | 1 |
150 And I press "Save changes"
151 And I press "Ok"
152 And I follow "Assignment: Test assignment name"
153 And I log out
154 And I log in as "student4"
155 And I am on "Course 1" course homepage
156 And I follow "Test assignment name"
157 And I should see "This is attempt 2 ( 3 attempts allowed )."
158 And I press "Add a new attempt"
159 And I set the following fields to these values:
160 | Online text | I'm the student's 4 group 2 second attempt |
161 And I press "Save changes"
162 And I log out
163 And I log in as "teacher1"
164 And I am on "Course 1" course homepage
165 And I follow "Test assignment name"
166 And I select "Group 2" from the "group" singleselect
167 And I click on "Grade" "link" in the ".submissionlinks" "css_element"
168 And I should see "2" in the "#id_attemptsettings" "css_element"