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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/backend.js +4 -1
- data/app/assets/javascripts/spree/backend/adjustments.js +1 -1
- data/app/assets/javascripts/spree/backend/admin.js +18 -29
- data/app/assets/javascripts/spree/backend/collections/states.js +1 -1
- data/app/assets/javascripts/spree/backend/components/selectable_table.js +5 -0
- data/app/assets/javascripts/spree/backend/components/selectable_table/return_items.js +5 -0
- data/app/assets/javascripts/spree/backend/components/selectable_table/summary.js +7 -0
- data/app/assets/javascripts/spree/backend/components/sortable_table.js +31 -25
- data/app/assets/javascripts/spree/backend/models/order.js +3 -3
- data/app/assets/javascripts/spree/backend/models/payment.js +1 -1
- data/app/assets/javascripts/spree/backend/models/shipment.js +1 -1
- data/app/assets/javascripts/spree/backend/models/stock_item.js +1 -1
- data/app/assets/javascripts/spree/backend/option_type_autocomplete.js +2 -2
- data/app/assets/javascripts/spree/backend/option_value_picker.js +2 -2
- data/app/assets/javascripts/spree/backend/product_picker.js +2 -2
- data/app/assets/javascripts/spree/backend/routes.js +40 -21
- data/app/assets/javascripts/spree/backend/shipments.js +5 -5
- data/app/assets/javascripts/spree/backend/shipping_methods/stock_locations_picker.js +18 -0
- data/app/assets/javascripts/spree/backend/stock_management.js +4 -2
- data/app/assets/javascripts/spree/backend/taxon_autocomplete.js +2 -2
- data/app/assets/javascripts/spree/backend/taxons.js +3 -3
- data/app/assets/javascripts/spree/backend/templates/index.js +2 -0
- data/app/assets/javascripts/spree/backend/templates/orders/customer_details/autocomplete.hbs +2 -2
- data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +5 -1
- data/app/assets/javascripts/spree/backend/templates/tables/return_item_sum_amount.hbs +7 -0
- data/app/assets/javascripts/spree/backend/templates/tables/selectable_label.hbs +6 -0
- data/app/assets/javascripts/spree/backend/user_picker.js +3 -4
- data/app/assets/javascripts/spree/backend/variant_autocomplete.js +2 -2
- data/app/assets/javascripts/spree/backend/views/cart/empty_cart_button.js +2 -2
- data/app/assets/javascripts/spree/backend/views/index.js +4 -0
- data/app/assets/javascripts/spree/backend/views/order/address.js +1 -1
- data/app/assets/javascripts/spree/backend/views/order/customer_select.js +2 -3
- data/app/assets/javascripts/spree/backend/views/order/details_adjustments.js +4 -1
- data/app/assets/javascripts/spree/backend/views/stock/edit_stock_item_row.js +4 -0
- data/app/assets/javascripts/spree/backend/views/tables/return_items.js +9 -0
- data/app/assets/javascripts/spree/backend/views/tables/selectable_table.js +70 -0
- data/app/assets/javascripts/spree/backend/views/tables/selectable_table/sum_return_item_amount.js +32 -0
- data/app/assets/javascripts/spree/backend/views/tables/selectable_table/summary.js +45 -0
- data/app/assets/stylesheets/spree/backend/components/_navigation.scss +4 -5
- data/app/assets/stylesheets/spree/backend/sections/_orders.scss +5 -1
- data/app/assets/stylesheets/spree/backend/sections/_style_guide.scss +4 -0
- data/app/assets/stylesheets/spree/backend/shared/_forms.scss +1 -0
- data/app/controllers/spree/admin/base_controller.rb +6 -0
- data/app/controllers/spree/admin/cancellations_controller.rb +2 -0
- data/app/controllers/spree/admin/customer_returns_controller.rb +4 -4
- data/app/controllers/spree/admin/images_controller.rb +2 -1
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +2 -0
- data/app/controllers/spree/admin/orders_controller.rb +7 -2
- data/app/controllers/spree/admin/payments_controller.rb +3 -1
- data/app/controllers/spree/admin/product_properties_controller.rb +1 -1
- data/app/controllers/spree/admin/products_controller.rb +18 -24
- data/app/controllers/spree/admin/promotion_codes_controller.rb +9 -4
- data/app/controllers/spree/admin/refunds_controller.rb +19 -0
- data/app/controllers/spree/admin/resource_controller.rb +27 -7
- data/app/controllers/spree/admin/return_authorizations_controller.rb +1 -1
- data/app/controllers/spree/admin/root_controller.rb +1 -1
- data/app/controllers/spree/admin/search_controller.rb +1 -2
- data/app/controllers/spree/admin/stock_items_controller.rb +6 -5
- data/app/controllers/spree/admin/stock_locations_controller.rb +4 -0
- data/app/controllers/spree/admin/stock_movements_controller.rb +7 -0
- data/app/controllers/spree/admin/taxons_controller.rb +12 -1
- data/app/controllers/spree/admin/users/api_key_controller.rb +29 -0
- data/app/controllers/spree/admin/users_controller.rb +37 -20
- data/app/controllers/spree/admin/variants_controller.rb +4 -2
- data/app/controllers/spree/admin/zones_controller.rb +1 -1
- data/app/helpers/spree/admin/base_helper.rb +4 -0
- data/app/helpers/spree/admin/customer_returns_helper.rb +1 -1
- data/app/helpers/spree/admin/navigation_helper.rb +1 -1
- data/app/helpers/spree/admin/orders_helper.rb +8 -4
- data/app/helpers/spree/admin/stock_movements_helper.rb +8 -4
- data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +2 -3
- data/app/views/spree/admin/images/index.html.erb +25 -21
- data/app/views/spree/admin/option_types/_option_value_fields.html.erb +8 -1
- data/app/views/spree/admin/option_types/edit.html.erb +3 -1
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +13 -13
- data/app/views/spree/admin/orders/index.html.erb +23 -13
- data/app/views/spree/admin/payment_methods/_form.html.erb +7 -2
- data/app/views/spree/admin/payments/index.html.erb +3 -1
- data/app/views/spree/admin/prices/_master_variant_table.html.erb +3 -3
- data/app/views/spree/admin/prices/_table.html.erb +3 -3
- data/app/views/spree/admin/product_properties/_product_property_fields.html.erb +7 -2
- data/app/views/spree/admin/product_properties/index.html.erb +14 -2
- data/app/views/spree/admin/products/_form.html.erb +13 -2
- data/app/views/spree/admin/products/index.html.erb +1 -1
- data/app/views/spree/admin/promotion_codes/index.html.erb +1 -1
- data/app/views/spree/admin/promotions/_actions.html.erb +1 -1
- data/app/views/spree/admin/promotions/_activations_new.html.erb +1 -1
- data/app/views/spree/admin/promotions/_rules.html.erb +1 -1
- data/app/views/spree/admin/promotions/edit.html.erb +2 -2
- data/app/views/spree/admin/promotions/index.html.erb +12 -5
- data/app/views/spree/admin/return_authorizations/_form.html.erb +3 -10
- data/app/views/spree/admin/return_authorizations/index.html.erb +1 -1
- data/app/views/spree/admin/search/users.json.jbuilder +15 -1
- data/app/views/spree/admin/shared/_address.html.erb +6 -6
- data/app/views/spree/admin/shared/_address_form.html.erb +15 -8
- data/app/views/spree/admin/shared/_order_submenu.html.erb +4 -4
- data/app/views/spree/admin/shared/_payments_tabs.html.erb +1 -1
- data/app/views/spree/admin/shared/_settings_checkout_tabs.html.erb +5 -5
- data/app/views/spree/admin/shared/_settings_sub_menu.html.erb +6 -6
- data/app/views/spree/admin/shared/_shipping_tabs.html.erb +3 -3
- data/app/views/spree/admin/shared/_taxes_tabs.html.erb +2 -2
- data/app/views/spree/admin/shared/preference_fields/_encrypted_string.html.erb +12 -0
- data/app/views/spree/admin/shipping_methods/_form.html.erb +18 -0
- data/app/views/spree/admin/stock_items/_stock_management.html.erb +1 -1
- data/app/views/spree/admin/stock_locations/edit.html.erb +1 -1
- data/app/views/spree/admin/stock_locations/index.html.erb +3 -1
- data/app/views/spree/admin/stock_movements/index.html.erb +30 -1
- data/app/views/spree/admin/stores/_form.html.erb +6 -0
- data/app/views/spree/admin/style_guide/topics/tables/_building_tables.html.erb +27 -3
- data/app/views/spree/admin/tax_categories/_form.html.erb +1 -0
- data/app/views/spree/admin/users/_form.html.erb +2 -2
- data/app/views/spree/admin/users/_tabs.html.erb +1 -1
- data/app/views/spree/admin/users/edit.html.erb +4 -4
- data/app/views/spree/admin/users/items.html.erb +5 -3
- data/app/views/spree/admin/users/orders.html.erb +5 -3
- data/app/views/spree/admin/variants/_table_filter.html.erb +1 -1
- data/app/views/spree/admin/variants/index.html.erb +2 -2
- data/config/initializers/form_builder.rb +2 -2
- data/lib/spree/backend/engine.rb +0 -2
- data/lib/spree/backend_configuration.rb +14 -1
- data/solidus_backend.gemspec +4 -4
- metadata +21 -120
- data/app/assets/javascripts/spree/backend/returns/return_item_selection.js +0 -35
- data/script/rails +0 -10
- data/spec/controllers/spree/admin/base_controller_spec.rb +0 -26
- data/spec/controllers/spree/admin/cancellations_controller_spec.rb +0 -83
- data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -235
- data/spec/controllers/spree/admin/locale_controller_spec.rb +0 -45
- data/spec/controllers/spree/admin/missing_products_controller_spec.rb +0 -18
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -128
- data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -408
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -95
- data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -194
- data/spec/controllers/spree/admin/prices_controller_spec.rb +0 -45
- data/spec/controllers/spree/admin/product_properties_controller_spec.rb +0 -71
- data/spec/controllers/spree/admin/products_controller_spec.rb +0 -270
- data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -23
- data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +0 -32
- data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -36
- data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -122
- data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -35
- data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -137
- data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -201
- data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -291
- data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -29
- data/spec/controllers/spree/admin/root_controller_spec.rb +0 -43
- data/spec/controllers/spree/admin/search_controller_spec.rb +0 -106
- data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -16
- data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -52
- data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -44
- data/spec/controllers/spree/admin/store_credits_controller_spec.rb +0 -311
- data/spec/controllers/spree/admin/users_controller_spec.rb +0 -287
- data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -71
- data/spec/features/admin/configuration/payment_methods_spec.rb +0 -176
- data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -126
- data/spec/features/admin/configuration/stock_locations_spec.rb +0 -54
- data/spec/features/admin/configuration/store_spec.rb +0 -62
- data/spec/features/admin/configuration/tax_categories_spec.rb +0 -58
- data/spec/features/admin/configuration/tax_rates_spec.rb +0 -31
- data/spec/features/admin/configuration/taxonomies_spec.rb +0 -61
- data/spec/features/admin/configuration/zones_spec.rb +0 -41
- data/spec/features/admin/homepage_spec.rb +0 -86
- data/spec/features/admin/javascript_format_money_spec.rb +0 -22
- data/spec/features/admin/locale_spec.rb +0 -34
- data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -55
- data/spec/features/admin/orders/adjustments_spec.rb +0 -130
- data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -45
- data/spec/features/admin/orders/cancelling_inventory_spec.rb +0 -50
- data/spec/features/admin/orders/customer_details_spec.rb +0 -203
- data/spec/features/admin/orders/customer_returns_spec.rb +0 -41
- data/spec/features/admin/orders/line_items_spec.rb +0 -52
- data/spec/features/admin/orders/listing_spec.rb +0 -186
- data/spec/features/admin/orders/log_entries_spec.rb +0 -56
- data/spec/features/admin/orders/new_order_spec.rb +0 -379
- data/spec/features/admin/orders/new_refund_spec.rb +0 -35
- data/spec/features/admin/orders/order_details_spec.rb +0 -591
- data/spec/features/admin/orders/payments_spec.rb +0 -330
- data/spec/features/admin/orders/return_authorizations_spec.rb +0 -56
- data/spec/features/admin/orders/return_payment_state_spec.rb +0 -65
- data/spec/features/admin/orders/risk_analysis_spec.rb +0 -49
- data/spec/features/admin/orders/shipments_spec.rb +0 -145
- data/spec/features/admin/payments/store_credits_spec.rb +0 -23
- data/spec/features/admin/products/edit/images_spec.rb +0 -76
- data/spec/features/admin/products/edit/products_spec.rb +0 -92
- data/spec/features/admin/products/edit/taxons_spec.rb +0 -57
- data/spec/features/admin/products/edit/variants_spec.rb +0 -63
- data/spec/features/admin/products/option_types_spec.rb +0 -116
- data/spec/features/admin/products/pricing_spec.rb +0 -127
- data/spec/features/admin/products/products_spec.rb +0 -348
- data/spec/features/admin/products/properties_spec.rb +0 -141
- data/spec/features/admin/products/stock_management_spec.rb +0 -101
- data/spec/features/admin/products/variant_spec.rb +0 -89
- data/spec/features/admin/promotion_adjustments_spec.rb +0 -286
- data/spec/features/admin/promotions/option_value_rule_spec.rb +0 -90
- data/spec/features/admin/promotions/product_rule_spec.rb +0 -35
- data/spec/features/admin/promotions/promotion_categories_spec.rb +0 -83
- data/spec/features/admin/promotions/promotion_code_batches_spec.rb +0 -37
- data/spec/features/admin/promotions/promotion_code_spec.rb +0 -31
- data/spec/features/admin/promotions/promotion_spec.rb +0 -52
- data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -76
- data/spec/features/admin/promotions/user_rule_spec.rb +0 -42
- data/spec/features/admin/reimbursements_spec.rb +0 -18
- data/spec/features/admin/store_credits_spec.rb +0 -132
- data/spec/features/admin/stores_spec.rb +0 -37
- data/spec/features/admin/style_guide_spec.rb +0 -14
- data/spec/features/admin/taxons_spec.rb +0 -90
- data/spec/features/admin/users_spec.rb +0 -412
- data/spec/fixtures/files/ror_ringer.jpeg +0 -0
- data/spec/helpers/admin/base_helper_spec.rb +0 -49
- data/spec/helpers/admin/navigation_helper_spec.rb +0 -139
- data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -29
- data/spec/helpers/admin/store_credit_events_helper_spec.rb +0 -97
- data/spec/helpers/promotion_rules_helper_spec.rb +0 -14
- data/spec/javascripts/fixtures/_boot.html.erb +0 -8
- data/spec/javascripts/fixtures/number_with_currency/with_currency_select.html.erb +0 -3
- data/spec/javascripts/fixtures/number_with_currency/without_select.html.erb +0 -3
- data/spec/javascripts/format_money_spec.js +0 -48
- data/spec/javascripts/spec_helper.js +0 -13
- data/spec/javascripts/support/show_errors.js +0 -8
- data/spec/javascripts/support/with_translations.js +0 -11
- data/spec/javascripts/translation_spec.js +0 -58
- data/spec/javascripts/views/number_with_currency_spec.js +0 -72
- data/spec/lib/spree/backend_configuration/menu_item_spec.rb +0 -17
- data/spec/lib/spree/backend_configuration_spec.rb +0 -22
- data/spec/spec_helper.rb +0 -123
- data/spec/support/appear_before_matcher.rb +0 -10
- data/spec/support/feature/base_feature_helper.rb +0 -17
- data/spec/support/feature/order_feature_helper.rb +0 -27
- data/spec/teaspoon_env.rb +0 -51
- data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
- data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
- 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
|