Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@mod @mod_quiz
2
 
3
Feature: Moving a question to another category should not affect random questions in a quiz
4
  In order for a quiz with random questions to work as expected
5
  Teachers should be able to
6
  Move a question to a different category without affecting the category the random questions in the quiz reference to
7
 
8
  Background:
9
    Given the following "users" exist:
10
      | username | firstname | lastname | email |
11
      | teacher1 | Teacher | 1 | teacher1@example.com |
12
    And the following "courses" exist:
13
      | fullname | shortname | format |
14
      | Course 1 | C1 | weeks |
15
    And the following "course enrolments" exist:
16
      | user | course | role |
17
      | teacher1 | C1 | editingteacher |
18
    And the following "activities" exist:
1441 ariadna 19
      | activity   | name    | intro                                           | course | idnumber |
20
      | quiz       | Quiz 1  | Quiz 1 for testing the Add random question form | C1     | quiz1    |
21
      | qbank      | Qbank 1 | Question bank 1                                 | C1     | qbank1   |
1 efrain 22
    And the following "question categories" exist:
1441 ariadna 23
      | contextlevel    | reference     | questioncategory    | name                |
24
      | Activity module | qbank1        | top                 | Default for Qbank 1 |
25
      | Activity module | qbank1        | Default for Qbank 1 | Subcategory         |
26
      | Activity module | qbank1        | top                 | Used category       |
1 efrain 27
    And the following "questions" exist:
28
      | questioncategory | qtype | name                      | questiontext                  |
29
      | Used category    | essay | Test question to be moved | Write about whatever you want |
30
 
31
  @javascript
32
  Scenario: Moving a question should not change the random question
33
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
34
    When I open the "last" add to quiz menu
35
    And I follow "a random question"
1441 ariadna 36
    And I click on "Switch bank" "button"
37
    And I click on "Qbank 1" "link" in the "Select question bank" "dialogue"
1 efrain 38
    And I apply question bank filter "Category" with value "Used category"
39
    And I press "Add random question"
1441 ariadna 40
    And I should see "Random (Used category) based on filter condition" on quiz page "1"
41
    And I click on "Configure question" "link" in the "Random (Used category) based on filter condition" "list_item"
1 efrain 42
    And I should see "Used category"
43
    And I am on "Course 1" course homepage
1441 ariadna 44
    And I navigate to "Question banks" in current page administration
45
    And I click on "Qbank 1" "link"
1 efrain 46
    And I apply question bank filter "Category" with value "Used category"
47
    And I click on "Test question to be moved" "checkbox" in the "Test question to be moved" "table_row"
48
    And I click on "With selected" "button"
49
    And I click on question bulk action "move"
1441 ariadna 50
    And I open the autocomplete suggestions list in the ".search-categories" "css_element"
51
    And I click on "Subcategory" "list_item" in the "Move the selected questions to..." "dialogue"
52
    And I click on "Move questions" "button"
53
    And I should see "Are you sure you want to move these questions?"
54
    And I click on "Confirm" "button"
55
    And I wait until the page is ready
56
    Then I should see "Subcategory (1)"
1 efrain 57
    And I am on the "Quiz 1" "mod_quiz > Edit" page
1441 ariadna 58
    And I should see "Random (Used category) based on filter condition" on quiz page "1"
59
    And I click on "Configure question" "link" in the "Random (Used category) based on filter condition" "list_item"
1 efrain 60
    And I should see "Used category"
61
 
62
  @javascript
63
  Scenario: Renaming a random question category should update the random question
64
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
65
    When I open the "last" add to quiz menu
66
    And I follow "a random question"
1441 ariadna 67
    Then I click on "Switch bank" "button"
68
    And I click on "Qbank 1" "link" in the "Select question bank" "dialogue"
1 efrain 69
    And I apply question bank filter "Category" with value "Used category"
70
    And I press "Add random question"
1441 ariadna 71
    And I should see "Random (Used category) based on filter condition" on quiz page "1"
72
    And I am on the "Qbank 1" "core_question > question categories" page
73
    And I open the action menu in "Used category" "list_item"
74
    And I choose "Edit" in the open action menu
1 efrain 75
    And I set the following fields to these values:
76
      | Name            | Used category new |
77
      | Category info   | I was edited      |
78
    And I press "Save changes"
1441 ariadna 79
    And I set the field "Show descriptions" to "1"
1 efrain 80
    Then I should see "Used category new"
81
    And I should see "I was edited" in the "Used category new" "list_item"
82
    And I am on the "Quiz 1" "mod_quiz > Edit" page
1441 ariadna 83
    And I should see "Random (Used category new) based on filter condition" on quiz page "1"
84
 
85
  @javascript
86
  Scenario: A random question with an invalid category should still be editable
87
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
88
    When I open the "last" add to quiz menu
89
    And I follow "a random question"
90
    Then I click on "Switch bank" "button"
91
    And I click on "Qbank 1" "link" in the "Select question bank" "dialogue"
92
    And I apply question bank filter "Category" with value "Used category"
93
    And I press "Add random question"
94
    And I should see "Random (Used category) based on filter condition" on quiz page "1"
95
    And I am on the "Qbank 1" "core_question > question categories" page
96
    And I open the action menu in "Used category" "list_item"
97
    And I choose "Delete" in the open action menu
98
    And I click on "Delete" "button" in the "Delete" "dialogue"
99
    And I press "Save in category"
100
    And I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
101
    Then I should not see "Random (Used category) based on filter condition" on quiz page "1"
102
    And I should see "Missing question category" on quiz page "1"