MDL-70153 qtype_essay: Add behat test for attachments max size
[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"
fdeeaff9 24 And I am on "Course 1" course homepage
02fda279 25 And I navigate to "Question bank" in current page administration
42865c84 26
c0066755 27 @javascript @_bug_phantomjs
42865c84 28 Scenario: Preview a question using the mouse.
9c14b28d 29 When I choose "Preview" action for "Drag onto image" in the question bank
42865c84 30 And I switch to "questionpreview" window
0f2aad59 31 # Increase window size and wait 2 seconds to ensure elements are placed properly by js.
e01012e9 32 # Keep window large else drag will scroll the window to find element.
ebf91776 33 And I change window size to "medium"
0f2aad59 34 And I wait "2" seconds
42865c84
TH
35 # Odd, but the <br>s go to nothing, not a space.
36 And I drag "mountainbelt" to place "1" in the drag and drop onto image question
37 And I drag "continentalshelf" to place "2" in the drag and drop onto image question
38 And I drag "oceantrench" to place "3" in the drag and drop onto image question
39 And I drag "abyssalplain" to place "4" in the drag and drop onto image question
40 And I drag "continentalslope" to place "5" in the drag and drop onto image question
41 And I drag "continentalrise" to place "6" in the drag and drop onto image question
42 And I drag "islandarc" to place "7" in the drag and drop onto image question
43 And I drag "mid-oceanridge" to place "8" in the drag and drop onto image question
44 And I press "Submit and finish"
45 Then the state of "Identify the features" question is shown as "Correct"
46 And I should see "Mark 1.00 out of 1.00"
be1ce906 47 And I switch to the main window
42865c84
TH
48
49 @javascript
50 Scenario: Preview a question using the keyboard.
9c14b28d 51 When I choose "Preview" action for "Drag onto image" in the question bank
42865c84 52 And I switch to "questionpreview" window
a3f22d31 53 # Increase window size and wait 2 seconds to ensure elements are placed properly by js.
ebf91776 54 And I change window size to "medium"
a3f22d31 55 And I wait "2" seconds
42865c84
TH
56 And I type " " on place "1" in the drag and drop onto image question
57 And I type " " on place "2" in the drag and drop onto image question
58 And I type " " on place "3" in the drag and drop onto image question
59 And I type " " on place "4" in the drag and drop onto image question
60 And I type " " on place "5" in the drag and drop onto image question
61 And I type " " on place "6" in the drag and drop onto image question
62 And I type " " on place "7" in the drag and drop onto image question
63 And I type " " on place "8" in the drag and drop onto image question
64 And I press "Submit and finish"
65 Then the state of "Identify the features" question is shown as "Correct"
66 And I should see "Mark 1.00 out of 1.00"
be1ce906 67 And I switch to the main window