1 |
efrain |
1 |
@mod @mod_lesson
|
|
|
2 |
Feature: In a lesson activity a student should
|
|
|
3 |
be able to close the lesson and then later resume.
|
|
|
4 |
|
|
|
5 |
Background:
|
|
|
6 |
Given the following "users" exist:
|
|
|
7 |
| username | firstname | lastname | email |
|
|
|
8 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
9 |
| student1 | Student | 1 | student1@example.com |
|
|
|
10 |
And the following "courses" exist:
|
|
|
11 |
| fullname | shortname | category |
|
|
|
12 |
| Course 1 | C1 | 0 |
|
|
|
13 |
And the following "course enrolments" exist:
|
|
|
14 |
| user | course | role |
|
|
|
15 |
| teacher1 | C1 | editingteacher |
|
|
|
16 |
| student1 | C1 | student |
|
|
|
17 |
And the following "activity" exists:
|
|
|
18 |
| activity | lesson |
|
|
|
19 |
| name | Test lesson name |
|
|
|
20 |
| course | C1 |
|
|
|
21 |
| idnumber | 0001 |
|
|
|
22 |
| retake | 1 |
|
|
|
23 |
|
|
|
24 |
Scenario: resume a lesson with both content then question pages
|
|
|
25 |
Given the following "mod_lesson > pages" exist:
|
|
|
26 |
| lesson | qtype | title | content |
|
|
|
27 |
| Test lesson name | content | First page name | First page contents |
|
|
|
28 |
| Test lesson name | content | Second page name | Second page contents |
|
|
|
29 |
| Test lesson name | content | Third page name | Third page contents |
|
|
|
30 |
| Test lesson name | truefalse | True/false question 1 | Paper is made from trees. |
|
|
|
31 |
| Test lesson name | truefalse | True/false question 2 | Kermit is a frog |
|
|
|
32 |
And the following "mod_lesson > answers" exist:
|
|
|
33 |
| page | answer | response | jumpto | score |
|
|
|
34 |
| First page name | Next page | | Next page | 0 |
|
|
|
35 |
| Second page name | Previous page | | Previous page | 0 |
|
|
|
36 |
| Second page name | Next page | | Next page | 0 |
|
|
|
37 |
| Third page name | Previous page | | Previous page | 0 |
|
|
|
38 |
| Third page name | Next page | | Next page | 0 |
|
|
|
39 |
| True/false question 1 | True | Correct | Next page | 1 |
|
|
|
40 |
| True/false question 1 | False | Wrong | This page | 0 |
|
|
|
41 |
| True/false question 2 | True | Correct | Next page | 1 |
|
|
|
42 |
| True/false question 2 | False | Wrong | This page | 0 |
|
|
|
43 |
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
44 |
And I should see "First page contents"
|
|
|
45 |
And I press "Next page"
|
|
|
46 |
# Add 1 sec delay so lesson knows a valid attempt has been made in past.
|
|
|
47 |
And I wait "1" seconds
|
|
|
48 |
And I should see "Second page contents"
|
|
|
49 |
And I press "Next page"
|
|
|
50 |
And I should see "Third page contents"
|
|
|
51 |
And I am on "Course 1" course homepage
|
|
|
52 |
And I follow "Test lesson name"
|
|
|
53 |
And I should see "You have seen more than one page of this lesson already."
|
|
|
54 |
And I should see "Do you want to start at the last page you saw?"
|
|
|
55 |
And I follow "Yes"
|
|
|
56 |
Then I should see "Third page contents"
|
|
|
57 |
# Add 1 sec delay so lesson knows differentiate 3rd and paper attempts.
|
|
|
58 |
And I wait "1" seconds
|
|
|
59 |
And I press "Next page"
|
|
|
60 |
And I should see "Paper is made from trees."
|
|
|
61 |
And I am on "Course 1" course homepage
|
|
|
62 |
And I follow "Test lesson name"
|
|
|
63 |
And I should see "You have seen more than one page of this lesson already."
|
|
|
64 |
And I should see "Do you want to start at the last page you saw?"
|
|
|
65 |
And I follow "Yes"
|
|
|
66 |
And I should see "Paper is made from trees."
|
|
|
67 |
And I set the following fields to these values:
|
|
|
68 |
| True | 1 |
|
|
|
69 |
And I press "Submit"
|
|
|
70 |
And I press "Continue"
|
|
|
71 |
And I should see "Kermit is a frog"
|
|
|
72 |
And I am on "Course 1" course homepage
|
|
|
73 |
And I follow "Test lesson name"
|
|
|
74 |
And I should see "You have seen more than one page of this lesson already."
|
|
|
75 |
And I should see "Do you want to start at the last page you saw?"
|
|
|
76 |
And I follow "Yes"
|
|
|
77 |
And I should see "Kermit is a frog"
|
|
|
78 |
And I set the following fields to these values:
|
|
|
79 |
| True | 1 |
|
|
|
80 |
And I press "Submit"
|
|
|
81 |
And I press "Continue"
|
|
|
82 |
And I should see "Congratulations - end of lesson reached"
|
|
|
83 |
|
|
|
84 |
Scenario: resume a lesson with only content pages
|
|
|
85 |
Given the following "mod_lesson > pages" exist:
|
|
|
86 |
| lesson | qtype | title | content |
|
|
|
87 |
| Test lesson name | content | First page name | First page contents |
|
|
|
88 |
| Test lesson name | content | Second page name | Second page contents |
|
|
|
89 |
| Test lesson name | content | Third page name | Third page contents |
|
|
|
90 |
| Test lesson name | content | Fourth page name | Fourth page contents |
|
|
|
91 |
And the following "mod_lesson > answers" exist:
|
|
|
92 |
| page | answer | jumpto |
|
|
|
93 |
| First page name | Next page | Next page |
|
|
|
94 |
| Second page name | Previous page | Previous page |
|
|
|
95 |
| Second page name | Next page | Next page |
|
|
|
96 |
| Third page name | Previous page | Previous page |
|
|
|
97 |
| Third page name | Next page | Next page |
|
|
|
98 |
| Fourth page name | Previous page | Previous page |
|
|
|
99 |
| Fourth page name | End of lesson | End of lesson |
|
|
|
100 |
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
101 |
And I should see "First page contents"
|
|
|
102 |
And I press "Next page"
|
|
|
103 |
And I should see "Second page contents"
|
|
|
104 |
# Add 1 sec delay so lesson knows a valid attempt has been made in past.
|
|
|
105 |
And I wait "1" seconds
|
|
|
106 |
And I press "Next page"
|
|
|
107 |
And I should see "Third page contents"
|
|
|
108 |
And I am on "Course 1" course homepage
|
|
|
109 |
And I follow "Test lesson name"
|
|
|
110 |
Then I should see "You have seen more than one page of this lesson already."
|
|
|
111 |
And I should see "Do you want to start at the last page you saw?"
|
|
|
112 |
And I follow "Yes"
|
|
|
113 |
And I should see "Third page contents"
|
|
|
114 |
And I press "Next page"
|
|
|
115 |
And I should see "Fourth page contents"
|
|
|
116 |
# Add 1 sec delay so lesson knows a valid attempt has been made in past.
|
|
|
117 |
And I wait "1" seconds
|
|
|
118 |
And I press "End of lesson"
|
|
|
119 |
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
120 |
And I should see "First page contents"
|
|
|
121 |
|
|
|
122 |
Scenario: resume a lesson with both question then content pages
|
|
|
123 |
Given the following "mod_lesson > pages" exist:
|
|
|
124 |
| lesson | qtype | title | content |
|
|
|
125 |
| Test lesson name | truefalse | True/false question 1 | Cat is an amphibian |
|
|
|
126 |
| Test lesson name | content | First page name | First page contents |
|
|
|
127 |
| Test lesson name | truefalse | True/false question 2 | Paper is made from trees. |
|
|
|
128 |
| Test lesson name | truefalse | True/false question 3 | 1+1=2 |
|
|
|
129 |
| Test lesson name | truefalse | True/false question 4 | 2+2=4 |
|
|
|
130 |
| Test lesson name | content | Second page name | Second page contents |
|
|
|
131 |
| Test lesson name | truefalse | True/false question 5 | Kermit is a frog |
|
|
|
132 |
And the following "mod_lesson > answers" exist:
|
|
|
133 |
| page | answer | response | jumpto | score |
|
|
|
134 |
| True/false question 1 | False | Correct | Next page | 1 |
|
|
|
135 |
| True/false question 1 | True | Wrong | This page | 0 |
|
|
|
136 |
| First page name | Next page | | Next page | 0 |
|
|
|
137 |
| True/false question 2 | True | Correct | Next page | 1 |
|
|
|
138 |
| True/false question 2 | False | Wrong | This page | 0 |
|
|
|
139 |
| True/false question 3 | True | Correct | Next page | 1 |
|
|
|
140 |
| True/false question 3 | False | Wrong | This page | 0 |
|
|
|
141 |
| True/false question 4 | True | Correct | Next page | 1 |
|
|
|
142 |
| True/false question 4 | False | Wrong | This page | 0 |
|
|
|
143 |
| Second page name | Next page | | Next page | 0 |
|
|
|
144 |
| True/false question 5 | True | Correct | Next page | 1 |
|
|
|
145 |
| True/false question 5 | False | Wrong | This page | 0 |
|
|
|
146 |
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
147 |
And I should see "Cat is an amphibian"
|
|
|
148 |
And I set the following fields to these values:
|
|
|
149 |
| False | 1 |
|
|
|
150 |
And I press "Submit"
|
|
|
151 |
And I press "Continue"
|
|
|
152 |
And I should see "First page contents"
|
|
|
153 |
And I press "Next page"
|
|
|
154 |
And I should see "Paper is made from trees."
|
|
|
155 |
And I set the following fields to these values:
|
|
|
156 |
| True | 1 |
|
|
|
157 |
And I press "Submit"
|
|
|
158 |
And I press "Continue"
|
|
|
159 |
And I should see "1+1=2"
|
|
|
160 |
And I set the following fields to these values:
|
|
|
161 |
| True | 1 |
|
|
|
162 |
# Add 1 sec delay so lesson knows a valid attempt has been made in past.
|
|
|
163 |
And I wait "1" seconds
|
|
|
164 |
And I press "Submit"
|
|
|
165 |
And I press "Continue"
|
|
|
166 |
And I should see "2+2=4"
|
|
|
167 |
And I am on "Course 1" course homepage
|
|
|
168 |
And I follow "Test lesson name"
|
|
|
169 |
And I should see "You have seen more than one page of this lesson already."
|
|
|
170 |
Then I should see "Do you want to start at the last page you saw?"
|
|
|
171 |
And I follow "Yes"
|
|
|
172 |
And I should see "2+2=4"
|
|
|
173 |
And I set the following fields to these values:
|
|
|
174 |
| True | 1 |
|
|
|
175 |
# Add 1 sec delay so lesson knows a valid attempt has been made in past.
|
|
|
176 |
And I wait "1" seconds
|
|
|
177 |
And I press "Submit"
|
|
|
178 |
And I press "Continue"
|
|
|
179 |
And I should see "Second page contents"
|
|
|
180 |
And I am on "Course 1" course homepage
|
|
|
181 |
And I follow "Test lesson name"
|
|
|
182 |
And I should see "You have seen more than one page of this lesson already."
|
|
|
183 |
And I should see "Do you want to start at the last page you saw?"
|
|
|
184 |
And I follow "Yes"
|
|
|
185 |
And I should see "Second page contents"
|
|
|
186 |
And I press "Next page"
|
|
|
187 |
And I should see "Kermit is a frog"
|
|
|
188 |
And I set the following fields to these values:
|
|
|
189 |
| True | 1 |
|
|
|
190 |
And I press "Submit"
|
|
|
191 |
And I press "Continue"
|
|
|
192 |
And I should see "Congratulations - end of lesson reached"
|
|
|
193 |
|
|
|
194 |
Scenario: resume a lesson with only question pages
|
|
|
195 |
Given the following "mod_lesson > pages" exist:
|
|
|
196 |
| lesson | qtype | title | content |
|
|
|
197 |
| Test lesson name | truefalse | True/false question 1 | Cat is an amphibian |
|
|
|
198 |
| Test lesson name | truefalse | True/false question 2 | Paper is made from trees. |
|
|
|
199 |
| Test lesson name | truefalse | True/false question 3 | 1+1=2 |
|
|
|
200 |
| Test lesson name | truefalse | True/false question 4 | 2+2=4 |
|
|
|
201 |
| Test lesson name | truefalse | True/false question 5 | Kermit is a frog |
|
|
|
202 |
And the following "mod_lesson > answers" exist:
|
|
|
203 |
| page | answer | response | jumpto | score |
|
|
|
204 |
| True/false question 1 | False | Correct | Next page | 1 |
|
|
|
205 |
| True/false question 1 | True | Wrong | This page | 0 |
|
|
|
206 |
| True/false question 2 | True | Correct | Next page | 1 |
|
|
|
207 |
| True/false question 2 | False | Wrong | This page | 0 |
|
|
|
208 |
| True/false question 3 | True | Correct | Next page | 1 |
|
|
|
209 |
| True/false question 3 | False | Wrong | This page | 0 |
|
|
|
210 |
| True/false question 4 | True | Correct | Next page | 1 |
|
|
|
211 |
| True/false question 4 | False | Wrong | This page | 0 |
|
|
|
212 |
| True/false question 5 | True | Correct | Next page | 1 |
|
|
|
213 |
| True/false question 5 | False | Wrong | This page | 0 |
|
|
|
214 |
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
215 |
And I should see "Cat is an amphibian"
|
|
|
216 |
And I set the following fields to these values:
|
|
|
217 |
| False | 1 |
|
|
|
218 |
And I press "Submit"
|
|
|
219 |
And I press "Continue"
|
|
|
220 |
And I should see "Paper is made from trees."
|
|
|
221 |
And I set the following fields to these values:
|
|
|
222 |
| True | 1 |
|
|
|
223 |
And I press "Submit"
|
|
|
224 |
And I press "Continue"
|
|
|
225 |
And I should see "1+1=2"
|
|
|
226 |
And I set the following fields to these values:
|
|
|
227 |
| True | 1 |
|
|
|
228 |
# Add 1 sec delay so lesson knows a valid attempt has been made in past.
|
|
|
229 |
And I wait "1" seconds
|
|
|
230 |
And I press "Submit"
|
|
|
231 |
And I press "Continue"
|
|
|
232 |
And I should see "2+2=4"
|
|
|
233 |
And I am on "Course 1" course homepage
|
|
|
234 |
And I follow "Test lesson name"
|
|
|
235 |
Then I should see "You have seen more than one page of this lesson already."
|
|
|
236 |
And I should see "Do you want to start at the last page you saw?"
|
|
|
237 |
And I follow "Yes"
|
|
|
238 |
And I should see "2+2=4"
|
|
|
239 |
And I set the following fields to these values:
|
|
|
240 |
| True | 1 |
|
|
|
241 |
# Add 1 sec delay so lesson knows a valid attempt has been made in past.
|
|
|
242 |
And I wait "1" seconds
|
|
|
243 |
And I press "Submit"
|
|
|
244 |
And I press "Continue"
|
|
|
245 |
And I should see "Kermit is a frog"
|
|
|
246 |
And I set the following fields to these values:
|
|
|
247 |
| True | 1 |
|
|
|
248 |
And I press "Submit"
|
|
|
249 |
And I press "Continue"
|
|
|
250 |
And I should see "Congratulations - end of lesson reached"
|