[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/question/tests/behat/ -> question_categories.feature (source)

   1  @core @core_question
   2  Feature: A teacher can put questions in categories in the question bank
   3    In order to organize my questions
   4    As a teacher
   5    I create and edit categories and move questions between them
   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 "question categories" exist:
  18        | contextlevel | reference | questioncategory | name           |
  19        | Course       | C1        | Top              | Default for C1 |
  20        | Course       | C1        | Default for C1   | Subcategory    |
  21        | Course       | C1        | Top              | Used category  |
  22      And the following "questions" exist:
  23        | questioncategory | qtype | name                      | questiontext                  |
  24        | Used category    | essay | Test question to be moved | Write about whatever you want |
  25      And I log in as "teacher1"
  26      And I follow "Course 1"
  27  
  28    @javascript
  29    Scenario: A new question category can be created
  30      When I navigate to "Categories" node in "Course administration > Question bank"
  31      And I set the following fields to these values:
  32        | Name            | New Category 1    |
  33        | Parent category | Top               |
  34        | Category info   | Created as a test |
  35      And I press "submitbutton"
  36      Then I should see "New Category 1 (0)"
  37      And I should see "Created as a test" in the "New Category 1" "list_item"
  38  
  39    @javascript
  40    Scenario: A question category can be edited
  41      When I navigate to "Categories" node in "Course administration > Question bank"
  42      And I click on "Edit" "link" in the "Subcategory" "list_item"
  43      And I set the following fields to these values:
  44        | Name            | New name     |
  45        | Category info   | I was edited |
  46      And I press "Save changes"
  47      Then I should see "New name"
  48      And I should see "I was edited" in the "New name" "list_item"
  49  
  50    @javascript
  51    Scenario: An empty question category can be deleted
  52      When I navigate to "Categories" node in "Course administration > Question bank"
  53      And I click on "Delete" "link" in the "Subcategory" "list_item"
  54      Then I should not see "Subcategory"
  55  
  56    @javascript
  57    Scenario: An non-empty question category can be deleted if you move the contents elsewhere
  58      When I navigate to "Categories" node in "Course administration > Question bank"
  59      And I click on "Delete" "link" in the "Used category" "list_item"
  60      And I should see "The category 'Used category' contains 1 questions"
  61      And I press "Save in category"
  62      Then I should not see "Used category"
  63      And I should see "Default for C1 (1)"
  64  
  65    @javascript
  66    Scenario: Move a question between categories via the question page
  67      When I navigate to "Questions" node in "Course administration > Question bank"
  68      And I set the field "Select a category" to "Used category"
  69      And I click on "Test question to be moved" "checkbox" in the "Test question to be moved" "table_row"
  70      And I set the field "Question category" to "Subcategory"
  71      And I press "Move to >>"
  72      Then I should see "Test question to be moved"
  73      And the field "Select a category" matches value "Subcategory (1)"
  74      And the "Select a category" select box should contain "Used category"
  75      And the "Select a category" select box should not contain "Used category (1)"
  76  
  77    @javascript
  78    Scenario: Move a question between categories via the question settings page
  79      When I navigate to "Questions" node in "Course administration > Question bank"
  80      And I set the field "Select a category" to "Used category"
  81      And I click on "Edit" "link" in the "Test question to be moved" "table_row"
  82      And I click on "Use this category" "checkbox"
  83      And I set the field "Save in category" to "Subcategory"
  84      And I press "id_submitbutton"
  85      Then I should see "Test question to be moved"
  86      And the field "Select a category" matches value "Subcategory (1)"
  87      And the "Select a category" select box should contain "Used category"
  88      And the "Select a category" select box should not contain "Used category (1)"


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1