1 |
efrain |
1 |
@mod @mod_quiz
|
|
|
2 |
Feature: Edit quiz page - remove questions
|
|
|
3 |
In order to change the layout of a quiz I built
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to be able to delete questions.
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | T1 | Teacher1 | teacher1@example.com |
|
|
|
11 |
And the following "courses" exist:
|
|
|
12 |
| fullname | shortname | category |
|
|
|
13 |
| Course 1 | C1 | 0 |
|
|
|
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 "activities" exist:
|
|
|
21 |
| activity | name | course | idnumber |
|
|
|
22 |
| quiz | Quiz 1 | C1 | quiz1 |
|
|
|
23 |
And I log in as "teacher1"
|
|
|
24 |
|
|
|
25 |
@javascript
|
|
|
26 |
Scenario: Delete questions by clicking on the delete icon.
|
|
|
27 |
Given the following "questions" exist:
|
|
|
28 |
| questioncategory | qtype | name | questiontext |
|
|
|
29 |
| Test questions | truefalse | Question A | This is question 01 |
|
|
|
30 |
| Test questions | truefalse | Question B | This is question 02 |
|
|
|
31 |
| Test questions | truefalse | Question C | This is question 03 |
|
|
|
32 |
And quiz "Quiz 1" contains the following questions:
|
|
|
33 |
| question | page |
|
|
|
34 |
| Question A | 1 |
|
|
|
35 |
| Question B | 1 |
|
|
|
36 |
| Question C | 2 |
|
|
|
37 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
38 |
|
|
|
39 |
# Confirm the starting point.
|
|
|
40 |
Then I should see "Question A" on quiz page "1"
|
|
|
41 |
And I should see "Question B" on quiz page "1"
|
|
|
42 |
And I should see "Question C" on quiz page "2"
|
|
|
43 |
And I should see "Total of marks: 3.00"
|
|
|
44 |
And I should see "Questions: 3"
|
|
|
45 |
And I should see "This quiz is open"
|
|
|
46 |
|
|
|
47 |
# Delete last question in last page. Page contains multiple questions
|
|
|
48 |
When I delete "Question C" in the quiz by clicking the delete icon
|
|
|
49 |
Then I should see "Question A" on quiz page "1"
|
|
|
50 |
And I should see "Question B" on quiz page "1"
|
|
|
51 |
And I should not see "Question C" on quiz page "2"
|
|
|
52 |
And I should see "Total of marks: 2.00"
|
|
|
53 |
And I should see "Questions: 2"
|
|
|
54 |
|
|
|
55 |
# Delete last question in last page. The page contains multiple questions and there are multiple pages.
|
|
|
56 |
When I click on the "Add" page break icon after question "Question A"
|
|
|
57 |
Then I should see "Question B" on quiz page "2"
|
|
|
58 |
And the "Remove" page break icon after question "Question A" should exist
|
|
|
59 |
And I delete "Question A" in the quiz by clicking the delete icon
|
|
|
60 |
Then I should see "Question B" on quiz page "1"
|
|
|
61 |
And I should not see "Page 2"
|
|
|
62 |
And I should not see "Question A" on quiz page "2"
|
|
|
63 |
And the "Remove" page break icon after question "Question B" should not exist
|
|
|
64 |
And I should see "Total of marks: 1.00"
|
|
|
65 |
|
|
|
66 |
@javascript
|
|
|
67 |
Scenario: Cannot delete the last question in a section.
|
|
|
68 |
Given the following "questions" exist:
|
|
|
69 |
| questioncategory | qtype | name | questiontext |
|
|
|
70 |
| Test questions | truefalse | Question A | This is question 01 |
|
|
|
71 |
| Test questions | truefalse | Question B | This is question 02 |
|
|
|
72 |
| Test questions | truefalse | Question C | This is question 03 |
|
|
|
73 |
And quiz "Quiz 1" contains the following questions:
|
|
|
74 |
| question | page |
|
|
|
75 |
| Question A | 1 |
|
|
|
76 |
| Question B | 1 |
|
|
|
77 |
| Question C | 2 |
|
|
|
78 |
And quiz "Quiz 1" contains the following sections:
|
|
|
79 |
| heading | firstslot | shuffle |
|
|
|
80 |
| Heading 1 | 1 | 1 |
|
|
|
81 |
| Heading 2 | 2 | 1 |
|
|
|
82 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
83 |
Then "Delete" "link" in the "Question A" "list_item" should not be visible
|
|
|
84 |
Then "Delete" "link" in the "Question B" "list_item" should be visible
|
|
|
85 |
Then "Delete" "link" in the "Question C" "list_item" should be visible
|
|
|
86 |
|
|
|
87 |
@javascript
|
|
|
88 |
Scenario: Can delete the last question in a quiz.
|
|
|
89 |
Given the following "questions" exist:
|
|
|
90 |
| questioncategory | qtype | name | questiontext |
|
|
|
91 |
| Test questions | truefalse | Question A | This is question 01 |
|
|
|
92 |
And quiz "Quiz 1" contains the following questions:
|
|
|
93 |
| question | page |
|
|
|
94 |
| Question A | 1 |
|
|
|
95 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
96 |
When I delete "Question A" in the quiz by clicking the delete icon
|
|
|
97 |
Then I should see "Questions: 0"
|