Proyectos de Subversion Moodle

Rev

Rev 11 | | 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 delete questions in the question bank
3
  In order to remove unused questions from the question bank
4
  As a teacher
5
  I need to delete questions
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    | intro              | course | idnumber |
19
      | qbank      | Qbank 1 | Question bank 1    | C1     | qbank1   |
1 efrain 20
    And the following "question categories" exist:
1441 ariadna 21
      | contextlevel    | reference | name           |
22
      | Activity module | qbank1    | Test questions |
1 efrain 23
    And the following "questions" exist:
24
      | questioncategory | qtype | name                        | questiontext                  |
25
      | Test questions   | essay | Test question to be deleted | Write about whatever you want |
1441 ariadna 26
    And I am on the "Qbank 1" "core_question > question bank" page logged in as "teacher1"
27
    And I apply question bank filter "Category" with value "Test questions"
1 efrain 28
 
29
  @javascript
30
  Scenario: A question not used anywhere can really be deleted
31
    When I choose "Delete" action for "Test question to be deleted" in the question bank
32
    And I press "Delete"
33
    And I apply question bank filter "Show hidden questions" with value "Yes"
34
    Then I should not see "Test question to be deleted"
35
 
1441 ariadna 36
  @javascript
1 efrain 37
  Scenario: Deleting a question can be cancelled
38
    When I choose "Delete" action for "Test question to be deleted" in the question bank
39
    And I press "Cancel"
40
    Then I should see "Test question to be deleted"
41
 
42
  @javascript
43
  Scenario: Delete a question used in a quiz
44
    Given the following "activity" exists:
45
      | course   | C1        |
46
      | activity | quiz      |
47
      | idnumber | Test quiz |
48
      | name     | Test quiz |
49
    And the following "question" exists:
50
      | questioncategory | Test questions                   |
51
      | qtype            | truefalse                        |
52
      | name             | Test used question to be deleted |
53
      | questiontext     | Write about whatever you want    |
54
    And quiz "Test quiz" contains the following questions:
55
      | question                         | page | requireprevious |
56
      | Test used question to be deleted | 1    | 0               |
1441 ariadna 57
    When I am on the "Qbank 1" "core_question > question bank" page
58
    And I apply question bank filter "Category" with value "Test questions"
1 efrain 59
    And I choose "Delete" action for "Test used question to be deleted" in the question bank
60
    And I should see "This will delete the following question and all its versions:"
11 efrain 61
    And I should see "* Denotes questions which can't be deleted because they are in use. Instead, they will be hidden in the question bank unless you set 'Show hidden questions' to 'Yes'."
1 efrain 62
    And I press "Delete"
63
    Then I should not see "Test used question to be deleted"
64
    And I apply question bank filter "Show hidden questions" with value "Yes"
65
    And I should see "Test used question to be deleted"
66
    And I am on the "Test quiz" "quiz activity" page
67
    And I click on "Preview quiz" "button"
68
    And I should see "Write about whatever you want"
69
 
70
  @javascript
71
  Scenario: A question can be deleted even if that question type is no longer installed
72
    Given the following "questions" exist:
73
      | questioncategory | qtype       | name            | questiontext    |
74
      | Test questions   | missingtype | Broken question | Write something |
75
    And I reload the page
76
    When I choose "Delete" action for "Broken question" in the question bank
77
    And I press "Delete"
78
    And I apply question bank filter "Show hidden questions" with value "Yes"
79
    Then I should not see "Broken question"
80
 
81
  @javascript
82
  Scenario: Delete question has multiple versions in question bank page
83
    When the following "core_question > updated questions" exist:
84
      | questioncategory | question                    | questiontext                          |
85
      | Test questions   | Test question to be deleted | Test question to be deleted version 2 |
86
    And I choose "Delete" action for "Test question to be deleted" in the question bank
87
    And I should see "This will delete the following question and all its versions:"
11 efrain 88
    And I should not see "* Denotes questions which can't be deleted because they are in use. Instead, they will be hidden in the question bank unless you set 'Show hidden questions' to 'Yes'."
1 efrain 89
    And I press "Delete"
90
    Then I should not see "Test question to be deleted"
91
    And I should not see "Test question to be deleted version2"