MDL-71205 Default options for qtype_numerical
[moodle.git] / question / type / numerical / tests / behat / add.feature
1 @qtype @qtype_numerical
2 Feature: Test creating a Numerical question
3   As a teacher
4   In order to test my students
5   I need to be able to create a Numerical question
7   Background:
8     Given the following "users" exist:
9       | username | firstname | lastname | email               |
10       | teacher1 | T1        | Teacher1 | teacher1@example.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 "language customisations" exist:
18       | component       | stringid | value |
19       | core_langconfig | decsep   | #     |
20     And I log in as "teacher1"
21     And I am on "Course 1" course homepage
22     And I navigate to "Question bank" in current page administration
24   Scenario: Create a Numerical question
25     When I add a "Numerical" question filling the form with:
26       | Question name                      | Numerical-001                          |
27       | Question text                      | What is the average of 4, 5, 6 and 10? |
28       | Default mark                       | 1                                      |
29       | General feedback                   | The average is 6.25                    |
30       | id_answer_0                        | 6.25                                   |
31       | id_tolerance_0                     | 0.05                                   |
32       | id_fraction_0                      | 100%                                   |
33       | id_answer_1                        | 2#25                                   |
34       | id_tolerance_1                     | 0#05                                   |
35       | id_fraction_1                      | 0%                                     |
36       | id_answer_2                        | 5,1                                    |
37       | id_tolerance_2                     | 0                                      |
38       | id_fraction_2                      | 100%                                   |
39     Then I should see "Numerical-001"
41   @javascript
42   Scenario: Create a Numerical question with units
43     Given I add a "Numerical" question filling the form with:
44       | Question name                      | Numerical-002                               |
45       | Question text                      | How many meter is 1m + 20cm + 50mm?         |
46       | Default mark                       | 1                                           |
47       | General feedback                   | The correct answer is 1.25m                 |
48       | id_answer_0                        | 1.25                                        |
49       | id_tolerance_0                     | 0                                           |
50       | id_fraction_0                      | 100%                                        |
51       | id_answer_1                        | 125                                         |
52       | id_tolerance_1                     | 0                                           |
53       | id_fraction_1                      | 0%                                          |
54       | id_answer_2                        | 1250                                        |
55       | id_tolerance_2                     | 0                                           |
56       | id_fraction_2                      | 0%                                          |
57       | id_unitrole                        | The unit must be given, and will be graded. |
58       | id_unitpenalty                     | 0.15                                        |
59       | id_unitgradingtypes                | as a fraction (0-1) of the question grade   |
60       | id_unitsleft                       | on the right, for example 1.00cm or 1.00km  |
61       | id_multichoicedisplay              | a drop-down menu                            |
62       | id_unit_0                          | m                                           |
63     And I should see "Numerical-002"
64     # Checking that the next new question form displays user preferences settings.
65     When I press "Create a new question ..."
66     And I set the field "item_qtype_numerical" to "1"
67     And I click on "Add" "button" in the "Choose a question type to add" "dialogue"
68     Then the following fields match these values:
69       | id_unitrole                        | The unit must be given, and will be graded. |
70       | id_unitpenalty                     | 0#15                                        |
71       | id_unitgradingtypes                | as a fraction (0-1) of the question grade   |
72       | id_multichoicedisplay              | a drop-down menu                            |
73       | id_unitsleft                       | on the right, for example 1.00cm or 1.00km  |