MDL-63738 question bank: a link to download a single question
[moodle.git] / question / tests / behat / preview_question.feature
CommitLineData
df44db5b 1@core @core_question
242a27b1
DM
2Feature: 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
df44db5b 7 Background:
759b323e 8 Given the following "users" exist:
234c5337 9 | username | firstname | lastname | email |
0fe86bbd 10 | teacher1 | Teacher | 1 | teacher1@example.com |
759b323e 11 And the following "courses" exist:
242a27b1 12 | fullname | shortname | format |
234c5337 13 | Course 1 | C1 | weeks |
759b323e 14 And the following "course enrolments" exist:
234c5337
TH
15 | user | course | role |
16 | teacher1 | C1 | editingteacher |
df44db5b
TH
17 And the following "question categories" exist:
18 | contextlevel | reference | name |
19 | Course | C1 | Test questions |
20 And the following "questions" exist:
21 | questioncategory | qtype | name |
22 | Test questions | numerical | Test question to be previewed |
242a27b1 23 And I log in as "teacher1"
fdeeaff9 24 And I am on "Course 1" course homepage
02fda279 25 And I navigate to "Question bank > Questions" in current page administration
d7ddbc82 26 When I click on "Preview" "link" in the "Test question to be previewed" "table_row"
242a27b1 27 And I switch to "questionpreview" window
234c5337 28
df44db5b
TH
29 @javascript @_switch_window
30 Scenario: Question preview shows the question and other information
31 Then the state of "What is pi to two d.p.?" question is shown as "Not yet answered"
32 And I should see "Marked out of 1.00"
234c5337
TH
33 And I should see "Technical information"
34 And I should see "Attempt options"
35 And I should see "Display options"
36
df44db5b
TH
37 @javascript @_switch_window
38 Scenario: Preview lets the teacher see what happens when an answer is saved
39 When I set the field "Answer:" to "1"
234c5337 40 And I press "Save"
df44db5b 41 Then the state of "What is pi to two d.p.?" question is shown as "Answer saved"
234c5337 42
df44db5b
TH
43 @javascript @_switch_window
44 Scenario: Preview lets the teacher see what happens when an answer is submitted
45 When I set the field "Answer:" to "3.14"
242a27b1 46 And I press "Submit and finish"
df44db5b 47 Then the state of "What is pi to two d.p.?" question is shown as "Correct"
234c5337 48
df44db5b
TH
49 @javascript @_switch_window
50 Scenario: Preview lets the teacher see what happens with different review options
51 Given I set the field "Answer:" to "3.14"
52 And I press "Submit and finish"
53 When I set the field "Whether correct" to "Not shown"
54 And I set the field "Decimal places in grades" to "5"
234c5337 55 And I press "Update display options"
df44db5b
TH
56 Then the state of "What is pi to two d.p.?" question is shown as "Complete"
57 And I should see "1.00000"
58
59 @javascript @_switch_window
60 Scenario: Preview lets the teacher see what happens with different behaviours
61 When I set the field "How questions behave" to "Immediate feedback"
62 And I set the field "Marked out of" to "3"
63 And I press "Start again with these options"
64 And I set the field "Answer:" to "3.1"
65 And I press "Check"
66 Then the state of "What is pi to two d.p.?" question is shown as "Incorrect"
67 And I should see "Mark 0.00 out of 3.00"
68 And I should see "Not accurate enough."
234c5337 69
df44db5b
TH
70 @javascript @_switch_window
71 Scenario: Preview lets the teacher "Start again" while previewing
72 Given I set the field "Answer:" to "1"
234c5337 73 And I press "Submit and finish"
df44db5b
TH
74 When I press "Start again"
75 Then the state of "What is pi to two d.p.?" question is shown as "Not yet answered"
234c5337 76
df44db5b
TH
77 @javascript @_switch_window
78 Scenario: Preview lets the teacher "Fill in correct response" while previewing
79 When I press "Fill in correct responses"
80 Then the field "Answer:" matches value "3.14"
616442a2
TH
81
82 @javascript @_switch_window
83 Scenario: Preview has an option to export the individual quesiton.
84 Then following "Download this question in Moodle XML format" should download between "1000" and "2500" bytes