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