1 |
efrain |
1 |
@qtype @qtype_calculatedmulti
|
|
|
2 |
Feature: Test editing a Calculated multichoice question
|
|
|
3 |
As a teacher
|
|
|
4 |
In order to be able to update my Calculated multichoice questions
|
|
|
5 |
I need to edit 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 "user preferences" exist:
|
|
|
21 |
| user | preference | value |
|
|
|
22 |
| teacher | htmleditor | textarea |
|
|
|
23 |
|
|
|
24 |
Scenario: Add, edit and preview a Calculated multichoice question with HTML in answers
|
|
|
25 |
When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
|
|
|
26 |
And I press "Create a new question ..."
|
|
|
27 |
And I set the field "Calculated multichoice" to "1"
|
|
|
28 |
And I click on "Add" "button"
|
|
|
29 |
And I set the following fields to these values:
|
|
|
30 |
| Question name | calculatedmulti-001 |
|
|
|
31 |
| Question text | Multiply those two: s^{A} and s{B} |
|
|
|
32 |
| Choice 1 | s<sup>{={A}*{B}}</sup> |
|
|
|
33 |
| Choice 1 format | 1 |
|
|
|
34 |
| Grade | 100% |
|
|
|
35 |
| Choice 2 | s<sup>{={A}+{B}}</sup> |
|
|
|
36 |
| Choice 2 format | 1 |
|
|
|
37 |
And I press "id_submitbutton"
|
|
|
38 |
And I should see "Choose wildcards dataset properties"
|
|
|
39 |
And I press "id_submitbutton"
|
|
|
40 |
And I should see "Edit the wildcards datasets"
|
|
|
41 |
And I press "id_addbutton"
|
|
|
42 |
And I set the following fields to these values:
|
|
|
43 |
| id_number_2 | 6 |
|
|
|
44 |
| id_number_1 | 4 |
|
|
|
45 |
And I press "id_savechanges"
|
|
|
46 |
# Checking that the wildcard values are there
|
|
|
47 |
And I am on the "calculatedmulti-001" "core_question > edit" page logged in as teacher
|
|
|
48 |
And I set the following fields to these values:
|
|
|
49 |
| Question name | Edited question name |
|
|
|
50 |
And I press "id_submitbutton"
|
|
|
51 |
And I should see "Choose wildcards dataset properties"
|
|
|
52 |
And I press "id_submitbutton"
|
|
|
53 |
And I press "id_savechanges"
|
|
|
54 |
And I should see "Edited question name"
|
|
|
55 |
# Preview it.
|
|
|
56 |
And I choose "Preview" action for "Edited question name" in the question bank
|
|
|
57 |
Then I should not see "<sup>"
|
|
|
58 |
|
|
|
59 |
Scenario: Add, edit and preview a Calculated multichoice question with plain-text answers
|
|
|
60 |
When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
|
|
|
61 |
And I press "Create a new question ..."
|
|
|
62 |
And I set the field "Calculated multichoice" to "1"
|
|
|
63 |
And I click on "Add" "button"
|
|
|
64 |
And I set the following fields to these values:
|
|
|
65 |
| Question name | calculatedmulti-001 |
|
|
|
66 |
| Question text | Multiply those two: s^{A} and s{B} |
|
|
|
67 |
| Choice 1 | s<sup>{={A}*{B}}</sup> |
|
|
|
68 |
| Choice 1 format | 2 |
|
|
|
69 |
| Grade | 100% |
|
|
|
70 |
| Choice 2 | s<sup>{={A}+{B}}</sup> |
|
|
|
71 |
| Choice 2 format | 2 |
|
|
|
72 |
And I press "id_submitbutton"
|
|
|
73 |
And I should see "Choose wildcards dataset properties"
|
|
|
74 |
And I press "id_submitbutton"
|
|
|
75 |
And I should see "Edit the wildcards datasets"
|
|
|
76 |
And I press "id_addbutton"
|
|
|
77 |
And I set the following fields to these values:
|
|
|
78 |
| id_number_2 | 6 |
|
|
|
79 |
| id_number_1 | 4 |
|
|
|
80 |
And I press "id_savechanges"
|
|
|
81 |
# Checking that the wildcard values are there
|
|
|
82 |
And I am on the "calculatedmulti-001" "core_question > edit" page logged in as teacher
|
|
|
83 |
And I set the following fields to these values:
|
|
|
84 |
| Question name | Edited question name |
|
|
|
85 |
And I press "id_submitbutton"
|
|
|
86 |
And I should see "Choose wildcards dataset properties"
|
|
|
87 |
And I press "id_submitbutton"
|
|
|
88 |
And I press "id_savechanges"
|
|
|
89 |
And I should see "Edited question name"
|
|
|
90 |
# Preview it.
|
|
|
91 |
And I choose "Preview" action for "Edited question name" in the question bank
|
|
|
92 |
Then I should see "<sup>"
|