workarea-storefront 3.4.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (686) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +52 -0
  3. data/README.md +19 -0
  4. data/Rakefile +23 -0
  5. data/app/assets/fonts/.keep +0 -0
  6. data/app/assets/images/workarea/core/test.jpg +0 -0
  7. data/app/assets/images/workarea/storefront/default_card.svg +1 -0
  8. data/app/assets/images/workarea/storefront/dialog_close.svg +1 -0
  9. data/app/assets/images/workarea/storefront/email/banner.png +0 -0
  10. data/app/assets/images/workarea/storefront/icons/facebook.svg +1 -0
  11. data/app/assets/images/workarea/storefront/icons/google_plus.svg +1 -0
  12. data/app/assets/images/workarea/storefront/icons/menu.svg +1 -0
  13. data/app/assets/images/workarea/storefront/icons/pinterest.svg +1 -0
  14. data/app/assets/images/workarea/storefront/icons/twitter.svg +1 -0
  15. data/app/assets/images/workarea/storefront/logo.png +0 -0
  16. data/app/assets/images/workarea/storefront/message_dismiss.svg +1 -0
  17. data/app/assets/images/workarea/storefront/message_error.svg +1 -0
  18. data/app/assets/images/workarea/storefront/message_info.svg +1 -0
  19. data/app/assets/images/workarea/storefront/message_success.svg +1 -0
  20. data/app/assets/images/workarea/storefront/message_warning.svg +1 -0
  21. data/app/assets/images/workarea/storefront/payment_icons/american_express.svg +1 -0
  22. data/app/assets/images/workarea/storefront/payment_icons/diner_s_club.svg +1 -0
  23. data/app/assets/images/workarea/storefront/payment_icons/discover.svg +1 -0
  24. data/app/assets/images/workarea/storefront/payment_icons/mastercard.svg +1 -0
  25. data/app/assets/images/workarea/storefront/payment_icons/visa.svg +1 -0
  26. data/app/assets/images/workarea/storefront/payment_method_icons.png +0 -0
  27. data/app/assets/images/workarea/storefront/style_guide_light_banner.png +0 -0
  28. data/app/assets/images/workarea/storefront/style_guide_product.jpg +0 -0
  29. data/app/assets/javascripts/jquery_ui/storefront/categorized_autocomplete.js +53 -0
  30. data/app/assets/javascripts/workarea/storefront/application.js.erb +162 -0
  31. data/app/assets/javascripts/workarea/storefront/config.js.erb +153 -0
  32. data/app/assets/javascripts/workarea/storefront/head.js.erb +18 -0
  33. data/app/assets/javascripts/workarea/storefront/modules/address_region_fields.js +91 -0
  34. data/app/assets/javascripts/workarea/storefront/modules/admin_toolbar.js +105 -0
  35. data/app/assets/javascripts/workarea/storefront/modules/alternate_image_buttons.js +78 -0
  36. data/app/assets/javascripts/workarea/storefront/modules/analytics.js +285 -0
  37. data/app/assets/javascripts/workarea/storefront/modules/authenticity_token.js +27 -0
  38. data/app/assets/javascripts/workarea/storefront/modules/back_to_top_button.js +47 -0
  39. data/app/assets/javascripts/workarea/storefront/modules/break_points.js +67 -0
  40. data/app/assets/javascripts/workarea/storefront/modules/cart_count.js +51 -0
  41. data/app/assets/javascripts/workarea/storefront/modules/checkout_addresses_forms.js +222 -0
  42. data/app/assets/javascripts/workarea/storefront/modules/checkout_primary_payments.js +66 -0
  43. data/app/assets/javascripts/workarea/storefront/modules/checkout_shipping_services.js +53 -0
  44. data/app/assets/javascripts/workarea/storefront/modules/current_user.js +28 -0
  45. data/app/assets/javascripts/workarea/storefront/modules/dialog.js +284 -0
  46. data/app/assets/javascripts/workarea/storefront/modules/dialog_buttons.js +78 -0
  47. data/app/assets/javascripts/workarea/storefront/modules/dialog_close_buttons.js +29 -0
  48. data/app/assets/javascripts/workarea/storefront/modules/dialog_forms.js +47 -0
  49. data/app/assets/javascripts/workarea/storefront/modules/forms.js +94 -0
  50. data/app/assets/javascripts/workarea/storefront/modules/loading.js +81 -0
  51. data/app/assets/javascripts/workarea/storefront/modules/log_out_link_placeholders.js +36 -0
  52. data/app/assets/javascripts/workarea/storefront/modules/messages.js +179 -0
  53. data/app/assets/javascripts/workarea/storefront/modules/mobile_filter_buttons.js +87 -0
  54. data/app/assets/javascripts/workarea/storefront/modules/mobile_nav_button.js +100 -0
  55. data/app/assets/javascripts/workarea/storefront/modules/option_buttons.js +40 -0
  56. data/app/assets/javascripts/workarea/storefront/modules/optional_fields.js +49 -0
  57. data/app/assets/javascripts/workarea/storefront/modules/pagination.js +284 -0
  58. data/app/assets/javascripts/workarea/storefront/modules/popup_buttons.js +42 -0
  59. data/app/assets/javascripts/workarea/storefront/modules/primary_nav_content.js +77 -0
  60. data/app/assets/javascripts/workarea/storefront/modules/product_details_sku_selects.js +94 -0
  61. data/app/assets/javascripts/workarea/storefront/modules/recent_views.js +25 -0
  62. data/app/assets/javascripts/workarea/storefront/modules/recommendations_placeholders.js +33 -0
  63. data/app/assets/javascripts/workarea/storefront/modules/scroll_to_buttons.js +37 -0
  64. data/app/assets/javascripts/workarea/storefront/modules/search_fields.js +59 -0
  65. data/app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js +35 -0
  66. data/app/assets/javascripts/workarea/storefront/modules/traffic_referrer.js +33 -0
  67. data/app/assets/javascripts/workarea/storefront/modules/workarea_analytics.js +54 -0
  68. data/app/assets/javascripts/workarea/storefront/routes.js.erb +16 -0
  69. data/app/assets/javascripts/workarea/storefront/serviceworkers/pwa_cache.js.erb +31 -0
  70. data/app/assets/javascripts/workarea/storefront/serviceworkers/register_pwa_cache.js +5 -0
  71. data/app/assets/javascripts/workarea/storefront/templates/authenticity_token.jst.ejs +1 -0
  72. data/app/assets/javascripts/workarea/storefront/templates/back_to_top_button.jst.ejs +3 -0
  73. data/app/assets/javascripts/workarea/storefront/templates/button.jst.ejs +3 -0
  74. data/app/assets/javascripts/workarea/storefront/templates/loading.jst.ejs +1 -0
  75. data/app/assets/javascripts/workarea/storefront/templates/log_out_link.jst.ejs +1 -0
  76. data/app/assets/javascripts/workarea/storefront/templates/message.jst.ejs +10 -0
  77. data/app/assets/javascripts/workarea/storefront/templates/message_dismiss_action.jst.ejs +5 -0
  78. data/app/assets/javascripts/workarea/storefront/templates/mobile_filters_nav_close_button.jst.ejs +3 -0
  79. data/app/assets/javascripts/workarea/storefront/templates/optional_field_prompt.jst.ejs +1 -0
  80. data/app/assets/javascripts/workarea/storefront/templates/page_header_cart_count.jst.ejs +1 -0
  81. data/app/assets/javascripts/workarea/storefront/templates/pagination_button.jst.ejs +11 -0
  82. data/app/assets/javascripts/workarea/storefront/templates/same_as_shipping_button_property.jst.ejs +8 -0
  83. data/app/assets/javascripts/workarea/storefront/templates/saved_addresses_property.jst.ejs +21 -0
  84. data/app/assets/javascripts/workarea/storefront/templates/ui_menu_heading.jst.ejs +1 -0
  85. data/app/assets/javascripts/workarea/storefront/templates/ui_menu_item.jst.ejs +8 -0
  86. data/app/assets/stylesheets/jquery_ui/storefront/_ui_autocomplete.scss +17 -0
  87. data/app/assets/stylesheets/jquery_ui/storefront/_ui_dialog.scss +158 -0
  88. data/app/assets/stylesheets/jquery_ui/storefront/_ui_helper_hidden_accessible.scss +7 -0
  89. data/app/assets/stylesheets/jquery_ui/storefront/_ui_menu.scss +40 -0
  90. data/app/assets/stylesheets/jquery_ui/storefront/_ui_state_focus.scss +10 -0
  91. data/app/assets/stylesheets/jquery_ui/storefront/_ui_widget_overlay.scss +11 -0
  92. data/app/assets/stylesheets/workarea/storefront/application.scss.erb +138 -0
  93. data/app/assets/stylesheets/workarea/storefront/base/_forms.scss +113 -0
  94. data/app/assets/stylesheets/workarea/storefront/base/_images.scss +29 -0
  95. data/app/assets/stylesheets/workarea/storefront/base/_lists.scss +8 -0
  96. data/app/assets/stylesheets/workarea/storefront/base/_page.scss +27 -0
  97. data/app/assets/stylesheets/workarea/storefront/base/_tables.scss +15 -0
  98. data/app/assets/stylesheets/workarea/storefront/components/_admin_toolbar.scss +34 -0
  99. data/app/assets/stylesheets/workarea/storefront/components/_back_to_top_button.scss +23 -0
  100. data/app/assets/stylesheets/workarea/storefront/components/_box.scss +37 -0
  101. data/app/assets/stylesheets/workarea/storefront/components/_breadcrumbs.scss +27 -0
  102. data/app/assets/stylesheets/workarea/storefront/components/_button.scss +47 -0
  103. data/app/assets/stylesheets/workarea/storefront/components/_button_content_block.scss +9 -0
  104. data/app/assets/stylesheets/workarea/storefront/components/_button_property.scss +40 -0
  105. data/app/assets/stylesheets/workarea/storefront/components/_cart.scss +21 -0
  106. data/app/assets/stylesheets/workarea/storefront/components/_category_summary_content_block.scss +14 -0
  107. data/app/assets/stylesheets/workarea/storefront/components/_checkout_addresses.scss +17 -0
  108. data/app/assets/stylesheets/workarea/storefront/components/_checkout_payment.scss +48 -0
  109. data/app/assets/stylesheets/workarea/storefront/components/_checkout_progress.scss +42 -0
  110. data/app/assets/stylesheets/workarea/storefront/components/_checkout_shipping.scss +11 -0
  111. data/app/assets/stylesheets/workarea/storefront/components/_checkout_step_summary.scss +19 -0
  112. data/app/assets/stylesheets/workarea/storefront/components/_content_block.scss +39 -0
  113. data/app/assets/stylesheets/workarea/storefront/components/_data_card.scss +68 -0
  114. data/app/assets/stylesheets/workarea/storefront/components/_divider_content_block.scss +38 -0
  115. data/app/assets/stylesheets/workarea/storefront/components/_email_signup.scss +9 -0
  116. data/app/assets/stylesheets/workarea/storefront/components/_hero_content_block.scss +77 -0
  117. data/app/assets/stylesheets/workarea/storefront/components/_html_content_block.scss +5 -0
  118. data/app/assets/stylesheets/workarea/storefront/components/_image_and_text_content_block.scss +30 -0
  119. data/app/assets/stylesheets/workarea/storefront/components/_image_content_block.scss +16 -0
  120. data/app/assets/stylesheets/workarea/storefront/components/_image_group_content_block.scss +9 -0
  121. data/app/assets/stylesheets/workarea/storefront/components/_inline_form.scss +11 -0
  122. data/app/assets/stylesheets/workarea/storefront/components/_loading.scss +92 -0
  123. data/app/assets/stylesheets/workarea/storefront/components/_message.scss +120 -0
  124. data/app/assets/stylesheets/workarea/storefront/components/_mobile_filters.scss +25 -0
  125. data/app/assets/stylesheets/workarea/storefront/components/_mobile_filters_nav.scss +31 -0
  126. data/app/assets/stylesheets/workarea/storefront/components/_mobile_nav.scss +67 -0
  127. data/app/assets/stylesheets/workarea/storefront/components/_option_button.scss +27 -0
  128. data/app/assets/stylesheets/workarea/storefront/components/_order_help_menu.scss +31 -0
  129. data/app/assets/stylesheets/workarea/storefront/components/_order_summary.scss +14 -0
  130. data/app/assets/stylesheets/workarea/storefront/components/_page_container.scss +26 -0
  131. data/app/assets/stylesheets/workarea/storefront/components/_page_content.scss +14 -0
  132. data/app/assets/stylesheets/workarea/storefront/components/_page_footer.scss +57 -0
  133. data/app/assets/stylesheets/workarea/storefront/components/_page_header.scss +79 -0
  134. data/app/assets/stylesheets/workarea/storefront/components/_page_messages.scss +36 -0
  135. data/app/assets/stylesheets/workarea/storefront/components/_pagination.scss +9 -0
  136. data/app/assets/stylesheets/workarea/storefront/components/_payment_icon.scss +19 -0
  137. data/app/assets/stylesheets/workarea/storefront/components/_personalized_recommendations_content_block.scss +10 -0
  138. data/app/assets/stylesheets/workarea/storefront/components/_primary_nav.scss +54 -0
  139. data/app/assets/stylesheets/workarea/storefront/components/_product_detail_container.scss +13 -0
  140. data/app/assets/stylesheets/workarea/storefront/components/_product_details.scss +84 -0
  141. data/app/assets/stylesheets/workarea/storefront/components/_product_insights_content_block.scss +10 -0
  142. data/app/assets/stylesheets/workarea/storefront/components/_product_list.scss +160 -0
  143. data/app/assets/stylesheets/workarea/storefront/components/_product_list_content_block.scss +10 -0
  144. data/app/assets/stylesheets/workarea/storefront/components/_product_prices.scss +32 -0
  145. data/app/assets/stylesheets/workarea/storefront/components/_product_summary.scss +53 -0
  146. data/app/assets/stylesheets/workarea/storefront/components/_property.scss +67 -0
  147. data/app/assets/stylesheets/workarea/storefront/components/_quote_content_block.scss +38 -0
  148. data/app/assets/stylesheets/workarea/storefront/components/_recent_views.scss +28 -0
  149. data/app/assets/stylesheets/workarea/storefront/components/_recommendations.scss +9 -0
  150. data/app/assets/stylesheets/workarea/storefront/components/_result_filters.scss +33 -0
  151. data/app/assets/stylesheets/workarea/storefront/components/_search_no_results.scss +21 -0
  152. data/app/assets/stylesheets/workarea/storefront/components/_search_results.scss +22 -0
  153. data/app/assets/stylesheets/workarea/storefront/components/_secondary_nav.scss +23 -0
  154. data/app/assets/stylesheets/workarea/storefront/components/_sitemap.scss +9 -0
  155. data/app/assets/stylesheets/workarea/storefront/components/_sitemap_pagination.scss +26 -0
  156. data/app/assets/stylesheets/workarea/storefront/components/_social_networks_content_block.scss +14 -0
  157. data/app/assets/stylesheets/workarea/storefront/components/_style_guide.scss +140 -0
  158. data/app/assets/stylesheets/workarea/storefront/components/_svg_icon.scss +57 -0
  159. data/app/assets/stylesheets/workarea/storefront/components/_table.scss +50 -0
  160. data/app/assets/stylesheets/workarea/storefront/components/_taxonomy_content_block.scss +87 -0
  161. data/app/assets/stylesheets/workarea/storefront/components/_text_box.scss +36 -0
  162. data/app/assets/stylesheets/workarea/storefront/components/_text_button.scss +17 -0
  163. data/app/assets/stylesheets/workarea/storefront/components/_text_content_block.scss +5 -0
  164. data/app/assets/stylesheets/workarea/storefront/components/_value.scss +46 -0
  165. data/app/assets/stylesheets/workarea/storefront/components/_video_and_text_content_block.scss +44 -0
  166. data/app/assets/stylesheets/workarea/storefront/components/_video_content_block.scss +21 -0
  167. data/app/assets/stylesheets/workarea/storefront/components/_view.scss +12 -0
  168. data/app/assets/stylesheets/workarea/storefront/email.scss +4 -0
  169. data/app/assets/stylesheets/workarea/storefront/email/_base.scss +52 -0
  170. data/app/assets/stylesheets/workarea/storefront/email/_components.scss +91 -0
  171. data/app/assets/stylesheets/workarea/storefront/email/_helpers.scss +69 -0
  172. data/app/assets/stylesheets/workarea/storefront/email/_settings.scss +22 -0
  173. data/app/assets/stylesheets/workarea/storefront/generic/_box_sizing.scss +20 -0
  174. data/app/assets/stylesheets/workarea/storefront/generic/_fonts.scss +24 -0
  175. data/app/assets/stylesheets/workarea/storefront/generic/_reset.scss +37 -0
  176. data/app/assets/stylesheets/workarea/storefront/objects/_button_reset.scss +17 -0
  177. data/app/assets/stylesheets/workarea/storefront/objects/_content_preview_visibility.scss +93 -0
  178. data/app/assets/stylesheets/workarea/storefront/objects/_content_wrapper.scss +18 -0
  179. data/app/assets/stylesheets/workarea/storefront/objects/_inline_list.scss +14 -0
  180. data/app/assets/stylesheets/workarea/storefront/objects/_list_reset.scss +10 -0
  181. data/app/assets/stylesheets/workarea/storefront/objects/_text_field_reset.scss +10 -0
  182. data/app/assets/stylesheets/workarea/storefront/settings/_breakpoints.scss.erb +8 -0
  183. data/app/assets/stylesheets/workarea/storefront/settings/_colors.scss +45 -0
  184. data/app/assets/stylesheets/workarea/storefront/settings/_global.scss +25 -0
  185. data/app/assets/stylesheets/workarea/storefront/settings/_grid.scss +36 -0
  186. data/app/assets/stylesheets/workarea/storefront/settings/_typography.scss +18 -0
  187. data/app/assets/stylesheets/workarea/storefront/settings/_z_indexes.scss +29 -0
  188. data/app/assets/stylesheets/workarea/storefront/tools/_center.scss +34 -0
  189. data/app/assets/stylesheets/workarea/storefront/tools/_focus_ring.scss +23 -0
  190. data/app/assets/stylesheets/workarea/storefront/tools/_respond_to.scss +31 -0
  191. data/app/assets/stylesheets/workarea/storefront/tools/_svg.scss +29 -0
  192. data/app/assets/stylesheets/workarea/storefront/trumps/_break_word.scss +9 -0
  193. data/app/assets/stylesheets/workarea/storefront/trumps/_clearfix.scss +13 -0
  194. data/app/assets/stylesheets/workarea/storefront/trumps/_hidden.scss +71 -0
  195. data/app/assets/stylesheets/workarea/storefront/trumps/_hidden_if_js_enabled.scss +10 -0
  196. data/app/assets/stylesheets/workarea/storefront/trumps/_image_replacement.scss +11 -0
  197. data/app/assets/stylesheets/workarea/storefront/trumps/_truncate.scss +10 -0
  198. data/app/assets/stylesheets/workarea/storefront/trumps/_visible.scss +70 -0
  199. data/app/assets/stylesheets/workarea/storefront/trumps/_visually_hidden.scss +14 -0
  200. data/app/assets/stylesheets/workarea/storefront/typography/_align.scss +15 -0
  201. data/app/assets/stylesheets/workarea/storefront/typography/_headings.scss +62 -0
  202. data/app/assets/stylesheets/workarea/storefront/typography/_links.scss +15 -0
  203. data/app/assets/stylesheets/workarea/storefront/typography/_text.scss +26 -0
  204. data/app/controllers/workarea/storefront/analytics_controller.rb +45 -0
  205. data/app/controllers/workarea/storefront/application_controller.rb +50 -0
  206. data/app/controllers/workarea/storefront/cart_items_controller.rb +99 -0
  207. data/app/controllers/workarea/storefront/carts_controller.rb +61 -0
  208. data/app/controllers/workarea/storefront/categories_controller.rb +11 -0
  209. data/app/controllers/workarea/storefront/check_inventory.rb +10 -0
  210. data/app/controllers/workarea/storefront/check_pricing_override.rb +17 -0
  211. data/app/controllers/workarea/storefront/checkout/addresses_controller.rb +58 -0
  212. data/app/controllers/workarea/storefront/checkout/payment_controller.rb +21 -0
  213. data/app/controllers/workarea/storefront/checkout/place_order_controller.rb +65 -0
  214. data/app/controllers/workarea/storefront/checkout/shipping_controller.rb +53 -0
  215. data/app/controllers/workarea/storefront/checkouts_controller.rb +102 -0
  216. data/app/controllers/workarea/storefront/contacts_controller.rb +28 -0
  217. data/app/controllers/workarea/storefront/content_areas_controller.rb +15 -0
  218. data/app/controllers/workarea/storefront/content_blocks_controller.rb +51 -0
  219. data/app/controllers/workarea/storefront/current_checkout.rb +114 -0
  220. data/app/controllers/workarea/storefront/email_signups_controller.rb +19 -0
  221. data/app/controllers/workarea/storefront/errors_controller.rb +58 -0
  222. data/app/controllers/workarea/storefront/http_caching.rb +33 -0
  223. data/app/controllers/workarea/storefront/menus_controller.rb +25 -0
  224. data/app/controllers/workarea/storefront/order_lookup.rb +20 -0
  225. data/app/controllers/workarea/storefront/orders_controller.rb +29 -0
  226. data/app/controllers/workarea/storefront/pages_controller.rb +23 -0
  227. data/app/controllers/workarea/storefront/products_controller.rb +25 -0
  228. data/app/controllers/workarea/storefront/recent_views_controller.rb +51 -0
  229. data/app/controllers/workarea/storefront/recommendations_controller.rb +11 -0
  230. data/app/controllers/workarea/storefront/searches_controller.rb +47 -0
  231. data/app/controllers/workarea/storefront/sitemaps_controller.rb +11 -0
  232. data/app/controllers/workarea/storefront/style_guides_controller.rb +6 -0
  233. data/app/controllers/workarea/storefront/user_activity.rb +17 -0
  234. data/app/controllers/workarea/storefront/users/accounts_controller.rb +91 -0
  235. data/app/controllers/workarea/storefront/users/addresses_controller.rb +49 -0
  236. data/app/controllers/workarea/storefront/users/credit_cards_controller.rb +75 -0
  237. data/app/controllers/workarea/storefront/users/logins_controller.rb +47 -0
  238. data/app/controllers/workarea/storefront/users/orders_controller.rb +30 -0
  239. data/app/controllers/workarea/storefront/users/passwords_controller.rb +65 -0
  240. data/app/helpers/workarea/storefront/admin_helper.rb +13 -0
  241. data/app/helpers/workarea/storefront/analytics_helper.rb +230 -0
  242. data/app/helpers/workarea/storefront/application_helper.rb +79 -0
  243. data/app/helpers/workarea/storefront/content_helper.rb +71 -0
  244. data/app/helpers/workarea/storefront/credit_cards_helper.rb +38 -0
  245. data/app/helpers/workarea/storefront/favicons_helper.rb +25 -0
  246. data/app/helpers/workarea/storefront/locales_helper.rb +27 -0
  247. data/app/helpers/workarea/storefront/navigation_helper.rb +97 -0
  248. data/app/helpers/workarea/storefront/pagination_helper.rb +22 -0
  249. data/app/helpers/workarea/storefront/products_helper.rb +43 -0
  250. data/app/helpers/workarea/storefront/recent_views_helper.rb +9 -0
  251. data/app/helpers/workarea/storefront/users_helper.rb +9 -0
  252. data/app/mailers/workarea/storefront/account_mailer.rb +21 -0
  253. data/app/mailers/workarea/storefront/application_mailer.rb +23 -0
  254. data/app/mailers/workarea/storefront/fulfillment_mailer.rb +47 -0
  255. data/app/mailers/workarea/storefront/inquiry_mailer.rb +10 -0
  256. data/app/mailers/workarea/storefront/order_mailer.rb +31 -0
  257. data/app/mailers/workarea/storefront/payment_mailer.rb +23 -0
  258. data/app/mailers/workarea/storefront/transactional_mailer.rb +17 -0
  259. data/app/view_models/workarea/storefront/cart_item_view_model.rb +11 -0
  260. data/app/view_models/workarea/storefront/cart_recommendations_view_model.rb +13 -0
  261. data/app/view_models/workarea/storefront/cart_view_model.rb +95 -0
  262. data/app/view_models/workarea/storefront/category_view_model.rb +119 -0
  263. data/app/view_models/workarea/storefront/checkout/addresses_view_model.rb +73 -0
  264. data/app/view_models/workarea/storefront/checkout/confirmation_view_model.rb +14 -0
  265. data/app/view_models/workarea/storefront/checkout/payment_view_model.rb +103 -0
  266. data/app/view_models/workarea/storefront/checkout/shipping_view_model.rb +13 -0
  267. data/app/view_models/workarea/storefront/checkout/summary_view_model.rb +89 -0
  268. data/app/view_models/workarea/storefront/checkout_content.rb +11 -0
  269. data/app/view_models/workarea/storefront/content_block_view_model.rb +62 -0
  270. data/app/view_models/workarea/storefront/content_blocks/category_summary_view_model.rb +52 -0
  271. data/app/view_models/workarea/storefront/content_blocks/hero_view_model.rb +23 -0
  272. data/app/view_models/workarea/storefront/content_blocks/image_group_view_model.rb +24 -0
  273. data/app/view_models/workarea/storefront/content_blocks/navigation_view_model.rb +32 -0
  274. data/app/view_models/workarea/storefront/content_blocks/product_insights_view_model.rb +46 -0
  275. data/app/view_models/workarea/storefront/content_blocks/product_list_view_model.rb +20 -0
  276. data/app/view_models/workarea/storefront/content_blocks/taxonomy_view_model.rb +17 -0
  277. data/app/view_models/workarea/storefront/content_blocks/video_view_model.rb +58 -0
  278. data/app/view_models/workarea/storefront/content_view_model.rb +11 -0
  279. data/app/view_models/workarea/storefront/credit_card_view_model.rb +7 -0
  280. data/app/view_models/workarea/storefront/detail_page_recommendations_view_model.rb +13 -0
  281. data/app/view_models/workarea/storefront/display_content.rb +56 -0
  282. data/app/view_models/workarea/storefront/email_recommendations_view_model.rb +13 -0
  283. data/app/view_models/workarea/storefront/email_signups_view_model.rb +18 -0
  284. data/app/view_models/workarea/storefront/fulfillment_item_view_model.rb +13 -0
  285. data/app/view_models/workarea/storefront/inquiry_view_model.rb +22 -0
  286. data/app/view_models/workarea/storefront/inventory_status_view_model.rb +27 -0
  287. data/app/view_models/workarea/storefront/menu_view_model.rb +7 -0
  288. data/app/view_models/workarea/storefront/option_set_view_model.rb +59 -0
  289. data/app/view_models/workarea/storefront/order_item_view_model.rb +83 -0
  290. data/app/view_models/workarea/storefront/order_pricing.rb +37 -0
  291. data/app/view_models/workarea/storefront/order_view_model.rb +144 -0
  292. data/app/view_models/workarea/storefront/package_view_model.rb +20 -0
  293. data/app/view_models/workarea/storefront/page_view_model.rb +11 -0
  294. data/app/view_models/workarea/storefront/pagination.rb +42 -0
  295. data/app/view_models/workarea/storefront/personalized_recommendations_view_model.rb +13 -0
  296. data/app/view_models/workarea/storefront/product_browsing.rb +33 -0
  297. data/app/view_models/workarea/storefront/product_templates/option_selects_view_model.rb +7 -0
  298. data/app/view_models/workarea/storefront/product_templates/option_thumbnails_view_model.rb +15 -0
  299. data/app/view_models/workarea/storefront/product_view_model.rb +183 -0
  300. data/app/view_models/workarea/storefront/product_view_model/cache_key.rb +44 -0
  301. data/app/view_models/workarea/storefront/product_view_model/image_collection.rb +58 -0
  302. data/app/view_models/workarea/storefront/product_view_model/option.rb +24 -0
  303. data/app/view_models/workarea/storefront/product_view_model/option_set.rb +97 -0
  304. data/app/view_models/workarea/storefront/product_view_model/sku_options.rb +53 -0
  305. data/app/view_models/workarea/storefront/recommendations_view_model.rb +39 -0
  306. data/app/view_models/workarea/storefront/refund_view_model.rb +16 -0
  307. data/app/view_models/workarea/storefront/search_content.rb +19 -0
  308. data/app/view_models/workarea/storefront/search_customization_content.rb +15 -0
  309. data/app/view_models/workarea/storefront/search_customization_view_model.rb +7 -0
  310. data/app/view_models/workarea/storefront/search_suggestion_view_model.rb +87 -0
  311. data/app/view_models/workarea/storefront/search_view_model.rb +50 -0
  312. data/app/view_models/workarea/storefront/shipping_view_model.rb +27 -0
  313. data/app/view_models/workarea/storefront/taxon_lookup.rb +37 -0
  314. data/app/view_models/workarea/storefront/user_activity_view_model.rb +41 -0
  315. data/app/view_models/workarea/storefront/user_view_model.rb +55 -0
  316. data/app/views/layouts/workarea/storefront/application.html.haml +175 -0
  317. data/app/views/layouts/workarea/storefront/checkout.html.haml +89 -0
  318. data/app/views/layouts/workarea/storefront/content_preview.html.haml +46 -0
  319. data/app/views/layouts/workarea/storefront/email.html.haml +193 -0
  320. data/app/views/layouts/workarea/storefront/empty.html.haml +48 -0
  321. data/app/views/layouts/workarea/storefront/navigation.html.haml +48 -0
  322. data/app/views/workarea/storefront/account_mailer/creation.html.haml +15 -0
  323. data/app/views/workarea/storefront/account_mailer/password_reset.html.haml +12 -0
  324. data/app/views/workarea/storefront/cart_items/create.html.haml +71 -0
  325. data/app/views/workarea/storefront/carts/_pricing.html.haml +14 -0
  326. data/app/views/workarea/storefront/carts/show.html.haml +183 -0
  327. data/app/views/workarea/storefront/categories/show.html.haml +103 -0
  328. data/app/views/workarea/storefront/checkouts/_checkout_progress.html.haml +6 -0
  329. data/app/views/workarea/storefront/checkouts/_summary.html.haml +102 -0
  330. data/app/views/workarea/storefront/checkouts/addresses.html.haml +56 -0
  331. data/app/views/workarea/storefront/checkouts/confirmation.html.haml +37 -0
  332. data/app/views/workarea/storefront/checkouts/payment.html.haml +184 -0
  333. data/app/views/workarea/storefront/checkouts/shipping.html.haml +39 -0
  334. data/app/views/workarea/storefront/checkouts/summary.html.haml +1 -0
  335. data/app/views/workarea/storefront/contacts/show.html.haml +41 -0
  336. data/app/views/workarea/storefront/content_areas/show.html.haml +6 -0
  337. data/app/views/workarea/storefront/content_blocks/_button.html.haml +5 -0
  338. data/app/views/workarea/storefront/content_blocks/_category_summary.html.haml +15 -0
  339. data/app/views/workarea/storefront/content_blocks/_divider.html.haml +2 -0
  340. data/app/views/workarea/storefront/content_blocks/_hero.html.haml +3 -0
  341. data/app/views/workarea/storefront/content_blocks/_html.html.haml +1 -0
  342. data/app/views/workarea/storefront/content_blocks/_image.html.haml +2 -0
  343. data/app/views/workarea/storefront/content_blocks/_image_and_text.html.haml +4 -0
  344. data/app/views/workarea/storefront/content_blocks/_image_group.html.haml +10 -0
  345. data/app/views/workarea/storefront/content_blocks/_product_insights.html.haml +10 -0
  346. data/app/views/workarea/storefront/content_blocks/_product_list.html.haml +10 -0
  347. data/app/views/workarea/storefront/content_blocks/_quote.html.haml +4 -0
  348. data/app/views/workarea/storefront/content_blocks/_recommendations.html.haml +1 -0
  349. data/app/views/workarea/storefront/content_blocks/_social_networks.html.haml +17 -0
  350. data/app/views/workarea/storefront/content_blocks/_taxonomy.html.haml +27 -0
  351. data/app/views/workarea/storefront/content_blocks/_text.html.haml +1 -0
  352. data/app/views/workarea/storefront/content_blocks/_three_column_taxonomy.html.haml +28 -0
  353. data/app/views/workarea/storefront/content_blocks/_two_column_taxonomy.html.haml +28 -0
  354. data/app/views/workarea/storefront/content_blocks/_video.html.haml +2 -0
  355. data/app/views/workarea/storefront/content_blocks/_video_and_text.html.haml +4 -0
  356. data/app/views/workarea/storefront/content_blocks/show.html.haml +1 -0
  357. data/app/views/workarea/storefront/email_signups/show.html.haml +12 -0
  358. data/app/views/workarea/storefront/errors/show.html.haml +12 -0
  359. data/app/views/workarea/storefront/facets/_range.html.haml +11 -0
  360. data/app/views/workarea/storefront/facets/_terms.html.haml +11 -0
  361. data/app/views/workarea/storefront/favicons/_tags.html.haml +8 -0
  362. data/app/views/workarea/storefront/fulfillment_mailer/canceled.html.haml +34 -0
  363. data/app/views/workarea/storefront/fulfillment_mailer/shipped.html.haml +92 -0
  364. data/app/views/workarea/storefront/inquiry_mailer/created.html.haml +27 -0
  365. data/app/views/workarea/storefront/mailers/_recommendations.html.haml +22 -0
  366. data/app/views/workarea/storefront/menus/index.html.haml +12 -0
  367. data/app/views/workarea/storefront/menus/show.html.haml +6 -0
  368. data/app/views/workarea/storefront/order_mailer/_summary.html.haml +209 -0
  369. data/app/views/workarea/storefront/order_mailer/confirmation.html.haml +15 -0
  370. data/app/views/workarea/storefront/order_mailer/reminder.html.haml +34 -0
  371. data/app/views/workarea/storefront/order_mailer/tenders/_credit_card.html.haml +4 -0
  372. data/app/views/workarea/storefront/order_mailer/tenders/_store_credit.html.haml +2 -0
  373. data/app/views/workarea/storefront/orders/_summary.html.haml +274 -0
  374. data/app/views/workarea/storefront/orders/index.html.haml +40 -0
  375. data/app/views/workarea/storefront/orders/show.html.haml +16 -0
  376. data/app/views/workarea/storefront/orders/tenders/_credit_card.html.haml +9 -0
  377. data/app/views/workarea/storefront/orders/tenders/_store_credit.html.haml +6 -0
  378. data/app/views/workarea/storefront/pages/accessibility.html.haml +53 -0
  379. data/app/views/workarea/storefront/pages/browser_config.xml.builder +9 -0
  380. data/app/views/workarea/storefront/pages/home_page.html.haml +20 -0
  381. data/app/views/workarea/storefront/pages/robots.text.erb +17 -0
  382. data/app/views/workarea/storefront/pages/show.html.haml +28 -0
  383. data/app/views/workarea/storefront/pages/templates/_generic.html.haml +1 -0
  384. data/app/views/workarea/storefront/pages/templates/_test.html.haml +1 -0
  385. data/app/views/workarea/storefront/pages/web_manifest.json.jbuilder +11 -0
  386. data/app/views/workarea/storefront/payment_mailer/refunded.html.haml +13 -0
  387. data/app/views/workarea/storefront/products/_price.html.haml +4 -0
  388. data/app/views/workarea/storefront/products/_pricing.html.haml +34 -0
  389. data/app/views/workarea/storefront/products/_summary.html.haml +12 -0
  390. data/app/views/workarea/storefront/products/details.html.haml +2 -0
  391. data/app/views/workarea/storefront/products/show.html.haml +48 -0
  392. data/app/views/workarea/storefront/products/templates/_generic.html.haml +69 -0
  393. data/app/views/workarea/storefront/products/templates/_option_selects.html.haml +70 -0
  394. data/app/views/workarea/storefront/products/templates/_option_thumbnails.html.haml +76 -0
  395. data/app/views/workarea/storefront/products/templates/_test.html.haml +1 -0
  396. data/app/views/workarea/storefront/recent_views/aside.html.haml +25 -0
  397. data/app/views/workarea/storefront/recent_views/narrow.html.haml +25 -0
  398. data/app/views/workarea/storefront/recent_views/show.html.haml +27 -0
  399. data/app/views/workarea/storefront/recommendations/show.html.haml +12 -0
  400. data/app/views/workarea/storefront/searches/index.json.jbuilder +1 -0
  401. data/app/views/workarea/storefront/searches/no_results.html.haml +31 -0
  402. data/app/views/workarea/storefront/searches/show.html.haml +99 -0
  403. data/app/views/workarea/storefront/shared/_address_fields.html.haml +105 -0
  404. data/app/views/workarea/storefront/shared/_left_navigation.html.haml +24 -0
  405. data/app/views/workarea/storefront/shared/_message.html.haml +4 -0
  406. data/app/views/workarea/storefront/sitemaps/_pagination.html.haml +37 -0
  407. data/app/views/workarea/storefront/sitemaps/show.html.haml +36 -0
  408. data/app/views/workarea/storefront/style_guides/_navigation.html.haml +11 -0
  409. data/app/views/workarea/storefront/style_guides/base/_forms.html.haml +82 -0
  410. data/app/views/workarea/storefront/style_guides/base/_tables.html.haml +63 -0
  411. data/app/views/workarea/storefront/style_guides/components/_box.html.haml +26 -0
  412. data/app/views/workarea/storefront/style_guides/components/_breadcrumbs.html.haml +12 -0
  413. data/app/views/workarea/storefront/style_guides/components/_button.html.haml +50 -0
  414. data/app/views/workarea/storefront/style_guides/components/_button_content_block.html.haml +20 -0
  415. data/app/views/workarea/storefront/style_guides/components/_button_property.html.haml +83 -0
  416. data/app/views/workarea/storefront/style_guides/components/_category_summary_content_block.html.haml +29 -0
  417. data/app/views/workarea/storefront/style_guides/components/_data_card.html.haml +215 -0
  418. data/app/views/workarea/storefront/style_guides/components/_divider_content_block.html.haml +40 -0
  419. data/app/views/workarea/storefront/style_guides/components/_hero_content_block.html.haml +29 -0
  420. data/app/views/workarea/storefront/style_guides/components/_html_content_block.html.haml +10 -0
  421. data/app/views/workarea/storefront/style_guides/components/_image_and_text_content_block.html.haml +28 -0
  422. data/app/views/workarea/storefront/style_guides/components/_image_content_block.html.haml +38 -0
  423. data/app/views/workarea/storefront/style_guides/components/_image_group_content_block.html.haml +17 -0
  424. data/app/views/workarea/storefront/style_guides/components/_inline_form.html.haml +18 -0
  425. data/app/views/workarea/storefront/style_guides/components/_loading.html.haml +106 -0
  426. data/app/views/workarea/storefront/style_guides/components/_message.html.haml +45 -0
  427. data/app/views/workarea/storefront/style_guides/components/_mobile_filters.html.haml +17 -0
  428. data/app/views/workarea/storefront/style_guides/components/_pagination.html.haml +24 -0
  429. data/app/views/workarea/storefront/style_guides/components/_payment_icon.html.haml +19 -0
  430. data/app/views/workarea/storefront/style_guides/components/_personalized_recommendations_content_block.html.haml +32 -0
  431. data/app/views/workarea/storefront/style_guides/components/_product_insights_content_block.html.haml +32 -0
  432. data/app/views/workarea/storefront/style_guides/components/_product_list.html.haml +302 -0
  433. data/app/views/workarea/storefront/style_guides/components/_product_list_content_block.html.haml +32 -0
  434. data/app/views/workarea/storefront/style_guides/components/_product_prices.html.haml +79 -0
  435. data/app/views/workarea/storefront/style_guides/components/_product_summary.html.haml +35 -0
  436. data/app/views/workarea/storefront/style_guides/components/_property.html.haml +93 -0
  437. data/app/views/workarea/storefront/style_guides/components/_quote_content_block.html.haml +18 -0
  438. data/app/views/workarea/storefront/style_guides/components/_recommendations.html.haml +34 -0
  439. data/app/views/workarea/storefront/style_guides/components/_social_networks_content_block.html.haml +20 -0
  440. data/app/views/workarea/storefront/style_guides/components/_svg_icon.html.haml +51 -0
  441. data/app/views/workarea/storefront/style_guides/components/_table.html.haml +112 -0
  442. data/app/views/workarea/storefront/style_guides/components/_taxonomy_content_block.html.haml +205 -0
  443. data/app/views/workarea/storefront/style_guides/components/_text_box.html.haml +73 -0
  444. data/app/views/workarea/storefront/style_guides/components/_text_button.html.haml +26 -0
  445. data/app/views/workarea/storefront/style_guides/components/_text_content_block.html.haml +10 -0
  446. data/app/views/workarea/storefront/style_guides/components/_ui_autocomplete.html.haml +11 -0
  447. data/app/views/workarea/storefront/style_guides/components/_ui_dialog.html.haml +5 -0
  448. data/app/views/workarea/storefront/style_guides/components/_ui_dialog_image.html.haml +5 -0
  449. data/app/views/workarea/storefront/style_guides/components/_ui_helper_hidden_accessible.html.haml +6 -0
  450. data/app/views/workarea/storefront/style_guides/components/_value.html.haml +70 -0
  451. data/app/views/workarea/storefront/style_guides/components/_video_and_text_content_block.html.haml +21 -0
  452. data/app/views/workarea/storefront/style_guides/components/_video_content_block.html.haml +11 -0
  453. data/app/views/workarea/storefront/style_guides/index.html.haml +87 -0
  454. data/app/views/workarea/storefront/style_guides/objects/_button_reset.html.haml +17 -0
  455. data/app/views/workarea/storefront/style_guides/objects/_inline_list.html.haml +20 -0
  456. data/app/views/workarea/storefront/style_guides/objects/_list_reset.html.haml +20 -0
  457. data/app/views/workarea/storefront/style_guides/objects/_text_field_reset.html.haml +11 -0
  458. data/app/views/workarea/storefront/style_guides/settings/_color_variables.html.haml +21 -0
  459. data/app/views/workarea/storefront/style_guides/show.html.haml +10 -0
  460. data/app/views/workarea/storefront/style_guides/trumps/_break_word.html.haml +15 -0
  461. data/app/views/workarea/storefront/style_guides/trumps/_clearfix.html.haml +21 -0
  462. data/app/views/workarea/storefront/style_guides/trumps/_hidden.html.haml +97 -0
  463. data/app/views/workarea/storefront/style_guides/trumps/_hidden_if_js_enabled.html.haml +17 -0
  464. data/app/views/workarea/storefront/style_guides/trumps/_image_replacement.html.haml +13 -0
  465. data/app/views/workarea/storefront/style_guides/trumps/_truncate.html.haml +13 -0
  466. data/app/views/workarea/storefront/style_guides/trumps/_visible.html.haml +97 -0
  467. data/app/views/workarea/storefront/style_guides/trumps/_visually_hidden.html.haml +17 -0
  468. data/app/views/workarea/storefront/style_guides/typography/_align.html.haml +25 -0
  469. data/app/views/workarea/storefront/style_guides/typography/_fonts.html.haml +9 -0
  470. data/app/views/workarea/storefront/style_guides/typography/_headings.html.haml +25 -0
  471. data/app/views/workarea/storefront/style_guides/typography/_links.html.haml +13 -0
  472. data/app/views/workarea/storefront/style_guides/typography/_text.html.haml +23 -0
  473. data/app/views/workarea/storefront/users/accounts/edit.html.haml +42 -0
  474. data/app/views/workarea/storefront/users/accounts/show.html.haml +118 -0
  475. data/app/views/workarea/storefront/users/addresses/edit.html.haml +24 -0
  476. data/app/views/workarea/storefront/users/addresses/new.html.haml +24 -0
  477. data/app/views/workarea/storefront/users/credit_cards/edit.html.haml +65 -0
  478. data/app/views/workarea/storefront/users/credit_cards/new.html.haml +58 -0
  479. data/app/views/workarea/storefront/users/current_user.json.jbuilder +8 -0
  480. data/app/views/workarea/storefront/users/logins/new.html.haml +51 -0
  481. data/app/views/workarea/storefront/users/orders/_summary.html.haml +23 -0
  482. data/app/views/workarea/storefront/users/orders/index.html.haml +21 -0
  483. data/app/views/workarea/storefront/users/orders/show.html.haml +19 -0
  484. data/app/views/workarea/storefront/users/passwords/change.html.haml +21 -0
  485. data/app/views/workarea/storefront/users/passwords/edit.html.haml +13 -0
  486. data/app/views/workarea/storefront/users/passwords/new.html.haml +24 -0
  487. data/bin/rails +18 -0
  488. data/config/locales/en.yml +403 -0
  489. data/config/routes.rb +110 -0
  490. data/lib/workarea/mailer_previews/storefront/account_mailer_preview.rb +16 -0
  491. data/lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb +27 -0
  492. data/lib/workarea/mailer_previews/storefront/inquiry_mailer_preview.rb +9 -0
  493. data/lib/workarea/mailer_previews/storefront/order_mailer_preview.rb +16 -0
  494. data/lib/workarea/mailer_previews/storefront/payment_mailer_preview.rb +9 -0
  495. data/lib/workarea/storefront.rb +7 -0
  496. data/lib/workarea/storefront/engine.rb +8 -0
  497. data/test/dummy/README.rdoc +28 -0
  498. data/test/dummy/Rakefile +6 -0
  499. data/test/dummy/app/assets/images/.keep +0 -0
  500. data/test/dummy/app/assets/javascripts/application.js +13 -0
  501. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  502. data/test/dummy/app/controllers/application_controller.rb +5 -0
  503. data/test/dummy/app/controllers/concerns/.keep +0 -0
  504. data/test/dummy/app/helpers/application_helper.rb +2 -0
  505. data/test/dummy/app/mailers/.keep +0 -0
  506. data/test/dummy/app/models/.keep +0 -0
  507. data/test/dummy/app/models/concerns/.keep +0 -0
  508. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  509. data/test/dummy/bin/bundle +3 -0
  510. data/test/dummy/bin/rails +5 -0
  511. data/test/dummy/bin/rake +4 -0
  512. data/test/dummy/bin/setup +34 -0
  513. data/test/dummy/bin/update +29 -0
  514. data/test/dummy/config.ru +4 -0
  515. data/test/dummy/config/application.rb +22 -0
  516. data/test/dummy/config/boot.rb +5 -0
  517. data/test/dummy/config/cable.yml +9 -0
  518. data/test/dummy/config/environment.rb +5 -0
  519. data/test/dummy/config/environments/development.rb +51 -0
  520. data/test/dummy/config/environments/production.rb +86 -0
  521. data/test/dummy/config/environments/test.rb +43 -0
  522. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  523. data/test/dummy/config/initializers/assets.rb +11 -0
  524. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  525. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  526. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  527. data/test/dummy/config/initializers/inflections.rb +16 -0
  528. data/test/dummy/config/initializers/mime_types.rb +4 -0
  529. data/test/dummy/config/initializers/new_framework_defaults.rb +17 -0
  530. data/test/dummy/config/initializers/session_store.rb +3 -0
  531. data/test/dummy/config/initializers/workarea.rb +8 -0
  532. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  533. data/test/dummy/config/locales/en.yml +23 -0
  534. data/test/dummy/config/puma.rb +47 -0
  535. data/test/dummy/config/routes.rb +8 -0
  536. data/test/dummy/config/secrets.yml +22 -0
  537. data/test/dummy/config/spring.rb +6 -0
  538. data/test/dummy/db/seeds.rb +10 -0
  539. data/test/dummy/lib/assets/.keep +0 -0
  540. data/test/dummy/log/.keep +0 -0
  541. data/test/dummy/public/404.html +67 -0
  542. data/test/dummy/public/422.html +67 -0
  543. data/test/dummy/public/500.html +66 -0
  544. data/test/dummy/public/favicon.ico +1 -0
  545. data/test/helpers/workarea/storefront/application_helper_test.rb +25 -0
  546. data/test/helpers/workarea/storefront/content_helper_test.rb +50 -0
  547. data/test/helpers/workarea/storefront/credit_cards_helper_test.rb +29 -0
  548. data/test/helpers/workarea/storefront/navigation_helper_test.rb +85 -0
  549. data/test/helpers/workarea/storefront/pagination_helper_test.rb +27 -0
  550. data/test/helpers/workarea/storefront/products_helper_test.rb +43 -0
  551. data/test/integration/workarea/storefront/accounts_integration_test.rb +128 -0
  552. data/test/integration/workarea/storefront/analytics_integration_test.rb +32 -0
  553. data/test/integration/workarea/storefront/browse_images_integration_test.rb +71 -0
  554. data/test/integration/workarea/storefront/cart_integration_test.rb +109 -0
  555. data/test/integration/workarea/storefront/cart_items_integration_test.rb +330 -0
  556. data/test/integration/workarea/storefront/categories_integration_test.rb +21 -0
  557. data/test/integration/workarea/storefront/checkout_side_effects_integration_test.rb +214 -0
  558. data/test/integration/workarea/storefront/checkout_with_pricing_override_integration_test.rb +168 -0
  559. data/test/integration/workarea/storefront/checkouts_integration_test.rb +267 -0
  560. data/test/integration/workarea/storefront/contact_form_integration_test.rb +33 -0
  561. data/test/integration/workarea/storefront/content_blocks_integration_test.rb +71 -0
  562. data/test/integration/workarea/storefront/current_checkout_integration_test.rb +30 -0
  563. data/test/integration/workarea/storefront/current_user_integration_test.rb +28 -0
  564. data/test/integration/workarea/storefront/email_signups_integration_test.rb +25 -0
  565. data/test/integration/workarea/storefront/errors_integration_test.rb +137 -0
  566. data/test/integration/workarea/storefront/favicons_integration_test.rb +16 -0
  567. data/test/integration/workarea/storefront/guest_browsing_integration_test.rb +24 -0
  568. data/test/integration/workarea/storefront/head_tags_integration_test.rb +127 -0
  569. data/test/integration/workarea/storefront/health_check_integration_test.rb +13 -0
  570. data/test/integration/workarea/storefront/host_integration_test.rb +32 -0
  571. data/test/integration/workarea/storefront/impersonations_integration_test.rb +128 -0
  572. data/test/integration/workarea/storefront/layout_integration_test.rb +29 -0
  573. data/test/integration/workarea/storefront/login_integration_test.rb +157 -0
  574. data/test/integration/workarea/storefront/order_data_integration_test.rb +264 -0
  575. data/test/integration/workarea/storefront/order_lookup_integration_test.rb +117 -0
  576. data/test/integration/workarea/storefront/pages_integration_test.rb +56 -0
  577. data/test/integration/workarea/storefront/place_order_integration_test.rb +140 -0
  578. data/test/integration/workarea/storefront/placing_order_integration_test.rb +92 -0
  579. data/test/integration/workarea/storefront/products_integration_test.rb +36 -0
  580. data/test/integration/workarea/storefront/search_integration_test.rb +128 -0
  581. data/test/integration/workarea/storefront/store_credit_integration_test.rb +121 -0
  582. data/test/integration/workarea/storefront/users/addresses_integration_test.rb +136 -0
  583. data/test/integration/workarea/storefront/users/credit_cards_integration_test.rb +96 -0
  584. data/test/integration/workarea/storefront/users/orders_integration_test.rb +15 -0
  585. data/test/integration/workarea/storefront/users/passwords_integration_test.rb +48 -0
  586. data/test/javascripts/address_region_fields_spec.js +46 -0
  587. data/test/javascripts/analytics_spec.js +91 -0
  588. data/test/javascripts/authenticity_token_spec.js +26 -0
  589. data/test/javascripts/back_to_top_button_spec.js +41 -0
  590. data/test/javascripts/break_points_spec.js +41 -0
  591. data/test/javascripts/checkout_primary_payments_spec.js +32 -0
  592. data/test/javascripts/dialog_spec.js +347 -0
  593. data/test/javascripts/fixtures/address_region_fields.html.haml +17 -0
  594. data/test/javascripts/fixtures/analytics_add_to_cart_form.html.haml +12 -0
  595. data/test/javascripts/fixtures/analytics_product_click.html.haml +7 -0
  596. data/test/javascripts/fixtures/authenticity_token.html.haml +2 -0
  597. data/test/javascripts/fixtures/back_to_top_button.html.haml +2 -0
  598. data/test/javascripts/fixtures/checkout_primary_payments.html.haml +12 -0
  599. data/test/javascripts/fixtures/dialog.html.haml +16 -0
  600. data/test/javascripts/fixtures/form.html.haml +10 -0
  601. data/test/javascripts/fixtures/optional_fields.html.haml +4 -0
  602. data/test/javascripts/fixtures/popup_button.html.haml +1 -0
  603. data/test/javascripts/fixtures/product_details_sku_select.html.haml +8 -0
  604. data/test/javascripts/fixtures/product_details_sku_select_without_sku_option_details.html.haml +7 -0
  605. data/test/javascripts/fixtures/scroll_to_element.html.haml +19 -0
  606. data/test/javascripts/forms_spec.js +85 -0
  607. data/test/javascripts/messages_spec.js +50 -0
  608. data/test/javascripts/optional_fields_spec.js +20 -0
  609. data/test/javascripts/popup_button_spec.js +19 -0
  610. data/test/javascripts/product_details_sku_selects_spec.js +154 -0
  611. data/test/javascripts/scroll_to_buttons_spec.js +46 -0
  612. data/test/javascripts/spec_helper.js +2 -0
  613. data/test/javascripts/traffic_referrer_spec.js +33 -0
  614. data/test/mailers/workarea/storefront/transactional_mailer_test.rb +29 -0
  615. data/test/performance/workarea/storefront/cart_performance_test.rb +52 -0
  616. data/test/performance/workarea/storefront/categories_performance_test.rb +26 -0
  617. data/test/performance/workarea/storefront/pages_performance_test.rb +31 -0
  618. data/test/performance/workarea/storefront/products_performance_test.rb +19 -0
  619. data/test/performance/workarea/storefront/search_performance_test.rb +27 -0
  620. data/test/system/workarea/storefront/accounts_system_test.rb +97 -0
  621. data/test/system/workarea/storefront/addresses_system_test.rb +60 -0
  622. data/test/system/workarea/storefront/analytics_system_test.rb +725 -0
  623. data/test/system/workarea/storefront/cart_items_system_test.rb +117 -0
  624. data/test/system/workarea/storefront/cart_system_test.rb +93 -0
  625. data/test/system/workarea/storefront/categories_system_test.rb +258 -0
  626. data/test/system/workarea/storefront/content_system_test.rb +114 -0
  627. data/test/system/workarea/storefront/credit_cards_system_test.rb +77 -0
  628. data/test/system/workarea/storefront/customer_service_system_test.rb +21 -0
  629. data/test/system/workarea/storefront/digital_products_system_test.rb +140 -0
  630. data/test/system/workarea/storefront/discounting_multiple_system_test.rb +87 -0
  631. data/test/system/workarea/storefront/discounting_system_test.rb +292 -0
  632. data/test/system/workarea/storefront/email_signup_system_test.rb +19 -0
  633. data/test/system/workarea/storefront/fulfillment_system_test.rb +78 -0
  634. data/test/system/workarea/storefront/guest_checkout_system_test.rb +426 -0
  635. data/test/system/workarea/storefront/logged_in_checkout_system_test.rb +336 -0
  636. data/test/system/workarea/storefront/login_system_test.rb +157 -0
  637. data/test/system/workarea/storefront/navigation_system_test.rb +73 -0
  638. data/test/system/workarea/storefront/no_js_system_test.rb +84 -0
  639. data/test/system/workarea/storefront/orders_system_test.rb +84 -0
  640. data/test/system/workarea/storefront/pages_system_test.rb +61 -0
  641. data/test/system/workarea/storefront/pagination_system_test.rb +129 -0
  642. data/test/system/workarea/storefront/passwords_system_test.rb +158 -0
  643. data/test/system/workarea/storefront/pricing_overrides_system_test.rb +45 -0
  644. data/test/system/workarea/storefront/products_system_test.rb +241 -0
  645. data/test/system/workarea/storefront/recommendations_system_test.rb +85 -0
  646. data/test/system/workarea/storefront/release_browsing_system_test.rb +73 -0
  647. data/test/system/workarea/storefront/search_system_test.rb +267 -0
  648. data/test/system/workarea/storefront/sitemap_system_test.rb +57 -0
  649. data/test/system/workarea/storefront/store_credit_system_test.rb +166 -0
  650. data/test/system/workarea/storefront/style_guides_system_test.rb +16 -0
  651. data/test/teaspoon_env.rb +10 -0
  652. data/test/test_helper.rb +10 -0
  653. data/test/view_models/workarea/storefront/cart_view_model_test.rb +36 -0
  654. data/test/view_models/workarea/storefront/category_view_model_test.rb +59 -0
  655. data/test/view_models/workarea/storefront/checkout/addresses_view_model_test.rb +16 -0
  656. data/test/view_models/workarea/storefront/checkout/payment_view_model_test.rb +76 -0
  657. data/test/view_models/workarea/storefront/checkout/summary_view_model_test.rb +29 -0
  658. data/test/view_models/workarea/storefront/content_block_view_model_test.rb +86 -0
  659. data/test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb +35 -0
  660. data/test/view_models/workarea/storefront/content_blocks/navigation_view_model_test.rb +53 -0
  661. data/test/view_models/workarea/storefront/content_blocks/product_insights_view_model_test.rb +73 -0
  662. data/test/view_models/workarea/storefront/content_blocks/product_list_view_model_test.rb +24 -0
  663. data/test/view_models/workarea/storefront/content_blocks/taxonomy_view_model_test.rb +81 -0
  664. data/test/view_models/workarea/storefront/content_blocks/video_view_model_test.rb +89 -0
  665. data/test/view_models/workarea/storefront/display_content_test.rb +105 -0
  666. data/test/view_models/workarea/storefront/fulfillment_item_view_model_test.rb +18 -0
  667. data/test/view_models/workarea/storefront/inventory_status_view_model_test.rb +39 -0
  668. data/test/view_models/workarea/storefront/option_set_view_model_test.rb +158 -0
  669. data/test/view_models/workarea/storefront/order_item_view_model_test.rb +49 -0
  670. data/test/view_models/workarea/storefront/order_view_model_test.rb +84 -0
  671. data/test/view_models/workarea/storefront/package_view_model_test.rb +32 -0
  672. data/test/view_models/workarea/storefront/product_templates/option_thumbnails_view_model_test.rb +25 -0
  673. data/test/view_models/workarea/storefront/product_view_model/cache_key_test.rb +16 -0
  674. data/test/view_models/workarea/storefront/product_view_model/image_collection_test.rb +93 -0
  675. data/test/view_models/workarea/storefront/product_view_model/option_set_test.rb +379 -0
  676. data/test/view_models/workarea/storefront/product_view_model/sku_options_test.rb +35 -0
  677. data/test/view_models/workarea/storefront/product_view_model_test.rb +235 -0
  678. data/test/view_models/workarea/storefront/recommendations_view_model_test.rb +62 -0
  679. data/test/view_models/workarea/storefront/refund_view_model_test.rb +23 -0
  680. data/test/view_models/workarea/storefront/search_suggestion_view_model_test.rb +42 -0
  681. data/test/view_models/workarea/storefront/search_view_model_test.rb +57 -0
  682. data/test/view_models/workarea/storefront/shipping_view_model_test.rb +29 -0
  683. data/test/view_models/workarea/storefront/user_activity_view_model_test.rb +65 -0
  684. data/test/view_models/workarea/storefront/user_view_model_test.rb +35 -0
  685. data/workarea-storefront.gemspec +16 -0
  686. metadata +742 -0
