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.
Files changed (212) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +28 -0
  3. data/.rspec +1 -0
  4. data/CHANGELOG.md +198 -0
  5. data/Gemfile +5 -0
  6. data/Gemfile.rails_version +27 -0
  7. data/MIT-LICENSE +20 -0
  8. data/README.md +166 -0
  9. data/Rakefile +106 -0
  10. data/app/controllers/surveyor_controller.rb +5 -0
  11. data/app/helpers/results_helper.rb +20 -0
  12. data/app/helpers/survey_form_builder.rb +37 -0
  13. data/app/helpers/surveyor_helper.rb +3 -0
  14. data/app/inputs/quiet_input.rb +5 -0
  15. data/app/inputs/surveyor_check_boxes_input.rb +35 -0
  16. data/app/inputs/surveyor_radio_input.rb +18 -0
  17. data/app/models/answer.rb +3 -0
  18. data/app/models/dependency.rb +3 -0
  19. data/app/models/dependency_condition.rb +3 -0
  20. data/app/models/question.rb +3 -0
  21. data/app/models/question_group.rb +4 -0
  22. data/app/models/response.rb +4 -0
  23. data/app/models/response_set.rb +3 -0
  24. data/app/models/survey.rb +3 -0
  25. data/app/models/survey_section.rb +4 -0
  26. data/app/models/survey_section_sweeper.rb +15 -0
  27. data/app/models/survey_translation.rb +4 -0
  28. data/app/models/validation.rb +3 -0
  29. data/app/models/validation_condition.rb +3 -0
  30. data/app/views/layouts/results.html.erb +13 -0
  31. data/app/views/layouts/surveyor_default.html.erb +12 -0
  32. data/app/views/partials/_answer.html.haml +25 -0
  33. data/app/views/partials/_dependents.html.haml +5 -0
  34. data/app/views/partials/_question.html.haml +28 -0
  35. data/app/views/partials/_question_group.html.haml +44 -0
  36. data/app/views/partials/_section.html.haml +12 -0
  37. data/app/views/partials/_section_menu.html.haml +12 -0
  38. data/app/views/surveyor/edit.html.haml +24 -0
  39. data/app/views/surveyor/export.json.rabl +85 -0
  40. data/app/views/surveyor/new.html.haml +24 -0
  41. data/app/views/surveyor/show.html.haml +74 -0
  42. data/app/views/surveyor/show.json.rabl +15 -0
  43. data/ci-exec.sh +56 -0
  44. data/config/routes.rb +8 -0
  45. data/cucumber.yml +10 -0
  46. data/doc/REPRESENTATIONS.md +34 -0
  47. data/doc/api_id_schema.json +7 -0
  48. data/doc/question types.png +0 -0
  49. data/doc/response_set_schema.json +54 -0
  50. data/doc/surveyor question combinations.png +0 -0
  51. data/doc/surveyor reject or delete decision matrix.png +0 -0
  52. data/doc/surveyor_models.png +0 -0
  53. data/doc/surveyor_models2.png +0 -0
  54. data/doc/surveyor_timestamp_schema.json +9 -0
  55. data/features/ajax_submissions.feature +140 -0
  56. data/features/export_to_json.feature +344 -0
  57. data/features/internationalization.feature +121 -0
  58. data/features/no_duplicates.feature +110 -0
  59. data/features/show_survey.feature +71 -0
  60. data/features/step_definitions/parser_steps.rb +145 -0
  61. data/features/step_definitions/surveyor_steps.rb +325 -0
  62. data/features/step_definitions/ui_steps.rb +25 -0
  63. data/features/step_definitions/web_steps.rb +225 -0
  64. data/features/support/REDCapDemoDatabase_DataDictionary.csv +127 -0
  65. data/features/support/database_cleaner.rb +16 -0
  66. data/features/support/env.rb +56 -0
  67. data/features/support/hooks.rb +4 -0
  68. data/features/support/paths.rb +39 -0
  69. data/features/support/redcap_new_headers.csv +1 -0
  70. data/features/support/redcap_siblings.csv +1 -0
  71. data/features/support/redcap_whitespace.csv +1 -0
  72. data/features/support/selectors.rb +39 -0
  73. data/features/support/simultaneous_ajax.rb +101 -0
  74. data/features/support/single_quit_selenium_driver.rb +23 -0
  75. data/features/support/slow_updates.rb +18 -0
  76. data/features/surveyor.feature +895 -0
  77. data/features/surveyor_dependencies.feature +476 -0
  78. data/features/surveyor_parser.feature +504 -0
  79. data/features/z_redcap_parser.feature +62 -0
  80. data/lib/assets/images/surveyor/next.gif +0 -0
  81. data/lib/assets/images/surveyor/prev.gif +0 -0
  82. data/lib/assets/images/surveyor/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  83. data/lib/assets/images/surveyor/ui-bg_flat_75_ffffff_40x100.png +0 -0
  84. data/lib/assets/images/surveyor/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  85. data/lib/assets/images/surveyor/ui-bg_glass_65_ffffff_1x400.png +0 -0
  86. data/lib/assets/images/surveyor/ui-bg_glass_75_dadada_1x400.png +0 -0
  87. data/lib/assets/images/surveyor/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  88. data/lib/assets/images/surveyor/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  89. data/lib/assets/images/surveyor/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  90. data/lib/assets/images/surveyor/ui-icons_222222_256x240.png +0 -0
  91. data/lib/assets/images/surveyor/ui-icons_2e83ff_256x240.png +0 -0
  92. data/lib/assets/images/surveyor/ui-icons_454545_256x240.png +0 -0
  93. data/lib/assets/images/surveyor/ui-icons_888888_256x240.png +0 -0
  94. data/lib/assets/images/surveyor/ui-icons_cd0a0a_256x240.png +0 -0
  95. data/lib/assets/javascripts/surveyor/jquery-1.9.0.js +9555 -0
  96. data/lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js +14850 -0
  97. data/lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js +1919 -0
  98. data/lib/assets/javascripts/surveyor/jquery.maskedinput.js +338 -0
  99. data/lib/assets/javascripts/surveyor/jquery.selectToUISlider.js +240 -0
  100. data/lib/assets/javascripts/surveyor/jquery.surveyor.js +154 -0
  101. data/lib/assets/stylesheets/surveyor.sass +132 -0
  102. data/lib/assets/stylesheets/surveyor/jquery-ui-1.10.0.custom.css +1174 -0
  103. data/lib/assets/stylesheets/surveyor/jquery-ui-timepicker-addon.css +11 -0
  104. data/lib/assets/stylesheets/surveyor/reset.css +48 -0
  105. data/lib/assets/stylesheets/surveyor/results.css +125 -0
  106. data/lib/assets/stylesheets/surveyor/ui.slider.extras.css +110 -0
  107. data/lib/generators/surveyor/custom_generator.rb +18 -0
  108. data/lib/generators/surveyor/install_generator.rb +101 -0
  109. data/lib/generators/surveyor/templates/app/assets/javascripts/surveyor_all.js +6 -0
  110. data/lib/generators/surveyor/templates/app/assets/stylesheets/surveyor_all.css +9 -0
  111. data/lib/generators/surveyor/templates/app/controllers/surveyor_controller.rb +40 -0
  112. data/lib/generators/surveyor/templates/app/views/layouts/surveyor_custom.html.erb +13 -0
  113. data/lib/generators/surveyor/templates/config/locales/surveyor_en.yml +19 -0
  114. data/lib/generators/surveyor/templates/config/locales/surveyor_es.yml +19 -0
  115. data/lib/generators/surveyor/templates/config/locales/surveyor_he.yml +19 -0
  116. data/lib/generators/surveyor/templates/config/locales/surveyor_ko.yml +19 -0
  117. data/lib/generators/surveyor/templates/db/migrate/add_api_id_to_question_groups.rb +10 -0
  118. data/lib/generators/surveyor/templates/db/migrate/add_api_ids.rb +14 -0
  119. data/lib/generators/surveyor/templates/db/migrate/add_api_ids_to_response_sets_and_responses.rb +12 -0
  120. data/lib/generators/surveyor/templates/db/migrate/add_correct_answer_id_to_questions.rb +10 -0
  121. data/lib/generators/surveyor/templates/db/migrate/add_default_value_to_answers.rb +10 -0
  122. data/lib/generators/surveyor/templates/db/migrate/add_display_order_to_surveys.rb +10 -0
  123. data/lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb +14 -0
  124. data/lib/generators/surveyor/templates/db/migrate/add_index_to_response_sets.rb +10 -0
  125. data/lib/generators/surveyor/templates/db/migrate/add_index_to_surveys.rb +10 -0
  126. data/lib/generators/surveyor/templates/db/migrate/add_input_mask_attributes_to_answer.rb +12 -0
  127. data/lib/generators/surveyor/templates/db/migrate/add_section_id_to_responses.rb +12 -0
  128. data/lib/generators/surveyor/templates/db/migrate/add_unique_index_on_access_code_and_version_in_surveys.rb +10 -0
  129. data/lib/generators/surveyor/templates/db/migrate/add_unique_indicies.rb +18 -0
  130. data/lib/generators/surveyor/templates/db/migrate/add_version_to_surveys.rb +10 -0
  131. data/lib/generators/surveyor/templates/db/migrate/api_ids_must_be_unique.rb +23 -0
  132. data/lib/generators/surveyor/templates/db/migrate/create_answers.rb +38 -0
  133. data/lib/generators/surveyor/templates/db/migrate/create_dependencies.rb +23 -0
  134. data/lib/generators/surveyor/templates/db/migrate/create_dependency_conditions.rb +30 -0
  135. data/lib/generators/surveyor/templates/db/migrate/create_question_groups.rb +28 -0
  136. data/lib/generators/surveyor/templates/db/migrate/create_questions.rb +37 -0
  137. data/lib/generators/surveyor/templates/db/migrate/create_response_sets.rb +23 -0
  138. data/lib/generators/surveyor/templates/db/migrate/create_responses.rb +34 -0
  139. data/lib/generators/surveyor/templates/db/migrate/create_survey_sections.rb +30 -0
  140. data/lib/generators/surveyor/templates/db/migrate/create_survey_translations.rb +19 -0
  141. data/lib/generators/surveyor/templates/db/migrate/create_surveys.rb +32 -0
  142. data/lib/generators/surveyor/templates/db/migrate/create_validation_conditions.rb +33 -0
  143. data/lib/generators/surveyor/templates/db/migrate/create_validations.rb +21 -0
  144. data/lib/generators/surveyor/templates/db/migrate/drop_unique_index_on_access_code_in_surveys.rb +10 -0
  145. data/lib/generators/surveyor/templates/db/migrate/update_blank_api_ids_on_question_group.rb +22 -0
  146. data/lib/generators/surveyor/templates/db/migrate/update_blank_versions_on_surveys.rb +13 -0
  147. data/lib/generators/surveyor/templates/surveys/EXTENDING_SURVEYOR.md +52 -0
  148. data/lib/generators/surveyor/templates/surveys/MODIFYING_SURVEYOR.md +91 -0
  149. data/lib/generators/surveyor/templates/surveys/date_survey.rb +16 -0
  150. data/lib/generators/surveyor/templates/surveys/kitchen_sink_survey.rb +280 -0
  151. data/lib/generators/surveyor/templates/surveys/languages.rb +14 -0
  152. data/lib/generators/surveyor/templates/surveys/quiz.rb +11 -0
  153. data/lib/generators/surveyor/templates/surveys/translations/languages.es.yml +18 -0
  154. data/lib/generators/surveyor/templates/surveys/translations/languages.he.yml +18 -0
  155. data/lib/generators/surveyor/templates/surveys/translations/languages.ko.yml +18 -0
  156. data/lib/generators/surveyor/templates/vendor/assets/stylesheets/custom.sass +5 -0
  157. data/lib/surveyor.rb +13 -0
  158. data/lib/surveyor/acts_as_response.rb +17 -0
  159. data/lib/surveyor/common.rb +59 -0
  160. data/lib/surveyor/engine.rb +10 -0
  161. data/lib/surveyor/helpers/asset_pipeline.rb +18 -0
  162. data/lib/surveyor/helpers/formtastic_custom_input.rb +13 -0
  163. data/lib/surveyor/helpers/surveyor_helper_methods.rb +103 -0
  164. data/lib/surveyor/models/answer_methods.rb +83 -0
  165. data/lib/surveyor/models/dependency_condition_methods.rb +69 -0
  166. data/lib/surveyor/models/dependency_methods.rb +57 -0
  167. data/lib/surveyor/models/question_group_methods.rb +58 -0
  168. data/lib/surveyor/models/question_methods.rb +112 -0
  169. data/lib/surveyor/models/response_methods.rb +126 -0
  170. data/lib/surveyor/models/response_set_methods.rb +188 -0
  171. data/lib/surveyor/models/survey_methods.rb +100 -0
  172. data/lib/surveyor/models/survey_section_methods.rb +53 -0
  173. data/lib/surveyor/models/survey_translation_methods.rb +30 -0
  174. data/lib/surveyor/models/validation_condition_methods.rb +54 -0
  175. data/lib/surveyor/models/validation_methods.rb +45 -0
  176. data/lib/surveyor/mustache_context.rb +11 -0
  177. data/lib/surveyor/parser.rb +427 -0
  178. data/lib/surveyor/redcap_parser.rb +288 -0
  179. data/lib/surveyor/surveyor_controller_methods.rb +236 -0
  180. data/lib/surveyor/unparser.rb +147 -0
  181. data/lib/surveyor/version.rb +3 -0
  182. data/lib/tasks/surveyor_tasks.rake +88 -0
  183. data/rails/init.rb +1 -0
  184. data/spec/controllers/surveyor_controller_spec.rb +311 -0
  185. data/spec/factories.rb +166 -0
  186. data/spec/helpers/formtastic_custom_input_spec.rb +15 -0
  187. data/spec/helpers/surveyor_helper_spec.rb +117 -0
  188. data/spec/lib/benchmark_spec.rb +22 -0
  189. data/spec/lib/chinese_survey.rb +14 -0
  190. data/spec/lib/common_spec.rb +34 -0
  191. data/spec/lib/parser_spec.rb +204 -0
  192. data/spec/lib/rake_kitchen_sink.rb +40 -0
  193. data/spec/lib/redcap_parser_spec.rb +75 -0
  194. data/spec/lib/tasks_spec.rake +26 -0
  195. data/spec/lib/unparser_spec.rb +126 -0
  196. data/spec/models/answer_spec.rb +174 -0
  197. data/spec/models/dependency_condition_spec.rb +439 -0
  198. data/spec/models/dependency_spec.rb +101 -0
  199. data/spec/models/question_group_spec.rb +93 -0
  200. data/spec/models/question_spec.rb +206 -0
  201. data/spec/models/response_set_spec.rb +477 -0
  202. data/spec/models/response_spec.rb +218 -0
  203. data/spec/models/survey_section_spec.rb +85 -0
  204. data/spec/models/survey_spec.rb +191 -0
  205. data/spec/models/validation_condition_spec.rb +113 -0
  206. data/spec/models/validation_spec.rb +74 -0
  207. data/spec/rcov.opts +2 -0
  208. data/spec/spec.opts +4 -0
  209. data/spec/spec_helper.rb +56 -0
  210. data/stacktests.sh +65 -0
  211. data/surveyor.gemspec +53 -0
  212. metadata +601 -0
