MDL-47494 ddimageortext: DD markers / onto image: form, drag items before drop zones...
[moodle.git] / question / type / ddimageortext / tests / behat / basic_test.feature
CommitLineData
3b504829
K
1@ou @ou_vle @qtype @qtype_ddimageortext
2Feature: Test all the basic functionality of this question type
3 In order to evaluate students responses, As a teacher I need to
4 create and preview ddimageortext (Drag and drop onto image) questions.
5
6 # Due to complexity and since the javascript code needs to be converted at some stage,
7 # we are not going to test attempting this qtype. However, we will do all other
8 # possible testings, such as creating the question preview it and seeing the
9 # correct information on the preview string as well as backing-up and restoring
10 # the course containing this qtype.
11
12 # Another way to test attempting this qtype while previewing it, it write a
13 # customised step for tabbing through place-holders and another customised
14 # step for making use of arrow keys in order to go through the list of choices.
15
16 Background:
17 Given the following "users" exist:
18 | username | firstname | lastname | email |
19 | teacher1 | T1 | Teacher1 | teacher1@moodle.com |
20 And the following "courses" exist:
21 | fullname | shortname | category |
22 | Course 1 | C1 | 0 |
23 And the following "course enrolments" exist:
24 | user | course | role |
25 | teacher1 | C1 | editingteacher |
26
27 @javascript
28 Scenario: Create, edit then preview a ddimageortext question.
29 Given I log in as "teacher1"
30 And I follow "Course 1"
31 And I navigate to "Question bank" node in "Course administration"
32 Then I should see "Question bank"
33
34 # Create a new question
35 # We have to set the fields individually, because of the step for uploading the background image.
36 Given I press "Create a new question ..."
37 And I set the field "Drag and drop onto image" to "1"
38 Then I press "Add"
39 And I should see "Adding drag and drop onto image"
40 Then I set the field "Question name" to "Drag and drop onto image 001"
41 And I set the field "Question text" to "Identify the features in this cross-section."
42 And I set the field "General feedback" to "The locations are now labelled on the diagram below."
43 Given I upload "question/type/ddimageortext/tests/fixtures/oceanfloorbase.jpg" file to "Background image" filemanager
44
45 # Draggable items
46 Given I follow "Draggable items"
47 Then I press "Blanks for 3 more draggable items"
48
49 And I set the field "id_drags_0_dragitemtype" to "Draggable text"
50 And I set the field "id_draglabel_0" to "island<br/>arc"
51
52 And I set the field "id_drags_1_dragitemtype" to "Draggable text"
53 And I set the field "id_draglabel_1" to "mid-ocean<br/>ridge"
54
55 And I set the field "id_drags_2_dragitemtype" to "Draggable text"
56 And I set the field "id_draglabel_2" to "abyssal<br/>plain"
57
58 And I set the field "id_drags_3_dragitemtype" to "Draggable text"
59 And I set the field "id_draglabel_3" to "continental<br/>rise"
60
61 And I set the field "id_drags_4_dragitemtype" to "Draggable text"
62 And I set the field "id_draglabel_4" to "ocean<br/>trench"
63
64 And I set the field "id_drags_5_dragitemtype" to "Draggable text"
65 And I set the field "id_draglabel_5" to "continental<br/>slope"
66
67 And I set the field "id_drags_6_dragitemtype" to "Draggable text"
68 And I set the field "id_draglabel_6" to "mountain<br/>belt"
69
70 And I set the field "id_drags_7_dragitemtype" to "Draggable text"
71 And I set the field "id_draglabel_7" to "continental<br/>shelf"
72
73 # Drop zones
74 Given I follow "Drop zones"
75 Then I press "Blanks for 3 more drop zones"
76
77 And I set the field "id_drops_0_xleft" to "53"
78 And I set the field "id_drops_0_ytop" to "17"
79 And I set the field "id_drops_0_choice" to "7"
80
81 And I set the field "id_drops_1_xleft" to "172"
82 And I set the field "id_drops_1_ytop" to "2"
83 And I set the field "id_drops_1_choice" to "8"
84
85 And I set the field "id_drops_2_xleft" to "363"
86 And I set the field "id_drops_2_ytop" to "31"
87 And I set the field "id_drops_2_choice" to "5"
88
89 And I set the field "id_drops_3_xleft" to "440"
90 And I set the field "id_drops_3_ytop" to "13"
91 And I set the field "id_drops_3_choice" to "3"
92
93 And I set the field "id_drops_4_xleft" to "115"
94 And I set the field "id_drops_4_ytop" to "74"
95 And I set the field "id_drops_4_choice" to "6"
96
97 And I set the field "id_drops_5_xleft" to "210"
98 And I set the field "id_drops_5_ytop" to "94"
99 And I set the field "id_drops_5_choice" to "4"
100
101 And I set the field "id_drops_6_xleft" to "310"
102 And I set the field "id_drops_6_ytop" to "87"
103 And I set the field "id_drops_6_choice" to "1"
104
105 And I set the field "id_drops_7_xleft" to "479"
106 And I set the field "id_drops_7_ytop" to "84"
107 And I set the field "id_drops_7_choice" to "2"
108
109
110 And I press "id_submitbutton"
111 Then I should see "Drag and drop onto image 001"
112
113 # Preview it.
114 When I click on "Preview" "link" in the "Drag and drop onto image 001" "table_row"
115 And I switch to "questionpreview" window
116 Then I should see "Preview question: Drag and drop onto image 001"
117 And I switch to the main window
118
119 # Backup the course and restore it.
120 When I log out
121 And I log in as "admin"
122 When I backup "Course 1" course using this options:
123 | Confirmation | Filename | test_backup.mbz |
124 When I restore "test_backup.mbz" backup into a new course using this options:
125 | Schema | Course name | Course 2 |
126 Then I should see "Course 2"
127 When I navigate to "Question bank" node in "Course administration"
128 Then I should see "Drag and drop onto image 001"
129
130 # Edit the copy and verify the form field contents.
131 When I click on "Edit" "link" in the "Drag and drop onto image 001" "table_row"
132 Then the following fields match these values:
133 | Question name | Drag and drop onto image 001 |
134 | Question text | Identify the features in this cross-section. |
135 | General feedback | The locations are now labelled on the diagram below. |
136
137 # Draggable items
138 | id_drags_0_dragitemtype | Draggable text |
139 | id_draglabel_0 | island<br/>arc |
140
141 | id_drags_1_dragitemtype | Draggable text |
142 | id_draglabel_1 | mid-ocean<br/>ridge |
143
144 | id_drags_2_dragitemtype | Draggable text |
145 | id_draglabel_2 | abyssal<br/>plain |
146
147 | id_drags_3_dragitemtype | Draggable text |
148 | id_draglabel_3 | continental<br/>rise |
149
150 | id_drags_4_dragitemtype | Draggable text |
151 | id_draglabel_4 | ocean<br/>trench |
152
153 | id_drags_5_dragitemtype | Draggable text |
154 | id_draglabel_5 | continental<br/>slope |
155
156 | id_drags_6_dragitemtype | Draggable text |
157 | id_draglabel_6 | mountain<br/>belt |
158
159 | id_drags_7_dragitemtype | Draggable text |
160 | id_draglabel_7 | continental<br/>shelf |
161
162 # Drop zones
163 | id_drops_0_xleft | 53 |
164 | id_drops_0_ytop | 17 |
165 | id_drops_0_choice | 7 |
166
167 | id_drops_1_xleft | 172 |
168 | id_drops_1_ytop | 2 |
169 | id_drops_1_choice | 8 |
170
171 | id_drops_2_xleft | 363 |
172 | id_drops_2_ytop | 31 |
173 | id_drops_2_choice | 5 |
174
175 | id_drops_3_xleft | 440 |
176 | id_drops_3_ytop | 13 |
177 | id_drops_3_choice | 3 |
178
179 | id_drops_4_xleft | 115 |
180 | id_drops_4_ytop | 74 |
181 | id_drops_4_choice | 6 |
182
183 | id_drops_5_xleft | 210 |
184 | id_drops_5_ytop | 94 |
185 | id_drops_5_choice | 4 |
186
187 | id_drops_6_xleft | 310 |
188 | id_drops_6_ytop | 87 |
189 | id_drops_6_choice | 1 |
190
191 | id_drops_7_xleft | 479 |
192 | id_drops_7_ytop | 84 |
193 | id_drops_7_choice | 2 |
194
195 And I set the following fields to these values:
196 | Question name | Edited question name |
197 And I press "id_submitbutton"
198 Then I should see "Edited question name"