1 |
efrain |
1 |
@qbank @qbank_deletequestion
|
|
|
2 |
Feature: Use the qbank plugin manager page for deletequestion
|
|
|
3 |
In order to check the plugin behaviour with enable and disable
|
|
|
4 |
|
|
|
5 |
Background:
|
1441 |
ariadna |
6 |
Given the following "users" exist:
|
|
|
7 |
| username | firstname | lastname | email |
|
|
|
8 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
9 |
And the following "courses" exist:
|
1 |
efrain |
10 |
| fullname | shortname | category |
|
|
|
11 |
| Course 1 | C1 | 0 |
|
1441 |
ariadna |
12 |
And the following "course enrolments" exist:
|
|
|
13 |
| user | course | role |
|
|
|
14 |
| teacher1 | C1 | editingteacher |
|
1 |
efrain |
15 |
And the following "activities" exist:
|
|
|
16 |
| activity | name | course | idnumber |
|
|
|
17 |
| quiz | Test quiz | C1 | quiz1 |
|
|
|
18 |
And the following "question categories" exist:
|
1441 |
ariadna |
19 |
| contextlevel | reference | name |
|
|
|
20 |
| Activity module | quiz1 | Test questions |
|
1 |
efrain |
21 |
And the following "questions" exist:
|
1441 |
ariadna |
22 |
| questioncategory | qtype | name | questiontext |
|
|
|
23 |
| Test questions | truefalse | Question 1 | Answer the first question |
|
|
|
24 |
| Test questions | truefalse | Question 2 | Answer the second question |
|
|
|
25 |
| Test questions | truefalse | Question 3 | Answer the third question |
|
1 |
efrain |
26 |
|
1441 |
ariadna |
27 |
@javascript
|
1 |
efrain |
28 |
Scenario: Enable/disable delete question column from the base view
|
|
|
29 |
Given I log in as "admin"
|
|
|
30 |
When I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
|
|
|
31 |
And I should see "Delete question"
|
|
|
32 |
And I click on "Disable" "link" in the "Delete question" "table_row"
|
|
|
33 |
And I am on the "Test quiz" "mod_quiz > question bank" page
|
1441 |
ariadna |
34 |
And I apply question bank filter "Category" with value "Test questions"
|
|
|
35 |
Then the "Delete" action should not exist for the "Question 1" question in the question bank
|
1 |
efrain |
36 |
And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
|
|
|
37 |
And I click on "Enable" "link" in the "Delete question" "table_row"
|
|
|
38 |
And I am on the "Test quiz" "mod_quiz > question bank" page
|
1441 |
ariadna |
39 |
And I apply question bank filter "Category" with value "Test questions"
|
|
|
40 |
And the "Delete" action should exist for the "Question 1" question in the question bank
|
1 |
efrain |
41 |
|
|
|
42 |
@javascript
|
|
|
43 |
Scenario: Enable/disable delete questions bulk action from the base view
|
|
|
44 |
Given I log in as "admin"
|
|
|
45 |
When I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
|
|
|
46 |
And I should see "Delete question"
|
|
|
47 |
And I click on "Disable" "link" in the "Delete question" "table_row"
|
|
|
48 |
And I am on the "Test quiz" "mod_quiz > question bank" page
|
1441 |
ariadna |
49 |
And I apply question bank filter "Category" with value "Test questions"
|
1 |
efrain |
50 |
And I click on "With selected" "button"
|
|
|
51 |
Then I should not see question bulk action "deleteselected"
|
|
|
52 |
And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
|
|
|
53 |
And I click on "Enable" "link" in the "Delete question" "table_row"
|
|
|
54 |
And I am on the "Test quiz" "mod_quiz > question bank" page
|
1441 |
ariadna |
55 |
And I apply question bank filter "Category" with value "Test questions"
|
1 |
efrain |
56 |
And I click on "With selected" "button"
|
|
|
57 |
And I should see question bulk action "deleteselected"
|
|
|
58 |
|
|
|
59 |
@javascript
|
|
|
60 |
Scenario: I should not see the deleted questions in the base view
|
|
|
61 |
Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "admin"
|
1441 |
ariadna |
62 |
And I apply question bank filter "Category" with value "Test questions"
|
|
|
63 |
And I click on "Question 1" "checkbox"
|
|
|
64 |
And I click on "Question 2" "checkbox"
|
1 |
efrain |
65 |
And I click on "With selected" "button"
|
|
|
66 |
And I click on question bulk action "deleteselected"
|
|
|
67 |
And I click on "Delete" "button" in the "Delete questions?" "dialogue"
|
1441 |
ariadna |
68 |
Then I should not see "Question 1"
|
|
|
69 |
And I should not see "Question 2"
|
1 |
efrain |
70 |
|
|
|
71 |
@javascript
|
|
|
72 |
Scenario: I should be able to delete a question when filtered using tags
|
1441 |
ariadna |
73 |
Given I am on the "Question 1" "core_question > edit" page logged in as "admin"
|
|
|
74 |
And I change window size to "large"
|
1 |
efrain |
75 |
And I set the following fields to these values:
|
|
|
76 |
| Tags | foo |
|
|
|
77 |
And I click on "Save changes" "button"
|
|
|
78 |
And I am on the "Test quiz" "mod_quiz > question bank" page
|
1441 |
ariadna |
79 |
And I apply question bank filter "Category" with value "Test questions"
|
1 |
efrain |
80 |
And I apply question bank filter "Tag" with value "foo"
|
1441 |
ariadna |
81 |
And I click on "Question 1" "checkbox"
|
1 |
efrain |
82 |
And I click on "With selected" "button"
|
|
|
83 |
And I click on question bulk action "deleteselected"
|
|
|
84 |
When I click on "Delete" "button" in the "Delete question?" "dialogue"
|
|
|
85 |
Then I should not see "Third question"
|
|
|
86 |
And "foo" "autocomplete_selection" should exist
|
1441 |
ariadna |
87 |
|
|
|
88 |
@javascript
|
|
|
89 |
Scenario: Questions can be bulk deleted from the question bank
|
|
|
90 |
Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
|
|
|
91 |
And I apply question bank filter "Category" with value "Test questions"
|
|
|
92 |
# Select questions to be deleted.
|
|
|
93 |
And I click on "Question 1" "checkbox"
|
|
|
94 |
And I click on "Question 2" "checkbox"
|
|
|
95 |
And I click on "With selected" "button"
|
|
|
96 |
When I press "Delete"
|
|
|
97 |
# Confirm that delete confirmation message is displayed.
|
|
|
98 |
Then I should see "This will delete the following questions and all their versions:"
|
|
|
99 |
# Confirm that selected questions are listed on the confirmation dialog.
|
|
|
100 |
And I should see "Question 1 v1"
|
|
|
101 |
And I should see "Question 2 v1"
|
|
|
102 |
# Delete selected questions.
|
|
|
103 |
And I press "Delete"
|
|
|
104 |
# Confirm that selected questions are deleted while unselected questions still exist.
|
|
|
105 |
And I should not see "Question 1"
|
|
|
106 |
And I should not see "Question 2"
|
|
|
107 |
And I should see "Question 3"
|