Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@qbank @qbank_previewquestion
2
Feature: A teacher can preview questions in the question bank
3
  In order to ensure the questions are properly created
4
  As a teacher
5
  I need to preview the 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 "activities" exist:
15
      | activity   | name      | course | idnumber |
16
      | quiz       | Test quiz | C1     | quiz1    |
17
    And the following "course enrolments" exist:
18
      | user     | course | role           |
19
      | teacher1 | C1     | editingteacher |
20
    And the following "question categories" exist:
21
      | contextlevel | reference | name           |
22
      | Course       | C1        | Test questions |
23
    And the following "questions" exist:
24
      | questioncategory | qtype     | name                          |
25
      | Test questions   | numerical | Test question to be previewed |
26
    And I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
27
    When I choose "Preview" action for "Test question to be previewed" in the question bank
28
 
29
  Scenario: Question preview shows the question and other information
30
    Then the state of "What is pi to two d.p.?" question is shown as "Not yet answered"
31
    And I should see "(latest)"
32
    And I should see "Marked out of 1.00"
33
    And I should see "Technical information"
34
    And I should see "Display options"
35
    And I should see "Preview options"
36
    And I should see "Comments"
37
    And I click on "Comments" "link"
38
    And I should see "Save comment"
39
    And I should see "ID number"
40
    And "Numerical" "icon" should exist
41
    And I should see "Version"
42
    And I click on "Preview options" "link"
43
    And I should see "These settings are for testing the question. The options you select only affect the preview."
44
    And I should see "Question version"
45
 
46
  Scenario: Preview lets the teacher see what happens when an answer is saved
47
    When I set the field "Answer:" to "1"
48
    And I press "Save"
49
    Then the state of "What is pi to two d.p.?" question is shown as "Answer saved"
50
 
51
  Scenario: Preview lets the teacher see what happens when an answer is submitted
52
    When I set the field "Answer:" to "3.14"
53
    And I press "Submit and finish"
54
    Then the state of "What is pi to two d.p.?" question is shown as "Correct"
55
 
56
  Scenario: Preview lets the teacher see what happens with different review options
57
    Given I set the field "Answer:" to "3.14"
58
    And I press "Submit and finish"
59
    And I press "Display options"
60
    When I set the field "Whether correct" to "Not shown"
61
    And I set the field "Decimal places in grades" to "5"
62
    And I press "Update display options"
63
    And I set the field "Answer:" to "3.14"
64
    And I press "Submit and finish"
65
    Then the state of "What is pi to two d.p.?" question is shown as "Complete"
66
    And I should see "1.00000"
67
 
68
  Scenario: Preview lets the teacher see what happens with different behaviours
69
    When I press "Preview options"
70
    And I set the field "How questions behave" to "Immediate feedback"
71
    And I set the field "Marked out of" to "3"
72
    And I press "Save preview options and start again"
73
    And I set the field "Answer:" to "3.1"
74
    And I press "Check"
75
    Then the state of "What is pi to two d.p.?" question is shown as "Incorrect"
76
    And I should see "Mark 0.00 out of 3.00"
77
    And I should see "Not accurate enough."
78
 
79
  Scenario: Preview lets the teacher "Start again" while previewing
80
    Given I set the field "Answer:" to "1"
81
    And I press "Submit and finish"
82
    When I press "Start again"
83
    Then the state of "What is pi to two d.p.?" question is shown as "Not yet answered"
84
 
85
  Scenario: Preview lets the teacher "Fill in correct response" while previewing
86
    When I press "Fill in correct responses"
87
    Then the field "Answer:" matches value "3.14"
88
 
89
  Scenario: Preview a question with very small grade
90
    When I press "Preview options"
91
    And I set the field "Marked out of" to "0.00000123456789"
92
    And I press "Save preview options and start again"
93
    Then the field "Marked out of" matches value "0.00000123456789"
94
 
95
  Scenario: Question version is updated when edited and teacher can change question version
96
    Given I should see "Version 1"
97
    And I press "Close preview"
98
    And I choose "Edit question" action for "Test question to be previewed" in the question bank
99
    And I set the field "Question name" to "New version"
100
    And I set the field "Question text" to "New text version"
101
    And I click on "submitbutton" "button"
102
    And I choose "Preview" action for "New version" in the question bank
103
    When I expand all fieldsets
104
    And I should see "Version 2"
105
    And I should see "(latest)"
106
    And I should see "New version"
107
    And I should see "New text version"
108
    And I should not see "Test question to be previewed"
109
    And I should not see "Version 1"
110
    And I should see "1" in the "Question version" "select"
111
    And I should see "2" in the "Question version" "select"
112
    And I set the field "Question version" to "1"
113
    And I press "Save preview options and start again"
114
    Then I should see "Version 1"
115
    And I should not see "Version 2"
116
    And I should not see "(latest)"
117
 
118
  Scenario: The preview always uses the latest question version by default.
119
    Given the following "core_question > updated questions" exist:
120
      | questioncategory | question                      | questiontext       |
121
      | Test questions   | Test question to be previewed | Question version 2 |
122
    And I should see "Version 1 (latest)"
123
    And I expand all fieldsets
124
    And the field "Question version" matches value "Always latest"
125
    And I set the field "Answer:" to "3.14"
126
    And I press "Submit and finish"
127
    And I should see "Version 1"
128
    When I press "Start again"
129
    Then I should not see "Version 1"
130
    And I should see "Version 2 (latest)"
131
 
132
  Scenario: Detect a newer version during always latest preview and offer to switch to the latest
133
    Given I should not see "This preview is using version 1"
134
    And the following "core_question > updated questions" exist:
135
      | questioncategory | question                      | questiontext       |
136
      | Test questions   | Test question to be previewed | Question version 2 |
137
    And I should see "Version 1 (latest)"
138
    And I set the field "Answer:" to "3.14"
139
    When I press "Submit and finish"
140
    And I should see "This preview is using an older version of the question."
141
    And I press "Use latest version"
142
    Then I should not see "Version 1"
143
    And I should see "Version 2 (latest)"
144
 
145
  Scenario: Previewing from the question history will not always show the latest version
146
    Given I press "Close preview"
147
    And the following "core_question > updated questions" exist:
148
      | questioncategory | question                      | questiontext       |
149
      | Test questions   | Test question to be previewed | Question version 2 |
150
    And I choose "History" action for "Test question to be previewed" in the question bank
151
    And I choose "Preview" action for "Test question to be previewed" in the question bank
152
    And I should see "Version 1 (of 2)"
153
    And I expand all fieldsets
154
    And the field "Question version" matches value "1"
155
    And I set the field "Answer:" to "3.14"
156
    And I press "Submit and finish"
157
    And I should see "Version 1 (of 2)"
158
    And I should not see "The latest version is 2."
159
    And the following "core_question > updated questions" exist:
160
      | questioncategory | question                      | questiontext       |
161
      | Test questions   | Test question to be previewed | Question version 3 |
162
    When I press "Start again"
163
    Then I should see "Version 1 (of 3)"
164
    And I should not see "Version 3 (latest)"
165
 
166
  Scenario: Question preview can be closed
167
    And I press "Close preview"
168
    Then I should not see "(latest)"
169
    And I should see "Test quiz"