1 |
efrain |
1 |
@mod @mod_questionnaire
|
|
|
2 |
Feature: Questions can be defined to be dependent on answers to multiple previous questions
|
|
|
3 |
In order to define a dependency
|
|
|
4 |
As a teacher
|
|
|
5 |
I must specify that branching questions are allowed and then create question dependencies
|
|
|
6 |
|
|
|
7 |
Background: Add a text box question that is dependent on a yes answer to a yes/no question.
|
|
|
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 | resume | navigate |
|
|
|
21 |
| questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | 1 | 1 |
|
|
|
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 "Yes/No" question and I fill the form with:
|
|
|
27 |
| Question Name | Q1 |
|
|
|
28 |
| Yes | y |
|
|
|
29 |
| Question Text | Do you own a car? |
|
|
|
30 |
Then I should see "[Yes/No] (Q1)"
|
|
|
31 |
And I should see "Do you own a car?"
|
|
|
32 |
And I add a "Text Box" question and I fill the form with:
|
|
|
33 |
| Question Name | Q2a |
|
|
|
34 |
| No | n |
|
|
|
35 |
| Input box length | 10 |
|
|
|
36 |
| Max. text length | 15 |
|
|
|
37 |
| id_dependquestions_and_0 | Q1->Yes |
|
|
|
38 |
| Question Text | What colour is the car? |
|
|
|
39 |
Then I should see "[Text Box] (Q2a)"
|
|
|
40 |
And I should see "What colour is the car?"
|
|
|
41 |
And I add a "Yes/No" question and I fill the form with:
|
|
|
42 |
| Question Name | Q2b |
|
|
|
43 |
| No | n |
|
|
|
44 |
| id_dependquestions_and_0 | Q1->No |
|
|
|
45 |
| Question Text | Will you buy a car this year? |
|
|
|
46 |
Then I should see "[Yes/No] (Q2b)"
|
|
|
47 |
And I should see "Will you buy a car this year?"
|
|
|
48 |
And I log out
|
|
|
49 |
|
|
|
50 |
@javascript
|
|
|
51 |
Scenario: Student should only be asked for the car colour if they have answered yes to question 1.
|
|
|
52 |
And I log in as "student1"
|
|
|
53 |
And I am on "Course 1" course homepage
|
|
|
54 |
And I follow "Test questionnaire"
|
|
|
55 |
And I navigate to "Answer the questions..." in current page administration
|
|
|
56 |
Then I should see "Do you own a car?"
|
|
|
57 |
# And I set the field "Do you own a car?" to "y"
|
|
|
58 |
And I click on "Yes" "radio"
|
|
|
59 |
And I press "Next Page >>"
|
|
|
60 |
Then I should see "What colour is the car?"
|
|
|
61 |
And I press "<< Previous Page"
|
|
|
62 |
Then I should see "Do you own a car?"
|
|
|
63 |
# And I set the field "Do you own a car?" to "n"
|
|
|
64 |
And I click on "No" "radio"
|
|
|
65 |
And I press "Next Page >>"
|
|
|
66 |
Then I should see "Will you buy a car this year?"
|