@@ -0,0 +1,46 @@
1
+ (function () {
2
+ 'use strict';
3
+
4
+ describe('WORKAREA.scrollToButtons', function () {
5
+ beforeEach(function () {
6
+ sinon.spy(WORKAREA.scrollToButtons, 'scrollToElement');
7
+ WORKAREA.initModules(
8
+ $(fixture.load('scroll_to_element.html.haml', true))
9
+ );
10
+ });
11
+
12
+ afterEach(function () {
13
+ WORKAREA.scrollToButtons.scrollToElement.restore();
14
+ });
15
+
16
+ describe('init', function () {
17
+ it('scrolls to the element on the page when clicked', function () {
18
+ $('.pdp .reviews-link').click();
19
+
20
+ expect(WORKAREA.scrollToButtons.scrollToElement.calledOnce).to.equal(true);
21
+ });
22
+
23
+ it('scrolls within a dialog', function () {
24
+ $('.ui-dialog .returns-link').click();
25
+
26
+ expect(WORKAREA.scrollToButtons.scrollToElement)
27
+ .to.have.been.called;
28
+ });
29
+
30
+ it('prevents scrolling outside of dialog', function () {
31
+ $('.ui-dialog .reviews-link').click();
32
+
33
+ expect(WORKAREA.scrollToButtons.scrollToElement)
34
+ .not.to.have.been.called;
35
+ });
36
+
37
+ it('prevents scrolling when target not found', function () {
38
+ $('.ui-dialog .external-link').click();
39
+
40
+ expect(WORKAREA.scrollToButtons.scrollToElement)
41
+ .not.to.have.been.called;
42
+ });
43
+
44
+ });
45
+ });
46
+ }());
@@ -0,0 +1,2 @@
1
+ //= require workarea/core/spec_helper
2
+ //= require workarea/storefront/spec_helper
@@ -0,0 +1,33 @@
1
+ (function () {
2
+ 'use strict';
3
+
4
+ describe('WORKAREA.trafficReferrer', function () {
5
+ describe('setCookie', function () {
6
+ beforeEach(function () {
7
+ WORKAREA.cookie.destroy('workarea_referrer');
8
+ });
9
+
10
+ it('sets a cookie', function () {
11
+ WORKAREA.trafficReferrer.setReferrer('http://workarea.com');
12
+
13
+ WORKAREA.trafficReferrer.setCookie();
14
+ expect(WORKAREA.cookie.read('workarea_referrer')).to.equal('http://workarea.com');
15
+ });
16
+
17
+ it('does not set a cookie when host matches referrer', function () {
18
+ WORKAREA.trafficReferrer.setReferrer('http://127.0.0.1');
19
+
20
+ WORKAREA.trafficReferrer.setCookie();
21
+ expect(WORKAREA.cookie.read('workarea_referrer')).to.equal(null);
22
+ });
23
+
24
+ it('does not set cookie when cookie is already set', function () {
25
+ WORKAREA.cookie.create('workarea_referrer', 'http://example.com');
26
+ WORKAREA.trafficReferrer.setReferrer('http://workarea.com');
27
+
28
+ WORKAREA.trafficReferrer.setCookie();
29
+ expect(WORKAREA.cookie.read('workarea_referrer')).to.equal('http://example.com');
30
+ });
31
+ });
32
+ });
33
+ }());
@@ -0,0 +1,29 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Storefront
5
+ class TransactionalMailerTest < Workarea::IntegrationTest
6
+ def test_enabled_transactional_emails
7
+ Workarea.with_config do |config|
8
+ config.send_transactional_emails = true
9
+
10
+ order = create_placed_order
11
+ OrderMailer.confirmation(order.id).deliver_now
12
+
13
+ assert(ActionMailer::Base.deliveries.last.present?)
14
+ end
15
+ end
16
+
17
+ def test_disabling_transactionl_email
18
+ Workarea.with_config do |config|
19
+ config.send_transactional_emails = false
20
+
21
+ order = create_placed_order
22
+ OrderMailer.confirmation(order.id).deliver_now
23
+
24
+ assert_nil(ActionMailer::Base.deliveries.last)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,52 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Storefront
5
+ class CartPerformanceTest < Workarea::PerformanceTest
6
+ setup :setup_cart
7
+
8
+ def setup_cart
9
+ @products = []
10
+ Sidekiq::Callbacks.disable do
11
+ 10.times do |i|
12
+ product = create_complex_product(name: "Test Product #{i}")
13
+
14
+ post storefront.cart_items_path,
15
+ params: {
16
+ product_id: product.id,
17
+ sku: product.skus.first,
18
+ quantity: 2 + i
19
+ }
20
+
21
+ @products << product
22
+ end
23
+
24
+ @categories = Array.new(5) do |i|
25
+ create_category(name: "Test Category #{i}", product_ids: @products.sample(4).map(&:id))
26
+ end
27
+ end
28
+
29
+ BulkIndexProducts.perform_by_models(@products)
30
+
31
+ order_total = create_order_total_discount(promo_codes: %w(TESTCODE))
32
+ buy_some = create_buy_some_get_some_discount(product_ids: [@products.first.id])
33
+ category = create_category_discount(category_ids: [@categories.first.id])
34
+ free_gift = create_free_gift_discount(sku: create_product.skus.first, product_ids: [@products.second.id])
35
+ product_attribute = create_product_attribute_discount(attribute_name: 'Color', attribute_value: 'Red')
36
+ product = create_product_discount(product_ids: @products.map(&:id))
37
+ fixed_price = create_quantity_fixed_price_discount(product_ids: [@products.third.id])
38
+
39
+ order_total.update_attributes!(compatible_discount_ids: [category.id, product_attribute.id, free_gift.id])
40
+ buy_some.update_attributes!(compatible_discount_ids: [product.id, fixed_price.id, order_total.id])
41
+ category.update_attributes!(compatible_discount_ids: [fixed_price.id, product_attribute.id])
42
+
43
+ post storefront.add_promo_code_to_cart_path, params: { promo_code: 'TESTCODE' }
44
+ end
45
+
46
+ def test_cart_with_many_discounts
47
+ get storefront.cart_path
48
+ assert(response.ok?)
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Storefront
5
+ class CategoriesPerformanceTest < Workarea::PerformanceTest
6
+
7
+ setup :setup_category
8
+
9
+ def setup_category
10
+ Sidekiq::Callbacks.disable do
11
+ @products = Array.new(Workarea.config.per_page) do
12
+ create_complex_product
13
+ end
14
+ end
15
+
16
+ BulkIndexProducts.perform_by_models(@products)
17
+ @category = create_category(product_ids: @products.map(&:id))
18
+ end
19
+
20
+ def test_categories_with_complex_products
21
+ get storefront.category_path(@category)
22
+ assert(response.ok?)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,31 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Storefront
5
+ class PagesPerformanceTest < Workarea::PerformanceTest
6
+ setup :setup_page
7
+
8
+ def setup_page
9
+ @page = create_page
10
+ content = Content.for(@page)
11
+
12
+ # Providing data for dynamic blocks to use
13
+ @products = Array.new(6) { create_product }
14
+ @categories = Array.new(3) { create_category(product_ids: @products.map(&:id)) }
15
+ create_taxon(navigable: @categories.first)
16
+ create_taxon(navigable: @page)
17
+
18
+ Workarea.config.content_block_types.each do |type|
19
+ 3.times { content.blocks.build(type_id: type.id, data: type.defaults) }
20
+ end
21
+
22
+ content.save!
23
+ end
24
+
25
+ def test_heavy_content_pages
26
+ get storefront.page_path(@page)
27
+ assert(response.ok?)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,19 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Storefront
5
+ class ProductsPerformanceTest < Workarea::PerformanceTest
6
+ setup :setup_product
7
+
8
+ def setup_product
9
+ @product = create_complex_product
10
+ 3.times { create_category(product_ids: [@product.id]) }
11
+ end
12
+
13
+ def test_high_variant_count
14
+ get storefront.product_path(@product)
15
+ assert(response.ok?)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,27 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Storefront
5
+ class SearchPerformanceTest < Workarea::PerformanceTest
6
+
7
+ setup :setup_catalog
8
+
9
+ def setup_catalog
10
+ name_prefix = %w(foo bar foobar)
11
+ Sidekiq::Callbacks.disable do
12
+ @products =
13
+ Array.new(Workarea.config.per_page) do |i|
14
+ create_complex_product(name: "#{name_prefix[i % 3]} #{i}")
15
+ end
16
+ end
17
+
18
+ BulkIndexProducts.perform_by_models(@products)
19
+ end
20
+
21
+ def test_search_with_complex_products
22
+ get storefront.search_path(q: 'foo')
23
+ assert(response.ok?)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,97 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Storefront
5
+ class AccountsSystemTest < Workarea::SystemTest
6
+ setup :set_user
7
+
8
+ def set_user
9
+ @user = create_user(
10
+ email: 'bcrouse@workarea.com',
11
+ password: 'W3bl1nc!',
12
+ name: 'Ben Crouse'
13
+ )
14
+ end
15
+
16
+ def test_signing_up
17
+ visit storefront.login_path
18
+
19
+ within '#signup_form' do
20
+ fill_in 'email', with: 'accounts-test@workarea.com'
21
+ fill_in 'password', with: 'W3bl1nc!'
22
+ check 'email_signup'
23
+ click_button t('workarea.storefront.users.create_account')
24
+ end
25
+
26
+ assert_current_path(storefront.users_account_path)
27
+ assert(page.has_content?('Success'))
28
+ end
29
+
30
+ def test_editing_account_details
31
+ set_current_user(@user)
32
+ visit storefront.edit_users_account_path
33
+
34
+ within '#info_form' do
35
+ fill_in 'email', with: 'bcrouse-change@workarea.com'
36
+ fill_in 'first_name', with: 'Benjamin'
37
+ fill_in 'last_name', with: 'Franklin'
38
+ fill_in 'password', with: 'Passw0rd!'
39
+ click_button t('workarea.storefront.forms.save')
40
+ end
41
+
42
+ assert(page.has_content?('Success'))
43
+ assert(page.has_content?('bcrouse-change@workarea.com'))
44
+ assert(page.has_content?('Benjamin Franklin'))
45
+ end
46
+
47
+ def test_account_dashboard
48
+ set_current_user(@user)
49
+
50
+ @user.auto_save_shipping_address(
51
+ first_name: 'Ben',
52
+ last_name: 'Crouse',
53
+ street: '22 S. 3rd St.',
54
+ street_2: 'Second Floor',
55
+ city: 'Philadelphia',
56
+ region: 'PA',
57
+ postal_code: '19106',
58
+ country: 'US',
59
+ phone_number: '2159251800'
60
+ )
61
+
62
+ @user.auto_save_billing_address(
63
+ first_name: 'Ben',
64
+ last_name: 'Crouse',
65
+ street: '1019 S. 47th St.',
66
+ city: 'Philadelphia',
67
+ region: 'PA',
68
+ postal_code: '19143',
69
+ country: 'US',
70
+ phone_number: '2159251800'
71
+ )
72
+
73
+ create_placed_order(id: 'ORDER_1234', user_id: @user.id)
74
+
75
+ fulfilled_order = create_placed_order(
76
+ id: 'ORDER_5678',
77
+ user_id: @user.id
78
+ )
79
+ shipped_item = fulfilled_order.items.first
80
+ fulfillment = Fulfillment.find(fulfilled_order.id)
81
+ fulfillment.ship_items('1Z', [
82
+ { 'id' => shipped_item.id, 'quantity' => shipped_item.quantity }
83
+ ])
84
+
85
+ visit storefront.users_account_path
86
+
87
+ assert(page.has_content?('ORDER_1234'))
88
+ assert(page.has_content?('Open'))
89
+ assert(page.has_content?('ORDER_5678'))
90
+ assert(page.has_content?('Shipped'))
91
+ assert(page.has_content?(t('workarea.storefront.orders.track_package')))
92
+ assert(page.has_content?('22 S. 3rd St.'))
93
+ assert(page.has_content?('1019 S. 47th St.'))
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,60 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Storefront
5
+ class AddressesSystemTest < Workarea::SystemTest
6
+ setup :set_user
7
+
8
+ def set_user
9
+ create_user(
10
+ email: 'bcrouse@workarea.com',
11
+ password: 'W3bl1nc!'
12
+ )
13
+ end
14
+
15
+ def test_managing_addresses
16
+ visit storefront.login_path
17
+
18
+ within '#login_form' do
19
+ fill_in 'email', with: 'bcrouse@workarea.com'
20
+ fill_in 'password', with: 'W3bl1nc!'
21
+ click_button t('workarea.storefront.users.login')
22
+ end
23
+
24
+ visit storefront.users_account_path
25
+
26
+ click_link t('workarea.storefront.users.add_address')
27
+
28
+ within '#address_form' do
29
+ fill_in 'address[first_name]', with: 'Ben'
30
+ fill_in 'address[last_name]', with: 'Crouse'
31
+ fill_in 'address[street]', with: '12 N. 3rd St.'
32
+ fill_in 'address[city]', with: 'Philadelphia'
33
+ select 'Pennsylvania', from: 'address_region_select'
34
+ fill_in 'address[postal_code]', with: '19106'
35
+ fill_in 'address[phone_number]', with: '2159251800'
36
+ click_button t('workarea.storefront.forms.save')
37
+ end
38
+
39
+ assert(page.has_content?('Success'))
40
+ assert(page.has_content?('12 N. 3rd St.'))
41
+
42
+ click_link t('workarea.storefront.forms.edit')
43
+
44
+ within '#address_form' do
45
+ fill_in 'address[street]', with: '22 S. 3rd St.'
46
+ fill_in 'address[street_2]', with: 'Second Floor'
47
+ fill_in 'address[phone_number]', with: '5556667777'
48
+ click_button t('workarea.storefront.forms.save')
49
+ end
50
+
51
+ assert(page.has_content?('Success'))
52
+ assert(page.has_content?('22 S. 3rd St.'))
53
+ assert(page.has_content?('Second Floor'))
54
+
55
+ click_button t('workarea.storefront.forms.delete')
56
+ assert(page.has_no_content?('22 S. 3rd St.'))
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,725 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Storefront
5
+ class AnalyticsSystemTest < Workarea::SystemTest
6
+ include Storefront::SystemTest
7
+
8
+ setup :set_products
9
+ setup :set_category
10
+ setup :set_search_settings
11
+
12
+ def set_products
13
+ @products = [
14
+ create_product(
15
+ id: 'PROD1',
16
+ name: 'Test Product 1',
17
+ variants: [{ sku: 'SKU1', regular: 10.to_m }],
18
+ filters: { 'Size' => 'Medium', 'Color' => 'Blue' }
19
+ ),
20
+ create_product(
21
+ id: 'PROD2',
22
+ name: 'Test Product 2',
23
+ variants: [{ sku: 'SKU2', regular: 12.to_m }],
24
+ filters: {
25
+ 'Size' => ['Medium', 'Small'],
26
+ 'Color' => ['Blue', 'Green']
27
+ }
28
+ )
29
+ ]
30
+ end
31
+
32
+ def set_category
33
+ @category = create_category(
34
+ name: 'Test Category',
35
+ product_ids: [@products.second.id, @products.first.id]
36
+ )
37
+ end
38
+
39
+ def set_search_settings
40
+ update_search_settings
41
+ end
42
+
43
+ def test_announcing_category_view_event
44
+ visit storefront.category_path(@category)
45
+
46
+ click_link 'Green (1)'
47
+ click_link 'Medium (1)'
48
+
49
+ events = find_analytics_events(for_event: 'categoryView')
50
+
51
+ assert_equal(1, events.count)
52
+ payload = events.first['arguments'].first
53
+
54
+ assert_equal('Test Category', payload['name'])
55
+ assert_equal('featured', payload['sort'])
56
+ assert_equal(1, payload['page'])
57
+ assert_equal(['Green'], payload['filters']['color'])
58
+ assert_equal(['Medium'], payload['filters']['size'])
59
+ assert_page_view
60
+
61
+ wait_for_xhr
62
+ insights = Metrics::CategoryByDay.first
63
+ assert_equal(@category.id.to_s, insights.category_id)
64
+ assert_equal(1, insights.views)
65
+ end
66
+
67
+ def test_announcing_search_results_view_event
68
+ visit storefront.search_path(q: 'test')
69
+
70
+ events = find_analytics_events(for_event: 'searchResultsView')
71
+ assert_equal(1, events.count)
72
+ payload = events.first['arguments'].first
73
+
74
+ assert_equal('test', payload['terms'])
75
+ assert_equal('relevance', payload['sort'])
76
+ assert_equal(1, payload['page'])
77
+ assert_equal({}, payload['filters'])
78
+ assert_equal(2, payload['totalResults'])
79
+ assert_page_view
80
+
81
+ click_link 'Green (1)'
82
+
83
+ events = find_analytics_events(for_event: 'searchResultsView')
84
+ assert_equal(1, events.count)
85
+ payload = events.first['arguments'].first
86
+
87
+ assert_equal(['Green'], payload['filters']['color'])
88
+ assert_equal(1, payload['totalResults'])
89
+ assert_page_view
90
+ end
91
+
92
+ def test_announcing_product_view_event
93
+ visit storefront.product_path(@products.first)
94
+
95
+ events = find_analytics_events(for_event: 'productView')
96
+ assert_equal(1, events.count)
97
+ payload = events.first['arguments'].first
98
+
99
+ assert_equal('PROD1', payload['id'])
100
+ assert_equal('Test Product 1', payload['name'])
101
+ assert_equal(false, payload['sale'])
102
+ assert_equal(10, payload['price'])
103
+ assert_equal('Test Category', payload['category'])
104
+ assert_page_view
105
+
106
+ wait_for_xhr
107
+ insights = Metrics::ProductByDay.first
108
+ assert_equal('PROD1', insights.product_id)
109
+ assert_equal(1, insights.views)
110
+ end
111
+
112
+ def test_announcing_product_list_event
113
+ visit storefront.category_path(@category)
114
+
115
+ events = find_analytics_events(for_event: 'productList')
116
+ assert_equal(1, events.count)
117
+ payload = events.first['arguments'].first
118
+
119
+ assert_equal('productList', payload['event'])
120
+ assert_equal('Test Category', payload['name'])
121
+ assert_equal(1, payload['page'])
122
+ assert_equal(20, payload['per_page'])
123
+ assert_equal(2, payload['impressions'].count)
124
+
125
+ first_impression = payload['impressions'].first
126
+ assert_equal('PROD2', first_impression['id'])
127
+ assert_equal('Test Product 2', first_impression['name'])
128
+ assert_equal(false, first_impression['sale'])
129
+ assert_equal(12, first_impression['price'])
130
+ assert_equal('Test Category', first_impression['category'])
131
+ assert_equal(0, first_impression['position'])
132
+
133
+ second_impression = payload['impressions'].second
134
+ assert_equal('PROD1', second_impression['id'])
135
+ assert_equal('Test Product 1', second_impression['name'])
136
+ assert_equal(false, second_impression['sale'])
137
+ assert_equal(10, second_impression['price'])
138
+ assert_equal('Test Category', second_impression['category'])
139
+ assert_equal(1, second_impression['position'])
140
+
141
+ assert_page_view
142
+ end
143
+
144
+ def test_announcing_product_click_event
145
+ visit storefront.category_path(@category)
146
+
147
+ disable_dom_events
148
+ within '.product-summary__name', match: :first do
149
+ click_link 'Test Product 2'
150
+ end
151
+
152
+ events = find_analytics_events(for_event: 'productClick')
153
+ assert_equal(1, events.count)
154
+ payload = events.first['arguments'].first
155
+
156
+ assert_equal('PROD2', payload['id'])
157
+ assert_equal('Test Product 2', payload['name'])
158
+ assert_equal(false, payload['sale'])
159
+ assert_equal(12, payload['price'])
160
+ assert_equal('Test Category', payload['category'])
161
+ assert_equal('Test Category', payload['list'])
162
+ assert_equal(0, payload['position'])
163
+ assert_page_view
164
+ end
165
+
166
+ def test_announcing_product_click_event_search_type_ahead
167
+ @products.each { |p| Search::Storefront::Product.new(p).save }
168
+ visit storefront.root_path
169
+ disable_dom_events
170
+
171
+ page.evaluate_script('$("#storefront_search").categorizedAutocomplete("search", "test");')
172
+
173
+ find('li', text: 'Test Product 1').click
174
+
175
+ events = find_analytics_events(for_event: 'productClick')
176
+ assert_equal(1, events.count)
177
+ payload = events.first['arguments'].first
178
+
179
+ assert_equal('PROD1', payload['id'])
180
+ assert_equal('Test Product 1', payload['name'])
181
+ assert_equal(false, payload['sale'])
182
+ assert_equal(10, payload['price'])
183
+ end
184
+
185
+ def test_announcing_add_to_cart_event
186
+ visit storefront.product_path(@products.second)
187
+
188
+ fill_in 'quantity', with: '3'
189
+ click_button t('workarea.storefront.products.add_to_cart')
190
+
191
+ events = find_analytics_events(for_event: 'addToCart')
192
+ assert_equal(1, events.count)
193
+ payload = events.first['arguments'].first
194
+
195
+ assert_equal('PROD2', payload['id'])
196
+ assert_equal('Test Product 2', payload['name'])
197
+ assert_equal(false, payload['sale'])
198
+ assert_equal(12, payload['price'])
199
+ assert_equal('Test Category', payload['category'])
200
+ assert_equal('3', payload['quantity'])
201
+ assert_page_view
202
+ end
203
+
204
+ def test_announcing_update_cart_item_event
205
+ visit storefront.product_path(@products.first)
206
+
207
+ fill_in 'quantity', with: '3'
208
+ click_button t('workarea.storefront.products.add_to_cart')
209
+ assert(page.has_content?('Success'))
210
+
211
+ visit storefront.cart_path
212
+
213
+ disable_dom_events
214
+ fill_in 'quantity', with: '1'
215
+
216
+ events = find_analytics_events(for_event: 'updateCartItem')
217
+ assert_equal(1, events.count)
218
+ payload = events.first['arguments'].first
219
+
220
+ assert(payload['id'].present?)
221
+ assert_equal('PROD1', payload['product_id'])
222
+ assert_equal('Test Product 1', payload['product_name'])
223
+ assert_equal('SKU1', payload['sku'])
224
+ assert_equal({}, payload['options'])
225
+ assert_equal(10, payload['price'])
226
+ assert_equal(3, payload['quantity'])
227
+ assert_equal('Test Category', payload['category'])
228
+ assert_equal(3, payload['from'])
229
+ assert_equal('1', payload['to'])
230
+ assert_page_view
231
+ end
232
+
233
+ def test_announcing_remove_from_cart_event
234
+ visit storefront.product_path(@products.second)
235
+
236
+ click_button t('workarea.storefront.products.add_to_cart')
237
+ click_link t('workarea.storefront.carts.view_cart')
238
+
239
+ disable_dom_events
240
+ click_button t('workarea.storefront.carts.remove')
241
+
242
+ events = find_analytics_events(for_event: 'removeFromCart')
243
+ assert_equal(1, events.count)
244
+ payload = events.first['arguments'].first
245
+
246
+ assert(payload['id'].present?)
247
+ assert_equal('PROD2', payload['product_id'])
248
+ assert_equal('Test Product 2', payload['product_name'])
249
+ assert_equal('SKU2', payload['sku'])
250
+ assert_equal({}, payload['options'])
251
+ assert_equal(12, payload['price'])
252
+ assert_equal(1, payload['quantity'])
253
+ assert_equal('Test Category', payload['category'])
254
+ assert_page_view
255
+ end
256
+
257
+ def test_announcing_add_to_cart_confirmation_event
258
+ visit storefront.product_path(@products.first)
259
+ click_button t('workarea.storefront.products.add_to_cart')
260
+
261
+ events = find_analytics_events(for_event: 'addToCartConfirmation')
262
+ assert_equal(1, events.count)
263
+ payload = events.first['arguments'].first
264
+
265
+ assert(payload['id'].present?)
266
+ assert_equal('PROD1', payload['product_id'])
267
+ assert_equal('Test Product 1', payload['product_name'])
268
+ assert_equal('SKU1', payload['sku'])
269
+ assert_equal({}, payload['options'])
270
+ assert_equal(10, payload['price'])
271
+ assert_equal(1, payload['quantity'])
272
+ assert_equal('Test Category', payload['category'])
273
+ assert_page_view
274
+ end
275
+
276
+ def test_announcing_cart_view_event
277
+ visit storefront.product_path(@products.first)
278
+ fill_in 'quantity', with: '2'
279
+ click_button t('workarea.storefront.products.add_to_cart')
280
+
281
+ visit storefront.product_path(@products.second)
282
+ fill_in 'quantity', with: '3'
283
+ click_button t('workarea.storefront.products.add_to_cart')
284
+
285
+ visit storefront.cart_path
286
+
287
+ events = find_analytics_events(for_event: 'cartView')
288
+ assert_equal(1, events.count)
289
+ payload = events.first['arguments'].first
290
+
291
+ assert_equal(Workarea.config.site_name, payload['site_name'])
292
+ assert(payload['id'].present?)
293
+ assert_equal([], payload['promo_codes'])
294
+ assert_nil(payload['shipping_service'])
295
+ assert_equal(0, payload['shipping_total'])
296
+ assert_equal(0, payload['tax_total'])
297
+ assert_equal(56, payload['total_price'])
298
+ assert_equal([], payload['tenders'])
299
+ assert_equal(2, payload['items'].count)
300
+
301
+ first_item = payload['items'].first
302
+ assert(first_item['id'].present?)
303
+ assert_equal('PROD2', first_item['product_id'])
304
+ assert_equal('Test Product 2', first_item['product_name'])
305
+ assert_equal('SKU2', first_item['sku'])
306
+ assert_equal({}, first_item['options'])
307
+ assert_equal(12, first_item['price'])
308
+ assert_equal(3, first_item['quantity'])
309
+ assert_equal('Test Category', first_item['category'])
310
+
311
+ second_item = payload['items'].second
312
+ assert(second_item['id'].present?)
313
+ assert_equal('PROD1', second_item['product_id'])
314
+ assert_equal('Test Product 1', second_item['product_name'])
315
+ assert_equal('SKU1', second_item['sku'])
316
+ assert_equal({}, second_item['options'])
317
+ assert_equal(10, second_item['price'])
318
+ assert_equal(2, second_item['quantity'])
319
+ assert_equal('Test Category', second_item['category'])
320
+
321
+ assert_page_view
322
+ end
323
+
324
+ def test_announcing_checkout_addresses_view_event
325
+ setup_checkout_specs
326
+ add_user_data
327
+ start_user_checkout
328
+
329
+ visit storefront.checkout_addresses_path
330
+
331
+ events = find_analytics_events(for_event: 'checkoutAddressesView')
332
+ assert_equal(1, events.count)
333
+ payload = events.first['arguments'].first
334
+
335
+ assert_equal(Workarea.config.site_name, payload['site_name'])
336
+ assert(payload['id'].present?)
337
+ assert_equal([], payload['promo_codes'])
338
+ assert_equal('Ground', payload['shipping_service'])
339
+ assert_equal(7, payload['shipping_total'])
340
+ assert_equal(0.84, payload['tax_total'])
341
+ assert_equal(12.84, payload['total_price'])
342
+ assert_equal([], payload['tenders'])
343
+ assert_equal(1, payload['items'].count)
344
+
345
+ order_item = payload['items'].first
346
+ assert(order_item['id'].present?)
347
+ assert_equal('INT_PRODUCT', order_item['product_id'])
348
+ assert_equal('Integration Product', order_item['product_name'])
349
+ assert_equal('SKU', order_item['sku'])
350
+ assert_equal({}, order_item['options'])
351
+ assert_equal(5, order_item['price'])
352
+ assert_equal(1, order_item['quantity'])
353
+ assert_nil(order_item['category'])
354
+
355
+ assert_page_view
356
+ end
357
+
358
+ def test_announcing_checkout_shipping_view_event
359
+ setup_checkout_specs
360
+ add_user_data
361
+ start_user_checkout
362
+
363
+ visit storefront.checkout_shipping_path
364
+
365
+ events = find_analytics_events(for_event: 'checkoutShippingView')
366
+ assert_equal(1, events.count)
367
+ payload = events.first['arguments'].first
368
+
369
+ assert_equal(Workarea.config.site_name, payload['site_name'])
370
+ assert(payload['id'].present?)
371
+ assert_equal([], payload['promo_codes'])
372
+ assert_equal('Ground', payload['shipping_service'])
373
+ assert_equal(7, payload['shipping_total'])
374
+ assert_equal(0.84, payload['tax_total'])
375
+ assert_equal(12.84, payload['total_price'])
376
+ assert_equal([], payload['tenders'])
377
+ assert_equal(1, payload['items'].count)
378
+
379
+ order_item = payload['items'].first
380
+ assert(order_item['id'].present?)
381
+ assert_equal('INT_PRODUCT', order_item['product_id'])
382
+ assert_equal('Integration Product', order_item['product_name'])
383
+ assert_equal('SKU', order_item['sku'])
384
+ assert_equal({}, order_item['options'])
385
+ assert_equal(5, order_item['price'])
386
+ assert_equal(1, order_item['quantity'])
387
+ assert_nil(order_item['category'])
388
+
389
+ assert_page_view
390
+ end
391
+
392
+ def test_announcing_checkout_shipping_service_selected_event
393
+ setup_checkout_specs
394
+ add_user_data
395
+ start_user_checkout
396
+
397
+ create_shipping_service(
398
+ name: 'Overnight',
399
+ tax_code: '001',
400
+ rates: [{ price: 20.to_m }]
401
+ )
402
+
403
+ visit storefront.checkout_shipping_path
404
+
405
+ choose "shipping_service_Overnight"
406
+
407
+ events = find_analytics_events(for_event: 'checkoutShippingServiceSelected')
408
+ assert_equal(1, events.count)
409
+ payload = events.first['arguments'].first
410
+
411
+ assert_equal('Overnight', payload['name'])
412
+ assert_equal(20, payload['price'])
413
+
414
+ assert_page_view
415
+ end
416
+
417
+ def test_announcing_checkout_payment_view_event
418
+ setup_checkout_specs
419
+ add_user_data
420
+ start_user_checkout
421
+
422
+ visit storefront.checkout_payment_path
423
+
424
+ events = find_analytics_events(for_event: 'checkoutPaymentView')
425
+ assert_equal(1, events.count)
426
+ payload = events.first['arguments'].first
427
+
428
+ assert_equal(Workarea.config.site_name, payload['site_name'])
429
+ assert(payload['id'].present?)
430
+ assert_equal([], payload['promo_codes'])
431
+ assert_equal('Ground', payload['shipping_service'])
432
+ assert_equal(7, payload['shipping_total'])
433
+ assert_equal(0.84, payload['tax_total'])
434
+ assert_equal(12.84, payload['total_price'])
435
+ assert_equal([], payload['tenders'])
436
+ assert_equal(1, payload['items'].count)
437
+
438
+ order_item = payload['items'].first
439
+ assert(order_item['id'].present?)
440
+ assert_equal('INT_PRODUCT', order_item['product_id'])
441
+ assert_equal('Integration Product', order_item['product_name'])
442
+ assert_equal('SKU', order_item['sku'])
443
+ assert_equal({}, order_item['options'])
444
+ assert_equal(5, order_item['price'])
445
+ assert_equal(1, order_item['quantity'])
446
+ assert_nil(order_item['category'])
447
+
448
+ assert_page_view
449
+ end
450
+
451
+ def test_announcing_checkout_order_placed_event
452
+ setup_checkout_specs
453
+ add_user_data
454
+ start_user_checkout
455
+
456
+ click_button t('workarea.storefront.checkouts.place_order')
457
+
458
+ events = find_analytics_events(for_event: 'checkoutOrderPlaced')
459
+ assert_equal(1, events.count)
460
+ payload = events.first['arguments'].first
461
+
462
+ assert_equal(Workarea.config.site_name, payload['site_name'])
463
+ assert(payload['id'].present?)
464
+ assert_equal([], payload['promo_codes'])
465
+ assert_equal('Ground', payload['shipping_service'])
466
+ assert_equal(7, payload['shipping_total'])
467
+ assert_equal(0.84, payload['tax_total'])
468
+ assert_equal(12.84, payload['total_price'])
469
+ assert_equal(['credit_card'], payload['tenders'])
470
+ assert_equal(1, payload['items'].count)
471
+
472
+ order_item = payload['items'].first
473
+ assert(order_item['id'].present?)
474
+ assert_equal('INT_PRODUCT', order_item['product_id'])
475
+ assert_equal('Integration Product', order_item['product_name'])
476
+ assert_equal('SKU', order_item['sku'])
477
+ assert_equal({}, order_item['options'])
478
+ assert_equal(5, order_item['price'])
479
+ assert_equal(1, order_item['quantity'])
480
+ assert_nil(order_item['category'])
481
+
482
+ assert_page_view
483
+ end
484
+
485
+ def test_announcing_email_signup_event
486
+ visit storefront.root_path
487
+
488
+ fill_in 'footer_email_signup_field', with: 'foo@bar.com'
489
+
490
+ disable_dom_events
491
+ click_button t('workarea.storefront.users.join')
492
+
493
+ events = find_analytics_events(for_event: 'emailSignup')
494
+ assert_equal(1, events.count)
495
+
496
+ assert_page_view
497
+ end
498
+
499
+ def test_announcing_checkout_login_event
500
+ setup_checkout_specs
501
+ add_user_data
502
+
503
+ visit storefront.checkout_path
504
+
505
+ disable_dom_events
506
+ click_link t('workarea.storefront.users.login')
507
+
508
+ events = find_analytics_events(for_event: 'checkoutLogin')
509
+ assert_equal(1, events.count)
510
+ assert_page_view
511
+ end
512
+
513
+ def test_announcing_checkout_signup_event
514
+ setup_checkout_specs
515
+ add_user_data
516
+ start_guest_checkout
517
+
518
+ fill_in_email
519
+ fill_in_shipping_address
520
+ click_button t('workarea.storefront.checkouts.continue_to_shipping')
521
+
522
+ click_button t('workarea.storefront.checkouts.continue_to_payment')
523
+
524
+ fill_in_credit_card
525
+ click_button t('workarea.storefront.checkouts.place_order')
526
+
527
+ fill_in 'password', with: 'W3bl1nc!'
528
+
529
+ disable_dom_events
530
+ click_button t('workarea.storefront.users.create_account')
531
+
532
+ events = find_analytics_events(for_event: 'checkoutSignup')
533
+ assert_equal(1, events.count)
534
+
535
+ assert_page_view
536
+ end
537
+
538
+ def test_announcing_login_event
539
+ visit storefront.login_path
540
+
541
+ assert_page_view
542
+ within '#login_form' do
543
+ fill_in 'email', with: 'bcrouse@workarea.com'
544
+ fill_in 'password', with: 'W3bl1nc!'
545
+
546
+ disable_dom_events
547
+ click_button t('workarea.storefront.users.login')
548
+ end
549
+
550
+ events = find_analytics_events(for_event: 'login')
551
+ assert_equal(1, events.count)
552
+
553
+ assert_page_view
554
+ end
555
+
556
+ def test_announcing_forgot_password_event
557
+ visit storefront.forgot_password_path
558
+
559
+ within '#forgot_password_form' do
560
+ fill_in 'email', with: 'bcrouse@workarea.com'
561
+
562
+ disable_dom_events
563
+ click_button t('workarea.storefront.forms.send')
564
+ end
565
+
566
+ events = find_analytics_events(for_event: 'forgotPassword')
567
+ assert_equal(1, events.count)
568
+
569
+ assert_page_view
570
+ end
571
+
572
+ def test_announcing_signup_event
573
+ visit storefront.login_path
574
+
575
+ within '#signup_form' do
576
+ fill_in 'email', with: 'bcrouse@workarea.com'
577
+ fill_in 'password', with: 'W3bl1nc!'
578
+
579
+ disable_dom_events
580
+ click_button t('workarea.storefront.users.create_account')
581
+ end
582
+
583
+ events = find_analytics_events(for_event: 'signup')
584
+ assert_equal(1, events.count)
585
+
586
+ assert_page_view
587
+ end
588
+
589
+ def test_announcing_primary_navigation_click_event
590
+ taxon = create_taxon(name: 'First Level', url: '/first/level')
591
+ create_menu(taxon: taxon)
592
+
593
+ visit storefront.root_path
594
+
595
+ disable_dom_events
596
+ click_link 'First Level'
597
+
598
+ events = find_analytics_events(for_event: 'primaryNavigationClick')
599
+ assert_equal(1, events.count)
600
+ payload = events.first['arguments'].first
601
+
602
+ assert_equal('First Level', payload['name'])
603
+ assert_equal('/first/level', payload['url'])
604
+ end
605
+
606
+ def test_announcing_checkout_edit_event
607
+ setup_checkout_specs
608
+ add_user_data
609
+ start_guest_checkout
610
+
611
+ fill_in_email
612
+ fill_in_shipping_address
613
+ click_button t('workarea.storefront.checkouts.continue_to_shipping')
614
+
615
+ disable_dom_events
616
+ click_link t('workarea.storefront.forms.edit')
617
+
618
+ events = find_analytics_events(for_event: 'checkoutEdit')
619
+ assert_equal(1, events.count)
620
+ payload = events.first['arguments'].first
621
+ assert_equal('addresses', payload['type'])
622
+ end
623
+
624
+ def test_announcing_validation_errors
625
+ setup_checkout_specs
626
+ add_user_data
627
+ start_guest_checkout
628
+
629
+ fill_in_email
630
+ fill_in_shipping_address
631
+ click_button t('workarea.storefront.checkouts.continue_to_shipping')
632
+
633
+ click_button t('workarea.storefront.checkouts.continue_to_payment')
634
+
635
+ fill_in_credit_card
636
+ fill_in 'credit_card[number]', with: '2'
637
+ click_button t('workarea.storefront.checkouts.place_order')
638
+
639
+ assert_current_path(storefront.checkout_place_order_path)
640
+ validation_events = find_analytics_events(for_event: 'validationError')
641
+ assert_equal(1, validation_events.count)
642
+ payload = validation_events.first['arguments'].first
643
+ assert_equal('payment', payload['model'])
644
+ end
645
+
646
+ def test_announcing_flash_messages
647
+ setup_checkout_specs
648
+ add_user_data
649
+ start_guest_checkout
650
+
651
+ fill_in_email
652
+ fill_in_shipping_address
653
+ click_button t('workarea.storefront.checkouts.continue_to_shipping')
654
+
655
+ flash_events = find_analytics_events(for_event: 'flashMessage')
656
+ assert_equal(1, flash_events.count)
657
+ payload = flash_events.first['arguments'].first
658
+ assert_equal('success', payload['type'])
659
+ end
660
+
661
+ def test_search_search_tracking
662
+ visit storefront.search_path(q: 'test')
663
+ insights = Metrics::SearchByDay.first
664
+
665
+ assert_equal('test', insights.query_id)
666
+ assert_equal(1, insights.searches)
667
+ assert_equal(2, insights.total_results)
668
+ click_link 'Test Product 1', match: :first
669
+
670
+ visit storefront.search_path(q: 'test')
671
+ assert_equal(2, insights.reload.searches)
672
+ assert_equal(2, insights.total_results)
673
+ end
674
+
675
+ def test_filter_tracking
676
+ # deprecated
677
+ end
678
+
679
+ def test_announcing_content_block_view
680
+ create_content(
681
+ name: 'home_page',
682
+ blocks: [
683
+ {
684
+ type_id: 'html',
685
+ data: { html: 'Home Page Content Block' }
686
+ }
687
+ ]
688
+ )
689
+
690
+ visit storefront.root_path
691
+ assert(page.has_content?('Home Page Content Block'))
692
+
693
+ events = find_analytics_events(for_event: 'contentBlockDisplay')
694
+
695
+ assert_equal(1, events.count)
696
+ payload = events.first['arguments'].first
697
+
698
+ assert_equal('html', payload['type'])
699
+ assert_equal(0, payload['position'])
700
+ assert_equal('Home Page Content Block', payload['data']['html'])
701
+ end
702
+
703
+ private
704
+
705
+ def find_analytics_events(for_event: nil)
706
+ all_events = page.evaluate_script('WORKAREA.analytics.events')
707
+
708
+ if for_event.blank?
709
+ all_events
710
+ else
711
+ all_events.select { |e| e['name'] == for_event }
712
+ end
713
+ end
714
+
715
+ def assert_page_view
716
+ page_view = find_analytics_events(for_event: 'pageView')
717
+ assert_equal(1, page_view.count)
718
+ end
719
+
720
+ def disable_dom_events
721
+ page.execute_script('WORKAREA.analytics.disableDomEvents();')
722
+ end
723
+ end
724
+ end
725
+ end