solidus_backend 2.10.5 → 2.11.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_backend might be problematic. Click here for more details.

Files changed (233) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/backend.js +4 -1
  3. data/app/assets/javascripts/spree/backend/adjustments.js +1 -1
  4. data/app/assets/javascripts/spree/backend/admin.js +18 -29
  5. data/app/assets/javascripts/spree/backend/collections/states.js +1 -1
  6. data/app/assets/javascripts/spree/backend/components/selectable_table.js +5 -0
  7. data/app/assets/javascripts/spree/backend/components/selectable_table/return_items.js +5 -0
  8. data/app/assets/javascripts/spree/backend/components/selectable_table/summary.js +7 -0
  9. data/app/assets/javascripts/spree/backend/components/sortable_table.js +31 -25
  10. data/app/assets/javascripts/spree/backend/models/order.js +3 -3
  11. data/app/assets/javascripts/spree/backend/models/payment.js +1 -1
  12. data/app/assets/javascripts/spree/backend/models/shipment.js +1 -1
  13. data/app/assets/javascripts/spree/backend/models/stock_item.js +1 -1
  14. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js +2 -2
  15. data/app/assets/javascripts/spree/backend/option_value_picker.js +2 -2
  16. data/app/assets/javascripts/spree/backend/product_picker.js +2 -2
  17. data/app/assets/javascripts/spree/backend/routes.js +40 -21
  18. data/app/assets/javascripts/spree/backend/shipments.js +5 -5
  19. data/app/assets/javascripts/spree/backend/shipping_methods/stock_locations_picker.js +18 -0
  20. data/app/assets/javascripts/spree/backend/stock_management.js +4 -2
  21. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js +2 -2
  22. data/app/assets/javascripts/spree/backend/taxons.js +3 -3
  23. data/app/assets/javascripts/spree/backend/templates/index.js +2 -0
  24. data/app/assets/javascripts/spree/backend/templates/orders/customer_details/autocomplete.hbs +2 -2
  25. data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +5 -1
  26. data/app/assets/javascripts/spree/backend/templates/tables/return_item_sum_amount.hbs +7 -0
  27. data/app/assets/javascripts/spree/backend/templates/tables/selectable_label.hbs +6 -0
  28. data/app/assets/javascripts/spree/backend/user_picker.js +3 -4
  29. data/app/assets/javascripts/spree/backend/variant_autocomplete.js +2 -2
  30. data/app/assets/javascripts/spree/backend/views/cart/empty_cart_button.js +2 -2
  31. data/app/assets/javascripts/spree/backend/views/index.js +4 -0
  32. data/app/assets/javascripts/spree/backend/views/order/address.js +1 -1
  33. data/app/assets/javascripts/spree/backend/views/order/customer_select.js +2 -3
  34. data/app/assets/javascripts/spree/backend/views/order/details_adjustments.js +4 -1
  35. data/app/assets/javascripts/spree/backend/views/stock/edit_stock_item_row.js +4 -0
  36. data/app/assets/javascripts/spree/backend/views/tables/return_items.js +9 -0
  37. data/app/assets/javascripts/spree/backend/views/tables/selectable_table.js +70 -0
  38. data/app/assets/javascripts/spree/backend/views/tables/selectable_table/sum_return_item_amount.js +32 -0
  39. data/app/assets/javascripts/spree/backend/views/tables/selectable_table/summary.js +45 -0
  40. data/app/assets/stylesheets/spree/backend/components/_navigation.scss +4 -5
  41. data/app/assets/stylesheets/spree/backend/sections/_orders.scss +5 -1
  42. data/app/assets/stylesheets/spree/backend/sections/_style_guide.scss +4 -0
  43. data/app/assets/stylesheets/spree/backend/shared/_forms.scss +1 -0
  44. data/app/controllers/spree/admin/base_controller.rb +6 -0
  45. data/app/controllers/spree/admin/cancellations_controller.rb +2 -0
  46. data/app/controllers/spree/admin/customer_returns_controller.rb +4 -4
  47. data/app/controllers/spree/admin/images_controller.rb +2 -1
  48. data/app/controllers/spree/admin/orders/customer_details_controller.rb +2 -0
  49. data/app/controllers/spree/admin/orders_controller.rb +7 -2
  50. data/app/controllers/spree/admin/payments_controller.rb +3 -1
  51. data/app/controllers/spree/admin/product_properties_controller.rb +1 -1
  52. data/app/controllers/spree/admin/products_controller.rb +18 -24
  53. data/app/controllers/spree/admin/promotion_codes_controller.rb +9 -4
  54. data/app/controllers/spree/admin/refunds_controller.rb +19 -0
  55. data/app/controllers/spree/admin/resource_controller.rb +27 -7
  56. data/app/controllers/spree/admin/return_authorizations_controller.rb +1 -1
  57. data/app/controllers/spree/admin/root_controller.rb +1 -1
  58. data/app/controllers/spree/admin/search_controller.rb +1 -2
  59. data/app/controllers/spree/admin/stock_items_controller.rb +6 -5
  60. data/app/controllers/spree/admin/stock_locations_controller.rb +4 -0
  61. data/app/controllers/spree/admin/stock_movements_controller.rb +7 -0
  62. data/app/controllers/spree/admin/taxons_controller.rb +12 -1
  63. data/app/controllers/spree/admin/users/api_key_controller.rb +29 -0
  64. data/app/controllers/spree/admin/users_controller.rb +37 -20
  65. data/app/controllers/spree/admin/variants_controller.rb +4 -2
  66. data/app/controllers/spree/admin/zones_controller.rb +1 -1
  67. data/app/helpers/spree/admin/base_helper.rb +4 -0
  68. data/app/helpers/spree/admin/customer_returns_helper.rb +1 -1
  69. data/app/helpers/spree/admin/navigation_helper.rb +1 -1
  70. data/app/helpers/spree/admin/orders_helper.rb +8 -4
  71. data/app/helpers/spree/admin/stock_movements_helper.rb +8 -4
  72. data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +2 -3
  73. data/app/views/spree/admin/images/index.html.erb +25 -21
  74. data/app/views/spree/admin/option_types/_option_value_fields.html.erb +8 -1
  75. data/app/views/spree/admin/option_types/edit.html.erb +3 -1
  76. data/app/views/spree/admin/orders/customer_details/_form.html.erb +13 -13
  77. data/app/views/spree/admin/orders/index.html.erb +23 -13
  78. data/app/views/spree/admin/payment_methods/_form.html.erb +7 -2
  79. data/app/views/spree/admin/payments/index.html.erb +3 -1
  80. data/app/views/spree/admin/prices/_master_variant_table.html.erb +3 -3
  81. data/app/views/spree/admin/prices/_table.html.erb +3 -3
  82. data/app/views/spree/admin/product_properties/_product_property_fields.html.erb +7 -2
  83. data/app/views/spree/admin/product_properties/index.html.erb +14 -2
  84. data/app/views/spree/admin/products/_form.html.erb +13 -2
  85. data/app/views/spree/admin/products/index.html.erb +1 -1
  86. data/app/views/spree/admin/promotion_codes/index.html.erb +1 -1
  87. data/app/views/spree/admin/promotions/_actions.html.erb +1 -1
  88. data/app/views/spree/admin/promotions/_activations_new.html.erb +1 -1
  89. data/app/views/spree/admin/promotions/_rules.html.erb +1 -1
  90. data/app/views/spree/admin/promotions/edit.html.erb +2 -2
  91. data/app/views/spree/admin/promotions/index.html.erb +12 -5
  92. data/app/views/spree/admin/return_authorizations/_form.html.erb +3 -10
  93. data/app/views/spree/admin/return_authorizations/index.html.erb +1 -1
  94. data/app/views/spree/admin/search/users.json.jbuilder +15 -1
  95. data/app/views/spree/admin/shared/_address.html.erb +6 -6
  96. data/app/views/spree/admin/shared/_address_form.html.erb +15 -8
  97. data/app/views/spree/admin/shared/_order_submenu.html.erb +4 -4
  98. data/app/views/spree/admin/shared/_payments_tabs.html.erb +1 -1
  99. data/app/views/spree/admin/shared/_settings_checkout_tabs.html.erb +5 -5
  100. data/app/views/spree/admin/shared/_settings_sub_menu.html.erb +6 -6
  101. data/app/views/spree/admin/shared/_shipping_tabs.html.erb +3 -3
  102. data/app/views/spree/admin/shared/_taxes_tabs.html.erb +2 -2
  103. data/app/views/spree/admin/shared/preference_fields/_encrypted_string.html.erb +12 -0
  104. data/app/views/spree/admin/shipping_methods/_form.html.erb +18 -0
  105. data/app/views/spree/admin/stock_items/_stock_management.html.erb +1 -1
  106. data/app/views/spree/admin/stock_locations/edit.html.erb +1 -1
  107. data/app/views/spree/admin/stock_locations/index.html.erb +3 -1
  108. data/app/views/spree/admin/stock_movements/index.html.erb +30 -1
  109. data/app/views/spree/admin/stores/_form.html.erb +6 -0
  110. data/app/views/spree/admin/style_guide/topics/tables/_building_tables.html.erb +27 -3
  111. data/app/views/spree/admin/tax_categories/_form.html.erb +1 -0
  112. data/app/views/spree/admin/users/_form.html.erb +2 -2
  113. data/app/views/spree/admin/users/_tabs.html.erb +1 -1
  114. data/app/views/spree/admin/users/edit.html.erb +4 -4
  115. data/app/views/spree/admin/users/items.html.erb +5 -3
  116. data/app/views/spree/admin/users/orders.html.erb +5 -3
  117. data/app/views/spree/admin/variants/_table_filter.html.erb +1 -1
  118. data/app/views/spree/admin/variants/index.html.erb +2 -2
  119. data/config/initializers/form_builder.rb +2 -2
  120. data/lib/spree/backend/engine.rb +0 -2
  121. data/lib/spree/backend_configuration.rb +14 -1
  122. data/solidus_backend.gemspec +4 -4
  123. metadata +21 -120
  124. data/app/assets/javascripts/spree/backend/returns/return_item_selection.js +0 -35
  125. data/script/rails +0 -10
  126. data/spec/controllers/spree/admin/base_controller_spec.rb +0 -26
  127. data/spec/controllers/spree/admin/cancellations_controller_spec.rb +0 -83
  128. data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -235
  129. data/spec/controllers/spree/admin/locale_controller_spec.rb +0 -45
  130. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +0 -18
  131. data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -128
  132. data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -408
  133. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -95
  134. data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -194
  135. data/spec/controllers/spree/admin/prices_controller_spec.rb +0 -45
  136. data/spec/controllers/spree/admin/product_properties_controller_spec.rb +0 -71
  137. data/spec/controllers/spree/admin/products_controller_spec.rb +0 -270
  138. data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -23
  139. data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +0 -32
  140. data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -36
  141. data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -122
  142. data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -35
  143. data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -137
  144. data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -201
  145. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -291
  146. data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -29
  147. data/spec/controllers/spree/admin/root_controller_spec.rb +0 -43
  148. data/spec/controllers/spree/admin/search_controller_spec.rb +0 -106
  149. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -16
  150. data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -52
  151. data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -44
  152. data/spec/controllers/spree/admin/store_credits_controller_spec.rb +0 -311
  153. data/spec/controllers/spree/admin/users_controller_spec.rb +0 -287
  154. data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -71
  155. data/spec/features/admin/configuration/payment_methods_spec.rb +0 -176
  156. data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -126
  157. data/spec/features/admin/configuration/stock_locations_spec.rb +0 -54
  158. data/spec/features/admin/configuration/store_spec.rb +0 -62
  159. data/spec/features/admin/configuration/tax_categories_spec.rb +0 -58
  160. data/spec/features/admin/configuration/tax_rates_spec.rb +0 -31
  161. data/spec/features/admin/configuration/taxonomies_spec.rb +0 -61
  162. data/spec/features/admin/configuration/zones_spec.rb +0 -41
  163. data/spec/features/admin/homepage_spec.rb +0 -86
  164. data/spec/features/admin/javascript_format_money_spec.rb +0 -22
  165. data/spec/features/admin/locale_spec.rb +0 -34
  166. data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -55
  167. data/spec/features/admin/orders/adjustments_spec.rb +0 -130
  168. data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -45
  169. data/spec/features/admin/orders/cancelling_inventory_spec.rb +0 -50
  170. data/spec/features/admin/orders/customer_details_spec.rb +0 -203
  171. data/spec/features/admin/orders/customer_returns_spec.rb +0 -41
  172. data/spec/features/admin/orders/line_items_spec.rb +0 -52
  173. data/spec/features/admin/orders/listing_spec.rb +0 -186
  174. data/spec/features/admin/orders/log_entries_spec.rb +0 -56
  175. data/spec/features/admin/orders/new_order_spec.rb +0 -379
  176. data/spec/features/admin/orders/new_refund_spec.rb +0 -35
  177. data/spec/features/admin/orders/order_details_spec.rb +0 -591
  178. data/spec/features/admin/orders/payments_spec.rb +0 -330
  179. data/spec/features/admin/orders/return_authorizations_spec.rb +0 -56
  180. data/spec/features/admin/orders/return_payment_state_spec.rb +0 -65
  181. data/spec/features/admin/orders/risk_analysis_spec.rb +0 -49
  182. data/spec/features/admin/orders/shipments_spec.rb +0 -145
  183. data/spec/features/admin/payments/store_credits_spec.rb +0 -23
  184. data/spec/features/admin/products/edit/images_spec.rb +0 -76
  185. data/spec/features/admin/products/edit/products_spec.rb +0 -92
  186. data/spec/features/admin/products/edit/taxons_spec.rb +0 -57
  187. data/spec/features/admin/products/edit/variants_spec.rb +0 -63
  188. data/spec/features/admin/products/option_types_spec.rb +0 -116
  189. data/spec/features/admin/products/pricing_spec.rb +0 -127
  190. data/spec/features/admin/products/products_spec.rb +0 -348
  191. data/spec/features/admin/products/properties_spec.rb +0 -141
  192. data/spec/features/admin/products/stock_management_spec.rb +0 -101
  193. data/spec/features/admin/products/variant_spec.rb +0 -89
  194. data/spec/features/admin/promotion_adjustments_spec.rb +0 -286
  195. data/spec/features/admin/promotions/option_value_rule_spec.rb +0 -90
  196. data/spec/features/admin/promotions/product_rule_spec.rb +0 -35
  197. data/spec/features/admin/promotions/promotion_categories_spec.rb +0 -83
  198. data/spec/features/admin/promotions/promotion_code_batches_spec.rb +0 -37
  199. data/spec/features/admin/promotions/promotion_code_spec.rb +0 -31
  200. data/spec/features/admin/promotions/promotion_spec.rb +0 -52
  201. data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -76
  202. data/spec/features/admin/promotions/user_rule_spec.rb +0 -42
  203. data/spec/features/admin/reimbursements_spec.rb +0 -18
  204. data/spec/features/admin/store_credits_spec.rb +0 -132
  205. data/spec/features/admin/stores_spec.rb +0 -37
  206. data/spec/features/admin/style_guide_spec.rb +0 -14
  207. data/spec/features/admin/taxons_spec.rb +0 -90
  208. data/spec/features/admin/users_spec.rb +0 -412
  209. data/spec/fixtures/files/ror_ringer.jpeg +0 -0
  210. data/spec/helpers/admin/base_helper_spec.rb +0 -49
  211. data/spec/helpers/admin/navigation_helper_spec.rb +0 -139
  212. data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -29
  213. data/spec/helpers/admin/store_credit_events_helper_spec.rb +0 -97
  214. data/spec/helpers/promotion_rules_helper_spec.rb +0 -14
  215. data/spec/javascripts/fixtures/_boot.html.erb +0 -8
  216. data/spec/javascripts/fixtures/number_with_currency/with_currency_select.html.erb +0 -3
  217. data/spec/javascripts/fixtures/number_with_currency/without_select.html.erb +0 -3
  218. data/spec/javascripts/format_money_spec.js +0 -48
  219. data/spec/javascripts/spec_helper.js +0 -13
  220. data/spec/javascripts/support/show_errors.js +0 -8
  221. data/spec/javascripts/support/with_translations.js +0 -11
  222. data/spec/javascripts/translation_spec.js +0 -58
  223. data/spec/javascripts/views/number_with_currency_spec.js +0 -72
  224. data/spec/lib/spree/backend_configuration/menu_item_spec.rb +0 -17
  225. data/spec/lib/spree/backend_configuration_spec.rb +0 -22
  226. data/spec/spec_helper.rb +0 -123
  227. data/spec/support/appear_before_matcher.rb +0 -10
  228. data/spec/support/feature/base_feature_helper.rb +0 -17
  229. data/spec/support/feature/order_feature_helper.rb +0 -27
  230. data/spec/teaspoon_env.rb +0 -51
  231. data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
  232. data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
  233. data/spec/views/spree/admin/shared/navigation_footer_spec.rb +0 -67
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe "Log entries", type: :feature do
6
- stub_authorization!
7
-
8
- let!(:payment) { create(:payment) }
9
-
10
- context "with a successful log entry" do
11
- before do
12
- response = ActiveMerchant::Billing::Response.new(
13
- true,
14
- "Transaction successful",
15
- transid: "ABCD1234"
16
- )
17
-
18
- payment.log_entries.create(
19
- details: response.to_yaml
20
- )
21
- end
22
-
23
- it "shows a successful attempt" do
24
- visit spree.admin_order_payments_path(payment.order)
25
- click_on payment.number
26
-
27
- within("#listing_log_entries") do
28
- expect(page).to have_content("Transaction successful")
29
- end
30
- end
31
- end
32
-
33
- context "with a failed log entry" do
34
- before do
35
- response = ActiveMerchant::Billing::Response.new(
36
- false,
37
- "Transaction failed",
38
- transid: "ABCD1234"
39
- )
40
-
41
- payment.log_entries.create(
42
- source: payment.source,
43
- details: response.to_yaml
44
- )
45
- end
46
-
47
- it "shows a failed attempt" do
48
- visit spree.admin_order_payments_path(payment.order)
49
- click_on payment.number
50
-
51
- within("#listing_log_entries") do
52
- expect(page).to have_content("Transaction failed")
53
- end
54
- end
55
- end
56
- end
@@ -1,379 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe "New Order", type: :feature do
6
- include OrderFeatureHelper
7
-
8
- let!(:product) { create(:product_in_stock) }
9
- let!(:state) { create(:state, state_code: 'CA') }
10
- let!(:store) { create(:store) }
11
- let!(:user) { create(:user, ship_address: create(:address), bill_address: create(:address)) }
12
- let!(:payment_method) { create(:check_payment_method) }
13
- let!(:shipping_method) { create(:shipping_method, cost: 0.0) }
14
-
15
- stub_authorization!
16
-
17
- before do
18
- visit spree.admin_path
19
- click_on "Orders"
20
- click_on "New Order"
21
- end
22
-
23
- it "does check if you have a billing address before letting you add shipments" do
24
- click_on "Shipments"
25
- expect(page).to have_content 'Please fill in customer info'
26
- expect(current_path).to eql(spree.edit_admin_order_customer_path(Spree::Order.last))
27
- end
28
-
29
- it "default line item quantity is 1", js: true do
30
- within ".line-items" do
31
- expect(page).to have_field 'quantity', with: '1'
32
- end
33
- end
34
-
35
- it "completes new order succesfully without using the cart", js: true do
36
- add_line_item product.name
37
-
38
- click_on "Customer"
39
-
40
- within "#select-customer" do
41
- targetted_select2_search user.email, from: "#s2id_customer_search"
42
- end
43
-
44
- expect(page).to have_checked_field('order_use_billing')
45
- fill_in_address
46
- click_on "Update"
47
-
48
- click_on "Payments"
49
- click_on "Update"
50
-
51
- expect(current_path).to eql(spree.admin_order_payments_path(Spree::Order.last))
52
-
53
- click_on "Confirm"
54
- click_on "Complete Order"
55
-
56
- expect(current_path).to eql(spree.edit_admin_order_path(Spree::Order.last))
57
-
58
- click_on "Payments"
59
- click_icon "capture"
60
-
61
- click_on "Shipments"
62
- click_on "Ship"
63
-
64
- within '.carton-state' do
65
- expect(page).to have_content('Shipped')
66
- end
67
- end
68
-
69
- it 'can create split payments', js: true do
70
- add_line_item product.name
71
-
72
- click_on "Customer"
73
-
74
- within "#select-customer" do
75
- targetted_select2_search user.email, from: "#s2id_customer_search"
76
- end
77
-
78
- expect(page).to have_checked_field('order_use_billing')
79
- fill_in_address
80
- click_on "Update"
81
-
82
- click_on "Payments"
83
- fill_in "Amount", with: '10.00'
84
- click_on 'Update'
85
-
86
- click_on 'New Payment'
87
- fill_in "Amount", with: '29.98'
88
- click_on 'Update'
89
-
90
- expect(page).to have_content("$10.00")
91
- expect(page).to have_content("$29.98")
92
- end
93
-
94
- context "adding new item to the order", js: true do
95
- it "inventory items show up just fine and are also registered as shipments" do
96
- add_line_item product.name
97
-
98
- within(".line-items") do
99
- expect(page).to have_content(product.name)
100
- end
101
-
102
- click_on "Customer"
103
-
104
- within "#select-customer" do
105
- targetted_select2_search user.email, from: "#s2id_customer_search"
106
- end
107
-
108
- expect(page).to have_checked_field('order_use_billing')
109
- fill_in_address
110
- click_on "Update"
111
-
112
- click_on "Shipments"
113
-
114
- within(".stock-contents") do
115
- expect(page).to have_content(product.name)
116
- end
117
- end
118
- end
119
-
120
- # Regression test for https://github.com/spree/spree/issues/3958
121
- context "without a delivery step", js: true do
122
- before do
123
- allow(Spree::Order).to receive_messages checkout_step_names: [:address, :payment, :confirm, :complete]
124
- end
125
-
126
- it "can still see line items" do
127
- add_line_item product.name
128
-
129
- within(".line-items") do
130
- within(".line-item-name") do
131
- expect(page).to have_content(product.name)
132
- end
133
- within(".line-item-qty-show") do
134
- expect(page).to have_content("1")
135
- end
136
- within(".line-item-price") do
137
- expect(page).to have_content(product.price)
138
- end
139
- end
140
- end
141
- end
142
-
143
- # Regression test for https://github.com/spree/spree/issues/3336
144
- context "start by customer address" do
145
- it "completes order fine", js: true do
146
- click_on "Customer"
147
-
148
- within "#select-customer" do
149
- targetted_select2_search user.email, from: "#s2id_customer_search"
150
- end
151
-
152
- expect(page).to have_checked_field('order_use_billing')
153
- fill_in_address
154
- click_on "Update"
155
-
156
- # Automatically redirected to Shipments page
157
- within '.no-objects-found' do
158
- click_on "Cart"
159
- end
160
-
161
- add_line_item product.name
162
-
163
- click_on "Payments"
164
- click_on "Update"
165
-
166
- within(".additional-info") do
167
- expect(page).to have_content("Confirm")
168
- end
169
- end
170
- end
171
-
172
- context "when changing customer", :js do
173
- let!(:other_user) { create :user, bill_address: bill_address }
174
-
175
- context "when one customer address have only textual state" do
176
- let(:country) { create :country, iso: "IT" }
177
- let(:bill_address) { create :address, country: country, state: nil, state_name: "Veneto" }
178
-
179
- it "changes the bill address state accordingly" do
180
- click_on "Customer"
181
-
182
- within "#select-customer" do
183
- targetted_select2_search user.email, from: "#s2id_customer_search"
184
- end
185
-
186
- expect(find("select#order_bill_address_attributes_state_id").value).to eq user.bill_address.state_id.to_s
187
-
188
- within "#select-customer" do
189
- targetted_select2_search other_user.email, from: "#s2id_customer_search"
190
- end
191
-
192
- expect(find("select#order_bill_address_attributes_state_id", visible: false).value).to eq ""
193
- expect(find("#order_bill_address_attributes_state_name").value).to eq other_user.bill_address.state_name
194
- end
195
- end
196
-
197
- context "when customers have same country but different state" do
198
- let(:different_state) { Spree::State.where.not(id: user.bill_address.state_id).first }
199
-
200
- let(:bill_address) { create :address, country: user.bill_address.country, state: different_state }
201
-
202
- it "changes the bill address state accordingly" do
203
- click_on "Customer"
204
-
205
- within "#select-customer" do
206
- targetted_select2_search user.email, from: "#s2id_customer_search"
207
- end
208
-
209
- expect(find('#order_bill_address_attributes_state_id').value).to eq user.bill_address.state_id.to_s
210
-
211
- within "#select-customer" do
212
- targetted_select2_search other_user.email, from: "#s2id_customer_search"
213
- end
214
-
215
- expect(find('#order_bill_address_attributes_state_id').value).to eq other_user.bill_address.state_id.to_s
216
- end
217
- end
218
- end
219
-
220
- # Regression test for https://github.com/spree/spree/issues/5327
221
- context "customer with default credit card", js: true do
222
- let!(:credit_card) { create(:credit_card, user: user) }
223
-
224
- before do
225
- user.wallet.add(credit_card)
226
- end
227
-
228
- it "transitions to delivery not to complete" do
229
- add_line_item product.name
230
-
231
- expect(page).to have_css('.line-item')
232
-
233
- click_link "Customer"
234
- targetted_select2 user.email, from: "#s2id_customer_search"
235
- click_button "Update"
236
- expect(page).to have_css('.order-state', text: 'Delivery')
237
- end
238
- end
239
-
240
- context "customer with attempted XSS", js: true do
241
- let(:xss_string) { %(<script>throw("XSS")</script>) }
242
- before do
243
- user.update!(email: xss_string)
244
- end
245
- it "displays the user's email escaped without executing" do
246
- click_on "Customer"
247
- targetted_select2_search user.email, from: "#s2id_customer_search"
248
- expect(page).to have_field("Customer E-Mail", with: xss_string)
249
- end
250
- end
251
-
252
- context 'with a checkout_zone set as the country of Canada' do
253
- let!(:canada) { create(:country, iso: 'CA', states_required: true) }
254
- let!(:canada_state) { create(:state, country: canada) }
255
- let!(:checkout_zone) { create(:zone, name: 'Checkout Zone', countries: [canada]) }
256
-
257
- before do
258
- Spree::Country.update_all(states_required: true)
259
- stub_spree_preferences(checkout_zone: checkout_zone.name)
260
- end
261
-
262
- context 'and default_country_iso of the United States' do
263
- before do
264
- stub_spree_preferences(default_country_iso: Spree::Country.find_by!(iso: 'US').iso)
265
- end
266
-
267
- it 'the shipping address country select includes only options for Canada' do
268
- visit spree.new_admin_order_path
269
- click_link 'Customer'
270
- within '#shipping' do
271
- expect(page).to have_select(
272
- 'Country',
273
- options: ['Canada']
274
- )
275
- end
276
- end
277
-
278
- it 'does not show any shipping address state' do
279
- visit spree.new_admin_order_path
280
- click_link 'Customer'
281
- within '#shipping' do
282
- expect(page).to have_select(
283
- 'State',
284
- disabled: true,
285
- visible: false,
286
- options: ['']
287
- )
288
- end
289
- end
290
-
291
- it 'the billing address country select includes only options for Canada' do
292
- visit spree.new_admin_order_path
293
- click_link 'Customer'
294
- within '#billing' do
295
- expect(page).to have_select(
296
- 'Country',
297
- options: ['Canada']
298
- )
299
- end
300
- end
301
-
302
- it 'does not show any billing address state' do
303
- visit spree.new_admin_order_path
304
- click_link 'Customer'
305
- within '#billing' do
306
- expect(page).to have_select(
307
- 'State',
308
- disabled: true,
309
- visible: false,
310
- options: ['']
311
- )
312
- end
313
- end
314
- end
315
-
316
- context 'and default_country_iso of Canada' do
317
- before do
318
- stub_spree_preferences(default_country_iso: Spree::Country.find_by!(iso: 'CA').iso)
319
- end
320
-
321
- it 'defaults the shipping address country to Canada' do
322
- visit spree.new_admin_order_path
323
- click_link 'Customer'
324
- within '#shipping' do
325
- expect(page).to have_select(
326
- 'Country',
327
- selected: 'Canada',
328
- options: ['Canada']
329
- )
330
- end
331
- end
332
-
333
- it 'shows relevant shipping address states' do
334
- visit spree.new_admin_order_path
335
- click_link 'Customer'
336
- within '#shipping' do
337
- expect(page).to have_select(
338
- 'State',
339
- options: [''] + canada.states.map(&:name)
340
- )
341
- end
342
- end
343
-
344
- it 'defaults the billing address country to Canada' do
345
- visit spree.new_admin_order_path
346
- click_link 'Customer'
347
- within '#billing' do
348
- expect(page).to have_select(
349
- 'Country',
350
- selected: 'Canada',
351
- options: ['Canada']
352
- )
353
- end
354
- end
355
-
356
- it 'shows relevant billing address states' do
357
- visit spree.new_admin_order_path
358
- click_link 'Customer'
359
- within '#billing' do
360
- expect(page).to have_select(
361
- 'State',
362
- options: [''] + canada.states.map(&:name)
363
- )
364
- end
365
- end
366
- end
367
- end
368
-
369
- def fill_in_address
370
- fill_in "First Name", with: "John 99"
371
- fill_in "Last Name", with: "Doe"
372
- fill_in "Street Address", with: "100 first lane"
373
- fill_in "Street Address (cont'd)", with: "#101"
374
- fill_in "City", with: "Bethesda"
375
- fill_in "Zip Code", with: "20170"
376
- select state.name, from: "State"
377
- fill_in "Phone", with: "123-456-7890"
378
- end
379
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe 'New Refund creation', :js do
6
- stub_authorization!
7
-
8
- let(:order) { create :order_ready_to_ship }
9
- let(:payment) { order.payments.first }
10
- let(:amount) { '10.99' }
11
- let!(:reason) { create :refund_reason }
12
-
13
- it 'creates a new refund' do
14
- visit spree.new_admin_order_payment_refund_path(order, payment)
15
- expect(page).not_to have_selector 'td', text: amount
16
- within '.new_refund' do
17
- fill_in 'refund_amount', with: amount
18
- select reason.name, from: 'Reason'
19
- click_button 'Refund'
20
- end
21
- expect(page).to have_content 'Refund has been successfully created!'
22
- expect(page).to have_selector 'td', text: amount
23
- end
24
-
25
- it 'disables the button at submit' do
26
- visit spree.new_admin_order_payment_refund_path(order, payment)
27
- page.execute_script "$('form').submit(function(e) { e.preventDefault()})"
28
- within '.new_refund' do
29
- fill_in 'refund_amount', with: amount
30
- select reason.name, from: 'Reason'
31
- click_button 'Refund'
32
- expect(page).to have_button('Refund', disabled: true)
33
- end
34
- end
35
- end