1 |
efrain |
1 |
@core @core_question @core_customfield @qbank_customfields @javascript
|
|
|
2 |
Feature: A teacher can edit question with custom fields
|
|
|
3 |
In order to improve my questions
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to be able to edit questions and add extra metadata via custom fields
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
And the following "courses" exist:
|
|
|
12 |
| fullname | shortname | format |
|
|
|
13 |
| Course 1 | C1 | weeks |
|
|
|
14 |
And the following "course enrolments" exist:
|
|
|
15 |
| user | course | role |
|
|
|
16 |
| teacher1 | C1 | editingteacher |
|
|
|
17 |
And the following "custom field categories" exist:
|
|
|
18 |
| name | component | area | itemid |
|
|
|
19 |
| Category for test | qbank_customfields | question | 0 |
|
|
|
20 |
And the following "custom fields" exist:
|
|
|
21 |
| name | category | type | shortname |
|
|
|
22 |
| Field 1 | Category for test | text | f1 |
|
|
|
23 |
And the following "activity" exists:
|
|
|
24 |
| activity | quiz |
|
|
|
25 |
| course | C1 |
|
|
|
26 |
| idnumber | 00001 |
|
|
|
27 |
| name | Test quiz name |
|
|
|
28 |
| intro | Test quiz description |
|
|
|
29 |
| section | 1 |
|
|
|
30 |
| grade | 10 |
|
|
|
31 |
And I log in as "teacher1"
|
|
|
32 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
33 |
And I add a "True/False" question to the "Test quiz name" quiz with:
|
|
|
34 |
| Question name | First question |
|
|
|
35 |
| Question text | Answer the first question |
|
|
|
36 |
| General feedback | Thank you, this is the general feedback |
|
|
|
37 |
| Correct answer | False |
|
|
|
38 |
| Feedback for the response 'True'. | So you think it is true |
|
|
|
39 |
| Feedback for the response 'False'. | So you think it is false |
|
|
|
40 |
And I am on the "Test quiz name" "mod_quiz > question bank" page
|
|
|
41 |
|
|
|
42 |
Scenario: Edit a previously created question and see the custom field in the overview table and in the question preview.
|
|
|
43 |
When I am on the "First question" "core_question > edit" page
|
|
|
44 |
Then I should see "Category for test"
|
|
|
45 |
And I expand all fieldsets
|
|
|
46 |
And I should see "Field 1"
|
|
|
47 |
And I set the following fields to these values:
|
|
|
48 |
| Question name | First question edited |
|
|
|
49 |
| Field 1 | custom field text |
|
|
|
50 |
And I press "id_submitbutton"
|
|
|
51 |
And I should see "First question"
|
|
|
52 |
And I should see "custom field text"
|
|
|
53 |
And I am on the "First question edited" "core_question > preview" page
|
|
|
54 |
And I should see "Field 1"
|
|
|
55 |
And I should see "custom field text"
|
|
|
56 |
|
|
|
57 |
Scenario: Preview a previously created question with custom fields set with empty values
|
|
|
58 |
When I am on the "First question" "core_question > preview" page
|
|
|
59 |
Then I should see "Field 1"
|
|
|
60 |
And I should not see "custom field text"
|