MDL-50163 behat: wait to ensure elements are placed properly by js.
[moodle.git] / question / type / ddimageortext / tests / behat / preview.feature
CommitLineData
8d892b1d 1@qtype @qtype_ddimageortext @_switch_window
42865c84
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 | ddimageortext | Drag onto image | xsection |
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 onto image" "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
42865c84
TH
34 # Odd, but the <br>s go to nothing, not a space.
35 And I drag "mountainbelt" to place "1" in the drag and drop onto image question
36 And I drag "continentalshelf" to place "2" in the drag and drop onto image question
37 And I drag "oceantrench" to place "3" in the drag and drop onto image question
38 And I drag "abyssalplain" to place "4" in the drag and drop onto image question
39 And I drag "continentalslope" to place "5" in the drag and drop onto image question
40 And I drag "continentalrise" to place "6" in the drag and drop onto image question
41 And I drag "islandarc" to place "7" in the drag and drop onto image question
42 And I drag "mid-oceanridge" to place "8" in the drag and drop onto image question
43 And I press "Submit and finish"
44 Then the state of "Identify the features" question is shown as "Correct"
45 And I should see "Mark 1.00 out of 1.00"
be1ce906 46 And I switch to the main window
42865c84
TH
47
48 @javascript
49 Scenario: Preview a question using the keyboard.
50 When I click on "Preview" "link" in the "Drag onto image" "table_row"
51 And I switch to "questionpreview" window
a3f22d31
RT
52 # Increase window size and wait 2 seconds to ensure elements are placed properly by js.
53 And I change window size to "medium"
54 And I wait "2" seconds
42865c84
TH
55 And I type " " on place "1" in the drag and drop onto image question
56 And I type " " on place "2" in the drag and drop onto image question
57 And I type " " on place "3" in the drag and drop onto image question
58 And I type " " on place "4" in the drag and drop onto image question
59 And I type " " on place "5" in the drag and drop onto image question
60 And I type " " on place "6" in the drag and drop onto image question
61 And I type " " on place "7" in the drag and drop onto image question
62 And I type " " on place "8" in the drag and drop onto image question
63 And I press "Submit and finish"
64 Then the state of "Identify the features" question is shown as "Correct"
65 And I should see "Mark 1.00 out of 1.00"
be1ce906 66 And I switch to the main window