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
@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 |
1441 ariadna 17
    And the following "activities" exist:
18
      | activity | name    | course | idnumber |
19
      | qbank    | Qbank 1 | C1     | qbank1   |
1 efrain 20
    And I log in as "teacher1"
21
    And I am on "Course 1" course homepage
22
 
23
  Scenario: A question can only have a unique idnumber within a category
24
    When the following "question categories" exist:
1441 ariadna 25
      | contextlevel    | reference | questioncategory | name           | idnumber |
26
      | Activity module | qbank1    | Top              | top            |          |
27
      | Activity module | qbank1    | top              | Used category  | c1used   |
1 efrain 28
    And the following "questions" exist:
29
      | questioncategory | qtype | name            | questiontext                  | idnumber |
30
      | Used category    | essay | Test question 1 | Write about whatever you want | q1       |
31
      | Used category    | essay | Test question 2 | Write about whatever you want | q2       |
32
    And I am on the "Test question 2" "core_question > edit" page
33
    And I set the field "ID number" to "q1"
34
    And I press "submitbutton"
35
    # This is the standard form warning reminding the user that the idnumber needs to be unique for a category.
36
    Then I should see "This ID number is already in use"
37
 
38
  Scenario: A question can be edited and saved without changing the idnumber
39
    When the following "question categories" exist:
1441 ariadna 40
      | contextlevel    | reference | questioncategory | name           | idnumber |
41
      | Activity module | qbank1    | Top              | top            |          |
42
      | Activity module | qbank1    | top              | Used category  | c1used   |
1 efrain 43
    And the following "questions" exist:
44
      | questioncategory | qtype | name            | questiontext                  | idnumber |
45
      | Used category    | essay | Test question 1 | Write about whatever you want | q1       |
46
    And I am on the "Test question 1" "core_question > edit" page
47
    And I press "Save changes"
48
    Then I should not see "This ID number is already in use"
49
 
50
  Scenario: Question idnumber conflicts found when saving to the same category.
51
    When the following "question categories" exist:
1441 ariadna 52
      | contextlevel    | reference | questioncategory | name       |
53
      | Activity module | qbank1    | Top              | top        |
54
      | Activity module | qbank1    | top              | Category 1 |
55
      | Activity module | qbank1    | top              | Category 2 |
1 efrain 56
    And the following "questions" exist:
57
      | questioncategory | qtype | name             | questiontext                  | idnumber |
58
      | Category 1       | essay | Question to edit | Write about whatever you want | q1       |
59
      | Category 1       | essay | Other question   | Write about whatever you want | q2       |
60
    And I am on the "Question to edit" "core_question > edit" page
61
    And I set the field "ID number" to "q2"
62
    And I press "Save changes"
63
    Then I should see "This ID number is already in use"
64
 
65
  @javascript
66
  Scenario: Moving a question between categories can force a change to the idnumber
67
    And the following "question categories" exist:
1441 ariadna 68
      | contextlevel    | reference | questioncategory | name           | idnumber |
69
      | Activity module | qbank1    | Top              | top            |          |
70
      | Activity module | qbank1    | top              | Subcategory    | c1sub    |
71
      | Activity module | qbank1    | top              | Used category  | c1used   |
1 efrain 72
    And the following "questions" exist:
73
      | questioncategory | qtype | name            | questiontext                  | idnumber |
74
      | Used category    | essay | Test question 1 | Write about whatever you want | q1       |
75
      | Used category    | essay | Test question 2 | Write about whatever you want | q2       |
76
      | Subcategory      | essay | Test question 3 | Write about whatever you want | q3       |
77
    When I am on the "Test question 3" "core_question > edit" page
78
    # The q1 idnumber is allowed for this question while it is in the Subcategory.
79
    And I set the field "ID number" to "q1"
80
    And I press "submitbutton"
81
    # Javascript is required for the next step.
82
    And I click on "Test question 3" "checkbox" in the "Test question 3" "table_row"
83
    And I click on "With selected" "button"
84
    And I click on question bulk action "move"
1441 ariadna 85
    And I open the autocomplete suggestions list in the ".search-categories" "css_element"
86
    And I click on "Used category" "list_item" in the "Move the selected questions to..." "dialogue"
87
    And I click on "Move questions" "button"
88
    And I should see "Are you sure you want to move these questions?"
89
    And I click on "Confirm" "button"
90
    And I wait until the page is ready
1 efrain 91
    And I choose "Edit question" action for "Test question 3" in the question bank
92
    # The question just moved into this category needs to have a unique idnumber, so a number is appended.
93
    Then the field "ID number" matches value "q1_1"