Proyectos de Subversion Moodle

Rev

| 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:
19
      | activity   | name   | intro                                           | course | idnumber |
20
      | quiz       | Quiz 1 | Quiz 1 for testing the Add random question form | C1     | quiz1    |
21
    And the following "question categories" exist:
22
      | contextlevel | reference | questioncategory | name           |
23
      | Course       | C1        | Top              | top            |
24
      | Course       | C1        | top              | Default for C1 |
25
      | Course       | C1        | Default for C1   | Subcategory    |
26
      | Course       | C1        | top              | Used category  |
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"
36
    And I apply question bank filter "Category" with value "Used category"
37
    And I press "Add random question"
38
    And I should see "Random question based on filter condition" on quiz page "1"
39
    And I click on "Configure question" "link" in the "Random question based on filter condition" "list_item"
40
    And I should see "Used category"
41
    And I am on "Course 1" course homepage
42
    And I navigate to "Question bank" in current page administration
43
    And I apply question bank filter "Category" with value "Used category"
44
    And I click on "Test question to be moved" "checkbox" in the "Test question to be moved" "table_row"
45
    And I click on "With selected" "button"
46
    And I click on question bulk action "move"
47
    And I set the field "Question category" to "Subcategory"
48
    And I press "Move to"
49
    Then I should see "Test question to be moved"
50
    And I should see "Subcategory (1)"
51
    And I am on the "Quiz 1" "mod_quiz > Edit" page
52
    And I should see "Random question based on filter condition" on quiz page "1"
53
    And I click on "Configure question" "link" in the "Random question based on filter condition" "list_item"
54
    And I should see "Used category"
55
 
56
  @javascript
57
  Scenario: Renaming a random question category should update the random question
58
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
59
    When I open the "last" add to quiz menu
60
    And I follow "a random question"
61
    And I apply question bank filter "Category" with value "Used category"
62
    And I press "Add random question"
63
    And I should see "Random question based on filter condition" on quiz page "1"
64
    And I am on the "Course 1" "core_question > course question categories" page
65
    And I click on "Edit this category" "link" in the "Used category" "list_item"
66
    And I set the following fields to these values:
67
      | Name            | Used category new |
68
      | Category info   | I was edited      |
69
    And I press "Save changes"
70
    Then I should see "Used category new"
71
    And I should see "I was edited" in the "Used category new" "list_item"
72
    And I am on the "Quiz 1" "mod_quiz > Edit" page
73
    And I should see "Random question based on filter condition" on quiz page "1"