1 |
efrain |
1 |
@mod @mod_questionnaire
|
|
|
2 |
Feature: Radio questions allow optional "other" responses with optional labels
|
|
|
3 |
In order to allow users to enter "other" answers to a radio button question
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to specify an "other" choice
|
|
|
6 |
|
|
|
7 |
Background: Add two radio button question to a questionnaire with both "other" choice options specified
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
| student1 | Student | 1 | student1@example.com |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | category |
|
|
|
14 |
| Course 1 | C1 | 0 |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| student1 | C1 | student |
|
|
|
19 |
And the following "activities" exist:
|
|
|
20 |
| activity | name | description | course | idnumber |
|
|
|
21 |
| questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 |
|
|
|
22 |
And I log in as "teacher1"
|
|
|
23 |
And I am on "Course 1" course homepage
|
|
|
24 |
And I follow "Test questionnaire"
|
|
|
25 |
And I navigate to "Questions" in current page administration
|
|
|
26 |
And I add a "Radio Buttons" question and I fill the form with:
|
|
|
27 |
| Question Name | Q1 |
|
|
|
28 |
| Yes | y |
|
|
|
29 |
| Question Text | Select one |
|
|
|
30 |
| Possible answers | Red,Blue,Black,!other |
|
|
|
31 |
Then I should see "position 1"
|
|
|
32 |
And I should see "[Radio Buttons] (Q1)"
|
|
|
33 |
And I should see "Select one"
|
|
|
34 |
And I add a "Radio Buttons" question and I fill the form with:
|
|
|
35 |
| Question Name | Q2 |
|
|
|
36 |
| Yes | y |
|
|
|
37 |
| Question Text | Select another |
|
|
|
38 |
| Possible answers | Green,Orange,Yellow,!other=Another colour: |
|
|
|
39 |
Then I should see "position 2"
|
|
|
40 |
And I should see "[Radio Buttons] (Q2)"
|
|
|
41 |
And I should see "Select another"
|
|
|
42 |
And I log out
|
|
|
43 |
|
|
|
44 |
@javascript
|
|
|
45 |
Scenario: Student selects other options and enters their own text.
|
|
|
46 |
And I log in as "student1"
|
|
|
47 |
And I am on "Course 1" course homepage
|
|
|
48 |
And I follow "Test questionnaire"
|
|
|
49 |
And I navigate to "Answer the questions..." in current page administration
|
|
|
50 |
Then I should see "Test questionnaire"
|
|
|
51 |
And I click on "Other:" "radio"
|
|
|
52 |
And I set the field "Text for Other:" to "Yellow"
|
|
|
53 |
And I click on "Another colour:" "radio"
|
|
|
54 |
And I set the field "Text for Another colour:" to "Indigo"
|
|
|
55 |
And I press "Submit questionnaire"
|
|
|
56 |
Then I should see "Thank you for completing this Questionnaire."
|
|
|
57 |
And I press "Continue"
|
|
|
58 |
Then I should see "View your response(s)"
|
|
|
59 |
And I should see "Test questionnaire"
|
|
|
60 |
And I should see "Other: Yellow"
|
|
|
61 |
And I should see "Another colour: Indigo"
|