1 |
efrain |
1 |
@mod @mod_questionnaire
|
|
|
2 |
Feature: Questionnaire responses can be saved and resumed without submitting.
|
|
|
3 |
When save is used on a response, a response can be resumed with the saved responses intact.
|
|
|
4 |
|
|
|
5 |
Background: Add a questionnaire with "Save/Resume answers" set to "Yes".
|
|
|
6 |
Given the following "users" exist:
|
|
|
7 |
| username | firstname | lastname | email |
|
|
|
8 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
9 |
| student1 | Student | 1 | student1@example.com |
|
|
|
10 |
And the following "courses" exist:
|
|
|
11 |
| fullname | shortname | category |
|
|
|
12 |
| Course 1 | C1 | 0 |
|
|
|
13 |
And the following "course enrolments" exist:
|
|
|
14 |
| user | course | role |
|
|
|
15 |
| teacher1 | C1 | editingteacher |
|
|
|
16 |
| student1 | C1 | student |
|
|
|
17 |
And the following "activities" exist:
|
|
|
18 |
| activity | name | description | course | idnumber | resume |
|
|
|
19 |
| questionnaire | Questionnaire 1 | Questionnaire description | C1 | questionnaire0 | 1 |
|
|
|
20 |
|
|
|
21 |
And I log in as "teacher1"
|
|
|
22 |
And I am on "Course 1" course homepage
|
|
|
23 |
And I follow "Questionnaire 1"
|
|
|
24 |
And I navigate to "Questions" in current page administration
|
|
|
25 |
And I add a "Check Boxes" question and I fill the form with:
|
|
|
26 |
| Question Name | Q1 |
|
|
|
27 |
| Yes | y |
|
|
|
28 |
| Min. forced responses | 1 |
|
|
|
29 |
| Max. forced responses | 2 |
|
|
|
30 |
| Question Text | Select one or two choices only |
|
|
|
31 |
| Possible answers | One,Two,Three,Four |
|
|
|
32 |
Then I should see "[Check Boxes] (Q1)"
|
|
|
33 |
And I should see "Select one or two choices only"
|
|
|
34 |
And I add a "Dropdown Box" question and I fill the form with:
|
|
|
35 |
| Question Name | Q2 |
|
|
|
36 |
| No | n |
|
|
|
37 |
| Question Text | Select one choice |
|
|
|
38 |
| Possible answers | One,Two,Three,Four |
|
|
|
39 |
Then I should see "[Dropdown Box] (Q2)"
|
|
|
40 |
And I should see "Select one choice"
|
|
|
41 |
And I log out
|
|
|
42 |
|
|
|
43 |
@javascript
|
|
|
44 |
Scenario: Student completes first question and saves response. Resumes with saved response already present.
|
|
|
45 |
And I log in as "student1"
|
|
|
46 |
And I am on "Course 1" course homepage
|
|
|
47 |
And I follow "Questionnaire 1"
|
|
|
48 |
And I navigate to "Answer the questions..." in current page administration
|
|
|
49 |
Then I should see "Questionnaire 1"
|
|
|
50 |
And I set the field "One" to "checked"
|
|
|
51 |
And I set the field "Two" to "checked"
|
|
|
52 |
And I set the field "Select one choice" to "Four"
|
|
|
53 |
And I press "Save and exit"
|
|
|
54 |
Then I should see "Your progress has been saved."
|
|
|
55 |
And I should see "Resume questionnaire"
|
|
|
56 |
|
|
|
57 |
And I am on "Course 1" course homepage
|
|
|
58 |
And I follow "Questionnaire 1"
|
|
|
59 |
Then I should see "Resume questionnaire"
|
|
|
60 |
And I navigate to "Resume questionnaire" in current page administration
|
|
|
61 |
Then I should see "Questionnaire 1"
|
|
|
62 |
And I should see "Select one or two choices only"
|
|
|
63 |
And the field "One" matches value "checked"
|
|
|
64 |
And the field "Two" matches value "checked"
|
|
|
65 |
And the field "Three" does not match value "checked"
|
|
|
66 |
And the field "Four" does not match value "checked"
|
|
|
67 |
And the field "Select one choice" matches value "Four"
|
|
|
68 |
And I set the field "Two" to "0"
|
|
|
69 |
And I set the field "Three" to "checked"
|
|
|
70 |
And I press "Save and exit"
|
|
|
71 |
Then I should see "Your progress has been saved."
|
|
|
72 |
And I should see "Resume questionnaire"
|
|
|
73 |
|
|
|
74 |
And I am on "Course 1" course homepage
|
|
|
75 |
And I follow "Questionnaire 1"
|
|
|
76 |
And I navigate to "Resume questionnaire" in current page administration
|
|
|
77 |
Then I should see "Questionnaire 1"
|
|
|
78 |
And I should see "Select one or two choices only"
|
|
|
79 |
And the field "One" matches value "checked"
|
|
|
80 |
And the field "Two" does not match value "checked"
|
|
|
81 |
And the field "Three" matches value "checked"
|
|
|
82 |
And the field "Four" does not match value "checked"
|
|
|
83 |
And the field "Select one choice" matches value "Four"
|
|
|
84 |
And I press "Submit questionnaire"
|
|
|
85 |
Then I should see "Thank you for completing this Questionnaire."
|
|
|
86 |
And I should not see "Resume questionnaire"
|
|
|
87 |
|
|
|
88 |
And I am on "Course 1" course homepage
|
|
|
89 |
And I follow "Questionnaire 1"
|
|
|
90 |
Then I should not see "Resume questionnaire"
|