1 |
efrain |
1 |
@mod @mod_questionnaire
|
|
|
2 |
Feature: Checkbox questions can have other options that can be typed in.
|
|
|
3 |
|
|
|
4 |
Background: Add a checkbox question to a questionnaire with an 'other' option.
|
|
|
5 |
Given the following "users" exist:
|
|
|
6 |
| username | firstname | lastname | email |
|
|
|
7 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
8 |
| student1 | Student | 1 | student1@example.com |
|
|
|
9 |
And the following "courses" exist:
|
|
|
10 |
| fullname | shortname | category |
|
|
|
11 |
| Course 1 | C1 | 0 |
|
|
|
12 |
And the following "course enrolments" exist:
|
|
|
13 |
| user | course | role |
|
|
|
14 |
| teacher1 | C1 | editingteacher |
|
|
|
15 |
| student1 | C1 | student |
|
|
|
16 |
And the following "activities" exist:
|
|
|
17 |
| activity | name | description | course | idnumber |
|
|
|
18 |
| questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 |
|
|
|
19 |
And I log in as "teacher1"
|
|
|
20 |
And I am on "Course 1" course homepage
|
|
|
21 |
And I follow "Test questionnaire"
|
|
|
22 |
And I navigate to "Questions" in current page administration
|
|
|
23 |
And I add a "Check Boxes" question and I fill the form with:
|
|
|
24 |
| Question Name | Q1 |
|
|
|
25 |
| Yes | y |
|
|
|
26 |
| Question Text | Select one or two choices only |
|
|
|
27 |
| Possible answers | One,Two,Three,Four,!other |
|
|
|
28 |
And I add a "Check Boxes" question and I fill the form with:
|
|
|
29 |
| Question Name | Q2 |
|
|
|
30 |
| No | n |
|
|
|
31 |
| Question Text | Select one or two choices only |
|
|
|
32 |
| Possible answers | Red,Blue,Yellow,Green,!other=Other colour |
|
|
|
33 |
And I log out
|
|
|
34 |
|
|
|
35 |
@javascript
|
|
|
36 |
Scenario: Student must enter a valid value when "other" is selected.
|
|
|
37 |
And I log in as "student1"
|
|
|
38 |
And I am on "Course 1" course homepage
|
|
|
39 |
And I follow "Test questionnaire"
|
|
|
40 |
And I navigate to "Answer the questions..." in current page administration
|
|
|
41 |
Then I should see "Select one or two choices only"
|
|
|
42 |
And I press "Submit questionnaire"
|
|
|
43 |
Then I should see "Please answer required question #1"
|
|
|
44 |
And I set the field "Other" to "checked"
|
|
|
45 |
And I set the field "Other colour" to "checked"
|
|
|
46 |
And I press "Submit questionnaire"
|
|
|
47 |
Then I should see "There is something wrong with your answer to questions:"
|
|
|
48 |
And I should see "#1. #2."
|