1 @qtype @qtype_shortanswer
2 Feature: Preview a Short answer question
4 In order to check my Short answer questions will work for students
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | teacher1 | T1 | Teacher1 | teacher1@moodle.com |
11 And the following "courses" exist:
12 | fullname | shortname | category |
14 And the following "course enrolments" exist:
15 | user | course | role |
16 | teacher1 | 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 Given I log in as "teacher1"
24 And I follow "Course 1"
25 And I navigate to "Question bank" node in "Course administration"
29 Scenario: Preview a Short answer question with correct answer
30 When I click on "Preview" "link" in the "shortanswer-001" "table_row"
31 And I switch to "questionpreview" window
32 Then I should see "Name an amphibian:"
33 # Set behaviour options
34 And I set the following fields to these values:
35 | behaviour | immediatefeedback |
36 And I press "Start again with these options"
37 And I set the field with xpath "//div[@class='qtext']//input[contains(@id, '1_answer')]" to "frog"
39 Then I should see "Frog is a very good answer."
40 And I should see "Generalfeedback: frog or toad would have been OK."
41 And I should see "The correct answer is: frog"
44 Scenario: Preview a Short answer question with almost correct answer
45 When I click on "Preview" "link" in the "shortanswer-001" "table_row"
46 And I switch to "questionpreview" window
47 Then I should see "Name an amphibian:"
48 # Set behaviour options
49 And I set the following fields to these values:
50 | behaviour | immediatefeedback |
51 And I press "Start again with these options"
52 And I set the field with xpath "//div[@class='qtext']//input[contains(@id, '1_answer')]" to "toad"
54 Then I should see "Toad is an OK good answer."
55 And I should see "Generalfeedback: frog or toad would have been OK."
56 And I should see "The correct answer is: frog"
59 Scenario: Preview a Short answer question with incorrect answer
60 When I click on "Preview" "link" in the "shortanswer-001" "table_row"
61 And I switch to "questionpreview" window
62 Then I should see "Name an amphibian:"
63 # Set behaviour options
64 And I set the following fields to these values:
65 | behaviour | immediatefeedback |
66 And I press "Start again with these options"
67 And I set the field with xpath "//div[@class='qtext']//input[contains(@id, '1_answer')]" to "cat"
69 Then I should see "That is a bad answer."
70 And I should see "Generalfeedback: frog or toad would have been OK."
71 And I should see "The correct answer is: frog"