MDL-50163 behat: wait to ensure elements are placed properly by js.
[moodle.git] / question / type / ddmarker / tests / behat / preview.feature
CommitLineData
8d892b1d 1@qtype @qtype_ddmarker @_switch_window
a366c8b9
TH
2Feature: Preview a drag-drop onto image question
3 As a teacher
4 In order to check my drag-drop onto image questions will work for students
5 I need to preview them
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | teacher1 | T1 | Teacher1 | teacher1@moodle.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 "question categories" exist:
18 | contextlevel | reference | name |
19 | Course | C1 | Test questions |
20 And the following "questions" exist:
21 | questioncategory | qtype | name | template |
22 | Test questions | ddmarker | Drag markers | mkmap |
23 Given I log in as "teacher1"
24 And I follow "Course 1"
25 And I navigate to "Question bank" node in "Course administration"
26
27 @javascript
28 Scenario: Preview a question using the mouse.
29 When I click on "Preview" "link" in the "Drag markers" "table_row"
30 And I switch to "questionpreview" window
0f2aad59
T
31 # Increase window size and wait 2 seconds to ensure elements are placed properly by js.
32 And I change window size to "medium"
33 And I wait "2" seconds
a366c8b9 34 # Odd, but the <br>s go to nothing, not a space.
0f2aad59
T
35 And I drag "OU" to "342,230" in the drag and drop markers question
36 And I drag "Railway station" to "254,197" in the drag and drop markers question
37 And I drag "Railway station,1" to "326,319" in the drag and drop markers question
38 And I drag "Railway station,2" to "203,101" in the drag and drop markers question
a366c8b9
TH
39 And I press "Submit and finish"
40 Then the state of "Please place the markers on the map of Milton Keynes" question is shown as "Correct"
41 And I should see "Mark 1.00 out of 1.00"
9deb358d 42 And I switch to the main window
a366c8b9
TH
43
44 @javascript
45 Scenario: Preview a question using the keyboard.
46 When I click on "Preview" "link" in the "Drag markers" "table_row"
47 And I switch to "questionpreview" window
a3f22d31
RT
48 # Increase window size and wait 2 seconds to ensure elements are placed properly by js.
49 And I change window size to "medium"
50 And I wait "2" seconds
a366c8b9
TH
51 And I type "up" "89" times on marker "Railway station" in the drag and drop markers question
52 And I type "right" "21" times on marker "Railway station" in the drag and drop markers question
53 And I press "Submit and finish"
54 Then the state of "Please place the markers on the map of Milton Keynes" question is shown as "Partially correct"
55 And I should see "Mark 0.25 out of 1.00"
9deb358d 56 And I switch to the main window