Proyectos de Subversion Moodle

Rev

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