solidus_backend 2.10.3 → 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,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe "Cancelling + Resuming", type: :feature do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
let(:user) { build_stubbed(:user, id: 123, spree_api_key: 'fake') }
|
9
|
-
|
10
|
-
before do
|
11
|
-
allow(user).to receive(:has_spree_role?).and_return(true)
|
12
|
-
allow_any_instance_of(Spree::Admin::BaseController).to receive(:try_spree_current_user).and_return(user)
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:order) do
|
16
|
-
order = create(:order)
|
17
|
-
order.update_columns({
|
18
|
-
state: 'complete',
|
19
|
-
completed_at: Time.current
|
20
|
-
})
|
21
|
-
order
|
22
|
-
end
|
23
|
-
|
24
|
-
it "can cancel an order" do
|
25
|
-
visit spree.edit_admin_order_path(order.number)
|
26
|
-
click_button 'Cancel'
|
27
|
-
within(".additional-info") do
|
28
|
-
expect(find('dt#order_status + dd')).to have_content("Canceled")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context "with a cancelled order" do
|
33
|
-
before do
|
34
|
-
order.update_column(:state, 'canceled')
|
35
|
-
end
|
36
|
-
|
37
|
-
it "can resume an order" do
|
38
|
-
visit spree.edit_admin_order_path(order.number)
|
39
|
-
click_button 'Resume'
|
40
|
-
within(".additional-info") do
|
41
|
-
expect(find('dt#order_status + dd')).to have_content("Resumed")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe "Cancel items" do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
let!(:order) do
|
9
|
-
create(
|
10
|
-
:order_ready_to_ship,
|
11
|
-
number: "R100",
|
12
|
-
state: "complete",
|
13
|
-
line_items_count: 1
|
14
|
-
)
|
15
|
-
end
|
16
|
-
|
17
|
-
def visit_order
|
18
|
-
visit spree.admin_path
|
19
|
-
click_link "Orders"
|
20
|
-
within_row(1) do
|
21
|
-
click_link "R100"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context "when some items are cancelable" do
|
26
|
-
it "can cancel the item" do
|
27
|
-
visit_order
|
28
|
-
|
29
|
-
click_link 'Cancel Items'
|
30
|
-
|
31
|
-
within_row(1) do
|
32
|
-
check 'inventory_unit_ids[]'
|
33
|
-
end
|
34
|
-
|
35
|
-
click_button "Cancel Items"
|
36
|
-
expect(page).to have_content("Inventory canceled")
|
37
|
-
expect(page).to have_content("1 x Canceled")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
context "when all items are not cancelable" do
|
42
|
-
before { order.inventory_units.each(&:cancel!) }
|
43
|
-
|
44
|
-
it "does not display the link to cancel items" do
|
45
|
-
visit_order
|
46
|
-
|
47
|
-
expect(page).to have_no_content('Cancel Items')
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,203 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe "Customer Details", type: :feature, js: true do
|
6
|
-
include OrderFeatureHelper
|
7
|
-
|
8
|
-
stub_authorization!
|
9
|
-
|
10
|
-
let(:country) { create(:country, name: "Kangaland") }
|
11
|
-
let(:state) { create(:state, name: "Alabama", country: country) }
|
12
|
-
let!(:shipping_method) { create(:shipping_method) }
|
13
|
-
let!(:order) { create(:order, ship_address: ship_address, bill_address: bill_address, state: 'complete', completed_at: "2011-02-01 12:36:15") }
|
14
|
-
let!(:product) { create(:product_in_stock) }
|
15
|
-
|
16
|
-
# We need a unique name that will appear for the customer dropdown
|
17
|
-
let!(:ship_address) { create(:address, country: country, state: state, first_name: "Rumpelstiltskin") }
|
18
|
-
let!(:bill_address) { create(:address, country: country, state: state, first_name: "Rumpelstiltskin") }
|
19
|
-
|
20
|
-
let!(:user) { create(:user, email: 'foobar@example.com', ship_address: ship_address, bill_address: bill_address) }
|
21
|
-
|
22
|
-
context "brand new order" do
|
23
|
-
let(:quantity) { 1 }
|
24
|
-
|
25
|
-
before do
|
26
|
-
visit spree.admin_path
|
27
|
-
click_link "Orders"
|
28
|
-
click_link "New Order"
|
29
|
-
|
30
|
-
add_line_item product.name, quantity: quantity
|
31
|
-
|
32
|
-
expect(page).to have_css('.line-item')
|
33
|
-
click_link "Customer"
|
34
|
-
targetted_select2 "foobar@example.com", from: "#s2id_customer_search"
|
35
|
-
end
|
36
|
-
|
37
|
-
# Regression test for https://github.com/spree/spree/issues/3335 and https://github.com/spree/spree/issues/5317
|
38
|
-
it "associates a user when not using guest checkout" do
|
39
|
-
# 5317 - Address prefills using user's default.
|
40
|
-
expect(page).to have_field('First Name', with: user.bill_address.firstname)
|
41
|
-
expect(page).to have_field('Last Name', with: user.bill_address.lastname)
|
42
|
-
expect(page).to have_field('Street Address', with: user.bill_address.address1)
|
43
|
-
expect(page).to have_field("Street Address (cont'd)", with: user.bill_address.address2)
|
44
|
-
expect(page).to have_field('City', with: user.bill_address.city)
|
45
|
-
expect(page).to have_field('Zip Code', with: user.bill_address.zipcode)
|
46
|
-
expect(page).to have_select('Country', selected: "United States of America", visible: false)
|
47
|
-
expect(page).to have_select('State', selected: user.bill_address.state.name, visible: false)
|
48
|
-
expect(page).to have_field('Phone', with: user.bill_address.phone)
|
49
|
-
click_button "Update"
|
50
|
-
expect(Spree::Order.last.user).not_to be_nil
|
51
|
-
end
|
52
|
-
|
53
|
-
# Regression test for https://github.com/solidusio/solidus/pull/2176
|
54
|
-
it "does not reset guest checkout to true when returning to customer tab" do
|
55
|
-
click_button "Update"
|
56
|
-
click_link "Customer"
|
57
|
-
expect(find('#guest_checkout_true')).not_to be_checked
|
58
|
-
end
|
59
|
-
|
60
|
-
context "when required quantity is more than available" do
|
61
|
-
let(:quantity) { 11 }
|
62
|
-
let!(:product) { create(:product_not_backorderable) }
|
63
|
-
|
64
|
-
it "displays an error" do
|
65
|
-
click_button "Update"
|
66
|
-
expect(page).to have_content I18n.t('spree.insufficient_stock_for_order')
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
context "editing an order" do
|
72
|
-
before do
|
73
|
-
stub_spree_preferences(
|
74
|
-
default_country_iso: country.iso,
|
75
|
-
company: true
|
76
|
-
)
|
77
|
-
|
78
|
-
visit spree.admin_path
|
79
|
-
click_link "Orders"
|
80
|
-
within('table#listing_orders') { click_icon(:edit) }
|
81
|
-
end
|
82
|
-
|
83
|
-
context "selected country has no state" do
|
84
|
-
before { create(:country, iso: "BRA", name: "Brazil") }
|
85
|
-
|
86
|
-
it "changes state field to text input" do
|
87
|
-
click_link "Customer"
|
88
|
-
|
89
|
-
within("#billing") do
|
90
|
-
select "Brazil", from: "Country"
|
91
|
-
fill_in "order_bill_address_attributes_state_name", with: "Piaui"
|
92
|
-
end
|
93
|
-
|
94
|
-
click_button "Update"
|
95
|
-
expect(page).to have_content "Customer Details Updated"
|
96
|
-
click_link "Customer"
|
97
|
-
expect(page).to have_field("order_bill_address_attributes_state_name", with: "Piaui")
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
it "should be able to update customer details for an existing order" do
|
102
|
-
order.ship_address = create(:address)
|
103
|
-
order.save!
|
104
|
-
|
105
|
-
click_link "Customer"
|
106
|
-
within("#shipping") { fill_in_address }
|
107
|
-
within("#billing") { fill_in_address }
|
108
|
-
|
109
|
-
click_button "Update"
|
110
|
-
click_link "Customer"
|
111
|
-
|
112
|
-
# Regression test for https://github.com/spree/spree/issues/2950 and https://github.com/spree/spree/issues/2433
|
113
|
-
# This act should transition the state of the order as far as it will go too
|
114
|
-
within("#order_tab_summary") do
|
115
|
-
expect(find("dt#order_status + dd")).to have_content("Complete")
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
it "should show validation errors" do
|
120
|
-
order.update!(ship_address_id: nil)
|
121
|
-
click_link "Customer"
|
122
|
-
click_button "Update"
|
123
|
-
expect(page).to have_content("Shipping address first name can't be blank")
|
124
|
-
end
|
125
|
-
|
126
|
-
context "for an order in confirm state with a user" do
|
127
|
-
let(:user) { order.user }
|
128
|
-
|
129
|
-
before do
|
130
|
-
order.update_columns(
|
131
|
-
ship_address_id: ship_address.id,
|
132
|
-
bill_address_id: bill_address.id,
|
133
|
-
state: "confirm",
|
134
|
-
completed_at: nil
|
135
|
-
)
|
136
|
-
end
|
137
|
-
|
138
|
-
it "updating order email works" do
|
139
|
-
click_link "Customer"
|
140
|
-
fill_in "order_email", with: "newemail@example.com"
|
141
|
-
click_button "Update"
|
142
|
-
expect(page).to have_content 'Customer Details Updated'
|
143
|
-
click_link "Customer"
|
144
|
-
expect(page).to have_field 'Customer E-Mail', with: order.reload.email
|
145
|
-
within '#order_user_link' do
|
146
|
-
expect(page).to have_link user.email
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
context "country associated was removed" do
|
152
|
-
let(:brazil) { create(:country, iso: "BR", name: "Brazil") }
|
153
|
-
|
154
|
-
before do
|
155
|
-
order.bill_address.country.destroy
|
156
|
-
stub_spree_preferences(default_country_iso: brazil.iso)
|
157
|
-
end
|
158
|
-
|
159
|
-
it "sets default country when displaying form" do
|
160
|
-
click_link "Customer"
|
161
|
-
expect(page).to have_field("order_bill_address_attributes_country_id", with: brazil.id, visible: false)
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
# Regression test for https://github.com/spree/spree/issues/942
|
166
|
-
context "errors when no shipping methods are available" do
|
167
|
-
before do
|
168
|
-
Spree::ShippingMethod.delete_all
|
169
|
-
end
|
170
|
-
|
171
|
-
specify do
|
172
|
-
click_link "Customer"
|
173
|
-
# Need to fill in valid information so it passes validations
|
174
|
-
fill_in "order_ship_address_attributes_firstname", with: "John 99"
|
175
|
-
fill_in "order_ship_address_attributes_lastname", with: "Doe"
|
176
|
-
fill_in "order_ship_address_attributes_lastname", with: "Company"
|
177
|
-
fill_in "order_ship_address_attributes_address1", with: "100 first lane"
|
178
|
-
fill_in "order_ship_address_attributes_address2", with: "#101"
|
179
|
-
fill_in "order_ship_address_attributes_city", with: "Bethesda"
|
180
|
-
fill_in "order_ship_address_attributes_zipcode", with: "20170"
|
181
|
-
|
182
|
-
within("#shipping") do
|
183
|
-
select 'Alabama', from: "State"
|
184
|
-
end
|
185
|
-
|
186
|
-
fill_in "order_ship_address_attributes_phone", with: "123-456-7890"
|
187
|
-
click_button "Update"
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
def fill_in_address
|
193
|
-
fill_in "First Name", with: "John 99"
|
194
|
-
fill_in "Last Name", with: "Doe"
|
195
|
-
fill_in "Company", with: "Company"
|
196
|
-
fill_in "Street Address", with: "100 first lane"
|
197
|
-
fill_in "Street Address (cont'd)", with: "#101"
|
198
|
-
fill_in "City", with: "Bethesda"
|
199
|
-
fill_in "Zip Code", with: "20170"
|
200
|
-
select 'Alabama', from: "State"
|
201
|
-
fill_in "Phone", with: "123-456-7890"
|
202
|
-
end
|
203
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe 'Customer returns', type: :feature do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
context 'when the order has more than one line item' do
|
9
|
-
let(:order) { create :shipped_order, line_items_count: 2 }
|
10
|
-
|
11
|
-
def create_customer_return
|
12
|
-
find('#select-all').click
|
13
|
-
page.execute_script "$('select.add-item').val('receive')"
|
14
|
-
select 'NY Warehouse', from: 'Stock Location'
|
15
|
-
click_button 'Create'
|
16
|
-
end
|
17
|
-
|
18
|
-
before do
|
19
|
-
visit spree.new_admin_order_customer_return_path(order)
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'when creating a return with state "Received"' do
|
23
|
-
it 'marks the order as returned', :js do
|
24
|
-
create_customer_return
|
25
|
-
|
26
|
-
expect(page).to have_content 'Customer Return has been successfully created'
|
27
|
-
within 'dd.order-state' do
|
28
|
-
expect(page).to have_content 'Returned'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'disables the button at submit', :js do
|
34
|
-
page.execute_script "$('form').submit(function(e) { e.preventDefault()})"
|
35
|
-
|
36
|
-
create_customer_return
|
37
|
-
|
38
|
-
expect(page).to have_button("Create", disabled: true)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
# Tests for https://github.com/spree/spree/issues/3958's features
|
6
|
-
describe "Order Line Items", type: :feature, js: true do
|
7
|
-
stub_authorization!
|
8
|
-
|
9
|
-
before do
|
10
|
-
# Removing the delivery step causes the order page to render a different
|
11
|
-
# partial, called _line_items, which shows line items rather than shipments
|
12
|
-
allow(Spree::Order).to receive_messages checkout_step_names: [:address, :payment, :confirm, :complete]
|
13
|
-
end
|
14
|
-
|
15
|
-
let!(:order) do
|
16
|
-
order = create(:order_with_line_items, line_items_count: 1)
|
17
|
-
order.shipments.destroy_all
|
18
|
-
order
|
19
|
-
end
|
20
|
-
|
21
|
-
it "can edit a line item's quantity" do
|
22
|
-
visit spree.cart_admin_order_path(order)
|
23
|
-
within(".line-items") do
|
24
|
-
find(".edit-line-item").click
|
25
|
-
fill_in "quantity", with: 10
|
26
|
-
find(".save-line-item").click
|
27
|
-
end
|
28
|
-
within '.line-item-qty-show' do
|
29
|
-
expect(page).to have_content("10")
|
30
|
-
end
|
31
|
-
within '.line-item-total' do
|
32
|
-
expect(page).to have_content("$100.00")
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
it "can delete a line item" do
|
37
|
-
visit spree.cart_admin_order_path(order)
|
38
|
-
|
39
|
-
product_name = find(".line-items tr:nth-child(1) .line-item-name").text
|
40
|
-
|
41
|
-
within(".line-items") do
|
42
|
-
within_row(1) do
|
43
|
-
accept_alert do
|
44
|
-
find(".delete-line-item").click
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
expect(find('#order_total')).to have_content("$0.00")
|
50
|
-
expect(page).not_to have_content(product_name)
|
51
|
-
end
|
52
|
-
end
|
@@ -1,186 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe "Orders Listing", type: :feature, js: true do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
let!(:promotion) { create(:promotion_with_item_adjustment, code: "vnskseiw") }
|
9
|
-
let(:promotion_code) { promotion.codes.first }
|
10
|
-
|
11
|
-
before(:each) do
|
12
|
-
allow_any_instance_of(Spree::OrderInventory).to receive(:add_to_shipment)
|
13
|
-
@order1 = create(:order_with_line_items, created_at: 1.day.from_now, completed_at: 1.day.from_now, number: "R100")
|
14
|
-
@order2 = create(:order, created_at: 1.day.ago, completed_at: 1.day.ago, number: "R200")
|
15
|
-
visit spree.admin_orders_path
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'displays the new order button' do
|
19
|
-
expect(page).to have_link('New Order')
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'without create permission' do
|
23
|
-
custom_authorization! do |_user|
|
24
|
-
can :manage, Spree::Order
|
25
|
-
cannot :create, Spree::Order
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'does not display the new order button' do
|
29
|
-
expect(page).to_not have_link('New Order')
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context "listing orders" do
|
34
|
-
it "should list existing orders" do
|
35
|
-
within_row(1) do
|
36
|
-
expect(column_text(2)).to eq "R100"
|
37
|
-
expect(column_text(3)).to eq "Cart"
|
38
|
-
end
|
39
|
-
|
40
|
-
within_row(2) do
|
41
|
-
expect(column_text(2)).to eq "R200"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should be able to sort the orders listing" do
|
46
|
-
# default is completed_at desc
|
47
|
-
within_row(1) { expect(page).to have_content("R100") }
|
48
|
-
within_row(2) { expect(page).to have_content("R200") }
|
49
|
-
|
50
|
-
click_link "Completed at", exact: false
|
51
|
-
|
52
|
-
# Completed at desc
|
53
|
-
within_row(1) { expect(page).to have_content("R200") }
|
54
|
-
within_row(2) { expect(page).to have_content("R100") }
|
55
|
-
|
56
|
-
within('table#listing_orders thead') { click_link "Number" }
|
57
|
-
|
58
|
-
# number asc
|
59
|
-
within_row(1) { expect(page).to have_content("R100") }
|
60
|
-
within_row(2) { expect(page).to have_content("R200") }
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
context "searching orders" do
|
65
|
-
context "when there are multiple stores" do
|
66
|
-
let(:stores) { FactoryBot.create_pair(:store) }
|
67
|
-
|
68
|
-
before do
|
69
|
-
stores.each do |store|
|
70
|
-
FactoryBot.create(:completed_order_with_totals, number: "R#{store.id}999", store: store)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
it "can find the orders belonging to a specific store" do
|
75
|
-
main_store, other_store = stores
|
76
|
-
|
77
|
-
click_on "Filter Results"
|
78
|
-
select main_store.name, from: I18n.t('spree.store')
|
79
|
-
click_on "Filter Results"
|
80
|
-
|
81
|
-
within_row(1) do
|
82
|
-
expect(page).to have_content("R#{main_store.id}999")
|
83
|
-
end
|
84
|
-
|
85
|
-
# Ensure that the other order doesn't show up
|
86
|
-
within("table#listing_orders") { expect(page).not_to have_content("R#{other_store.id}999") }
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
context "when there's a single store" do
|
91
|
-
it "should be able to search orders" do
|
92
|
-
click_on "Filter Results"
|
93
|
-
fill_in "q_number_start", with: "R200"
|
94
|
-
click_on 'Filter Results'
|
95
|
-
within_row(1) do
|
96
|
-
expect(page).to have_content("R200")
|
97
|
-
end
|
98
|
-
|
99
|
-
# Ensure that the other order doesn't show up
|
100
|
-
within("table#listing_orders") { expect(page).not_to have_content("R100") }
|
101
|
-
end
|
102
|
-
|
103
|
-
it "should be able to filter on variant_id" do
|
104
|
-
click_on "Filter Results"
|
105
|
-
select2_search @order1.products.first.sku, from: I18n.t('spree.variant')
|
106
|
-
click_on 'Filter Results'
|
107
|
-
|
108
|
-
within_row(1) do
|
109
|
-
expect(page).to have_content(@order1.number)
|
110
|
-
end
|
111
|
-
|
112
|
-
expect(page).not_to have_content(@order2.number)
|
113
|
-
end
|
114
|
-
|
115
|
-
context "when pagination is really short" do
|
116
|
-
before do
|
117
|
-
stub_spree_preferences(orders_per_page: 1)
|
118
|
-
end
|
119
|
-
|
120
|
-
# Regression test for https://github.com/spree/spree/issues/4004
|
121
|
-
it "should be able to go from page to page for incomplete orders" do
|
122
|
-
10.times { Spree::Order.create email: "incomplete@example.com" }
|
123
|
-
click_on "Filter Results"
|
124
|
-
uncheck "q_completed_at_not_null"
|
125
|
-
click_on 'Filter Results'
|
126
|
-
within(".pagination", match: :first) do
|
127
|
-
click_link "2"
|
128
|
-
end
|
129
|
-
expect(page).to have_content("incomplete@example.com")
|
130
|
-
click_on "Filter Results"
|
131
|
-
expect(find("#q_completed_at_not_null")).not_to be_checked
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
it "should be able to search orders using only completed at input" do
|
136
|
-
click_on "Filter Results"
|
137
|
-
fill_in "q_created_at_gt", with: Date.current
|
138
|
-
|
139
|
-
click_on 'Filter Results'
|
140
|
-
within_row(1) { expect(page).to have_content("R100") }
|
141
|
-
|
142
|
-
# Ensure that the other order doesn't show up
|
143
|
-
within("table#listing_orders") { expect(page).not_to have_content("R200") }
|
144
|
-
end
|
145
|
-
|
146
|
-
context "filter on promotions" do
|
147
|
-
before(:each) do
|
148
|
-
@order1.order_promotions.build(
|
149
|
-
promotion: promotion,
|
150
|
-
promotion_code: promotion_code
|
151
|
-
)
|
152
|
-
@order1.save
|
153
|
-
visit spree.admin_orders_path
|
154
|
-
end
|
155
|
-
|
156
|
-
it "only shows the orders with the selected promotion" do
|
157
|
-
click_on "Filter Results"
|
158
|
-
fill_in "q_order_promotions_promotion_code_value_start", with: promotion.codes.first.value
|
159
|
-
click_on 'Filter Results'
|
160
|
-
within_row(1) { expect(page).to have_content("R100") }
|
161
|
-
within("table#listing_orders") { expect(page).not_to have_content("R200") }
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
context "when toggling the completed orders checkbox" do
|
166
|
-
before do
|
167
|
-
create(:order, number: 'R300', completed_at: nil, state: 'cart')
|
168
|
-
end
|
169
|
-
|
170
|
-
it "shows both complete and incomplete orders" do
|
171
|
-
check "q_completed_at_not_null"
|
172
|
-
click_on "Filter Results"
|
173
|
-
|
174
|
-
expect(page).to have_content("R200")
|
175
|
-
expect(page).to_not have_content("R300")
|
176
|
-
|
177
|
-
uncheck "q_completed_at_not_null"
|
178
|
-
click_on 'Filter Results'
|
179
|
-
|
180
|
-
expect(page).to have_content("R200")
|
181
|
-
expect(page).to have_content("R300")
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
end
|