1 |
efrain |
1 |
@mod @mod_lesson
|
|
|
2 |
Feature: In a lesson activity, students can not re-attempt a question more than the allowed amount
|
|
|
3 |
In order to check a lesson question can not be attempted more than the allowed amount
|
|
|
4 |
As a student I need to check I cannot reattempt a question more than I should be allowed
|
|
|
5 |
|
|
|
6 |
Background:
|
|
|
7 |
Given the following "users" exist:
|
|
|
8 |
| username | firstname | lastname | email |
|
|
|
9 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
10 |
| student1 | Student | 1 | student1@example.com |
|
|
|
11 |
And the following "courses" exist:
|
|
|
12 |
| fullname | shortname | category |
|
|
|
13 |
| Course 1 | C1 | 0 |
|
|
|
14 |
And the following "course enrolments" exist:
|
|
|
15 |
| user | course | role |
|
|
|
16 |
| teacher1 | C1 | editingteacher |
|
|
|
17 |
| student1 | C1 | student |
|
|
|
18 |
And the following "activity" exists:
|
|
|
19 |
| activity | lesson |
|
|
|
20 |
| course | C1 |
|
|
|
21 |
| idnumber | 0001 |
|
|
|
22 |
| name | Test lesson name |
|
|
|
23 |
| retake | 1 |
|
|
|
24 |
| minquestions | 3 |
|
|
|
25 |
And 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 | truefalse | True/false question 1 | The earth is round. |
|
|
|
29 |
| Test lesson name | truefalse | True/false question 2 | Kermit is a frog |
|
|
|
30 |
| Test lesson name | content | Second page name | Second page contents |
|
|
|
31 |
| Test lesson name | truefalse | True/false question 3 | Paper is made from trees. |
|
|
|
32 |
| Test lesson name | content | Third page name | Third page contents |
|
|
|
33 |
And the following "mod_lesson > answers" exist:
|
|
|
34 |
| page | answer | response | jumpto | score |
|
|
|
35 |
| First page name | Next page | | Next page | 0 |
|
|
|
36 |
| Second page name | Previous page | | Previous page | 0 |
|
|
|
37 |
| Second page name | Next page | | Next page | 0 |
|
|
|
38 |
| True/false question 1 | True | Correct | Next page | 1 |
|
|
|
39 |
| True/false question 1 | False | Wrong | This page | 0 |
|
|
|
40 |
| True/false question 2 | True | Correct | Next page | 1 |
|
|
|
41 |
| True/false question 2 | False | Wrong | This page | 0 |
|
|
|
42 |
| True/false question 3 | True | Correct | Next page | 1 |
|
|
|
43 |
| True/false question 3 | False | Wrong | This page | 0 |
|
|
|
44 |
| Third page name | Previous page | | Previous page | 0 |
|
|
|
45 |
| Third page name | Next page | | Next page | 0 |
|
|
|
46 |
|
|
|
47 |
Scenario: Check that we can leave a quiz and when we re-enter we can not re-attempt the question again
|
|
|
48 |
Given I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
49 |
And I should see "First page contents"
|
|
|
50 |
And I press "Next page"
|
|
|
51 |
And I should see "The earth is round"
|
|
|
52 |
And I set the following fields to these values:
|
|
|
53 |
| False| 1 |
|
|
|
54 |
And I press "Submit"
|
|
|
55 |
And I should see "Wrong"
|
|
|
56 |
And I am on the "Test lesson name" "lesson activity" page
|
|
|
57 |
And I should see "Do you want to start at the last page you saw?"
|
|
|
58 |
And I click on "No" "link" in the "#page-content" "css_element"
|
|
|
59 |
And I should see "First page contents"
|
|
|
60 |
And I press "Next page"
|
|
|
61 |
And I should see "The earth is round"
|
|
|
62 |
And I set the following fields to these values:
|
|
|
63 |
| False| 1 |
|
|
|
64 |
When I press "Submit"
|
|
|
65 |
Then I should see "Maximum number of attempts reached - Moving to next page"
|
|
|
66 |
|
|
|
67 |
@javascript @_bug_phantomjs
|
|
|
68 |
Scenario: Check that we can not click back on the browser at the last quiz result page and re-attempt the last question to get full marks
|
|
|
69 |
Given I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
70 |
And I should see "First page contents"
|
|
|
71 |
And I press "Next page"
|
|
|
72 |
And I should see "The earth is round"
|
|
|
73 |
And I set the following fields to these values:
|
|
|
74 |
| True| 1 |
|
|
|
75 |
And I press "Submit"
|
|
|
76 |
And I should see "Correct"
|
|
|
77 |
And I press "Continue"
|
|
|
78 |
And I should see "Kermit is a frog"
|
|
|
79 |
And I set the following fields to these values:
|
|
|
80 |
| True| 1 |
|
|
|
81 |
And I press "Submit"
|
|
|
82 |
And I should see "Correct"
|
|
|
83 |
And I press "Continue"
|
|
|
84 |
And I should see "Second page contents"
|
|
|
85 |
And I press "Next page"
|
|
|
86 |
And I should see "Paper is made from trees"
|
|
|
87 |
And I set the following fields to these values:
|
|
|
88 |
| False | 1 |
|
|
|
89 |
And I press "Submit"
|
|
|
90 |
And I should see "Wrong"
|
|
|
91 |
And I press "Continue"
|
|
|
92 |
And I should see "Third page contents"
|
|
|
93 |
And I press "Next page"
|
|
|
94 |
And I should see "Congratulations - end of lesson reached"
|
|
|
95 |
And I should see "Your score is 2 (out of 3)"
|
|
|
96 |
And I press the "back" button in the browser
|
|
|
97 |
And I press the "back" button in the browser
|
|
|
98 |
And I press the "back" button in the browser
|
11 |
efrain |
99 |
And I reload the page
|
1 |
efrain |
100 |
And I should see "Paper is made from trees"
|
|
|
101 |
And I set the following fields to these values:
|
|
|
102 |
| True | 1 |
|
|
|
103 |
And I press "Submit"
|
|
|
104 |
And I should see "Correct"
|
|
|
105 |
And I press "Continue"
|
|
|
106 |
And I should see "Third page contents"
|
|
|
107 |
When I press "Next page"
|
|
|
108 |
Then I should see "Number of questions answered: 1 (You should answer at least 3)"
|
|
|
109 |
|
|
|
110 |
@javascript
|
|
|
111 |
Scenario: Check that we can not click back on the browser and re-attempt a question
|
|
|
112 |
Given I am on the "Test lesson name" "lesson activity" page logged in as student1
|
|
|
113 |
And I should see "First page contents"
|
|
|
114 |
And I press "Next page"
|
|
|
115 |
And I should see "The earth is round"
|
|
|
116 |
And I set the following fields to these values:
|
|
|
117 |
| False | 1 |
|
|
|
118 |
And I press "Submit"
|
|
|
119 |
And I should see "Wrong"
|
|
|
120 |
And I press the "back" button in the browser
|
11 |
efrain |
121 |
And I reload the page
|
1 |
efrain |
122 |
And I set the following fields to these values:
|
|
|
123 |
| True | 1 |
|
|
|
124 |
When I press "Submit"
|
|
|
125 |
Then I should see "Maximum number of attempts reached - Moving to next page"
|
|
|
126 |
And I press "Continue"
|
|
|
127 |
And I should see "Kermit is a frog"
|
|
|
128 |
And I set the following fields to these values:
|
|
|
129 |
| False | 1 |
|
|
|
130 |
And I press "Submit"
|
|
|
131 |
And I should see "Wrong"
|
|
|
132 |
And I press the "back" button in the browser
|
|
|
133 |
And I set the following fields to these values:
|
|
|
134 |
| True | 1 |
|
|
|
135 |
And I press "Submit"
|
|
|
136 |
And I should see "Maximum number of attempts reached - Moving to next page"
|
|
|
137 |
And I press "Continue"
|
|
|
138 |
And I should see "Second page contents"
|
|
|
139 |
And I press "Next page"
|
|
|
140 |
And I should see "Paper is made from trees"
|
|
|
141 |
And I set the following fields to these values:
|
|
|
142 |
| True | 1 |
|
|
|
143 |
And I press "Submit"
|
|
|
144 |
And I should see "Correct"
|
|
|
145 |
And I press the "back" button in the browser
|
11 |
efrain |
146 |
And I reload the page
|
1 |
efrain |
147 |
And I set the following fields to these values:
|
|
|
148 |
| False | 1 |
|
|
|
149 |
And I press "Submit"
|
|
|
150 |
And I should see "Maximum number of attempts reached - Moving to next page"
|
|
|
151 |
And I press "Continue"
|
|
|
152 |
And I should see "Third page contents"
|
|
|
153 |
And I press "Next page"
|
|
|
154 |
And I should see "Congratulations - end of lesson reached"
|
|
|
155 |
And I should see "Your score is 1 (out of 3)"
|