2 Feature: A teacher can put questions in categories in the question bank
3 In order to organize their questions
5 I need to put questions in categories
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | teacher1 | Teacher | 1 | teacher1@asd.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 follow "Course 1"
19 # Add 2 test categories.
20 And I follow "Question bank"
21 And I follow "Categories"
22 And I set the following fields to these values:
23 | Name | New Category 1 |
24 | Parent category | Top |
25 And I press "id_submitbutton"
26 And I set the following fields to these values:
27 | Name | New Category 2 |
28 | Parent category | Top |
29 And I press "id_submitbutton"
31 And I add a "Essay" question filling the form with:
32 | Question name | my test question |
33 | Question text | my test question |
34 | Category | New Category 1 |
37 Scenario: Move a question between categories via the question page
38 When I set the field "Select a category" to "New Category 1 (1)"
39 And I click on "my test question" "checkbox" in the "my test question" "table_row"
40 And I set the field "Question category" to "New Category 2"
41 And I press "Move to >>"
42 Then I should see "my test question"
43 And the "Select a category" select box should contain "New Category 2 (1)"
44 And the "Select a category" select box should contain "New Category 1"
45 And the "Select a category" select box should not contain "New Category 1 (1)"
48 Scenario: Move a question between categories via the question settings page
49 When I click on "Edit" "link" in the "my test question" "table_row"
50 And I click on "Use this category" "checkbox"
51 And I set the field "Save in category" to "New Category 2"
52 And I press "id_submitbutton"
53 Then I should see "my test question"
54 And the "Select a category" select box should contain "New Category 2 (1)"
55 And the "Select a category" select box should not contain "New Category 1 (1)"
58 Scenario: Delete a question category
59 When I follow "Categories"
60 And I click on "Delete" "link" in the "//a[text()='New Category 1']/parent::b/parent::li" "xpath_element"
61 Then I should see "The category 'New Category 1' contains 1 questions"
62 And I press "Save in category"
63 And I should not see "New Category 1"