1 |
efrain |
1 |
@mod @mod_quiz
|
|
|
2 |
Feature: Quiz question versioning
|
|
|
3 |
In order to manage question versions
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to be able to choose which versions can be displayed in a quiz
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname | category | groupmode |
|
|
|
10 |
| Course 1 | C1 | 0 | 1 |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email |
|
|
|
13 |
| teacher | Teacher | 1 | teacher@example.com |
|
|
|
14 |
And the following "course enrolments" exist:
|
|
|
15 |
| user | course | role |
|
|
|
16 |
| teacher | 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 the following "questions" exist:
|
|
|
24 |
| questioncategory | qtype | name | questiontext |
|
|
|
25 |
| Test questions | truefalse | First question | Answer the first question |
|
|
|
26 |
| Test questions | truefalse | Other question | Answer the first question |
|
|
|
27 |
And quiz "Quiz 1" contains the following questions:
|
|
|
28 |
| question | page |
|
|
|
29 |
| First question | 1 |
|
|
|
30 |
|
|
|
31 |
@javascript
|
|
|
32 |
Scenario: Appropriate question version should be displayed when not edited
|
|
|
33 |
When I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher"
|
|
|
34 |
Then I should see "First question"
|
|
|
35 |
And I should see "Answer the first question"
|
|
|
36 |
And the field "version" matches value "Always latest"
|
|
|
37 |
And the "version" select box should contain "v1 (latest)"
|
|
|
38 |
# We check that the corresponding version is the appropriate one in preview
|
|
|
39 |
And I click on "Preview question" "link"
|
|
|
40 |
And I switch to "questionpreview" window
|
|
|
41 |
And I should see "Version 1 (latest)"
|
|
|
42 |
And I should see "Answer the first question"
|
|
|
43 |
And I click on "Submit and finish" "button"
|
|
|
44 |
And I should see "You should have selected true."
|
|
|
45 |
|
|
|
46 |
@javascript
|
|
|
47 |
Scenario: Approriate question version should be displayed when edited
|
|
|
48 |
When I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher"
|
|
|
49 |
And I click on "Edit question First question" "link"
|
|
|
50 |
# We edit the question with new informations to generate a second version
|
|
|
51 |
And I set the following fields to these values:
|
|
|
52 |
| Question name | First question (v2) |
|
|
|
53 |
| Question text | Answer the new first question |
|
|
|
54 |
| Correct answer | False |
|
|
|
55 |
And I press "id_submitbutton"
|
|
|
56 |
And the field "version" matches value "Always latest"
|
|
|
57 |
And the "version" select box should contain "v1"
|
|
|
58 |
And I set the field "version" to "v2 (latest)"
|
|
|
59 |
Then I should see "First question (v2)"
|
|
|
60 |
And I should see "Answer the new first question"
|
|
|
61 |
And I click on "Preview question" "link"
|
|
|
62 |
And I switch to "questionpreview" window
|
|
|
63 |
# We check that the corresponding version is the appropriate one in preview
|
|
|
64 |
# We also check that the new information is properly displayed
|
|
|
65 |
And I should see "Version 2 (latest)"
|
|
|
66 |
And I should see "Answer the new first question"
|
|
|
67 |
|
|
|
68 |
@javascript
|
|
|
69 |
Scenario: Appropriate question version displayed when later draft version exists
|
|
|
70 |
# Edit the question in the question bank to add a new draft version.
|
|
|
71 |
Given I am on the "First question" "core_question > edit" page logged in as teacher
|
|
|
72 |
And I set the following fields to these values:
|
|
|
73 |
| Question name | First question (v2) |
|
|
|
74 |
| Question text | Answer the new first question |
|
|
|
75 |
| Correct answer | False |
|
|
|
76 |
| Question status | Draft |
|
|
|
77 |
And I press "id_submitbutton"
|
|
|
78 |
When I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
79 |
Then I should see "First question"
|
|
|
80 |
And I should see "Answer the first question"
|
|
|
81 |
And the field "version" matches value "Always latest"
|
|
|
82 |
And the "version" select box should contain "v1 (latest)"
|
|
|
83 |
And the "version" select box should not contain "v2"
|
|
|
84 |
And the "version" select box should not contain "v2 (latest)"
|
|
|
85 |
And I am on the "Quiz 1" "mod_quiz > View" page
|
|
|
86 |
And I press "Preview quiz"
|
|
|
87 |
And I should see "Answer the first question"
|
|
|
88 |
|
|
|
89 |
@javascript
|
|
|
90 |
Scenario: Creating a new question should have always latest in the version selection
|
|
|
91 |
When I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher"
|
|
|
92 |
# Change the version of the existing question, to ensure it does not match later.
|
|
|
93 |
And I set the field "version" to "v1 (latest)"
|
|
|
94 |
And I open the "Page 1" add to quiz menu
|
|
|
95 |
And I follow "a new question"
|
|
|
96 |
And I set the field "item_qtype_essay" to "1"
|
|
|
97 |
And I press "submitbutton"
|
|
|
98 |
And I set the following fields to these values:
|
|
|
99 |
| Question name | New essay |
|
|
|
100 |
| Question text | Write 200 words about quizzes. |
|
|
|
101 |
And I press "id_submitbutton"
|
|
|
102 |
And I should see "New essay" on quiz page "1"
|
|
|
103 |
And the field "version" in the "New essay" "list_item" matches value "Always latest"
|
|
|
104 |
|
|
|
105 |
@javascript
|
|
|
106 |
Scenario: Adding a question from question bank should have always latest in the version selection
|
|
|
107 |
When I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher"
|
|
|
108 |
And I open the "Page 1" add to quiz menu
|
|
|
109 |
And I follow "from question bank"
|
|
|
110 |
And I click on "Select" "checkbox" in the "Other question" "table_row"
|
|
|
111 |
And I press "Add selected questions to the quiz"
|
|
|
112 |
Then I should see "Other question" on quiz page "1"
|
|
|
113 |
And the field "version" in the "Other question" "list_item" matches value "Always latest"
|
|
|
114 |
|
|
|
115 |
@javascript
|
|
|
116 |
Scenario: Adding a question where all available versions are drafts should display a helpful message.
|
|
|
117 |
Given quiz "Quiz 1" contains the following questions:
|
|
|
118 |
| question | page |
|
|
|
119 |
| First question | 1 |
|
|
|
120 |
And I am on the "Quiz 1" "mod_quiz > Question bank" page logged in as teacher
|
|
|
121 |
And I set the field "question_status_dropdown" in the "First question" "table_row" to "Draft"
|
|
|
122 |
When I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
123 |
Then I should see "This question is in draft status. To use it in the quiz, go to the question bank and change the status to ready."
|
|
|
124 |
|
|
|
125 |
@javascript
|
|
|
126 |
Scenario: Previewing a question set to use always latest version will set the preview to always latest version
|
|
|
127 |
When I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher"
|
|
|
128 |
And the field "version" in the "First question" "list_item" matches value "Always latest"
|
|
|
129 |
When I follow "Preview question"
|
|
|
130 |
And I expand all fieldsets
|
|
|
131 |
Then the field "Question version" matches value "Always latest"
|
|
|
132 |
|
|
|
133 |
@javascript
|
|
|
134 |
Scenario: Previewing a question set to use a specific version will set the preview to that version
|
|
|
135 |
When I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher"
|
|
|
136 |
And I set the field "version" to "v1 (latest)"
|
|
|
137 |
When I follow "Preview question"
|
|
|
138 |
And I expand all fieldsets
|
|
|
139 |
Then the field "Question version" matches value "1"
|