1 |
efrain |
1 |
@mod @mod_quiz
|
|
|
2 |
Feature: Edit quiz page - pagination
|
|
|
3 |
In order to build a quiz laid out in pages the way I want
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to be able to add and remove pages, and repaginate.
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | T1 | Teacher1 | teacher1@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 |
And the following "activities" exist:
|
|
|
18 |
| activity | name | intro | course | idnumber |
|
|
|
19 |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 |
|
|
|
20 |
|
|
|
21 |
When I log in as "teacher1"
|
|
|
22 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
23 |
|
|
|
24 |
@javascript
|
|
|
25 |
Scenario: Repaginate questions with N question(s) per page as well as clicking
|
|
|
26 |
on "add page break" or "Remove page break" icons to repaginate in any desired format.
|
|
|
27 |
|
|
|
28 |
# Add the first Essay question.
|
|
|
29 |
And I open the action menu in ".page-add-actions" "css_element"
|
|
|
30 |
And I follow "a new question"
|
|
|
31 |
And I set the field "item_qtype_essay" to "1"
|
|
|
32 |
And I press "submitbutton"
|
|
|
33 |
Then I should see "Adding an Essay question"
|
|
|
34 |
And I set the field "Question name" to "Essay 01 new"
|
|
|
35 |
And I set the field "Question text" to "Please write 100 words about Essay 01"
|
|
|
36 |
And I press "id_submitbutton"
|
|
|
37 |
Then I should see "Essay 01 new" on quiz page "1"
|
|
|
38 |
|
|
|
39 |
# Add the second Essay question.
|
|
|
40 |
And I open the action menu in ".page-add-actions" "css_element"
|
|
|
41 |
And I follow "a new question"
|
|
|
42 |
And I set the field "item_qtype_essay" to "1"
|
|
|
43 |
And I press "submitbutton"
|
|
|
44 |
Then I should see "Adding an Essay question"
|
|
|
45 |
And I set the field "Question name" to "Essay 02 new"
|
|
|
46 |
And I set the field "Question text" to "Please write 200 words about Essay 02"
|
|
|
47 |
And I press "id_submitbutton"
|
|
|
48 |
Then I should see "Essay 01 new" on quiz page "1"
|
|
|
49 |
And I should see "Essay 02 new" on quiz page "1"
|
|
|
50 |
|
|
|
51 |
# Start repaginating.
|
|
|
52 |
And I should not see "Page 2"
|
|
|
53 |
|
|
|
54 |
When I click on the "Add" page break icon after question "Essay 01 new"
|
|
|
55 |
And I should see "Essay 01 new" on quiz page "1"
|
|
|
56 |
And I should see "Essay 02 new" on quiz page "2"
|
|
|
57 |
|
|
|
58 |
When I click on the "Remove" page break icon after question "Essay 01 new"
|
|
|
59 |
And I should see "Essay 01 new" on quiz page "1"
|
|
|
60 |
And I should see "Essay 02 new" on quiz page "1"
|
|
|
61 |
And I should not see "Page 2"
|
|
|
62 |
|
|
|
63 |
# Add the third Essay question.
|
|
|
64 |
And I open the action menu in ".page-add-actions" "css_element"
|
|
|
65 |
And I follow "a new question"
|
|
|
66 |
And I set the field "item_qtype_essay" to "1"
|
|
|
67 |
And I press "submitbutton"
|
|
|
68 |
Then I should see "Adding an Essay question"
|
|
|
69 |
And I set the field "Question name" to "Essay 03 new"
|
|
|
70 |
And I set the field "Question text" to "Please write 200 words about Essay 03"
|
|
|
71 |
And I press "id_submitbutton"
|
|
|
72 |
Then I should see "Essay 01 new" on quiz page "1"
|
|
|
73 |
And I should see "Essay 02 new" on quiz page "1"
|
|
|
74 |
And I should see "Essay 03 new" on quiz page "1"
|
|
|
75 |
And I should not see "Page 2"
|
|
|
76 |
And I should not see "Page 3"
|
|
|
77 |
|
|
|
78 |
When I click on the "Add" page break icon after question "Essay 02 new"
|
|
|
79 |
And I should see "Essay 01 new" on quiz page "1"
|
|
|
80 |
And I should see "Essay 02 new" on quiz page "1"
|
|
|
81 |
And I should see "Essay 03 new" on quiz page "2"
|
|
|
82 |
And I should not see "Page 3"
|
|
|
83 |
|
|
|
84 |
When I click on the "Add" page break icon after question "Essay 01 new"
|
|
|
85 |
And I should see "Essay 01 new" on quiz page "1"
|
|
|
86 |
And I should see "Essay 02 new" on quiz page "2"
|
|
|
87 |
And I should see "Essay 03 new" on quiz page "3"
|
|
|
88 |
|
|
|
89 |
When I click on the "Remove" page break icon after question "Essay 02 new"
|
|
|
90 |
And I should see "Essay 01 new" on quiz page "1"
|
|
|
91 |
And I should see "Essay 02 new" on quiz page "2"
|
|
|
92 |
And I should see "Essay 03 new" on quiz page "2"
|
|
|
93 |
And I should not see "Page 3"
|
|
|
94 |
|
|
|
95 |
When I click on the "Remove" page break icon after question "Essay 01 new"
|
|
|
96 |
And I should see "Essay 01 new" on quiz page "1"
|
|
|
97 |
And I should see "Essay 02 new" on quiz page "1"
|
|
|
98 |
And I should see "Essay 03 new" on quiz page "1"
|
|
|
99 |
And I should not see "Page 2"
|
|
|
100 |
And I should not see "Page 3"
|
|
|
101 |
|
|
|
102 |
# Repaginate one question per page.
|
|
|
103 |
When I press "Repaginate"
|
|
|
104 |
And I set the field "menuquestionsperpage" to "1"
|
|
|
105 |
And I click on "Go" "button" in the "Repaginate" "dialogue"
|
|
|
106 |
Then I should see "Essay 01 new" on quiz page "1"
|
|
|
107 |
And I should see "Essay 02 new" on quiz page "2"
|
|
|
108 |
And I should see "Essay 03 new" on quiz page "3"
|
|
|
109 |
|
|
|
110 |
# Add the forth Essay question in a new page (Page 4).
|
|
|
111 |
When I open the "Page 3" add to quiz menu
|
|
|
112 |
And I choose "a new question" in the open action menu
|
|
|
113 |
And I set the field "item_qtype_essay" to "1"
|
|
|
114 |
And I press "submitbutton"
|
|
|
115 |
Then I should see "Adding an Essay question"
|
|
|
116 |
When I set the field "Question name" to "Essay 04 new"
|
|
|
117 |
And I set the field "Question text" to "Please write 300 words about Essay 04"
|
|
|
118 |
And I press "id_submitbutton"
|
|
|
119 |
Then I should see "Essay 01 new" on quiz page "1"
|
|
|
120 |
And I should see "Essay 02 new" on quiz page "2"
|
|
|
121 |
And I should see "Essay 03 new" on quiz page "3"
|
|
|
122 |
And I should see "Essay 04 new" on quiz page "3"
|
|
|
123 |
|
|
|
124 |
When I click on the "Add" page break icon after question "Essay 03 new"
|
|
|
125 |
And I should see "Essay 01 new" on quiz page "1"
|
|
|
126 |
And I should see "Essay 02 new" on quiz page "2"
|
|
|
127 |
And I should see "Essay 03 new" on quiz page "3"
|
|
|
128 |
And I should see "Essay 04 new" on quiz page "4"
|
|
|
129 |
|
|
|
130 |
# Repaginate with 2 questions per page.
|
|
|
131 |
When I press "Repaginate"
|
|
|
132 |
And I set the field "menuquestionsperpage" to "2"
|
|
|
133 |
And I click on "Go" "button" in the "Repaginate" "dialogue"
|
|
|
134 |
Then I should see "Essay 01 new" on quiz page "1"
|
|
|
135 |
And I should see "Essay 02 new" on quiz page "1"
|
|
|
136 |
And I should see "Essay 03 new" on quiz page "2"
|
|
|
137 |
And I should see "Essay 04 new" on quiz page "2"
|
|
|
138 |
|
|
|
139 |
# Repaginate with unlimited questions per page (All questions on Page 1).
|
|
|
140 |
When I press "Repaginate"
|
|
|
141 |
And I set the field "menuquestionsperpage" to "Unlimited"
|
|
|
142 |
And I click on "Go" "button" in the "Repaginate" "dialogue"
|
|
|
143 |
Then I should see "Essay 01 new" on quiz page "1"
|
|
|
144 |
And I should see "Essay 02 new" on quiz page "1"
|
|
|
145 |
And I should see "Essay 03 new" on quiz page "1"
|
|
|
146 |
And I should see "Essay 04 new" on quiz page "1"
|