hssc_surveyor 1.4.1.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +28 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +198 -0
- data/Gemfile +5 -0
- data/Gemfile.rails_version +19 -0
- data/MIT-LICENSE +20 -0
- data/README.md +186 -0
- data/Rakefile +105 -0
- data/app/controllers/surveyor_controller.rb +6 -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 +4 -0
- data/app/models/dependency.rb +4 -0
- data/app/models/dependency_condition.rb +4 -0
- data/app/models/question.rb +4 -0
- data/app/models/question_group.rb +5 -0
- data/app/models/response.rb +5 -0
- data/app/models/response_set.rb +4 -0
- data/app/models/survey.rb +4 -0
- data/app/models/survey_section.rb +5 -0
- data/app/models/survey_section_sweeper.rb +15 -0
- data/app/models/survey_translation.rb +5 -0
- data/app/models/validation.rb +4 -0
- data/app/models/validation_condition.rb +4 -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 +41 -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/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/lib/assets/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/lib/assets/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/lib/assets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/assets/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/lib/assets/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/lib/assets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/lib/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/lib/assets/images/ui-icons_222222_256x240.png +0 -0
- data/lib/assets/images/ui-icons_2e83ff_256x240.png +0 -0
- data/lib/assets/images/ui-icons_454545_256x240.png +0 -0
- data/lib/assets/images/ui-icons_888888_256x240.png +0 -0
- data/lib/assets/images/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 +156 -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/assets/stylesheets/surveyor.sass +132 -0
- data/lib/generators/surveyor/custom_generator.rb +18 -0
- data/lib/generators/surveyor/install_generator.rb +102 -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_attachment_to_response.rb +5 -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 +284 -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/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 +13 -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 +86 -0
- data/lib/surveyor/models/dependency_condition_methods.rb +72 -0
- data/lib/surveyor/models/dependency_methods.rb +60 -0
- data/lib/surveyor/models/question_group_methods.rb +61 -0
- data/lib/surveyor/models/question_methods.rb +115 -0
- data/lib/surveyor/models/response_methods.rb +132 -0
- data/lib/surveyor/models/response_set_methods.rb +196 -0
- data/lib/surveyor/models/survey_methods.rb +103 -0
- data/lib/surveyor/models/survey_section_methods.rb +56 -0
- data/lib/surveyor/models/survey_translation_methods.rb +33 -0
- data/lib/surveyor/models/validation_condition_methods.rb +56 -0
- data/lib/surveyor/models/validation_methods.rb +48 -0
- data/lib/surveyor/mustache_context.rb +11 -0
- data/lib/surveyor/parser.rb +428 -0
- data/lib/surveyor/redcap_parser.rb +289 -0
- data/lib/surveyor/surveyor_controller_methods.rb +237 -0
- data/lib/surveyor/unparser.rb +147 -0
- data/lib/surveyor/version.rb +3 -0
- data/lib/surveyor.rb +13 -0
- data/lib/tasks/surveyor_tasks.rake +88 -0
- data/rails/init.rb +1 -0
- data/spec/controllers/surveyor_controller_spec.rb +307 -0
- data/spec/factories.rb +161 -0
- data/spec/helpers/formtastic_custom_input_spec.rb +15 -0
- data/spec/helpers/surveyor_helper_spec.rb +118 -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 +175 -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 +207 -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 +45 -0
- metadata +657 -0
@@ -0,0 +1,895 @@
|
|
1
|
+
Feature: Survey creation
|
2
|
+
As a survey participant
|
3
|
+
I want to take a survey
|
4
|
+
So that I can get paid
|
5
|
+
|
6
|
+
Scenario: Creating basic questions
|
7
|
+
Given I parse
|
8
|
+
"""
|
9
|
+
survey "Favorites" do
|
10
|
+
section "Colors" do
|
11
|
+
label "You with the sad eyes don't be discouraged"
|
12
|
+
|
13
|
+
question_1 "What is your favorite color?", :pick => :one
|
14
|
+
answer "red"
|
15
|
+
answer "blue"
|
16
|
+
answer "green"
|
17
|
+
answer :other
|
18
|
+
|
19
|
+
q_2b "Choose the colors you don't like", :pick => :any
|
20
|
+
a_1 "orange"
|
21
|
+
a_2 "purple"
|
22
|
+
a_3 "brown"
|
23
|
+
a :omit
|
24
|
+
end
|
25
|
+
end
|
26
|
+
"""
|
27
|
+
When I start the "Favorites" survey
|
28
|
+
Then I should see "You with the sad eyes don't be discouraged"
|
29
|
+
And I choose "red"
|
30
|
+
And I choose "blue"
|
31
|
+
And I check "orange"
|
32
|
+
And I check "brown"
|
33
|
+
And I press "Click here to finish"
|
34
|
+
Then there should be 1 response set with 3 responses with:
|
35
|
+
| answer |
|
36
|
+
| blue |
|
37
|
+
| orange |
|
38
|
+
| brown |
|
39
|
+
|
40
|
+
Scenario: Creating default answers
|
41
|
+
Given I parse
|
42
|
+
"""
|
43
|
+
survey "Favorites" do
|
44
|
+
section "Foods" do
|
45
|
+
question_1 "What is your favorite food?"
|
46
|
+
answer "food", :string, :default_value => "beef"
|
47
|
+
end
|
48
|
+
section "Section 2" do
|
49
|
+
end
|
50
|
+
section "Section 3" do
|
51
|
+
end
|
52
|
+
end
|
53
|
+
"""
|
54
|
+
When I start the "Favorites" survey
|
55
|
+
And I press "Section 3"
|
56
|
+
And I press "Click here to finish"
|
57
|
+
Then there should be 1 response set with 1 responses with:
|
58
|
+
| string_value |
|
59
|
+
| beef |
|
60
|
+
Then the survey should be complete
|
61
|
+
|
62
|
+
When I start the "Favorites" survey
|
63
|
+
And I fill in "food" with "chicken"
|
64
|
+
And I press "Foods"
|
65
|
+
And I press "Section 3"
|
66
|
+
And I press "Click here to finish"
|
67
|
+
Then there should be 2 response set with 2 responses with:
|
68
|
+
| string_value |
|
69
|
+
| chicken |
|
70
|
+
|
71
|
+
@quiz
|
72
|
+
Scenario: Creating, it's quiz time
|
73
|
+
Given I parse
|
74
|
+
"""
|
75
|
+
survey "Favorites" do
|
76
|
+
section "Foods" do
|
77
|
+
question_1 "What is the best meat?", :pick => :one, :correct => "oink"
|
78
|
+
a_oink "bacon"
|
79
|
+
a_tweet "chicken"
|
80
|
+
a_moo "beef"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
"""
|
84
|
+
Then question "1" should have correct answer "oink"
|
85
|
+
|
86
|
+
Scenario: Creating custom css class
|
87
|
+
Given I parse
|
88
|
+
"""
|
89
|
+
survey "Movies" do
|
90
|
+
section "First" do
|
91
|
+
q "What is your favorite movie?"
|
92
|
+
a :string, :custom_class => "my_custom_class"
|
93
|
+
q "What is your favorite state?"
|
94
|
+
a :string
|
95
|
+
q "Anything else to say?", :pick => :any
|
96
|
+
a "yes", :string, :custom_class => "other_custom_class"
|
97
|
+
q "Random question", :pick => :one
|
98
|
+
a "yes", :string, :custom_class => "other_other_custom_class"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
"""
|
102
|
+
When I start the "Movies" survey
|
103
|
+
Then the element "input[type='text'].my_custom_class" should exist
|
104
|
+
And the element "input[type='checkbox'].other_custom_class" should exist
|
105
|
+
And the element "input[type='radio'].other_other_custom_class" should exist
|
106
|
+
And the element "input[type='text'].other_other_custom_class" should exist
|
107
|
+
|
108
|
+
Scenario: Creating a pick one question with an option for other
|
109
|
+
Given I parse
|
110
|
+
"""
|
111
|
+
survey "Favorites" do
|
112
|
+
section "Foods" do
|
113
|
+
q "What is the best meat?", :pick => :one
|
114
|
+
a "bacon"
|
115
|
+
a "chicken"
|
116
|
+
a "beef"
|
117
|
+
a "other", :string
|
118
|
+
end
|
119
|
+
end
|
120
|
+
"""
|
121
|
+
When I start the "Favorites" survey
|
122
|
+
Then I choose "bacon"
|
123
|
+
And I press "Click here to finish"
|
124
|
+
Then there should be 1 response set with 1 response with:
|
125
|
+
| bacon |
|
126
|
+
|
127
|
+
Scenario: Creating a repeater with a dropdown
|
128
|
+
Given I parse
|
129
|
+
"""
|
130
|
+
survey "Movies" do
|
131
|
+
section "Preferences" do
|
132
|
+
repeater "What are you favorite genres?" do
|
133
|
+
q "Make", :pick => :one, :display_type => :dropdown
|
134
|
+
a "Action"
|
135
|
+
a "Comedy"
|
136
|
+
a "Mystery"
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
"""
|
141
|
+
When I start the "Movies" survey
|
142
|
+
Then a dropdown should exist with the options "Action, Comedy, Mystery"
|
143
|
+
|
144
|
+
# Issue 251 - text field with checkbox
|
145
|
+
Scenario: Creating a group with a dropdown
|
146
|
+
Given I parse
|
147
|
+
"""
|
148
|
+
survey "All Holidays" do
|
149
|
+
section "Favorites" do
|
150
|
+
group "Holidays" do
|
151
|
+
q "What is your favorite holiday?", :pick => :one, :display_type => :dropdown
|
152
|
+
a "Christmas"
|
153
|
+
a "New Year"
|
154
|
+
a "March 8th"
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
"""
|
159
|
+
When I start the "All Holidays" survey
|
160
|
+
Then a dropdown should exist with the options "Christmas, New Year, March 8th"
|
161
|
+
|
162
|
+
Scenario: Creating another pick one question with an option for other
|
163
|
+
Given I parse
|
164
|
+
"""
|
165
|
+
survey "Favorites" do
|
166
|
+
section "Foods" do
|
167
|
+
q "What is the best meat?", :pick => :one
|
168
|
+
a "bacon"
|
169
|
+
a "chicken"
|
170
|
+
a "beef"
|
171
|
+
a "other", :string
|
172
|
+
end
|
173
|
+
end
|
174
|
+
"""
|
175
|
+
When I start the "Favorites" survey
|
176
|
+
Then I choose "other"
|
177
|
+
And I fill in "r_1_string_value" with "shrimp"
|
178
|
+
And I press "Click here to finish"
|
179
|
+
Then there should be 1 response set with 1 response with:
|
180
|
+
| shrimp |
|
181
|
+
|
182
|
+
Scenario: Creating checkboxes with text area
|
183
|
+
Given I parse
|
184
|
+
"""
|
185
|
+
survey "Websites" do
|
186
|
+
section "Search engines" do
|
187
|
+
q "Have you ever used the following services?", :pick => :any
|
188
|
+
a "Yellowpages.com|Describe your experience", :text
|
189
|
+
a "Google.com|Describe your experience", :text
|
190
|
+
a "Bing.com|Describe your experience", :text
|
191
|
+
end
|
192
|
+
end
|
193
|
+
"""
|
194
|
+
When I start the "Websites" survey
|
195
|
+
Then there should be 3 checkboxes
|
196
|
+
And there should be 3 text areas
|
197
|
+
|
198
|
+
Scenario: Creating double letter rule keys
|
199
|
+
Given I parse
|
200
|
+
"""
|
201
|
+
survey "Doubles" do
|
202
|
+
section "Two" do
|
203
|
+
q_twin "Are you a twin?", :pick => :one
|
204
|
+
a_yes "Oh yes"
|
205
|
+
a_no "Oh no"
|
206
|
+
|
207
|
+
q_two_first_names "Do you have two first names?", :pick => :one
|
208
|
+
a_yes "Why yes"
|
209
|
+
a_no "Why no"
|
210
|
+
|
211
|
+
q "Do you want to be part of an SNL skit?", :pick => :one
|
212
|
+
a_yes "Um yes"
|
213
|
+
a_no "Um no"
|
214
|
+
dependency :rule => "A or AA"
|
215
|
+
condition_A :q_twin, "==", :a_yes
|
216
|
+
condition_AA :q_two_first_names, "==", :a_yes
|
217
|
+
end
|
218
|
+
section "Deux" do
|
219
|
+
label "Here for the ride"
|
220
|
+
end
|
221
|
+
section "Three" do
|
222
|
+
label "Here for the ride"
|
223
|
+
end
|
224
|
+
end
|
225
|
+
"""
|
226
|
+
When I start the "Doubles" survey
|
227
|
+
Then I choose "Oh yes"
|
228
|
+
And I press "Deux"
|
229
|
+
And I press "Two"
|
230
|
+
Then the question "Do you want to be part of an SNL skit?" should be triggered
|
231
|
+
|
232
|
+
Scenario: Creating and changing dropdowns
|
233
|
+
Given I parse
|
234
|
+
"""
|
235
|
+
survey "Drop" do
|
236
|
+
section "Like it is hot" do
|
237
|
+
q "Name", :pick => :one, :display_type => :dropdown
|
238
|
+
a "Snoop"
|
239
|
+
a "Dogg"
|
240
|
+
a "D-O double G"
|
241
|
+
a "S-N double O-P, D-O double G"
|
242
|
+
end
|
243
|
+
section "Two" do
|
244
|
+
label "Here for the ride"
|
245
|
+
end
|
246
|
+
section "Three" do
|
247
|
+
label "Here for the ride"
|
248
|
+
end
|
249
|
+
end
|
250
|
+
"""
|
251
|
+
When I start the "Drop" survey
|
252
|
+
Then I select "Snoop" from "Name"
|
253
|
+
And I press "Two"
|
254
|
+
And I press "Like it is hot"
|
255
|
+
And I select "Dogg" from "Name"
|
256
|
+
And I press "Two"
|
257
|
+
Then there should be 1 response with answer "Dogg"
|
258
|
+
|
259
|
+
# Issue 234 - text field with checkbox
|
260
|
+
@javascript
|
261
|
+
Scenario: Creating a question with an option checkbox for other and text input
|
262
|
+
Given I parse
|
263
|
+
"""
|
264
|
+
survey "Favorite Cuisine" do
|
265
|
+
section "Foods" do
|
266
|
+
q "What is the best cuisine?", :pick => :any
|
267
|
+
a "french"
|
268
|
+
a "italian"
|
269
|
+
a "chinese"
|
270
|
+
a "other", :string
|
271
|
+
end
|
272
|
+
end
|
273
|
+
"""
|
274
|
+
When I start the "Favorite Cuisine" survey
|
275
|
+
And I change "r_4_string_value" to "thai"
|
276
|
+
Then the "other" checkbox should be checked
|
277
|
+
|
278
|
+
# Issue 234 - empty text field with checkbox
|
279
|
+
@javascript
|
280
|
+
Scenario: Creating a question with an option checkbox for other and an empty text input
|
281
|
+
Given I parse
|
282
|
+
"""
|
283
|
+
survey "Favorite Cuisine again" do
|
284
|
+
section "Foods" do
|
285
|
+
q "What is the best cuisine?", :pick => :any
|
286
|
+
a "french"
|
287
|
+
a "italian"
|
288
|
+
a "chinese"
|
289
|
+
a "other", :string
|
290
|
+
end
|
291
|
+
end
|
292
|
+
"""
|
293
|
+
When I start the "Favorite Cuisine again" survey
|
294
|
+
And I change "r_4_string_value" to ""
|
295
|
+
Then the "other" checkbox should not be checked
|
296
|
+
|
297
|
+
# Issue 234 - text field with radio buttons
|
298
|
+
@javascript
|
299
|
+
Scenario: Creating a question with an option radio button for other and text input
|
300
|
+
Given I parse
|
301
|
+
"""
|
302
|
+
survey "Favorite Cuisine again again" do
|
303
|
+
section "Foods" do
|
304
|
+
q "What is the best cuisine?", :pick => :one
|
305
|
+
a "french"
|
306
|
+
a "italian"
|
307
|
+
a "chinese"
|
308
|
+
a "other", :string
|
309
|
+
end
|
310
|
+
end
|
311
|
+
"""
|
312
|
+
When I start the "Favorite Cuisine again again" survey
|
313
|
+
And I change "r_1_string_value" to "thai"
|
314
|
+
Then the "other" radiobutton should be checked
|
315
|
+
|
316
|
+
# Issue 234 - empty text field with radio buttons
|
317
|
+
@javascript
|
318
|
+
Scenario: Creating another question with an option radio button for other and text input
|
319
|
+
Given I parse
|
320
|
+
"""
|
321
|
+
survey "Favorite Cuisine" do
|
322
|
+
section "Foods" do
|
323
|
+
q "What is the best cuisine?", :pick => :one
|
324
|
+
a "french"
|
325
|
+
a "italian"
|
326
|
+
a "chinese"
|
327
|
+
a "other", :string
|
328
|
+
end
|
329
|
+
end
|
330
|
+
"""
|
331
|
+
When I start the "Favorite Cuisine" survey
|
332
|
+
And I change "r_1_string_value" to ""
|
333
|
+
Then the "other" radiobutton should not be checked
|
334
|
+
|
335
|
+
|
336
|
+
# Issue 259 - substitution of the text with Mustache
|
337
|
+
@javascript @mustache
|
338
|
+
Scenario: Creating a question with an mustache syntax
|
339
|
+
Given I have survey context of "FakeMustacheContext"
|
340
|
+
Given I parse
|
341
|
+
"""
|
342
|
+
survey "Overall info" do
|
343
|
+
section "Group of questions" do
|
344
|
+
group "Information on {{name}}?", :help_text => "Answer all you know on {{name}}" do
|
345
|
+
label "{{name}} does not work for {{site}}!", :help_text => "Make sure you sure {{name}} doesn't work for {{site}}"
|
346
|
+
|
347
|
+
q "Where does {{name}} live?", :pick => :one,
|
348
|
+
:help_text => "If you don't know where {{name}} lives, skip the question"
|
349
|
+
a "{{name}} lives on North Pole"
|
350
|
+
a "{{name}} lives on South Pole"
|
351
|
+
a "{{name}} doesn't exist"
|
352
|
+
end
|
353
|
+
end
|
354
|
+
end
|
355
|
+
"""
|
356
|
+
When I start the "Overall info" survey
|
357
|
+
Then I should see "Information on Santa Claus"
|
358
|
+
And I should see "Answer all you know on Santa Claus"
|
359
|
+
And I should see "Santa Claus does not work for Northwestern!"
|
360
|
+
And I should see "Make sure you sure Santa Claus doesn't work for Northwestern"
|
361
|
+
And I should see "Where does Santa Claus live?"
|
362
|
+
And I should see "If you don't know where Santa Claus lives, skip the question"
|
363
|
+
And I should see "Santa Claus lives on North Pole"
|
364
|
+
And I should see "Santa Claus lives on South Pole"
|
365
|
+
And I should see "Santa Claus doesn't exist"
|
366
|
+
|
367
|
+
# Issue 296 - Mustache rendering doesn't work with simple hash contexts
|
368
|
+
@javascript @mustache
|
369
|
+
Scenario: Creating a question with an mustache syntax
|
370
|
+
Given I have a simple hash context
|
371
|
+
Given I parse
|
372
|
+
"""
|
373
|
+
survey "Overall info" do
|
374
|
+
section "Group of questions" do
|
375
|
+
group "Information on {{name}}?", :help_text => "Answer all you know on {{name}}" do
|
376
|
+
label "{{name}} does not work for {{site}}!", :help_text => "Make sure you sure {{name}} doesn't work for {{site}}"
|
377
|
+
|
378
|
+
q "Where does {{name}} live?", :pick => :one,
|
379
|
+
:help_text => "If you don't know where {{name}} lives, skip the question"
|
380
|
+
a "{{name}} lives on North Pole"
|
381
|
+
a "{{name}} lives on South Pole"
|
382
|
+
a "{{name}} doesn't exist"
|
383
|
+
end
|
384
|
+
end
|
385
|
+
end
|
386
|
+
"""
|
387
|
+
When I start the "Overall info" survey
|
388
|
+
Then I should see "Information on Moses"
|
389
|
+
And I should see "Answer all you know on Moses"
|
390
|
+
And I should see "Moses does not work for Northwestern!"
|
391
|
+
And I should see "Make sure you sure Moses doesn't work for Northwestern"
|
392
|
+
And I should see "Where does Moses live?"
|
393
|
+
And I should see "If you don't know where Moses lives, skip the question"
|
394
|
+
And I should see "Moses lives on North Pole"
|
395
|
+
And I should see "Moses lives on South Pole"
|
396
|
+
And I should see "Moses doesn't exist"
|
397
|
+
|
398
|
+
Scenario: Creating and saving grids
|
399
|
+
Given I parse
|
400
|
+
"""
|
401
|
+
survey "Grid" do
|
402
|
+
section "One" do
|
403
|
+
grid "Tell us how often do you cover these each day" do
|
404
|
+
a "1"
|
405
|
+
a "2"
|
406
|
+
a "3"
|
407
|
+
q "Head", :pick => :one
|
408
|
+
q "Knees", :pick => :one
|
409
|
+
q "Toes", :pick => :one
|
410
|
+
end
|
411
|
+
end
|
412
|
+
section "Two" do
|
413
|
+
label "Here for the ride"
|
414
|
+
end
|
415
|
+
section "Three" do
|
416
|
+
label "Here for the ride"
|
417
|
+
end
|
418
|
+
end
|
419
|
+
"""
|
420
|
+
When I start the "Grid" survey
|
421
|
+
And I choose "1"
|
422
|
+
And I press "Two"
|
423
|
+
And I press "One"
|
424
|
+
Then there should be 1 response with answer "1"
|
425
|
+
|
426
|
+
Scenario: Creating dates
|
427
|
+
Given I parse
|
428
|
+
"""
|
429
|
+
survey "When" do
|
430
|
+
section "One" do
|
431
|
+
q "Tell us when you want to meet"
|
432
|
+
a "Give me a date", :date
|
433
|
+
end
|
434
|
+
section "Two" do
|
435
|
+
q "Tell us when you would like to eat"
|
436
|
+
a "When eat", :time
|
437
|
+
end
|
438
|
+
section "Three" do
|
439
|
+
q "Tell us when you would like a phone call"
|
440
|
+
a "When phone", :datetime
|
441
|
+
end
|
442
|
+
end
|
443
|
+
"""
|
444
|
+
When I start the "When" survey
|
445
|
+
# 2/14/11
|
446
|
+
And I fill in "Give me a date" with "2011-02-14"
|
447
|
+
# 1:30am
|
448
|
+
And I press "Two"
|
449
|
+
And I fill in "When eat" with "01:30"
|
450
|
+
# 2/15/11 5:30pm
|
451
|
+
And I press "Three"
|
452
|
+
And I fill in "When phone" with "2011-02-15 17:30:00"
|
453
|
+
|
454
|
+
# Verification
|
455
|
+
When I press "One"
|
456
|
+
Then the "Give me a date" field should contain "2011-02-14"
|
457
|
+
When I press "Two"
|
458
|
+
Then the "When eat" field should contain "01:30"
|
459
|
+
When I press "Three"
|
460
|
+
Then the "When phone" field should contain "2011-02-15 17:30:00"
|
461
|
+
|
462
|
+
# 2/13/11
|
463
|
+
When I press "One"
|
464
|
+
And I fill in "Give me a date" with "2011-02-13"
|
465
|
+
# 1:30pm
|
466
|
+
And I press "Two"
|
467
|
+
And I fill in "When eat" with "13:30"
|
468
|
+
# 2/15/11 5:00pm
|
469
|
+
And I press "Three"
|
470
|
+
And I fill in "When phone" with "2011-02-15 17:00:00"
|
471
|
+
|
472
|
+
# Verification
|
473
|
+
When I press "One"
|
474
|
+
Then the "Give me a date" field should contain "2011-02-13"
|
475
|
+
When I press "Two"
|
476
|
+
Then the "When eat" field should contain "13:30"
|
477
|
+
When I press "Three"
|
478
|
+
Then the "When phone" field should contain "2011-02-15 17:00:00"
|
479
|
+
|
480
|
+
@javascript
|
481
|
+
Scenario: Creating a date using the JS datepicker
|
482
|
+
Given I parse
|
483
|
+
"""
|
484
|
+
survey "When" do
|
485
|
+
section "One" do
|
486
|
+
q "Tell us when you want to meet"
|
487
|
+
a "Give me a date", :date
|
488
|
+
end
|
489
|
+
end
|
490
|
+
"""
|
491
|
+
When I start the "When" survey
|
492
|
+
And I click "Give me a date"
|
493
|
+
And I select "May" as the datepicker's month
|
494
|
+
And I select "2013" as the datepicker's year
|
495
|
+
And I follow "18"
|
496
|
+
And I press "Click here to finish"
|
497
|
+
Then there should be a date response with value "2013-05-18"
|
498
|
+
|
499
|
+
Scenario: Creating images
|
500
|
+
Given I parse
|
501
|
+
"""
|
502
|
+
survey "Images" do
|
503
|
+
section "One" do
|
504
|
+
q "Which way?"
|
505
|
+
a "/images/surveyor/next.gif", :display_type => "image"
|
506
|
+
a "/images/surveyor/prev.gif", :display_type => "image"
|
507
|
+
end
|
508
|
+
end
|
509
|
+
"""
|
510
|
+
And I set the asset directory
|
511
|
+
When I start the "Images" survey
|
512
|
+
Then I should see the image "/images/surveyor/next.gif"
|
513
|
+
And I should see the image "/images/surveyor/prev.gif"
|
514
|
+
|
515
|
+
@javascript
|
516
|
+
Scenario: Creating and unchecking checkboxes
|
517
|
+
Given I parse
|
518
|
+
"""
|
519
|
+
survey "Travels" do
|
520
|
+
section "Countries" do
|
521
|
+
q "Which of these countries have you visited?", :pick => :any
|
522
|
+
a "Ireland"
|
523
|
+
a "Kenya"
|
524
|
+
a "Singapore"
|
525
|
+
end
|
526
|
+
section "Activities" do
|
527
|
+
q "What do you like to do on vacation?", :pick => :any
|
528
|
+
a "Eat good food"
|
529
|
+
a "Lie on the beach"
|
530
|
+
a "Wander around cool neighborhoods"
|
531
|
+
end
|
532
|
+
end
|
533
|
+
"""
|
534
|
+
When I go to the surveys page
|
535
|
+
And I start the "Travels" survey
|
536
|
+
Then there should be 3 checkboxes
|
537
|
+
When I check "Singapore"
|
538
|
+
And I press "Activities"
|
539
|
+
And I press "Countries"
|
540
|
+
Then the "Singapore" checkbox should be checked
|
541
|
+
When I uncheck "Singapore"
|
542
|
+
And I press "Activities"
|
543
|
+
And I press "Countries"
|
544
|
+
Then the "Singapore" checkbox should not be checked
|
545
|
+
When I check "Singapore"
|
546
|
+
Then 1 responses should exist
|
547
|
+
When I uncheck "Singapore"
|
548
|
+
Then 0 responses should exist
|
549
|
+
|
550
|
+
Scenario: Accessing outdated survey
|
551
|
+
Given I parse
|
552
|
+
"""
|
553
|
+
survey "Travels" do
|
554
|
+
section "Everything" do
|
555
|
+
q "Which of these countries have you visited?", :pick => :any
|
556
|
+
a "Italy"
|
557
|
+
a "Morocco"
|
558
|
+
a "Mexico"
|
559
|
+
end
|
560
|
+
end
|
561
|
+
"""
|
562
|
+
And I parse
|
563
|
+
"""
|
564
|
+
survey "Travels" do
|
565
|
+
section "Countries" do
|
566
|
+
q "Which of these countries have you visited?", :pick => :any
|
567
|
+
a "Ireland"
|
568
|
+
a "Kenya"
|
569
|
+
a "Singapore"
|
570
|
+
end
|
571
|
+
end
|
572
|
+
"""
|
573
|
+
When I go to the surveys page
|
574
|
+
And I press "Take it"
|
575
|
+
Then I should see "Ireland"
|
576
|
+
And I should not see "Italy"
|
577
|
+
|
578
|
+
When I go to the surveys page
|
579
|
+
And I select "0" from "survey_version"
|
580
|
+
And I press "Take it"
|
581
|
+
Then I should see "Mexico"
|
582
|
+
And I should not see "Keniya"
|
583
|
+
|
584
|
+
# Issue 236 - ":text"- field doesn't show up in the multi-select questions
|
585
|
+
Scenario: Pick one and pick any with text areas
|
586
|
+
Given I parse
|
587
|
+
"""
|
588
|
+
survey "Pick plus text" do
|
589
|
+
section "Examples" do
|
590
|
+
q "What is your best beauty secret?", :pick => :one
|
591
|
+
a "My secret is", :text
|
592
|
+
a "None of your business"
|
593
|
+
a "I don't know"
|
594
|
+
|
595
|
+
q "Who knows about this secret?", :pick => :any
|
596
|
+
a "Only you and me, because", :text
|
597
|
+
a "These other people:", :text
|
598
|
+
end
|
599
|
+
end
|
600
|
+
"""
|
601
|
+
When I go to the surveys page
|
602
|
+
And I press "Take it"
|
603
|
+
Then I should see 3 textareas on the page
|
604
|
+
|
605
|
+
# Issue 207 - Create separate fields for date and time
|
606
|
+
Scenario: Pick one and pick any with dates
|
607
|
+
Given I parse
|
608
|
+
"""
|
609
|
+
survey "Complex date survey" do
|
610
|
+
section "Date questions with pick one and pick any" do
|
611
|
+
q "What is your birth date?", :pick => :one
|
612
|
+
a "I was born on", :date
|
613
|
+
a "Refused"
|
614
|
+
|
615
|
+
q "At what time were you born?", :pick => :any
|
616
|
+
a "I was born at", :time
|
617
|
+
a "This time is approximate"
|
618
|
+
|
619
|
+
q "When would you like to schedule your next appointment?"
|
620
|
+
a :datetime
|
621
|
+
end
|
622
|
+
end
|
623
|
+
"""
|
624
|
+
When I go to the surveys page
|
625
|
+
And I press "Take it"
|
626
|
+
Then I should see 1 "date" input on the page
|
627
|
+
And I should see 1 "time" input on the page
|
628
|
+
And I should see 1 "datetime" input on the page
|
629
|
+
|
630
|
+
# Issue #251 - Dropdowns inside of group display as radio buttons
|
631
|
+
Scenario: Dropdown within a group
|
632
|
+
Given I parse
|
633
|
+
"""
|
634
|
+
survey "Dropdowns" do
|
635
|
+
section "Location" do
|
636
|
+
q "What is the address of your new home?", :pick => :one
|
637
|
+
a_1 "Address known"
|
638
|
+
a_2 "Out of the country"
|
639
|
+
a_3 "PO Box address only"
|
640
|
+
a_neg_1 "Refused"
|
641
|
+
a_neg_2 "Don't know"
|
642
|
+
|
643
|
+
group "Address information" do
|
644
|
+
q_NEW_STATE "State", :display_type => :dropdown, :pick=>:one
|
645
|
+
a_1 "AL"
|
646
|
+
a_2 "AK"
|
647
|
+
a_3 "AZ"
|
648
|
+
a_4 "AR"
|
649
|
+
a_5 "CA"
|
650
|
+
a_6 "CO"
|
651
|
+
end
|
652
|
+
end
|
653
|
+
end
|
654
|
+
"""
|
655
|
+
When I go to the surveys page
|
656
|
+
And I press "Take it"
|
657
|
+
Then I should see 1 select on the page
|
658
|
+
|
659
|
+
# Issue #336 :is_exclusive doesn't disable other answers that are tagged as :is_exclusive
|
660
|
+
@javascript
|
661
|
+
Scenario: multiple exclusive checkboxes
|
662
|
+
Given I parse
|
663
|
+
"""
|
664
|
+
survey "Heat" do
|
665
|
+
section "Types" do
|
666
|
+
q_heat2 "Are there any other types of heat you use regularly during the heating season
|
667
|
+
to heat your home? ", :pick => :any
|
668
|
+
a_1 "Electric"
|
669
|
+
a_2 "Gas - propane or LP"
|
670
|
+
a_3 "Oil"
|
671
|
+
a_4 "Wood"
|
672
|
+
a_5 "Kerosene or diesel"
|
673
|
+
a_6 "Coal or coke"
|
674
|
+
a_7 "Solar energy"
|
675
|
+
a_8 "Heat pump"
|
676
|
+
a_9 "No other heating source", :is_exclusive => true
|
677
|
+
a_neg_5 "Other"
|
678
|
+
a_neg_1 "Refused", :is_exclusive => true
|
679
|
+
a_neg_2 "Don't know", :is_exclusive => true
|
680
|
+
end
|
681
|
+
end
|
682
|
+
"""
|
683
|
+
When I start the "Heat" survey
|
684
|
+
And I click "No other heating source"
|
685
|
+
Then the checkbox for "Refused" should be disabled
|
686
|
+
And the checkbox for "Don't know" should be disabled
|
687
|
+
When I uncheck "No other heating source"
|
688
|
+
Then the checkbox for "Refused" should be enabled
|
689
|
+
When I check "Electric"
|
690
|
+
Then the checkbox for "Refused" should be enabled
|
691
|
+
When I check "Refused"
|
692
|
+
Then the checkbox for "Electric" should be disabled
|
693
|
+
And the checkbox for "Don't know" should be disabled
|
694
|
+
|
695
|
+
# #197 - Add a hidden field type, don't show hidden questions and groups in the DOM
|
696
|
+
# don't use up question numbers on them either. custom class "hidden" doesn't
|
697
|
+
# do anything until you add your own css to hide it
|
698
|
+
Scenario: hidden questions for injecting data
|
699
|
+
Given I parse
|
700
|
+
"""
|
701
|
+
survey "Sesame Street" do
|
702
|
+
section "The Count" do
|
703
|
+
q_name "What is your name?", :display_type => :hidden
|
704
|
+
a :string, :help_text => "(e.g. Count Von Count)"
|
705
|
+
|
706
|
+
group "Friends", :display_type => :hidden do
|
707
|
+
q "Who are your friends?"
|
708
|
+
a :string
|
709
|
+
end
|
710
|
+
|
711
|
+
label "AH AH AH AH AH!"
|
712
|
+
|
713
|
+
q_numbers "What is your favorite number?", :pick => :one, :custom_class => "hidden"
|
714
|
+
a "One"
|
715
|
+
a "Two"
|
716
|
+
a "Three!"
|
717
|
+
end
|
718
|
+
end
|
719
|
+
"""
|
720
|
+
When I start the "Sesame Street" survey
|
721
|
+
Then I should see "AH AH AH AH AH!"
|
722
|
+
And I should see "1) What is your favorite number?"
|
723
|
+
And I should not see "What is your name?"
|
724
|
+
|
725
|
+
@numbers
|
726
|
+
Scenario: hidden numbers
|
727
|
+
Given I parse
|
728
|
+
"""
|
729
|
+
survey "Alpha" do
|
730
|
+
section "A-C" do
|
731
|
+
q "Aligator"
|
732
|
+
q "Barber"
|
733
|
+
q "Camel"
|
734
|
+
end
|
735
|
+
end
|
736
|
+
"""
|
737
|
+
And I replace question numbers with letters
|
738
|
+
When I start the "Alpha" survey
|
739
|
+
Then I should see "A. Aligator"
|
740
|
+
And I should see "B. Barber"
|
741
|
+
And I should see "C. Camel"
|
742
|
+
|
743
|
+
Scenario: help text
|
744
|
+
Given I parse
|
745
|
+
"""
|
746
|
+
survey "Help!" do
|
747
|
+
section "Songs" do
|
748
|
+
q "Do you need anybody?", :pick => :one, :help_text => "select one of the following"
|
749
|
+
a "I need somebody to love", :help_text => "like The Beatles"
|
750
|
+
a "I am a rock, I am an island", :help_text => "like Simon and Garfunkel"
|
751
|
+
|
752
|
+
grid "How would these artists respond to 'Do you need anybody?'", :help_text => "in your opinion" do
|
753
|
+
a "Yes", :help_text => "would say yes"
|
754
|
+
a "No", :help_text => "would say no"
|
755
|
+
q "Bobby Darrin", :pick => :one
|
756
|
+
q "Kurt Cobain", :pick => :one
|
757
|
+
q "Ella Fitzgerald", :pick => :one
|
758
|
+
q "Kanye West", :pick => :one
|
759
|
+
end
|
760
|
+
|
761
|
+
repeater "Over and over" do
|
762
|
+
q "Row row row your boat", :pick => :any, :help_text => "the 1st part of a round"
|
763
|
+
a "gently down the stream", :help_text => "the 2nd part of a round"
|
764
|
+
a "merrily merrily merrily merrily", :help_text => "the 3rd part of a round"
|
765
|
+
a "life is but a dream", :help_text => "the 4th part of a round"
|
766
|
+
end
|
767
|
+
end
|
768
|
+
end
|
769
|
+
"""
|
770
|
+
When I start the "Help!" survey
|
771
|
+
Then I should see "select one of the following"
|
772
|
+
And I should see "like The Beatles"
|
773
|
+
And I should see "like Simon and Garfunkel"
|
774
|
+
And I should see "in your opinion"
|
775
|
+
And I should see "would say yes"
|
776
|
+
And I should see "would say no"
|
777
|
+
And I should see "the 1st part of a round"
|
778
|
+
And I should see "the 2nd part of a round"
|
779
|
+
And I should see "the 3rd part of a round"
|
780
|
+
And I should see "the 4th part of a round"
|
781
|
+
|
782
|
+
Scenario: labels in groups
|
783
|
+
Given I parse
|
784
|
+
"""
|
785
|
+
survey "Labels" do
|
786
|
+
section "One" do
|
787
|
+
group "Grouped" do
|
788
|
+
label "Grouped greetings"
|
789
|
+
a "Your response", :string
|
790
|
+
end
|
791
|
+
group "Inline group", :display_type => :inline do
|
792
|
+
label "Inline greetings"
|
793
|
+
a "Your response", :string
|
794
|
+
end
|
795
|
+
repeater "Repeater" do
|
796
|
+
label "Repeater greetings"
|
797
|
+
a "Your response", :string
|
798
|
+
end
|
799
|
+
grid "Grid" do
|
800
|
+
a "Grid response", :string
|
801
|
+
label "Grid greetings"
|
802
|
+
end
|
803
|
+
end
|
804
|
+
end
|
805
|
+
"""
|
806
|
+
When I start the "Labels" survey
|
807
|
+
Then I should see "Grouped greetings"
|
808
|
+
And I should see "Inline greetings"
|
809
|
+
And I should see "Repeater greetings"
|
810
|
+
And I should see "Grid greetings"
|
811
|
+
And I should not see "Your response"
|
812
|
+
And I should see "Grid response"
|
813
|
+
And I should see no text inputs on the page
|
814
|
+
|
815
|
+
@javascript
|
816
|
+
Scenario: dates in pick one
|
817
|
+
Given I parse
|
818
|
+
"""
|
819
|
+
survey "Dates" do
|
820
|
+
section "One" do
|
821
|
+
q_test_1 "When will you stop by?", :pick=>:one
|
822
|
+
a_date "On", :date, :custom_class => "date"
|
823
|
+
a_neg_1 "REFUSED"
|
824
|
+
a_neg_2 "DON'T KNOW"
|
825
|
+
end
|
826
|
+
section "Two" do
|
827
|
+
label "second section"
|
828
|
+
end
|
829
|
+
end
|
830
|
+
"""
|
831
|
+
When I start the survey
|
832
|
+
And I click "On"
|
833
|
+
And I click the first date field
|
834
|
+
And I select "Mar" as the datepicker's month
|
835
|
+
And I select "2013" as the datepicker's year
|
836
|
+
And I follow "9"
|
837
|
+
Then there should be a date response with value "2013-03-09"
|
838
|
+
When I press "Two"
|
839
|
+
And I press "One"
|
840
|
+
Then the first date field should contain "2013-03-09"
|
841
|
+
And the first date field should not contain "2013-03-09 00:00:00.000000"
|
842
|
+
|
843
|
+
@javascript
|
844
|
+
Scenario: input mask and input mask placeholder
|
845
|
+
Given I parse
|
846
|
+
"""
|
847
|
+
survey "Personal" do
|
848
|
+
section "One" do
|
849
|
+
q "What is your phone number?"
|
850
|
+
a "phone", :string, :input_mask => '(999)999-9999', :input_mask_placeholder => '#'
|
851
|
+
end
|
852
|
+
end
|
853
|
+
"""
|
854
|
+
When I start the "Personal" survey
|
855
|
+
And I fill in "phone" with "1234567890"
|
856
|
+
And I press "Click here to finish"
|
857
|
+
Then there should be 1 response set with 1 responses with:
|
858
|
+
| string_value |
|
859
|
+
| (123)456-7890 |
|
860
|
+
|
861
|
+
@javascript
|
862
|
+
Scenario: numeric input mask with alphanumeric input
|
863
|
+
Given I parse
|
864
|
+
"""
|
865
|
+
survey "Personal" do
|
866
|
+
section "One" do
|
867
|
+
q "What is your phone number?"
|
868
|
+
a 'phone', :string, :input_mask => '(999)999-9999'
|
869
|
+
end
|
870
|
+
end
|
871
|
+
"""
|
872
|
+
When I start the "Personal" survey
|
873
|
+
And I fill in "phone" with "1a2b3c4d5e6f7g8h9i0"
|
874
|
+
And I press "Click here to finish"
|
875
|
+
Then there should be 1 response set with 1 responses with:
|
876
|
+
| string_value |
|
877
|
+
| (123)456-7890 |
|
878
|
+
|
879
|
+
@javascript
|
880
|
+
Scenario: alpha input mask with alphanumeric input
|
881
|
+
Given I parse
|
882
|
+
"""
|
883
|
+
survey "Personal" do
|
884
|
+
section "One" do
|
885
|
+
q "What are your favorite letters?"
|
886
|
+
a 'letters', :string, :input_mask => 'aaaaaaaaa'
|
887
|
+
end
|
888
|
+
end
|
889
|
+
"""
|
890
|
+
When I start the "Personal" survey
|
891
|
+
And I fill in "letters" with "1a2b3c4d5e6f7g8h9i0"
|
892
|
+
And I press "Click here to finish"
|
893
|
+
Then there should be 1 response set with 1 responses with:
|
894
|
+
| string_value |
|
895
|
+
| abcdefghi |
|