1 |
efrain |
1 |
@qtype @qtype_shortanswer
|
|
|
2 |
Feature: Preview a Short answer question
|
|
|
3 |
As a teacher
|
|
|
4 |
In order to check my Short answer questions will work for students
|
|
|
5 |
I need to preview them
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username |
|
|
|
10 |
| teacher |
|
|
|
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 |
| teacher | C1 | editingteacher |
|
|
|
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 | template |
|
|
|
22 |
| Test questions | shortanswer | shortanswer-001 | frogtoad |
|
|
|
23 |
|
|
|
24 |
@javascript @_switch_window
|
|
|
25 |
Scenario: Preview a Short answer question with correct answer
|
|
|
26 |
When I am on the "shortanswer-001" "core_question > preview" page logged in as teacher
|
|
|
27 |
And I should see "Name an amphibian:"
|
|
|
28 |
# Set behaviour options
|
|
|
29 |
And I set the following fields to these values:
|
|
|
30 |
| behaviour | immediatefeedback |
|
|
|
31 |
And I press "Save preview options and start again"
|
|
|
32 |
And I set the field with xpath "//div[@class='qtext']//input[contains(@id, '1_answer')]" to "frog"
|
|
|
33 |
And I press "Check"
|
|
|
34 |
Then I should see "Frog is a very good answer."
|
|
|
35 |
And I should see "Generalfeedback: frog or toad would have been OK."
|
|
|
36 |
And I should see "The correct answer is: frog"
|
|
|
37 |
|
|
|
38 |
@javascript @_switch_window
|
|
|
39 |
Scenario: Preview a Short answer question with almost correct answer
|
|
|
40 |
When I am on the "shortanswer-001" "core_question > preview" page logged in as teacher
|
|
|
41 |
And I should see "Name an amphibian:"
|
|
|
42 |
# Set behaviour options
|
|
|
43 |
And I set the following fields to these values:
|
|
|
44 |
| behaviour | immediatefeedback |
|
|
|
45 |
And I press "Save preview options and start again"
|
|
|
46 |
And I set the field with xpath "//div[@class='qtext']//input[contains(@id, '1_answer')]" to "toad"
|
|
|
47 |
And I press "Check"
|
|
|
48 |
Then I should see "Toad is an OK good answer."
|
|
|
49 |
And I should see "Generalfeedback: frog or toad would have been OK."
|
|
|
50 |
And I should see "The correct answer is: frog"
|
|
|
51 |
|
|
|
52 |
@javascript @_switch_window
|
|
|
53 |
Scenario: Preview a Short answer question with incorrect answer
|
|
|
54 |
When I am on the "shortanswer-001" "core_question > preview" page logged in as teacher
|
|
|
55 |
And I should see "Name an amphibian:"
|
|
|
56 |
# Set behaviour options
|
|
|
57 |
And I set the following fields to these values:
|
|
|
58 |
| behaviour | immediatefeedback |
|
|
|
59 |
And I press "Save preview options and start again"
|
|
|
60 |
And I set the field with xpath "//div[@class='qtext']//input[contains(@id, '1_answer')]" to "cat"
|
|
|
61 |
And I press "Check"
|
|
|
62 |
Then I should see "That is a bad answer."
|
|
|
63 |
And I should see "Generalfeedback: frog or toad would have been OK."
|
|
|
64 |
And I should see "The correct answer is: frog"
|