a46d14b19da0bba76c7bff210dc69120378dfc9d
[moodle.git] / question / type / ddmarker / tests / behat / preview.feature
1 @ou @ou_vle @qtype @qtype_ddmarker
2 Feature: 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
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"
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
31     # Odd, but the <br>s go to nothing, not a space.
32     And I drag "OU" to "340,228" in the drag and drop markers question
33     And I drag "Railway station" to "252,195" in the drag and drop markers question
34     And I drag "Railway station,1" to "324,317" in the drag and drop markers question
35     And I drag "Railway station,2" to "201,99" in the drag and drop markers question
36     And I press "Submit and finish"
37     Then the state of "Please place the markers on the map of Milton Keynes" question is shown as "Correct"
38     And I should see "Mark 1.00 out of 1.00"
39     And I switch to the main window
41   @javascript
42   Scenario: Preview a question using the keyboard.
43     When I click on "Preview" "link" in the "Drag markers" "table_row"
44     And I switch to "questionpreview" window
45     And I type "up" "89" times on marker "Railway station" in the drag and drop markers question
46     And I type "right" "21" times on marker "Railway station" in the drag and drop markers question
47     And I press "Submit and finish"
48     Then the state of "Please place the markers on the map of Milton Keynes" question is shown as "Partially correct"
49     And I should see "Mark 0.25 out of 1.00"
50     And I switch to the main window