1 |
efrain |
1 |
@qbank @qbank_managecategories
|
|
|
2 |
Feature: A teacher can put questions with idnumbers in categories with idnumbers in the question bank
|
|
|
3 |
In order to organize my questions
|
|
|
4 |
As a teacher
|
|
|
5 |
I create and edit categories (now with idnumbers)
|
|
|
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 I log in as "teacher1"
|
|
|
18 |
And I am on "Course 1" course homepage
|
|
|
19 |
|
|
|
20 |
Scenario: A new question category can only be created with a unique idnumber for a context
|
|
|
21 |
# Note need to create the top category each time.
|
|
|
22 |
When the following "question categories" exist:
|
|
|
23 |
| contextlevel | reference | questioncategory | name | idnumber |
|
|
|
24 |
| Course | C1 | Top | top | |
|
|
|
25 |
| Course | C1 | top | Used category | c1used |
|
|
|
26 |
And I am on the "Course 1" "core_question > course question categories" page
|
|
|
27 |
And I follow "Add category"
|
|
|
28 |
And I set the following fields to these values:
|
|
|
29 |
| Name | Sub used category |
|
|
|
30 |
| Parent category | Used category |
|
|
|
31 |
| Category info | Created as a test |
|
|
|
32 |
| ID number | c1used |
|
|
|
33 |
And I press "submitbutton"
|
|
|
34 |
# Standard warning.
|
|
|
35 |
Then I should see "This ID number is already in use"
|
|
|
36 |
# Correction to a unique idnumber for the context.
|
|
|
37 |
And I set the field "ID number" to "c1unused"
|
|
|
38 |
And I press "submitbutton"
|
|
|
39 |
Then I should see "Sub used category"
|
|
|
40 |
And I should see "ID number"
|
|
|
41 |
And I should see "c1unused"
|
|
|
42 |
And I should see "(0)"
|
|
|
43 |
And I should see "Created as a test" in the "Sub used category" "list_item"
|
|
|
44 |
|
|
|
45 |
Scenario: A question category can be edited and saved without changing the idnumber
|
|
|
46 |
When the following "question categories" exist:
|
|
|
47 |
| contextlevel | reference | questioncategory | name | idnumber |
|
|
|
48 |
| Course | C1 | Top | top | |
|
|
|
49 |
| Course | C1 | top | Used category | c1used |
|
|
|
50 |
And I am on the "Course 1" "core_question > course question categories" page
|
|
|
51 |
And I click on "Edit this category" "link" in the "Used category" "list_item"
|
|
|
52 |
And I press "Save changes"
|
|
|
53 |
Then I should not see "This ID number is already in use"
|