Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@mod @mod_questionnaire
2
Feature: Questions can be defined to be dependent on answers to 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 the "multilang" filter is "on"
23
    And the "multilang" filter applies to "content and headings"
24
    And I log in as "teacher1"
25
    And I am on "Course 1" course homepage
26
    And I follow "Test questionnaire"
27
    And I navigate to "Questions" in current page administration
28
    And I add a "Yes/No" question and I fill the form with:
29
      | Question Name | Q1 |
30
      | Yes | y |
31
      | Question Text | Are you still in School? |
32
    Then I should see "[Yes/No] (Q1)"
33
    And I add a "Check Boxes" question and I fill the form with:
34
      | Question Name | Y.1 |
35
      | No | n |
36
      | Min. forced responses | 0 |
37
      | Max. forced responses | 0 |
38
      | Question Text | Are you taking: |
39
      | Possible answers | <span lang="fr" class="multilang">Calc</span><span lang="en" class="multilang">Math</span>,Physics,Art,Music |
40
      | id_dependquestions_and_0  | Q1->Yes |
41
    Then I should see "[Check Boxes] (Y.1)"
42
    And I add a "Yes/No" question and I fill the form with:
43
      | Question Name | MP.1 |
44
      | Yes | y |
45
      | Question Text | Do you like Math but not Physics? |
46
      | id_dependquestions_and_0  | Y.1->Math |
47
      | id_dependquestions_and_1  | Y.1->Physics |
48
      | id_dependlogic_and_1  | This answer not given |
49
    Then I should see "[Yes/No] (MP.1)"
50
    And I add a "Yes/No" question and I fill the form with:
51
      | Question Name | MP.2 |
52
      | Yes | y |
53
      | Question Text | Do you plan to take a B.Sc.? |
54
      | id_dependquestions_and_0  | Q1->Yes |
55
      | id_dependquestions_or_0  | Y.1->Math |
56
      | id_dependquestions_or_1  | Y.1->Physics |
57
    Then I should see "[Yes/No] (MP.2)"
58
    And I add a "Yes/No" question and I fill the form with:
59
      | Question Name | AM.1 |
60
      | Yes | y |
61
      | Question Text | Do you plan to take a B.A.? |
62
      | id_dependquestions_and_0  | Q1->Yes |
63
      | id_dependquestions_or_0  | Y.1->Art |
64
      | id_dependquestions_or_1  | Y.1->Music |
65
    Then I should see "[Yes/No] (AM.1)"
66
    And I add a "Yes/No" question and I fill the form with:
67
      | Question Name | N.1 |
68
      | Yes | y |
69
      | Question Text | Are you taking an apprenticeship? |
70
      | id_dependquestions_and_0  | Q1->No |
71
    Then I should see "[Yes/No] (N.1)"
72
    And I add a "Dropdown Box" question and I fill the form with:
73
      | Question Name | Q2 |
74
      | No | n |
75
      | Question Text | Select one choice |
76
      | Possible answers | One,Two,Three,Four |
77
    Then I should see "[Dropdown Box] (Q2)"
78
    And I add a "Label" question and I fill the form with:
79
      | Question Text | You answered one |
80
      | id_dependquestions_and_0  | Q2->One |
81
    Then I should see "[Label]"
82
    And I add a "Label" question and I fill the form with:
83
      | Question Text | You did not answer one |
84
      | id_dependquestions_and_0  | Q2->One |
85
      | id_dependlogic_and_0  | This answer not given |
86
    Then I should see "[Label]"
87
    And I add a "Yes/No" question and I fill the form with:
88
      | Question Name | Q3 |
89
      | Yes | y |
90
      | Question Text | Are you happy? |
91
    Then I should see "[Yes/No] (Q3)"
92
    And I am on the "Test questionnaire" "mod_questionnaire > Preview" page
93
    And I should see "Previewing Questionnaire"
94
    And I log out
95
 
96
  @javascript
97
  Scenario: Student should only be asked questions on school if they have answered yes to question 1.
98
    And I log in as "student1"
99
    And I am on "Course 1" course homepage
100
    And I follow "Test questionnaire"
101
    And I navigate to "Answer the questions..." in current page administration
102
    Then I should see "Are you still in School?"
103
    And I click on "Yes" "radio"
104
    And I press "Next Page >>"
105
    Then I should see "Are you taking:"
106
    And I set the field "Math" to "checked"
107
    And I press "Next Page >>"
108
    Then I should see "Do you like Math but not Physics?"
109
    And I click on "No" "radio"
110
    And I press "Next Page >>"
111
    Then I should see "Do you plan to take a B.Sc.?"
112
    And I click on "Yes" "radio"
113
    And I press "Next Page >>"
114
    Then I should see "Select one choice"
115
    And I press "<< Previous Page"
116
    And I press "<< Previous Page"
117
    And I press "<< Previous Page"
118
    And I set the field "Art" to "checked"
119
    And I press "Next Page >>"
120
    Then I should see "Do you like Math but not Physics?"
121
    And I press "Next Page >>"
122
    Then I should see "Do you plan to take a B.Sc.?"
123
    And I press "Next Page >>"
124
    Then I should see "Do you plan to take a B.A.?"
125
    And I click on "No" "radio"
126
    And I press "Next Page >>"
127
    Then I should see "Select one choice"
128
    And I press "<< Previous Page"
129
    And I press "<< Previous Page"
130
    And I press "<< Previous Page"
131
    And I press "<< Previous Page"
132
    And I click on "Math" "checkbox"
133
    And I press "Next Page >>"
134
    Then I should see "Do you plan to take a B.A.?"
135
    And I press "<< Previous Page"
136
    And I click on "Art" "checkbox"
137
    And I press "Next Page >>"
138
    Then I should see "Select one choice"
139
    And I press "<< Previous Page"
140
    And I press "<< Previous Page"
141
    Then I should see "Are you still in School?"
142
    And I click on "No" "radio"
143
    And I press "Next Page >>"
144
    Then I should see "Are you taking an apprenticeship?"
145
    And I click on "No" "radio"
146
    And I press "Next Page >>"
147
    Then I should see "Select one choice"
148
    And I set the field "dropQ2" to "One"
149
    And I press "Next Page >>"
150
    Then I should see "You answered one"
151
    And I press "<< Previous Page"
152
    And I set the field "dropQ2" to "Three"
153
    And I press "Next Page >>"
154
    Then I should see "You did not answer one"
155
    And I press "Next Page >>"
156
    Then I should see "Are you happy?"