Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_question
2
Feature: A teacher can put questions with idnumbers in categories in the question bank
3
  In order to organize my questions
4
  As a teacher
5
  I move questions between 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 question can only have a unique idnumber within a category
21
    When the following "question categories" exist:
22
      | contextlevel | reference | questioncategory | name           | idnumber |
23
      | Course       | C1        | Top              | top            |          |
24
      | Course       | C1        | top              | Used category  | c1used   |
25
    And the following "questions" exist:
26
      | questioncategory | qtype | name            | questiontext                  | idnumber |
27
      | Used category    | essay | Test question 1 | Write about whatever you want | q1       |
28
      | Used category    | essay | Test question 2 | Write about whatever you want | q2       |
29
    And I am on the "Test question 2" "core_question > edit" page
30
    And I set the field "ID number" to "q1"
31
    And I press "submitbutton"
32
    # This is the standard form warning reminding the user that the idnumber needs to be unique for a category.
33
    Then I should see "This ID number is already in use"
34
 
35
  Scenario: A question can be edited and saved without changing the idnumber
36
    When the following "question categories" exist:
37
      | contextlevel | reference | questioncategory | name           | idnumber |
38
      | Course       | C1        | Top              | top            |          |
39
      | Course       | C1        | top              | Used category  | c1used   |
40
    And the following "questions" exist:
41
      | questioncategory | qtype | name            | questiontext                  | idnumber |
42
      | Used category    | essay | Test question 1 | Write about whatever you want | q1       |
43
    And I am on the "Test question 1" "core_question > edit" page
44
    And I press "Save changes"
45
    Then I should not see "This ID number is already in use"
46
 
47
  Scenario: Question idnumber conflicts found when saving to the same category.
48
    When the following "question categories" exist:
49
      | contextlevel | reference | questioncategory | name       |
50
      | Course       | C1        | Top              | top        |
51
      | Course       | C1        | top              | Category 1 |
52
      | Course       | C1        | top              | Category 2 |
53
    And the following "questions" exist:
54
      | questioncategory | qtype | name             | questiontext                  | idnumber |
55
      | Category 1       | essay | Question to edit | Write about whatever you want | q1       |
56
      | Category 1       | essay | Other question   | Write about whatever you want | q2       |
57
    And I am on the "Question to edit" "core_question > edit" page
58
    And I set the field "ID number" to "q2"
59
    And I press "Save changes"
60
    Then I should see "This ID number is already in use"
61
 
62
  @javascript
63
  Scenario: Moving a question between categories can force a change to the idnumber
64
    And the following "question categories" exist:
65
      | contextlevel | reference | questioncategory | name           | idnumber |
66
      | Course       | C1        | Top              | top            |          |
67
      | Course       | C1        | top              | Subcategory    | c1sub    |
68
      | Course       | C1        | top              | Used category  | c1used   |
69
    And the following "questions" exist:
70
      | questioncategory | qtype | name            | questiontext                  | idnumber |
71
      | Used category    | essay | Test question 1 | Write about whatever you want | q1       |
72
      | Used category    | essay | Test question 2 | Write about whatever you want | q2       |
73
      | Subcategory      | essay | Test question 3 | Write about whatever you want | q3       |
74
    When I am on the "Test question 3" "core_question > edit" page
75
    # The q1 idnumber is allowed for this question while it is in the Subcategory.
76
    And I set the field "ID number" to "q1"
77
    And I press "submitbutton"
78
    # Javascript is required for the next step.
79
    And I click on "Test question 3" "checkbox" in the "Test question 3" "table_row"
80
    And I click on "With selected" "button"
81
    And I click on question bulk action "move"
82
    And I set the field "Question category" to "Subcategory"
83
    And I press "Move to"
84
    And I choose "Edit question" action for "Test question 3" in the question bank
85
    # The question just moved into this category needs to have a unique idnumber, so a number is appended.
86
    Then the field "ID number" matches value "q1_1"