@@ -0,0 +1,127 @@
1
+ "Variable / Field Name","Form Name","Field Units","Section Header","Field Type","Field Label","Choices OR Calculations","Field Note","Text Validation Type","Text Validation Min","Text Validation Max",Identifier?,"Branching Logic (Show field only if...)","Required Field?"
2
+ study_id,demographics,,,text,"Study ID",,,,,,,,
3
+ date_enrolled,demographics,,"Demographic Characteristics",text,"Date subject signed consent",,YYYY-MM-DD,date,,,,,
4
+ first_name,demographics,,,text,"First Name",,,,,,y,,
5
+ last_name,demographics,,,text,"Last Name",,,,,,y,,
6
+ address,demographics,,"Contact Information",notes,"Street, City, State, ZIP",,,,,,y,,
7
+ telephone_1,demographics,,,text,"Phone number",,"Include Area Code",phone,,,y,,
8
+ telephone_2,demographics,,,text,"Second phone number",,"Include Area Code",phone,,,y,,
9
+ email,demographics,,,text,E-mail,,,email,,,y,,
10
+ sex,demographics,,,dropdown,Gender,"0, Female | 1, Male",,,,,,,y
11
+ given_birth,demographics,,,dropdown,"Has the subject given birth before?","0, No | 1, Yes",,,,,,"[sex] = ""0""",
12
+ num_children,demographics,,,text,"How many times has the subject given birth?",,,integer,0,,,"[sex] = ""0"" and [given_birth] = ""1""",
13
+ ethnicity,demographics,,,radio,Ethnicity,"0, Hispanic or Latino | 1, NOT Hispanic or Latino | 2, Unknown / Not Reported",,,,,,,
14
+ race,demographics,,,radio,Race,"0, American Indian/Alaska Native | 1, Asian | 2, Native Hawaiian or Other Pacific Islander | 3, Black or African American | 4, White | 5, More Than One Race | 6, Unknown / Not Reported",,,,,,,
15
+ dob,demographics,,,text,"Date of birth",,,date,,,y,,
16
+ age,demographics,,,calc,"Age (years)","round(datediff([dob],'today','y'),1)",,,,,,,
17
+ height,demographics,cm,,text,"Height (cm)",,,number,130,215,,,
18
+ weight,demographics,kilograms,,text,"Weight (kilograms)",,,integer,35,200,,,
19
+ bmi,demographics,kilograms,,calc,BMI,"round(([weight]*10000)/(([height])^(2)),1)",,,,,,,
20
+ patient_document,demographics,,,file,"Patient document",,,,,,,,
21
+ meds,demographics,,,checkbox,"Is patient taking any of the following medications? (check all that apply)","1, Lexapro | 2, Celexa | 3, Prozac | 4, Paxil | 5, Zoloft",,,,,,,
22
+ diabetes,demographics,,,dropdown,"Patient has a diagnosis of diabetes mellitus?","0, No | 1, Yes",,,,,,,
23
+ diabetes_type,demographics,,,dropdown,"Type of Diabetes Mellitus","0, Type 1 insulin-dependent | 1, Type 2 insulin-dependent | 2, Type 2 non insulin-dependent",,,,,,,
24
+ dialysis_initiation,demographics,,"Dialysis Information",text,"Date of first outpatient dialysis treatment",,,date,,,,,
25
+ access_type,demographics,,,dropdown,"Type of vascular access","0, Graft | 1, Fistula | 2, Catheter with maturing graft | 3, Catheter with maturing fistula",,,,,,,
26
+ access_location,demographics,,,dropdown,"Location of currently used vascular access","0, Forearm | 1, Upper arm | 2, Internal jugular vein | 3, Subclavian vein | 4, Other",,,,,,,
27
+ dialysis_unit_name,demographics,,,text,"Name of dialysis unit",,,,,,,,
28
+ dialysis_unit_phone,demographics,,,text,"Phone number",,"Include Area Code",phone,,,,,
29
+ dialysis_schedule_days,demographics,,,radio,"Days of the week patient is dialyzed","0, Monday-Wednesday-Friday | 1, Tuesday-Thursday-Saturday | 2, Other",,,,,,,
30
+ dialysis_schedule_time,demographics,,,dropdown,"Shift patient is dialyzed","0, First shift | 1, Second shift | 2, Third shift | 3, Fourth shift",,,,,,,
31
+ etiology_esrd,demographics,,,dropdown,"Etiology of ESRD","0, Diabetes | 1, Hypertension | 2, Glomerulonephritis | 3, Polycystic Kidney Disease | 4, Interstitial Nephritis | 5, Hereditary Nephritis | 6, Other",,,,,,,
32
+ subject_comments,demographics,,"General Comments",notes,Comments,,,,,,,,
33
+ date_visit_b,baseline_data,,"Baseline Measurements",text,"Date of baseline visit",,,date,,,,,
34
+ date_blood_b,baseline_data,,,text,"Date blood was drawn",,,date,,,,,
35
+ alb_b,baseline_data,g/dL,,text,"Serum Albumin (g/dL)",,,integer,3,5,,,
36
+ prealb_b,baseline_data,mg/dL,,text,"Serum Prealbumin (mg/dL)",,,number,10,40,,,
37
+ creat_b,baseline_data,mg/dL,,text,"Creatinine (mg/dL)",,,number,0.5,20,,,
38
+ npcr_b,baseline_data,g/kg/d,,text,"Normalized Protein Catabolic Rate (g/kg/d)",,,number,0.5,2,,,
39
+ chol_b,baseline_data,mg/dL,,text,"Cholesterol (mg/dL)",,,number,100,300,,,
40
+ transferrin_b,baseline_data,mg/dL,,text,"Transferrin (mg/dL)",,,number,100,300,,,
41
+ kt_v_b,baseline_data,,,text,Kt/V,,,number,0.9,3,,,
42
+ drywt_b,baseline_data,kilograms,,text,"Dry weight (kilograms)",,,number,35,200,,,
43
+ plasma1_b,baseline_data,,,dropdown,"Collected Plasma 1?","0, No | 1, Yes",,,,,,,
44
+ plasma2_b,baseline_data,,,dropdown,"Collected Plasma 2?","0, No | 1, Yes",,,,,,,
45
+ plasma3_b,baseline_data,,,dropdown,"Collected Plasma 3?","0, No | 1, Yes",,,,,,,
46
+ serum1_b,baseline_data,,,dropdown,"Collected Serum 1?","0, No | 1, Yes",,,,,,,
47
+ serum2_b,baseline_data,,,dropdown,"Collected Serum 2?","0, No | 1, Yes",,,,,,,
48
+ serum3_b,baseline_data,,,dropdown,"Collected Serum 3?","0, No | 1, Yes",,,,,,,
49
+ sga_b,baseline_data,,,text,"Subject Global Assessment (score = 1-7)",,,number,0.9,7.1,,,
50
+ date_supplement_dispensed,baseline_data,,,text,"Date patient begins supplement",,,date,,,,,
51
+ date_visit_1,month_1_data,,"Month 1",text,"Date of Month 1 visit",,,date,,,,,
52
+ alb_1,month_1_data,g/dL,,text,"Serum Albumin (g/dL)",,,number,3,5,,,
53
+ prealb_1,month_1_data,mg/dL,,text,"Serum Prealbumin (mg/dL)",,,number,10,40,,,
54
+ creat_1,month_1_data,mg/dL,,text,"Creatinine (mg/dL)",,,number,0.5,20,,,
55
+ npcr_1,month_1_data,g/kg/d,,text,"Normalized Protein Catabolic Rate (g/kg/d)",,,number,0.5,2,,,
56
+ chol_1,month_1_data,mg/dL,,text,"Cholesterol (mg/dL)",,,number,100,300,,,
57
+ transferrin_1,month_1_data,mg/dL,,text,"Transferrin (mg/dL)",,,number,100,300,,,
58
+ kt_v_1,month_1_data,,,text,Kt/V,,,number,0.9,3,,,
59
+ drywt_1,month_1_data,kilograms,,text,"Dry weight (kilograms)",,,number,35,200,,,
60
+ no_show_1,month_1_data,,,text,"Number of treatments missed",,,number,0,7,,,
61
+ compliance_1,month_1_data,,,dropdown,"How compliant was the patient in drinking the supplement?","0, 100 percent | 1, 99-75 percent | 2, 74-50 percent | 3, 49-25 percent | 4, 0-24 percent",,,,,,,
62
+ hospit_1,month_1_data,,"Hospitalization Data",dropdown,"Was patient hospitalized since last visit?","0, No | 1, Yes",,,,,,,
63
+ cause_hosp_1,month_1_data,,,dropdown,"What was the cause of hospitalization?","1, Vascular access related events | 2, CVD events | 3, Other",,,,,,,
64
+ admission_date_1,month_1_data,,,text,"Date of hospital admission",,,date,,,,,
65
+ discharge_date_1,month_1_data,,,text,"Date of hospital discharge",,,date,,,,,
66
+ discharge_summary_1,month_1_data,,,dropdown,"Discharge summary in patients binder?","0, No | 1, Yes",,,,,,,
67
+ death_1,month_1_data,,"Mortality Data",dropdown,"Has patient died since last visit?","0, No | 1, Yes",,,,,,,
68
+ date_death_1,month_1_data,,,text,"Date of death",,,date,,,,,
69
+ cause_death_1,month_1_data,,,dropdown,"What was the cause of death?","1, All-cause | 2, Cardiovascular",,,,,,,
70
+ date_visit_2,month_2_data,,"Month 2",text,"Date of Month 2 visit",,,date,,,,,
71
+ alb_2,month_2_data,g/dL,,text,"Serum Albumin (g/dL)",,,number,3,5,,,
72
+ prealb_2,month_2_data,mg/dL,,text,"Serum Prealbumin (mg/dL)",,,number,10,40,,,
73
+ creat_2,month_2_data,mg/dL,,text,"Creatinine (mg/dL)",,,number,0.5,20,,,
74
+ npcr_2,month_2_data,g/kg/d,,text,"Normalized Protein Catabolic Rate (g/kg/d)",,,number,0.5,2,,,
75
+ chol_2,month_2_data,mg/dL,,text,"Cholesterol (mg/dL)",,,number,100,300,,,
76
+ transferrin_2,month_2_data,mg/dL,,text,"Transferrin (mg/dL)",,,number,100,300,,,
77
+ kt_v_2,month_2_data,,,text,Kt/V,,,number,0.9,3,,,
78
+ drywt_2,month_2_data,kilograms,,text,"Dry weight (kilograms)",,,number,35,200,,,
79
+ no_show_2,month_2_data,,,text,"Number of treatments missed",,,number,0,7,,,
80
+ compliance_2,month_2_data,,,dropdown,"How compliant was the patient in drinking the supplement?","0, 100 percent | 1, 99-75 percent | 2, 74-50 percent | 3, 49-25 percent | 4, 0-24 percent",,,,,,,
81
+ hospit_2,month_2_data,,"Hospitalization Data",dropdown,"Was patient hospitalized since last visit?","0, No | 1, Yes",,,,,,,
82
+ cause_hosp_2,month_2_data,,,dropdown,"What was the cause of hospitalization?","1, Vascular access related events | 2, CVD events | 3, Other",,,,,,,
83
+ admission_date_2,month_2_data,,,text,"Date of hospital admission",,,date,,,,,
84
+ discharge_date_2,month_2_data,,,text,"Date of hospital discharge",,,date,,,,,
85
+ discharge_summary_2,month_2_data,,,dropdown,"Discharge summary in patients binder?","0, No | 1, Yes",,,,,,,
86
+ death_2,month_2_data,,"Mortality Data",dropdown,"Has patient died since last visit?","0, No | 1, Yes",,,,,,,
87
+ date_death_2,month_2_data,,,text,"Date of death",,,date,,,,,
88
+ cause_death_2,month_2_data,,,dropdown,"What was the cause of death?","1, All-cause | 2, Cardiovascular",,,,,,,
89
+ date_visit_3,month_3_data,,"Month 3",text,"Date of Month 3 visit",,,date,,,,,
90
+ date_blood_3,month_3_data,,,text,"Date blood was drawn",,,date,,,,,
91
+ alb_3,month_3_data,g/dL,,text,"Serum Albumin (g/dL)",,,number,3,5,,,
92
+ prealb_3,month_3_data,mg/dL,,text,"Serum Prealbumin (mg/dL)",,,number,10,40,,,
93
+ creat_3,month_3_data,mg/dL,,text,"Creatinine (mg/dL)",,,number,0.5,20,,,
94
+ npcr_3,month_3_data,g/kg/d,,text,"Normalized Protein Catabolic Rate (g/kg/d)",,,number,0.5,2,,,
95
+ chol_3,month_3_data,mg/dL,,text,"Cholesterol (mg/dL)",,,number,100,300,,,
96
+ transferrin_3,month_3_data,mg/dL,,text,"Transferrin (mg/dL)",,,number,100,300,,,
97
+ kt_v_3,month_3_data,,,text,Kt/V,,,number,0.9,3,,,
98
+ drywt_3,month_3_data,kilograms,,text,"Dry weight (kilograms)",,,number,35,200,,,
99
+ plasma1_3,month_3_data,,,dropdown,"Collected Plasma 1?","0, No | 1, Yes",,,,,,,
100
+ plasma2_3,month_3_data,,,dropdown,"Collected Plasma 2?","0, No | 1, Yes",,,,,,,
101
+ plasma3_3,month_3_data,,,dropdown,"Collected Plasma 3?","0, No | 1, Yes",,,,,,,
102
+ serum1_3,month_3_data,,,dropdown,"Collected Serum 1?","0, No | 1, Yes",,,,,,,
103
+ serum2_3,month_3_data,,,dropdown,"Collected Serum 2?","0, No | 1, Yes",,,,,,,
104
+ serum3_3,month_3_data,,,dropdown,"Collected Serum 3?","0, No | 1, Yes",,,,,,,
105
+ sga_3,month_3_data,,,text,"Subject Global Assessment (score = 1-7)",,,number,0.9,7.1,,,
106
+ no_show_3,month_3_data,,,text,"Number of treatments missed",,,number,0,7,,,
107
+ compliance_3,month_3_data,,,dropdown,"How compliant was the patient in drinking the supplement?","0, 100 percent | 1, 99-75 percent | 2, 74-50 percent | 3, 49-25 percent | 4, 0-24 percent",,,,,,,
108
+ hospit_3,month_3_data,,"Hospitalization Data",dropdown,"Was patient hospitalized since last visit?","0, No | 1, Yes",,,,,,,
109
+ cause_hosp_3,month_3_data,,,dropdown,"What was the cause of hospitalization?","1, Vascular access related events | 2, CVD events | 3, Other",,,,,,,
110
+ admission_date_3,month_3_data,,,text,"Date of hospital admission",,,date,,,,,
111
+ discharge_date_3,month_3_data,,,text,"Date of hospital discharge",,,date,,,,,
112
+ discharge_summary_3,month_3_data,,,dropdown,"Discharge summary in patients binder?","0, No | 1, Yes",,,,,,,
113
+ death_3,month_3_data,,"Mortality Data",dropdown,"Has patient died since last visit?","0, No | 1, Yes",,,,,,,
114
+ date_death_3,month_3_data,,,text,"Date of death",,,date,,,,,
115
+ cause_death_3,month_3_data,,,dropdown,"What was the cause of death?","1, All-cause | 2, Cardiovascular",,,,,,,
116
+ complete_study,completion_data,,"Study Completion Information",dropdown,"Has patient completed study?","0, No | 1, Yes",,,,,,,
117
+ withdraw_date,completion_data,,,text,"Put a date if patient withdrew study",,,date,,,,,
118
+ withdraw_reason,completion_data,,,dropdown,"Reason patient withdrew from study","0, Non-compliance | 1, Did not wish to continue in study | 2, Could not tolerate the supplement | 3, Hospitalization | 4, Other",,,,,,,
119
+ complete_study_date,completion_data,,,text,"Date of study completion",,,date,,,,,
120
+ study_comments,completion_data,,"General Comments",notes,Comments,,,,,,,,
121
+ fatexp20_0d31d8,promis_fatigue__short_form_7a,,"Please respond to each item by marking one answer per question.<br><br>In the past 7 days...",radio,"How often did you feel tired?...","1, 1 Never | 2, 2 Rarely | 3, 3 Sometimes | 4, 4 Often | 5, 5 Always",,,,,,,
122
+ fatexp5_d80a4c,promis_fatigue__short_form_7a,,,radio,"How often did you experience extreme exhaustion?...","1, 1 Never | 2, 2 Rarely | 3, 3 Sometimes | 4, 4 Often | 5, 5 Always",,,,,,,
123
+ fatexp18_396fe5,promis_fatigue__short_form_7a,,,radio,"How often did you run out of energy?...","1, 1 Never | 2, 2 Rarely | 3, 3 Sometimes | 4, 4 Often | 5, 5 Always",,,,,,,
124
+ fatimp33_a9e236,promis_fatigue__short_form_7a,,,radio,"How often did your fatigue limit you at work (include work at home)?...","1, 1 Never | 2, 2 Rarely | 3, 3 Sometimes | 4, 4 Often | 5, 5 Always",,,,,,,
125
+ fatimp30_5f4d82,promis_fatigue__short_form_7a,,,radio,"How often were you too tired to think clearly?...","1, 1 Never | 2, 2 Rarely | 3, 3 Sometimes | 4, 4 Often | 5, 5 Always",,,,,,,
126
+ fatimp21_de19f3,promis_fatigue__short_form_7a,,,radio,"How often were you too tired to take a bath or shower?...","1, 1 Never | 2, 2 Rarely | 3, 3 Sometimes | 4, 4 Often | 5, 5 Always",,,,,,,
127
+ fatimp40_f7e5db,promis_fatigue__short_form_7a,,,radio,"How often did you have enough energy to exercise strenuously?...","5, 5 Never | 4, 4 Rarely | 3, 3 Sometimes | 2, 2 Often | 1, 1 Always",,,,,,,
@@ -0,0 +1,16 @@
1
+ require 'database_cleaner'
2
+
3
+ # Use transaction cleaning for performance by default
4
+ DatabaseCleaner.strategy = :transaction
5
+ # Clean to start so that manual testing data in testbed can't cause false
6
+ # test results.
7
+ DatabaseCleaner.clean_with(:truncation)
8
+
9
+ # use truncation to allow direct DB checks in Selenium tests
10
+ Before('@javascript') do
11
+ DatabaseCleaner.strategy = :truncation
12
+ end
13
+
14
+ After('@javascript') do
15
+ DatabaseCleaner.strategy = :transaction
16
+ end
@@ -0,0 +1,56 @@
1
+ # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
+ # It is recommended to regenerate this file in the future when you upgrade to a
3
+ # newer version of cucumber-rails. Consider adding your own code to a new file
4
+ # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
+ # files.
6
+ ENV["RAILS_ROOT"] ||= File.expand_path(File.dirname(__FILE__) + '/../../testbed')
7
+ require 'cucumber/rails'
8
+
9
+ # For Rails 3.0
10
+ include Surveyor::Helpers::AssetPipeline
11
+
12
+ # require File.expand_path(File.dirname(__FILE__) + '/../../testbed/config/environment.rb')
13
+ # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
14
+ # order to ease the transition to Capybara we set the default here. If you'd
15
+ # prefer to use XPath just remove this line and adjust any selectors in your
16
+ # steps to use the XPath syntax.
17
+ Capybara.default_selector = :css
18
+
19
+ # By default, any exception happening in your Rails application will bubble up
20
+ # to Cucumber so that your scenario will fail. This is a different from how
21
+ # your application behaves in the production environment, where an error page will
22
+ # be rendered instead.
23
+ #
24
+ # Sometimes we want to override this default behaviour and allow Rails to rescue
25
+ # exceptions and display an error page (just like when the app is running in production).
26
+ # Typical scenarios where you want to do this is when you test your error pages.
27
+ # There are two ways to allow Rails to rescue exceptions:
28
+ #
29
+ # 1) Tag your scenario (or feature) with @allow-rescue
30
+ #
31
+ # 2) Set the value below to true. Beware that doing this globally is not
32
+ # recommended as it will mask a lot of errors for you!
33
+ #
34
+ ActionController::Base.allow_rescue = false
35
+
36
+ # Use chrome for Selenium by default. This is because of Firefox's bug 566671
37
+ # (https://bugzilla.mozilla.org/show_bug.cgi?id=566671): any test that relies on
38
+ # blur or change events will not work when Firefox is in the background.
39
+ ENV['SELENIUM_BROWSER'] ||= 'chrome'
40
+
41
+ # Wait for AJAX requests to complete in selenium
42
+ # n.b.: Capybara 2.0 will change the way this works.
43
+ # http://groups.google.com/group/ruby-capybara/browse_thread/thread/6d955173ce413b0a/d0682d47a915dfbd
44
+ Capybara.register_driver :selenium do |app|
45
+ SingleQuitSeleniumDriver.new(app, :browser => ENV['SELENIUM_BROWSER'].to_sym,
46
+ :resynchronize => true)
47
+ end
48
+
49
+ Before do |scenario|
50
+ Rails.logger.info "\n\nBeginning scenario #{scenario.file_colon_line} \"#{scenario.title}\""
51
+ end
52
+
53
+ require "json_spec/cucumber"
54
+ JsonSpec.configure do
55
+ exclude_keys "id", "created_at", "updated_at", "uuid", "modified_at", "completed_at"
56
+ end
@@ -0,0 +1,4 @@
1
+ AfterStep('@pause') do
2
+ print "Press Return to continue..."
3
+ STDIN.getc
4
+ end
@@ -0,0 +1,39 @@
1
+ module NavigationHelpers
2
+ # Maps a name to a path. Used by the
3
+ #
4
+ # When /^I go to (.+)$/ do |page_name|
5
+ #
6
+ # step definition in web_steps.rb
7
+ #
8
+ def path_to(page_name)
9
+ case page_name
10
+
11
+ when /^the home\s?page$/
12
+ '/'
13
+ when /^the surveys page$/
14
+ '/surveys'
15
+ when /the surveys page in "(.*)"$/
16
+ "/surveys?locale=#{$1}"
17
+ when /the last response set show page/
18
+ "/surveys/#{ResponseSet.last.survey.access_code}/#{ResponseSet.last.access_code}"
19
+
20
+ # Add more mappings here.
21
+ # Here is an example that pulls values out of the Regexp:
22
+ #
23
+ # when /^(.*)'s profile page$/i
24
+ # user_profile_path(User.find_by_login($1))
25
+
26
+ else
27
+ begin
28
+ page_name =~ /^the (.*) page$/
29
+ path_components = $1.split(/\s+/)
30
+ self.send(path_components.push('path').join('_').to_sym)
31
+ rescue NoMethodError, ArgumentError
32
+ raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
33
+ "Now, go and add a mapping in #{__FILE__}"
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ World(NavigationHelpers)
@@ -0,0 +1 @@
1
+ Variable / Field Name,Form Name,Field Units,Section Header,Field Type,Field Label,Choices Calculations OR Slider Labels,Field Note,Text Validation Type OR Show Slider Number,Text Validation Min,Text Validation Max,Identifier?,Branching Logic (Show field only if...),Required Field?
@@ -0,0 +1 @@
1
+ Variable / Field Name,Form Name,Field Units,Section Header,Field Type,Field Label,Choices OR Calculations,Field Note,Text Validation Type,Text Validation Min,Text Validation Max,Identifier?,Branching Logic (Show field only if...),Required Field?
@@ -0,0 +1 @@
1
+ Variable / Field Name,Form Name,Field Units,Section Header,Field Type,Field Label,Choices OR Calculations,Field Note,Text Validation Type,Text Validation Min,Text Validation Max,Identifier?,Branching Logic (Show field only if...),Required Field?
@@ -0,0 +1,39 @@
1
+ module HtmlSelectorsHelpers
2
+ # Maps a name to a selector. Used primarily by the
3
+ #
4
+ # When /^(.+) within (.+)$/ do |step, scope|
5
+ #
6
+ # step definitions in web_steps.rb
7
+ #
8
+ def selector_for(locator)
9
+ case locator
10
+
11
+ when "the page"
12
+ "html > body"
13
+
14
+ # Add more mappings here.
15
+ # Here is an example that pulls values out of the Regexp:
16
+ #
17
+ # when /^the (notice|error|info) flash$/
18
+ # ".flash.#{$1}"
19
+
20
+ # You can also return an array to use a different selector
21
+ # type, like:
22
+ #
23
+ # when /the header/
24
+ # [:xpath, "//header"]
25
+
26
+ # This allows you to provide a quoted selector as the scope
27
+ # for "within" steps as was previously the default for the
28
+ # web steps:
29
+ when /^"(.+)"$/
30
+ $1
31
+
32
+ else
33
+ raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
34
+ "Now, go and add a mapping in #{__FILE__}"
35
+ end
36
+ end
37
+ end
38
+
39
+ World(HtmlSelectorsHelpers)
@@ -0,0 +1,101 @@
1
+ require 'selenium/webdriver'
2
+
3
+ Before('~@simultaneous_ajax') do
4
+ evict_capybara_session :selenium_nowait
5
+ end
6
+
7
+ Before('@simultaneous_ajax') do
8
+ evict_capybara_session :selenium
9
+
10
+ @simultaneous_ajax = true
11
+ Capybara.javascript_driver = Capybara.current_driver = :selenium_nowait
12
+ end
13
+
14
+ After('@simultaneous_ajax') do
15
+ Capybara.javascript_driver = nil
16
+ @simultaneous_ajax = false
17
+ end
18
+
19
+ # Evict the "other" selenium driver's session when switching drivers because it
20
+ # seems that WebDriver can't handle having two different browsers open
21
+ # simultaneously. Specifically, if you:
22
+ #
23
+ # * Run a test with driver A, then
24
+ # * Run set of tests with driver B, then
25
+ # * Attempt to run a test with driver A
26
+ #
27
+ # ... the final driver A test will hang attempting to contact some piece of the
28
+ # webdriver infrastructure. It will hang until it times out, or until you
29
+ # kill the browser associated with driver B. This code does the killing for
30
+ # you.
31
+ def evict_capybara_session(driver_name)
32
+ Capybara.instance_eval do
33
+ key = session_pool.keys.grep(/^#{driver_name}\:/).first
34
+ if key
35
+ session = session_pool.delete(key)
36
+ puts "key=#{key} evicting session #{session.object_id} driver #{session.driver.object_id}"
37
+ session.driver.quit
38
+ end
39
+ end
40
+ end
41
+
42
+ class AjaxRefCountListener < Selenium::WebDriver::Support::AbstractEventListener
43
+ def refcount_key
44
+ 'surveyorIntegratedTestsRequestsOutstanding'
45
+ end
46
+
47
+ def call(*args)
48
+ event = args.unshift
49
+ driver = args.pop
50
+ unless event.to_s =~ /script/ # prevent infinite recursion
51
+ enable_ajax_call_refcount_if_necessary(driver)
52
+ end
53
+ end
54
+
55
+ def enable_ajax_call_refcount_if_necessary(driver)
56
+ unless driver.execute_script "return window.hasOwnProperty('#{refcount_key}')"
57
+ enable_ajax_call_refcount(driver)
58
+ end
59
+ end
60
+
61
+ # Taken wholesale from the resynchronize code in Capybara's Selenium driver.
62
+ # Replicated here because the Capybara implementation doesn't let you make
63
+ # multiple interactions issuing separate AJAX calls and then wait for all of
64
+ # them — it can only wait for those AJAX requests issued in the context of a
65
+ # single interaction (a click, etc.).
66
+ def enable_ajax_call_refcount(driver)
67
+ driver.execute_script <<-JS
68
+ window.#{refcount_key} = 0;
69
+ (function() { // Overriding XMLHttpRequest
70
+ var oldXHR = window.XMLHttpRequest;
71
+
72
+ function newXHR() {
73
+ var realXHR = new oldXHR();
74
+
75
+ window.#{refcount_key}++;
76
+ realXHR.addEventListener("readystatechange", function() {
77
+ if( realXHR.readyState == 4 ) {
78
+ setTimeout( function() {
79
+ window.#{refcount_key}--;
80
+ if(window.#{refcount_key} < 0) {
81
+ window.#{refcount_key} = 0;
82
+ }
83
+ }, 500 );
84
+ }
85
+ }, false);
86
+
87
+ return realXHR;
88
+ }
89
+
90
+ window.XMLHttpRequest = newXHR;
91
+ })();
92
+ JS
93
+ end
94
+ end
95
+
96
+ # Provides an alternative selenium driver with resync off and refcounting on.
97
+ # This allows for simulation of competing AJAX requests.
98
+ Capybara.register_driver :selenium_nowait do |app|
99
+ SingleQuitSeleniumDriver.new(app, :browser => ENV['SELENIUM_BROWSER'].to_sym,
100
+ :resynchronize => false, :listener => AjaxRefCountListener.new)
101
+ end
@@ -0,0 +1,23 @@
1
+ require 'capybara/selenium/driver'
2
+
3
+ ##
4
+ # Subclass of `Capybara::Selenium::Driver` that ensures that quit is only called
5
+ # once.
6
+ #
7
+ # This is necessary because there is code in the Firefox selenium bridge which
8
+ # reacts poorly if its quit method is called more than once. The
9
+ # @simultaneous_ajax support for the duplicate check features requires a
10
+ # separate selenium driver instance, which in turn requires directly calling
11
+ # quit on the running driver when switching between them.
12
+ #
13
+ # Capybara::Selenium::Driver registers an `at_exit` hook which isn't removed
14
+ # when you call quit. This results in quit being called twice for some driver
15
+ # instances, provoking the issue with Firefox.
16
+ class SingleQuitSeleniumDriver < Capybara::Selenium::Driver
17
+ def quit
18
+ unless @already_quit
19
+ super
20
+ @already_quit = true
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,18 @@
1
+ # It appears that rails caches the filter chain after the first request. We
2
+ # can't wait and only apply this if any @slow_updates scenarios are executed.
3
+ class SurveyorController
4
+ before_filter(:only => :update) do
5
+ if $delay_updates
6
+ Rails.logger.info "Slowing things down."
7
+ sleep 2
8
+ end
9
+ end
10
+ end
11
+
12
+ Before('@slow_updates') do
13
+ $delay_updates = true
14
+ end
15
+
16
+ After('@slow_updates') do
17
+ $delay_updates = false
18
+ end
@@ -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 |