affectiva-surveyor 1.5.0.pre.disco.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +28 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +198 -0
- data/Gemfile +5 -0
- data/Gemfile.rails_version +27 -0
- data/MIT-LICENSE +20 -0
- data/README.md +166 -0
- data/Rakefile +106 -0
- data/app/controllers/surveyor_controller.rb +5 -0
- data/app/helpers/results_helper.rb +20 -0
- data/app/helpers/survey_form_builder.rb +37 -0
- data/app/helpers/surveyor_helper.rb +3 -0
- data/app/inputs/quiet_input.rb +5 -0
- data/app/inputs/surveyor_check_boxes_input.rb +35 -0
- data/app/inputs/surveyor_radio_input.rb +18 -0
- data/app/models/answer.rb +3 -0
- data/app/models/dependency.rb +3 -0
- data/app/models/dependency_condition.rb +3 -0
- data/app/models/question.rb +3 -0
- data/app/models/question_group.rb +4 -0
- data/app/models/response.rb +4 -0
- data/app/models/response_set.rb +3 -0
- data/app/models/survey.rb +3 -0
- data/app/models/survey_section.rb +4 -0
- data/app/models/survey_section_sweeper.rb +15 -0
- data/app/models/survey_translation.rb +4 -0
- data/app/models/validation.rb +3 -0
- data/app/models/validation_condition.rb +3 -0
- data/app/views/layouts/results.html.erb +13 -0
- data/app/views/layouts/surveyor_default.html.erb +12 -0
- data/app/views/partials/_answer.html.haml +25 -0
- data/app/views/partials/_dependents.html.haml +5 -0
- data/app/views/partials/_question.html.haml +28 -0
- data/app/views/partials/_question_group.html.haml +44 -0
- data/app/views/partials/_section.html.haml +12 -0
- data/app/views/partials/_section_menu.html.haml +12 -0
- data/app/views/surveyor/edit.html.haml +24 -0
- data/app/views/surveyor/export.json.rabl +85 -0
- data/app/views/surveyor/new.html.haml +24 -0
- data/app/views/surveyor/show.html.haml +74 -0
- data/app/views/surveyor/show.json.rabl +15 -0
- data/ci-exec.sh +56 -0
- data/config/routes.rb +8 -0
- data/cucumber.yml +10 -0
- data/doc/REPRESENTATIONS.md +34 -0
- data/doc/api_id_schema.json +7 -0
- data/doc/question types.png +0 -0
- data/doc/response_set_schema.json +54 -0
- data/doc/surveyor question combinations.png +0 -0
- data/doc/surveyor reject or delete decision matrix.png +0 -0
- data/doc/surveyor_models.png +0 -0
- data/doc/surveyor_models2.png +0 -0
- data/doc/surveyor_timestamp_schema.json +9 -0
- data/features/ajax_submissions.feature +140 -0
- data/features/export_to_json.feature +344 -0
- data/features/internationalization.feature +121 -0
- data/features/no_duplicates.feature +110 -0
- data/features/show_survey.feature +71 -0
- data/features/step_definitions/parser_steps.rb +145 -0
- data/features/step_definitions/surveyor_steps.rb +325 -0
- data/features/step_definitions/ui_steps.rb +25 -0
- data/features/step_definitions/web_steps.rb +225 -0
- data/features/support/REDCapDemoDatabase_DataDictionary.csv +127 -0
- data/features/support/database_cleaner.rb +16 -0
- data/features/support/env.rb +56 -0
- data/features/support/hooks.rb +4 -0
- data/features/support/paths.rb +39 -0
- data/features/support/redcap_new_headers.csv +1 -0
- data/features/support/redcap_siblings.csv +1 -0
- data/features/support/redcap_whitespace.csv +1 -0
- data/features/support/selectors.rb +39 -0
- data/features/support/simultaneous_ajax.rb +101 -0
- data/features/support/single_quit_selenium_driver.rb +23 -0
- data/features/support/slow_updates.rb +18 -0
- data/features/surveyor.feature +895 -0
- data/features/surveyor_dependencies.feature +476 -0
- data/features/surveyor_parser.feature +504 -0
- data/features/z_redcap_parser.feature +62 -0
- data/lib/assets/images/surveyor/next.gif +0 -0
- data/lib/assets/images/surveyor/prev.gif +0 -0
- data/lib/assets/images/surveyor/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/lib/assets/images/surveyor/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/lib/assets/images/surveyor/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/lib/assets/images/surveyor/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/assets/images/surveyor/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/lib/assets/images/surveyor/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/lib/assets/images/surveyor/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/lib/assets/images/surveyor/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/lib/assets/images/surveyor/ui-icons_222222_256x240.png +0 -0
- data/lib/assets/images/surveyor/ui-icons_2e83ff_256x240.png +0 -0
- data/lib/assets/images/surveyor/ui-icons_454545_256x240.png +0 -0
- data/lib/assets/images/surveyor/ui-icons_888888_256x240.png +0 -0
- data/lib/assets/images/surveyor/ui-icons_cd0a0a_256x240.png +0 -0
- data/lib/assets/javascripts/surveyor/jquery-1.9.0.js +9555 -0
- data/lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js +14850 -0
- data/lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js +1919 -0
- data/lib/assets/javascripts/surveyor/jquery.maskedinput.js +338 -0
- data/lib/assets/javascripts/surveyor/jquery.selectToUISlider.js +240 -0
- data/lib/assets/javascripts/surveyor/jquery.surveyor.js +154 -0
- data/lib/assets/stylesheets/surveyor.sass +132 -0
- data/lib/assets/stylesheets/surveyor/jquery-ui-1.10.0.custom.css +1174 -0
- data/lib/assets/stylesheets/surveyor/jquery-ui-timepicker-addon.css +11 -0
- data/lib/assets/stylesheets/surveyor/reset.css +48 -0
- data/lib/assets/stylesheets/surveyor/results.css +125 -0
- data/lib/assets/stylesheets/surveyor/ui.slider.extras.css +110 -0
- data/lib/generators/surveyor/custom_generator.rb +18 -0
- data/lib/generators/surveyor/install_generator.rb +101 -0
- data/lib/generators/surveyor/templates/app/assets/javascripts/surveyor_all.js +6 -0
- data/lib/generators/surveyor/templates/app/assets/stylesheets/surveyor_all.css +9 -0
- data/lib/generators/surveyor/templates/app/controllers/surveyor_controller.rb +40 -0
- data/lib/generators/surveyor/templates/app/views/layouts/surveyor_custom.html.erb +13 -0
- data/lib/generators/surveyor/templates/config/locales/surveyor_en.yml +19 -0
- data/lib/generators/surveyor/templates/config/locales/surveyor_es.yml +19 -0
- data/lib/generators/surveyor/templates/config/locales/surveyor_he.yml +19 -0
- data/lib/generators/surveyor/templates/config/locales/surveyor_ko.yml +19 -0
- data/lib/generators/surveyor/templates/db/migrate/add_api_id_to_question_groups.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/add_api_ids.rb +14 -0
- data/lib/generators/surveyor/templates/db/migrate/add_api_ids_to_response_sets_and_responses.rb +12 -0
- data/lib/generators/surveyor/templates/db/migrate/add_correct_answer_id_to_questions.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/add_default_value_to_answers.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/add_display_order_to_surveys.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb +14 -0
- data/lib/generators/surveyor/templates/db/migrate/add_index_to_response_sets.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/add_index_to_surveys.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/add_input_mask_attributes_to_answer.rb +12 -0
- data/lib/generators/surveyor/templates/db/migrate/add_section_id_to_responses.rb +12 -0
- data/lib/generators/surveyor/templates/db/migrate/add_unique_index_on_access_code_and_version_in_surveys.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/add_unique_indicies.rb +18 -0
- data/lib/generators/surveyor/templates/db/migrate/add_version_to_surveys.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/api_ids_must_be_unique.rb +23 -0
- data/lib/generators/surveyor/templates/db/migrate/create_answers.rb +38 -0
- data/lib/generators/surveyor/templates/db/migrate/create_dependencies.rb +23 -0
- data/lib/generators/surveyor/templates/db/migrate/create_dependency_conditions.rb +30 -0
- data/lib/generators/surveyor/templates/db/migrate/create_question_groups.rb +28 -0
- data/lib/generators/surveyor/templates/db/migrate/create_questions.rb +37 -0
- data/lib/generators/surveyor/templates/db/migrate/create_response_sets.rb +23 -0
- data/lib/generators/surveyor/templates/db/migrate/create_responses.rb +34 -0
- data/lib/generators/surveyor/templates/db/migrate/create_survey_sections.rb +30 -0
- data/lib/generators/surveyor/templates/db/migrate/create_survey_translations.rb +19 -0
- data/lib/generators/surveyor/templates/db/migrate/create_surveys.rb +32 -0
- data/lib/generators/surveyor/templates/db/migrate/create_validation_conditions.rb +33 -0
- data/lib/generators/surveyor/templates/db/migrate/create_validations.rb +21 -0
- data/lib/generators/surveyor/templates/db/migrate/drop_unique_index_on_access_code_in_surveys.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/update_blank_api_ids_on_question_group.rb +22 -0
- data/lib/generators/surveyor/templates/db/migrate/update_blank_versions_on_surveys.rb +13 -0
- data/lib/generators/surveyor/templates/surveys/EXTENDING_SURVEYOR.md +52 -0
- data/lib/generators/surveyor/templates/surveys/MODIFYING_SURVEYOR.md +91 -0
- data/lib/generators/surveyor/templates/surveys/date_survey.rb +16 -0
- data/lib/generators/surveyor/templates/surveys/kitchen_sink_survey.rb +280 -0
- data/lib/generators/surveyor/templates/surveys/languages.rb +14 -0
- data/lib/generators/surveyor/templates/surveys/quiz.rb +11 -0
- data/lib/generators/surveyor/templates/surveys/translations/languages.es.yml +18 -0
- data/lib/generators/surveyor/templates/surveys/translations/languages.he.yml +18 -0
- data/lib/generators/surveyor/templates/surveys/translations/languages.ko.yml +18 -0
- data/lib/generators/surveyor/templates/vendor/assets/stylesheets/custom.sass +5 -0
- data/lib/surveyor.rb +13 -0
- data/lib/surveyor/acts_as_response.rb +17 -0
- data/lib/surveyor/common.rb +59 -0
- data/lib/surveyor/engine.rb +10 -0
- data/lib/surveyor/helpers/asset_pipeline.rb +18 -0
- data/lib/surveyor/helpers/formtastic_custom_input.rb +13 -0
- data/lib/surveyor/helpers/surveyor_helper_methods.rb +103 -0
- data/lib/surveyor/models/answer_methods.rb +83 -0
- data/lib/surveyor/models/dependency_condition_methods.rb +69 -0
- data/lib/surveyor/models/dependency_methods.rb +57 -0
- data/lib/surveyor/models/question_group_methods.rb +58 -0
- data/lib/surveyor/models/question_methods.rb +112 -0
- data/lib/surveyor/models/response_methods.rb +126 -0
- data/lib/surveyor/models/response_set_methods.rb +188 -0
- data/lib/surveyor/models/survey_methods.rb +100 -0
- data/lib/surveyor/models/survey_section_methods.rb +53 -0
- data/lib/surveyor/models/survey_translation_methods.rb +30 -0
- data/lib/surveyor/models/validation_condition_methods.rb +54 -0
- data/lib/surveyor/models/validation_methods.rb +45 -0
- data/lib/surveyor/mustache_context.rb +11 -0
- data/lib/surveyor/parser.rb +427 -0
- data/lib/surveyor/redcap_parser.rb +288 -0
- data/lib/surveyor/surveyor_controller_methods.rb +236 -0
- data/lib/surveyor/unparser.rb +147 -0
- data/lib/surveyor/version.rb +3 -0
- data/lib/tasks/surveyor_tasks.rake +88 -0
- data/rails/init.rb +1 -0
- data/spec/controllers/surveyor_controller_spec.rb +311 -0
- data/spec/factories.rb +166 -0
- data/spec/helpers/formtastic_custom_input_spec.rb +15 -0
- data/spec/helpers/surveyor_helper_spec.rb +117 -0
- data/spec/lib/benchmark_spec.rb +22 -0
- data/spec/lib/chinese_survey.rb +14 -0
- data/spec/lib/common_spec.rb +34 -0
- data/spec/lib/parser_spec.rb +204 -0
- data/spec/lib/rake_kitchen_sink.rb +40 -0
- data/spec/lib/redcap_parser_spec.rb +75 -0
- data/spec/lib/tasks_spec.rake +26 -0
- data/spec/lib/unparser_spec.rb +126 -0
- data/spec/models/answer_spec.rb +174 -0
- data/spec/models/dependency_condition_spec.rb +439 -0
- data/spec/models/dependency_spec.rb +101 -0
- data/spec/models/question_group_spec.rb +93 -0
- data/spec/models/question_spec.rb +206 -0
- data/spec/models/response_set_spec.rb +477 -0
- data/spec/models/response_spec.rb +218 -0
- data/spec/models/survey_section_spec.rb +85 -0
- data/spec/models/survey_spec.rb +191 -0
- data/spec/models/validation_condition_spec.rb +113 -0
- data/spec/models/validation_spec.rb +74 -0
- data/spec/rcov.opts +2 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +56 -0
- data/stacktests.sh +65 -0
- data/surveyor.gemspec +53 -0
- metadata +601 -0
@@ -0,0 +1,476 @@
|
|
1
|
+
Feature: Survey dependencies
|
2
|
+
As a survey participant
|
3
|
+
I want to see dependent question if conditions are met
|
4
|
+
And I do now want to see dependent question if conditions are not met
|
5
|
+
|
6
|
+
@javascript
|
7
|
+
Scenario: "Simple question dependencies"
|
8
|
+
Given I parse
|
9
|
+
"""
|
10
|
+
survey "Anybody" do
|
11
|
+
section "First" do
|
12
|
+
q_1 "Anybody there?", :pick => :one
|
13
|
+
a_1 "Yes"
|
14
|
+
a_2 "No"
|
15
|
+
|
16
|
+
q_2 "Who are you??"
|
17
|
+
dependency :rule => "A"
|
18
|
+
condition_A :q_1, "==", :a_1
|
19
|
+
a :string
|
20
|
+
|
21
|
+
q_3 "Weird.. Must be talking to myself..", :pick => :one
|
22
|
+
dependency :rule => "A"
|
23
|
+
condition_A :q_1, "==", :a_2
|
24
|
+
a "Maybe"
|
25
|
+
a "Huh?"
|
26
|
+
end
|
27
|
+
section "Second" do
|
28
|
+
q "Anything else?"
|
29
|
+
a :string
|
30
|
+
end
|
31
|
+
end
|
32
|
+
"""
|
33
|
+
When I go to the surveys page
|
34
|
+
And I start the "Anybody" survey
|
35
|
+
Then I should see "Anybody there?"
|
36
|
+
And the element "#q_2" should be hidden
|
37
|
+
And the element "#q_3" should be hidden
|
38
|
+
When I choose "Yes"
|
39
|
+
Then the element "#q_2" should not be hidden
|
40
|
+
And the element "#q_3" should be hidden
|
41
|
+
When I choose "No"
|
42
|
+
Then the element "#q_3" should not be hidden
|
43
|
+
And the element "#q_2" should be hidden
|
44
|
+
When I press "Second"
|
45
|
+
And I press "First"
|
46
|
+
Then the element "#q_3" should not be hidden
|
47
|
+
And the element "#q_2" should be hidden
|
48
|
+
|
49
|
+
@javascript
|
50
|
+
Scenario: "Dependencies inside of the question group"
|
51
|
+
Given I parse
|
52
|
+
"""
|
53
|
+
survey "Anybody" do
|
54
|
+
section "First" do
|
55
|
+
group "" do
|
56
|
+
q_1 "Anybody there?", :pick => :one
|
57
|
+
a_1 "Yes"
|
58
|
+
a_2 "No"
|
59
|
+
|
60
|
+
q_2 "Who are you??"
|
61
|
+
dependency :rule => "A"
|
62
|
+
condition_A :q_1, "==", :a_1
|
63
|
+
a :string
|
64
|
+
|
65
|
+
q_3 "Weird.. Must be talking to myself..", :pick => :one
|
66
|
+
dependency :rule => "A"
|
67
|
+
condition_A :q_1, "==", :a_2
|
68
|
+
a "Maybe"
|
69
|
+
a "Huh?"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
section "Second" do
|
73
|
+
q "Anything else?"
|
74
|
+
a :string
|
75
|
+
end
|
76
|
+
end
|
77
|
+
"""
|
78
|
+
When I go to the surveys page
|
79
|
+
And I start the "Anybody" survey
|
80
|
+
Then I should see "Anybody there?"
|
81
|
+
And the element "#q_2" should be hidden
|
82
|
+
And the element "#q_3" should be hidden
|
83
|
+
When I choose "Yes"
|
84
|
+
Then the element "#q_2" should not be hidden
|
85
|
+
And the element "#q_3" should be hidden
|
86
|
+
When I choose "No"
|
87
|
+
Then the element "#q_3" should not be hidden
|
88
|
+
And the element "#q_2" should be hidden
|
89
|
+
When I press "Second"
|
90
|
+
And I press "First"
|
91
|
+
Then the element "#q_3" should not be hidden
|
92
|
+
And the element "#q_2" should be hidden
|
93
|
+
|
94
|
+
|
95
|
+
@javascript
|
96
|
+
Scenario: "Dependencies inside of the 'inline' question group"
|
97
|
+
Given I parse
|
98
|
+
"""
|
99
|
+
survey "Anybody" do
|
100
|
+
section "First" do
|
101
|
+
group "", :display_type => :inline do
|
102
|
+
q_1 "Anybody there?", :pick => :one
|
103
|
+
a_1 "Yes"
|
104
|
+
a_2 "No"
|
105
|
+
|
106
|
+
q_2 "Who are you??"
|
107
|
+
dependency :rule => "A"
|
108
|
+
condition_A :q_1, "==", :a_1
|
109
|
+
a :string
|
110
|
+
|
111
|
+
q_3 "Weird.. Must be talking to myself..", :pick => :one
|
112
|
+
dependency :rule => "A"
|
113
|
+
condition_A :q_1, "==", :a_2
|
114
|
+
a "Maybe"
|
115
|
+
a "Huh?"
|
116
|
+
end
|
117
|
+
end
|
118
|
+
section "Second" do
|
119
|
+
q "Anything else?"
|
120
|
+
a :string
|
121
|
+
end
|
122
|
+
end
|
123
|
+
"""
|
124
|
+
When I go to the surveys page
|
125
|
+
And I start the "Anybody" survey
|
126
|
+
Then I should see "Anybody there?"
|
127
|
+
And the element "#q_2" should be hidden
|
128
|
+
And the element "#q_3" should be hidden
|
129
|
+
|
130
|
+
When I choose "Yes"
|
131
|
+
Then the element "#q_2" should not be hidden
|
132
|
+
And the element "#q_3" should be hidden
|
133
|
+
|
134
|
+
When I choose "No"
|
135
|
+
Then the element "#q_3" should not be hidden
|
136
|
+
And the element "#q_2" should be hidden
|
137
|
+
|
138
|
+
When I press "Second"
|
139
|
+
And I press "First"
|
140
|
+
Then the element "#q_3" should not be hidden
|
141
|
+
And the element "#q_2" should be hidden
|
142
|
+
|
143
|
+
@javascript
|
144
|
+
Scenario: "Dependency on group"
|
145
|
+
Given I parse
|
146
|
+
"""
|
147
|
+
survey "Anybody" do
|
148
|
+
section "First" do
|
149
|
+
q_1 "Anybody there?", :pick => :one
|
150
|
+
a_1 "Yes"
|
151
|
+
a_2 "No"
|
152
|
+
|
153
|
+
group "Who are you?", :display_type => :inline do
|
154
|
+
dependency :rule => "A"
|
155
|
+
condition_A :q_1, "==", :a_1
|
156
|
+
|
157
|
+
q_2 "Name yourself"
|
158
|
+
a :string
|
159
|
+
|
160
|
+
q_3 "Why are you here?"
|
161
|
+
a :string
|
162
|
+
end
|
163
|
+
|
164
|
+
group "" do
|
165
|
+
dependency :rule => "A"
|
166
|
+
condition_A :q_1, "==", :a_2
|
167
|
+
|
168
|
+
q_4 "Who is talking?", :pick => :one
|
169
|
+
a "You are"
|
170
|
+
a "Are you nuts?"
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
174
|
+
section "Second" do
|
175
|
+
q "Anything else?"
|
176
|
+
a :string
|
177
|
+
end
|
178
|
+
end
|
179
|
+
"""
|
180
|
+
When I go to the surveys page
|
181
|
+
And I start the "Anybody" survey
|
182
|
+
Then I should see "Anybody there?"
|
183
|
+
And the element "#q_2" should be hidden
|
184
|
+
And the element "#q_3" should be hidden
|
185
|
+
And the element "#q_4" should be hidden
|
186
|
+
|
187
|
+
When I choose "Yes"
|
188
|
+
Then the element "#q_2" should not be hidden
|
189
|
+
And the element "#q_3" should not be hidden
|
190
|
+
And the element "#q_4" should be hidden
|
191
|
+
|
192
|
+
When I choose "No"
|
193
|
+
Then the element "#q_2" should be hidden
|
194
|
+
And the element "#q_3" should be hidden
|
195
|
+
And the element "#q_4" should not be hidden
|
196
|
+
|
197
|
+
When I press "Second"
|
198
|
+
And I press "First"
|
199
|
+
Then the element "#q_2" should be hidden
|
200
|
+
And the element "#q_3" should be hidden
|
201
|
+
And the element "#q_4" should not be hidden
|
202
|
+
|
203
|
+
@javascript
|
204
|
+
Scenario: "Dependency on question in dependent group"
|
205
|
+
Given I parse
|
206
|
+
"""
|
207
|
+
survey "Anybody" do
|
208
|
+
section "First" do
|
209
|
+
q_1 "Anybody there?", :pick => :one
|
210
|
+
a_1 "Yes"
|
211
|
+
a_2 "No"
|
212
|
+
|
213
|
+
group "Who are you?" do
|
214
|
+
dependency :rule => "A"
|
215
|
+
condition_A :q_1, "==", :a_1
|
216
|
+
|
217
|
+
q_2 "Are you..", :pick => :one
|
218
|
+
a_1 "Human"
|
219
|
+
a_2 "Dancer"
|
220
|
+
a_3 "Owner Of The World"
|
221
|
+
|
222
|
+
q_3 "Why are you here?"
|
223
|
+
dependency :rule => "A"
|
224
|
+
condition_A :q_2, "==", :a_1
|
225
|
+
a :string
|
226
|
+
|
227
|
+
q_4 "Which one?"
|
228
|
+
dependency :rule => "A"
|
229
|
+
condition_A :q_2, "==", :a_3
|
230
|
+
a :string
|
231
|
+
end
|
232
|
+
|
233
|
+
group "" do
|
234
|
+
dependency :rule => "A"
|
235
|
+
condition_A :q_1, "==", :a_2
|
236
|
+
|
237
|
+
q_5 "Who is talking?", :pick => :one
|
238
|
+
a "You are"
|
239
|
+
a "Are you nuts?"
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
243
|
+
section "Second" do
|
244
|
+
q "Anything else?"
|
245
|
+
a :string
|
246
|
+
end
|
247
|
+
end
|
248
|
+
"""
|
249
|
+
When I go to the surveys page
|
250
|
+
And I start the "Anybody" survey
|
251
|
+
Then I should see "Anybody there?"
|
252
|
+
And the element "#q_2" should be hidden
|
253
|
+
And the element "#q_3" should be hidden
|
254
|
+
And the element "#q_4" should be hidden
|
255
|
+
And the element "#q_5" should be hidden
|
256
|
+
|
257
|
+
When I choose "Yes"
|
258
|
+
Then the element "#q_2" should not be hidden
|
259
|
+
And the element "#q_3" should be hidden
|
260
|
+
And the element "#q_4" should be hidden
|
261
|
+
And the element "#q_5" should be hidden
|
262
|
+
|
263
|
+
When I choose "Human"
|
264
|
+
Then the element "#q_3" should not be hidden
|
265
|
+
And the element "#q_4" should be hidden
|
266
|
+
And the element "#q_5" should be hidden
|
267
|
+
|
268
|
+
When I choose "Owner Of The World"
|
269
|
+
Then the element "#q_3" should be hidden
|
270
|
+
And the element "#q_4" should not be hidden
|
271
|
+
And the element "#q_5" should be hidden
|
272
|
+
|
273
|
+
When I choose "No"
|
274
|
+
Then the element "#q_2" should be hidden
|
275
|
+
And the element "#q_3" should be hidden
|
276
|
+
And the element "#q_4" should be hidden
|
277
|
+
And the element "#q_5" should not be hidden
|
278
|
+
|
279
|
+
#issue #337 answer != condition returns false if question was never activated
|
280
|
+
@javascript
|
281
|
+
Scenario: Depending with != on questions without responses
|
282
|
+
Given I parse
|
283
|
+
"""
|
284
|
+
survey "Cooling" do
|
285
|
+
section "Basics" do
|
286
|
+
q_cooling_1 "How do you cool your home?", :pick => :one
|
287
|
+
a_1 "Fans"
|
288
|
+
a_2 "Window AC"
|
289
|
+
a_3 "Central AC"
|
290
|
+
a_4 "Passive"
|
291
|
+
|
292
|
+
q_cooling_2 "How much does it cost to run your non-passive cooling solutions?"
|
293
|
+
dependency :rule => "A"
|
294
|
+
condition_A :q_cooling_1, "!=", :a_4
|
295
|
+
a_1 "$", :float
|
296
|
+
end
|
297
|
+
end
|
298
|
+
"""
|
299
|
+
When I go to the surveys page
|
300
|
+
And I start the "Cooling" survey
|
301
|
+
Then the question "How much does it cost to run your non-passive cooling solutions?" should be triggered
|
302
|
+
And I choose "Passive"
|
303
|
+
Then the question "How much does it cost to run your non-passive cooling solutions?" should be hidden
|
304
|
+
|
305
|
+
#issue #337 answer != condition returns false if question was never activated
|
306
|
+
@javascript
|
307
|
+
Scenario: Depending with != on questions without responses
|
308
|
+
Given I parse
|
309
|
+
"""
|
310
|
+
survey "Heating" do
|
311
|
+
section "Basics" do
|
312
|
+
q_heating_1 "How do you heat your home?", :pick => :one
|
313
|
+
a_1 "Force air"
|
314
|
+
a_2 "Radiators"
|
315
|
+
a_3 "Oven"
|
316
|
+
a_4 "Passive"
|
317
|
+
|
318
|
+
q_heating_2 "How much does it cost to run your non-passive heating solutions?"
|
319
|
+
dependency :rule => "A and B"
|
320
|
+
condition_A :q_heating_1, "!=", :a_4
|
321
|
+
condition_B :q_heating_1, "count>0"
|
322
|
+
a_1 "$", :float
|
323
|
+
end
|
324
|
+
end
|
325
|
+
"""
|
326
|
+
When I go to the surveys page
|
327
|
+
And I start the "Heating" survey
|
328
|
+
Then the question "How much does it cost to run your non-passive heating solutions?" should be hidden
|
329
|
+
And I choose "Oven"
|
330
|
+
Then the question "How much does it cost to run your non-passive heating solutions?" should be triggered
|
331
|
+
|
332
|
+
@javascript
|
333
|
+
Scenario: Count== dependencies
|
334
|
+
Given I parse
|
335
|
+
"""
|
336
|
+
survey "Counting" do
|
337
|
+
section "First" do
|
338
|
+
q_counts "How many times do you count a day", :pick => :any
|
339
|
+
a_1 "Once for me"
|
340
|
+
a_2 "Once for you"
|
341
|
+
a_3 "Once for everyone"
|
342
|
+
|
343
|
+
label "Good!"
|
344
|
+
dependency :rule => "A"
|
345
|
+
condition_A :q_counts, "count==1"
|
346
|
+
|
347
|
+
label "Twice as good!"
|
348
|
+
dependency :rule => "A"
|
349
|
+
condition_A :q_counts, "count==2"
|
350
|
+
end
|
351
|
+
end
|
352
|
+
"""
|
353
|
+
When I go to the surveys page
|
354
|
+
And I start the "Counting" survey
|
355
|
+
Then I should see "How many times do you count a day"
|
356
|
+
And the element "#q_2" should be hidden
|
357
|
+
And the element "#q_3" should be hidden
|
358
|
+
When I check "Once for me"
|
359
|
+
Then the element "#q_2" should not be hidden
|
360
|
+
And the element "#q_3" should be hidden
|
361
|
+
When I check "Once for you"
|
362
|
+
Then the element "#q_3" should not be hidden
|
363
|
+
And the element "#q_2" should be hidden
|
364
|
+
|
365
|
+
@javascript
|
366
|
+
Scenario: Dependency evaluation when the last response is removed
|
367
|
+
Given I parse
|
368
|
+
"""
|
369
|
+
survey "Heating" do
|
370
|
+
section "Basics" do
|
371
|
+
q_heating_1 "How do you heat your home?", :pick => :any
|
372
|
+
a_1 "Forced air"
|
373
|
+
a_2 "Radiators"
|
374
|
+
a_3 "Oven"
|
375
|
+
a_4 "Passive"
|
376
|
+
|
377
|
+
q_heating_2 "How much does it cost to run your non-passive heating solutions?"
|
378
|
+
dependency :rule => "A"
|
379
|
+
condition_A :q_heating_1, "==", :a_1
|
380
|
+
a_1 "$", :float
|
381
|
+
end
|
382
|
+
end
|
383
|
+
"""
|
384
|
+
When I go to the surveys page
|
385
|
+
And I start the "Heating" survey
|
386
|
+
Then the question "How much does it cost to run your non-passive heating solutions?" should be hidden
|
387
|
+
And I check "Forced air"
|
388
|
+
Then the question "How much does it cost to run your non-passive heating solutions?" should be triggered
|
389
|
+
And I uncheck "Forced air"
|
390
|
+
Then the question "How much does it cost to run your non-passive heating solutions?" should be hidden
|
391
|
+
|
392
|
+
@javascript
|
393
|
+
Scenario: Dependency evaluation within groups
|
394
|
+
Given I parse
|
395
|
+
"""
|
396
|
+
survey "Body" do
|
397
|
+
section "Joints" do
|
398
|
+
group "Muscle" do
|
399
|
+
q_muscles_joints_bones "Muscles, Joints, Bones", :pick => :any, :data_export_identifier => "muscles_joints_bones"
|
400
|
+
a_1 "Weakness"
|
401
|
+
a_2 "Arthritis"
|
402
|
+
a_3 "Cane/Walker"
|
403
|
+
a_4 "Morning stiffness"
|
404
|
+
a_5 "Joint pain"
|
405
|
+
a_6 "Muscle tenderness"
|
406
|
+
a_7 :other
|
407
|
+
|
408
|
+
q_muscles_joints_bones_other "Explain", :data_export_identifier => "muscles_joints_bones_other"
|
409
|
+
dependency :rule => "A"
|
410
|
+
condition_A :q_muscles_joints_bones, "==", :a_7
|
411
|
+
a "Explain", :string
|
412
|
+
end
|
413
|
+
end
|
414
|
+
end
|
415
|
+
"""
|
416
|
+
When I go to the surveys page
|
417
|
+
And I start the "Body" survey
|
418
|
+
Then the question "Explain" should be hidden
|
419
|
+
When I check "Other"
|
420
|
+
Then the question "Explain" should be triggered
|
421
|
+
When I uncheck "Other"
|
422
|
+
Then the question "Explain" should be hidden
|
423
|
+
|
424
|
+
@javascript
|
425
|
+
Scenario: Dependencies on multi-select (from the kitchen sink)
|
426
|
+
Given I parse
|
427
|
+
"""
|
428
|
+
survey "Colors" do
|
429
|
+
section "Dependencies" do
|
430
|
+
question "What is your favorite color?", :pick => :one
|
431
|
+
answer "red is my fav"
|
432
|
+
answer "blue is my fav"
|
433
|
+
answer "green is my fav"
|
434
|
+
answer "yellow is my fav"
|
435
|
+
answer :other
|
436
|
+
|
437
|
+
q_2 "Choose the colors you don't like", :pick => :any
|
438
|
+
a_1 "red"
|
439
|
+
a_2 "blue"
|
440
|
+
a_3 "green"
|
441
|
+
a_4 "yellow"
|
442
|
+
a :omit
|
443
|
+
|
444
|
+
q_2a "Please explain why you don't like this color?"
|
445
|
+
a_1 "explanation", :text, :help_text => "Please give an explanation for each color you don't like"
|
446
|
+
dependency :rule => "A or B or C or D"
|
447
|
+
condition_A :q_2, "==", :a_1
|
448
|
+
condition_B :q_2, "==", :a_2
|
449
|
+
condition_C :q_2, "==", :a_3
|
450
|
+
condition_D :q_2, "==", :a_4
|
451
|
+
|
452
|
+
q_2b "Please explain why you dislike so many colors?"
|
453
|
+
a_1 "explanation", :text
|
454
|
+
dependency :rule => "Z"
|
455
|
+
condition_Z :q_2, "count>2"
|
456
|
+
end
|
457
|
+
end
|
458
|
+
"""
|
459
|
+
When I go to the surveys page
|
460
|
+
And I start the "Colors" survey
|
461
|
+
And I choose "red is my fav"
|
462
|
+
Then the question "Please explain why you don't like this color?" should be hidden
|
463
|
+
And the question "Please explain why you dislike so many colors?" should be hidden
|
464
|
+
When I check "red"
|
465
|
+
Then the question "Please explain why you don't like this color?" should be triggered
|
466
|
+
And the question "Please explain why you dislike so many colors?" should be hidden
|
467
|
+
When I check "blue"
|
468
|
+
And I check "green"
|
469
|
+
Then the question "Please explain why you don't like this color?" should be triggered
|
470
|
+
And the question "Please explain why you dislike so many colors?" should be triggered
|
471
|
+
When I uncheck "red"
|
472
|
+
And I uncheck "blue"
|
473
|
+
And I uncheck "green"
|
474
|
+
Then the question "Please explain why you don't like this color?" should be hidden
|
475
|
+
And the question "Please explain why you dislike so many colors?" should be hidden
|
476
|
+
|