1 |
efrain |
1 |
@qtype @qtype_numerical
|
|
|
2 |
Feature: Preview a Numerical question
|
|
|
3 |
As a teacher
|
|
|
4 |
In order to check my Numerical questions will work for students
|
|
|
5 |
I need to preview them
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username |
|
|
|
10 |
| teacher |
|
|
|
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 |
| teacher | 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 | numerical | Numerical-001 | pi |
|
|
|
23 |
| Test questions | numerical | Numerical-002 | pi3tries |
|
|
|
24 |
And the following "language customisations" exist:
|
|
|
25 |
| component | stringid | value |
|
|
|
26 |
| core_langconfig | decsep | # |
|
|
|
27 |
|
|
|
28 |
@javascript @_switch_window
|
|
|
29 |
Scenario: Preview a Numerical question and submit a correct response.
|
|
|
30 |
When I am on the "Numerical-001" "core_question > preview" page logged in as teacher
|
|
|
31 |
And I should see "What is pi to two d.p.?"
|
|
|
32 |
And I expand all fieldsets
|
|
|
33 |
And I set the field "How questions behave" to "Immediate feedback"
|
|
|
34 |
And I press "Save preview options and start again"
|
|
|
35 |
And I set the field with xpath "//span[@class='answer']//input[contains(@id, '1_answer')]" to "3.14"
|
|
|
36 |
And I press "Check"
|
|
|
37 |
Then I should see "Very good."
|
|
|
38 |
And I should see "Mark 1#00 out of 1#00"
|
|
|
39 |
And I press "Start again"
|
|
|
40 |
And I set the field with xpath "//span[@class='answer']//input[contains(@id, '1_answer')]" to "3,14"
|
|
|
41 |
And I press "Check"
|
|
|
42 |
And I should see "Please enter your answer without using the thousand separator (,)."
|
|
|
43 |
And I press "Start again"
|
|
|
44 |
And I set the field with xpath "//span[@class='answer']//input[contains(@id, '1_answer')]" to "3#14"
|
|
|
45 |
And I press "Check"
|
|
|
46 |
And I should see "Very good."
|
|
|
47 |
And I should see "Mark 1#00 out of 1#00"
|
|
|
48 |
|
|
|
49 |
Scenario: Preview a Numerical question with optional units
|
|
|
50 |
Given I am on the "Numerical-001" "core_question > edit" page logged in as teacher
|
|
|
51 |
# Edit the existing numerical question, add in the optional units.
|
|
|
52 |
And I set the following fields to these values:
|
|
|
53 |
| Question name | Numerical Question (optional) |
|
|
|
54 |
| Question text | How many meter is 1m + 20cm + 50mm? |
|
|
|
55 |
| Default mark | 1 |
|
|
|
56 |
| General feedback | The correct answer is 1.25m |
|
|
|
57 |
| id_answer_0 | 1.25 |
|
|
|
58 |
| id_tolerance_0 | 0 |
|
|
|
59 |
| id_fraction_0 | 100% |
|
|
|
60 |
| id_answer_1 | 125 |
|
|
|
61 |
| id_tolerance_1 | 0 |
|
|
|
62 |
| id_fraction_1 | 0% |
|
|
|
63 |
| id_unitrole | Units are optional. |
|
|
|
64 |
| id_unitsleft | on the right, for example 1.00cm or 1.00km |
|
|
|
65 |
| id_unit_0 | m |
|
|
|
66 |
And I press "submitbutton"
|
|
|
67 |
When I choose "Preview" action for "Numerical Question (optional)" in the question bank
|
|
|
68 |
# Unit is optional, so the unit select box should not be exist.
|
|
|
69 |
Then "Select one unit" "select" should not exist
|