spree_backend 3.1.5 → 3.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/spree/admin/orders_controller.rb +1 -3
- data/app/controllers/spree/admin/products_controller.rb +1 -1
- data/app/views/spree/admin/products/_form.html.erb +8 -8
- data/app/views/spree/admin/products/index.html.erb +1 -1
- data/app/views/spree/admin/shared/_product_tabs.html.erb +4 -4
- data/app/views/spree/admin/taxons/edit.html.erb +1 -1
- data/spree_backend.gemspec +1 -1
- metadata +7 -98
- data/spec/controllers/spree/admin/base_controller_spec.rb +0 -46
- data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -185
- data/spec/controllers/spree/admin/general_settings_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/missing_products_controller_spec.rb +0 -18
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -197
- data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -254
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -49
- data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -97
- data/spec/controllers/spree/admin/products_controller_spec.rb +0 -99
- data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -21
- data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -21
- data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -44
- data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -32
- data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -74
- data/spec/controllers/spree/admin/reports_controller_spec.rb +0 -42
- data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -252
- data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -225
- data/spec/controllers/spree/admin/return_index_controller_spec.rb +0 -37
- data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -27
- data/spec/controllers/spree/admin/root_controller_spec.rb +0 -35
- data/spec/controllers/spree/admin/search_controller_spec.rb +0 -56
- data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -14
- data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -19
- data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/tax_categories_controller_spec.rb +0 -34
- data/spec/controllers/spree/admin/users_controller_spec.rb +0 -161
- data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -32
- data/spec/features/admin/configuration/analytics_tracker_spec.rb +0 -47
- data/spec/features/admin/configuration/countries_spec.rb +0 -24
- data/spec/features/admin/configuration/general_settings_spec.rb +0 -44
- data/spec/features/admin/configuration/payment_methods_spec.rb +0 -63
- data/spec/features/admin/configuration/roles_spec.rb +0 -47
- data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -62
- data/spec/features/admin/configuration/states_spec.rb +0 -68
- data/spec/features/admin/configuration/stock_locations_spec.rb +0 -48
- data/spec/features/admin/configuration/store_credit_categories_spec.rb +0 -50
- data/spec/features/admin/configuration/tax_categories_spec.rb +0 -56
- data/spec/features/admin/configuration/tax_rates_spec.rb +0 -18
- data/spec/features/admin/configuration/zones_spec.rb +0 -39
- data/spec/features/admin/homepage_spec.rb +0 -89
- data/spec/features/admin/locale_spec.rb +0 -31
- data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -53
- data/spec/features/admin/orders/adjustments_spec.rb +0 -129
- data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -47
- data/spec/features/admin/orders/customer_details_spec.rb +0 -154
- data/spec/features/admin/orders/line_items_spec.rb +0 -51
- data/spec/features/admin/orders/listing_spec.rb +0 -222
- data/spec/features/admin/orders/log_entries_spec.rb +0 -55
- data/spec/features/admin/orders/new_order_spec.rb +0 -160
- data/spec/features/admin/orders/order_details_spec.rb +0 -662
- data/spec/features/admin/orders/payments_spec.rb +0 -230
- data/spec/features/admin/orders/risk_analysis_spec.rb +0 -48
- data/spec/features/admin/orders/shipments_spec.rb +0 -64
- data/spec/features/admin/orders/state_changes_spec.rb +0 -21
- data/spec/features/admin/products/edit/images_spec.rb +0 -86
- data/spec/features/admin/products/edit/products_spec.rb +0 -64
- data/spec/features/admin/products/edit/taxons_spec.rb +0 -41
- data/spec/features/admin/products/edit/variants_spec.rb +0 -56
- data/spec/features/admin/products/option_types_spec.rb +0 -114
- data/spec/features/admin/products/products_spec.rb +0 -445
- data/spec/features/admin/products/properties_spec.rb +0 -147
- data/spec/features/admin/products/prototypes_spec.rb +0 -112
- data/spec/features/admin/products/stock_management_spec.rb +0 -124
- data/spec/features/admin/products/taxonomies_spec.rb +0 -52
- data/spec/features/admin/products/variant_spec.rb +0 -50
- data/spec/features/admin/promotions/adjustments_spec.rb +0 -259
- data/spec/features/admin/promotions/option_value_rule_spec.rb +0 -70
- data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -70
- data/spec/features/admin/refund_reasons/refund_reasons_spec.rb +0 -57
- data/spec/features/admin/reports_spec.rb +0 -61
- data/spec/features/admin/return_authorization_reasons/return_authorization_reasons_spec.rb +0 -63
- data/spec/features/admin/returns/customer_returns_spec.rb +0 -80
- data/spec/features/admin/returns/return_authorizations_spec.rb +0 -152
- data/spec/features/admin/stock_transfer_spec.rb +0 -75
- data/spec/features/admin/store_credits_spec.rb +0 -93
- data/spec/features/admin/taxons_spec.rb +0 -47
- data/spec/features/admin/users_spec.rb +0 -286
- data/spec/helpers/admin/base_helper_spec.rb +0 -30
- data/spec/helpers/admin/navigation_helper_spec.rb +0 -106
- data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -30
- data/spec/helpers/promotion_rules_helper_spec.rb +0 -12
- data/spec/models/spree/resource_spec.rb +0 -48
- data/spec/routing/admin_path_spec.rb +0 -22
- data/spec/spec_helper.rb +0 -134
- data/spec/support/appear_before_matcher.rb +0 -8
- data/spec/support/ror_ringer.jpeg +0 -0
- data/spec/test_views/spree/admin/submodule/posts/edit.html.erb +0 -1
- data/spec/test_views/spree/admin/submodule/posts/new.html.erb +0 -1
- data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
- data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
@@ -1,154 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Customer Details", type: :feature, js: true do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
let!(:country) { create(:country, name: 'United States of America', iso: 'US') }
|
7
|
-
let!(:state) { create(:state, name: "Alabama", country: country, abbr: 'AL') }
|
8
|
-
let!(:shipping_method) { create(:shipping_method, display_on: "front_end") }
|
9
|
-
let!(:order) { create(:order, state: 'complete', completed_at: "2011-02-01 12:36:15") }
|
10
|
-
let!(:product) { create(:product_in_stock) }
|
11
|
-
|
12
|
-
# We need a unique name that will appear for the customer dropdown
|
13
|
-
let!(:ship_address) { create(:address, country: country, state: state, first_name: "Rumpelstiltskin") }
|
14
|
-
let!(:bill_address) { create(:address, country: country, state: state, first_name: "Rumpelstiltskin") }
|
15
|
-
|
16
|
-
let!(:user) { create(:user, email: 'foobar@example.com', ship_address: ship_address, bill_address: bill_address) }
|
17
|
-
|
18
|
-
# Value attribute is dynamically set via JS, so not observable via a CSS/XPath selector
|
19
|
-
# As the browser might take time to make the values visible in the dom we need to
|
20
|
-
# "intelligiently" wait for that event o prevent a race.
|
21
|
-
def expect_form_value(id, value)
|
22
|
-
node = page.find(id)
|
23
|
-
wait_for_condition { node.value.eql?(value) }
|
24
|
-
end
|
25
|
-
|
26
|
-
context "brand new order" do
|
27
|
-
before do
|
28
|
-
allow(Spree.user_class).to receive(:find_by).and_return(user)
|
29
|
-
visit spree.new_admin_order_path
|
30
|
-
end
|
31
|
-
# Regression test for #3335 & #5317
|
32
|
-
it "associates a user when not using guest checkout" do
|
33
|
-
select2_search product.name, from: Spree.t(:name_or_sku)
|
34
|
-
within("table.stock-levels") do
|
35
|
-
fill_in "variant_quantity", with: 1
|
36
|
-
click_icon :add
|
37
|
-
end
|
38
|
-
wait_for_ajax
|
39
|
-
click_link "Customer"
|
40
|
-
targetted_select2 "foobar@example.com", from: "#s2id_customer_search"
|
41
|
-
# 5317 - Address prefills using user's default.
|
42
|
-
expect_form_value('#order_bill_address_attributes_firstname', user.bill_address.firstname)
|
43
|
-
expect_form_value('#order_bill_address_attributes_lastname', user.bill_address.lastname)
|
44
|
-
expect_form_value('#order_bill_address_attributes_address1', user.bill_address.address1)
|
45
|
-
expect_form_value('#order_bill_address_attributes_address2', user.bill_address.address2)
|
46
|
-
expect_form_value('#order_bill_address_attributes_city', user.bill_address.city)
|
47
|
-
expect_form_value('#order_bill_address_attributes_zipcode', user.bill_address.zipcode)
|
48
|
-
expect_form_value('#order_bill_address_attributes_country_id', user.bill_address.country_id.to_s)
|
49
|
-
expect_form_value('#order_bill_address_attributes_state_id', user.bill_address.state_id.to_s)
|
50
|
-
expect_form_value('#order_bill_address_attributes_phone', user.bill_address.phone)
|
51
|
-
click_button "Update"
|
52
|
-
expect(Spree::Order.last.user).to eq(user)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
context "editing an order" do
|
57
|
-
before do
|
58
|
-
configure_spree_preferences do |config|
|
59
|
-
config.default_country_id = country.id
|
60
|
-
config.company = true
|
61
|
-
end
|
62
|
-
|
63
|
-
allow(Spree.user_class).to receive(:find_by).and_return(user)
|
64
|
-
visit spree.admin_orders_path
|
65
|
-
within('table#listing_orders') { click_icon(:edit) }
|
66
|
-
end
|
67
|
-
|
68
|
-
context "selected country has no state" do
|
69
|
-
before { create(:country, iso: "BRA", name: "Brazil") }
|
70
|
-
|
71
|
-
it "changes state field to text input" do
|
72
|
-
click_link "Customer"
|
73
|
-
|
74
|
-
within("#billing") do
|
75
|
-
targetted_select2 "Brazil", from: "#s2id_order_bill_address_attributes_country_id"
|
76
|
-
fill_in "order_bill_address_attributes_state_name", with: "Piaui"
|
77
|
-
end
|
78
|
-
|
79
|
-
click_button "Update"
|
80
|
-
expect(find_field("order_bill_address_attributes_state_name").value).to eq("Piaui")
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
it "should be able to update customer details for an existing order" do
|
85
|
-
order.ship_address = create(:address)
|
86
|
-
order.save!
|
87
|
-
|
88
|
-
click_link "Customer"
|
89
|
-
within("#shipping") { fill_in_address "ship" }
|
90
|
-
within("#billing") { fill_in_address "bill" }
|
91
|
-
|
92
|
-
click_button "Update"
|
93
|
-
click_link "Customer"
|
94
|
-
|
95
|
-
# Regression test for #2950 + #2433
|
96
|
-
# This act should transition the state of the order as far as it will go too
|
97
|
-
within("#order_tab_summary") do
|
98
|
-
expect(find(".state").text).to eq("complete")
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
it "should show validation errors" do
|
103
|
-
click_link "Customer"
|
104
|
-
click_button "Update"
|
105
|
-
expect(page).to have_content("Shipping address first name can't be blank")
|
106
|
-
end
|
107
|
-
|
108
|
-
it "updates order email for an existing order with a user" do
|
109
|
-
order.update_columns(ship_address_id: ship_address.id, bill_address_id: bill_address.id, state: "confirm", completed_at: nil)
|
110
|
-
previous_user = order.user
|
111
|
-
click_link "Customer"
|
112
|
-
fill_in "order_email", with: "newemail@example.com"
|
113
|
-
expect(order.user_id).to eq previous_user.id
|
114
|
-
expect(order.user.email).to eq previous_user.email
|
115
|
-
expect { click_button "Update" }.to change { order.reload.email }.to "newemail@example.com"
|
116
|
-
end
|
117
|
-
|
118
|
-
# Regression test for #942
|
119
|
-
context "errors when no shipping methods are available" do
|
120
|
-
before do
|
121
|
-
Spree::ShippingMethod.delete_all
|
122
|
-
end
|
123
|
-
|
124
|
-
specify do
|
125
|
-
click_link "Customer"
|
126
|
-
# Need to fill in valid information so it passes validations
|
127
|
-
fill_in "order_ship_address_attributes_firstname", with: "John 99"
|
128
|
-
fill_in "order_ship_address_attributes_lastname", with: "Doe"
|
129
|
-
fill_in "order_ship_address_attributes_lastname", with: "Company"
|
130
|
-
fill_in "order_ship_address_attributes_address1", with: "100 first lane"
|
131
|
-
fill_in "order_ship_address_attributes_address2", with: "#101"
|
132
|
-
fill_in "order_ship_address_attributes_city", with: "Bethesda"
|
133
|
-
fill_in "order_ship_address_attributes_zipcode", with: "20170"
|
134
|
-
|
135
|
-
page.select('Alabama', from: 'order_ship_address_attributes_state_id')
|
136
|
-
fill_in "order_ship_address_attributes_phone", with: "123-456-7890"
|
137
|
-
expect { click_button "Update" }.not_to raise_error
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
def fill_in_address(kind = "bill")
|
143
|
-
fill_in "First Name", with: "John 99"
|
144
|
-
fill_in "Last Name", with: "Doe"
|
145
|
-
fill_in "Company", with: "Company"
|
146
|
-
fill_in "Street Address", with: "100 first lane"
|
147
|
-
fill_in "Street Address (cont'd)", with: "#101"
|
148
|
-
fill_in "City", with: "Bethesda"
|
149
|
-
fill_in "Zip", with: "20170"
|
150
|
-
targetted_select2 country.name, from: "#s2id_order_#{kind}_address_attributes_country_id"
|
151
|
-
targetted_select2 state.name, from: "#s2id_order_#{kind}_address_attributes_state_id"
|
152
|
-
fill_in "Phone", with: "123-456-7890"
|
153
|
-
end
|
154
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# Tests for #3958's features
|
4
|
-
describe "Order Line Items", type: :feature, js: true do
|
5
|
-
stub_authorization!
|
6
|
-
|
7
|
-
before do
|
8
|
-
# Removing the delivery step causes the order page to render a different
|
9
|
-
# partial, called _line_items, which shows line items rather than shipments
|
10
|
-
allow(Spree::Order).to receive_messages :checkout_step_names => [:address, :payment, :confirm, :complete]
|
11
|
-
end
|
12
|
-
|
13
|
-
let!(:order) do
|
14
|
-
order = create(:order_with_line_items, :line_items_count => 1)
|
15
|
-
order.shipments.destroy_all
|
16
|
-
order
|
17
|
-
end
|
18
|
-
|
19
|
-
it "can edit a line item's quantity" do
|
20
|
-
visit spree.edit_admin_order_path(order)
|
21
|
-
within(".line-items") do
|
22
|
-
within_row(1) do
|
23
|
-
find(".edit-line-item").click
|
24
|
-
fill_in "quantity", :with => 10
|
25
|
-
find(".save-line-item").click
|
26
|
-
within '.line-item-qty-show' do
|
27
|
-
expect(page).to have_content("10")
|
28
|
-
end
|
29
|
-
within '.line-item-total' do
|
30
|
-
expect(page).to have_content("$199.90")
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
it "can delete a line item" do
|
37
|
-
visit spree.edit_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(page).not_to have_content(product_name)
|
50
|
-
end
|
51
|
-
end
|
@@ -1,222 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Orders Listing", type: :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
let(:order1) do
|
7
|
-
create :order_with_line_items,
|
8
|
-
created_at: 1.day.from_now,
|
9
|
-
completed_at: 1.day.from_now,
|
10
|
-
considered_risky: true,
|
11
|
-
number: "R100"
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:order2) do
|
15
|
-
create :order,
|
16
|
-
created_at: 1.day.ago,
|
17
|
-
completed_at: 1.day.ago,
|
18
|
-
number: "R200"
|
19
|
-
end
|
20
|
-
|
21
|
-
before do
|
22
|
-
allow_any_instance_of(Spree::OrderInventory).to receive(:add_to_shipment)
|
23
|
-
# create the order instances after stubbing the `add_to_shipment` method
|
24
|
-
order1; order2
|
25
|
-
visit spree.admin_orders_path
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "listing orders" do
|
29
|
-
it "should list existing orders" do
|
30
|
-
within_row(1) do
|
31
|
-
expect(column_text(2)).to eq "R100"
|
32
|
-
expect(find("td:nth-child(3)")).to have_css '.label-considered_risky'
|
33
|
-
expect(column_text(4)).to eq "cart"
|
34
|
-
end
|
35
|
-
|
36
|
-
within_row(2) do
|
37
|
-
expect(column_text(2)).to eq "R200"
|
38
|
-
expect(find("td:nth-child(3)")).to have_css '.label-considered_safe'
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should be able to sort the orders listing" do
|
43
|
-
# default is completed_at desc
|
44
|
-
within_row(1) { expect(page).to have_content("R100") }
|
45
|
-
within_row(2) { expect(page).to have_content("R200") }
|
46
|
-
|
47
|
-
click_link "Completed At"
|
48
|
-
|
49
|
-
# Completed at desc
|
50
|
-
within_row(1) { expect(page).to have_content("R200") }
|
51
|
-
within_row(2) { expect(page).to have_content("R100") }
|
52
|
-
|
53
|
-
within('table#listing_orders thead') { click_link "Number" }
|
54
|
-
|
55
|
-
# number asc
|
56
|
-
within_row(1) { expect(page).to have_content("R100") }
|
57
|
-
within_row(2) { expect(page).to have_content("R200") }
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
describe "searching orders" do
|
62
|
-
it "should be able to search orders" do
|
63
|
-
fill_in "q_number_cont", with: "R200"
|
64
|
-
click_on 'Filter Results'
|
65
|
-
within_row(1) do
|
66
|
-
expect(page).to have_content("R200")
|
67
|
-
end
|
68
|
-
|
69
|
-
# Ensure that the other order doesn't show up
|
70
|
-
within("table#listing_orders") { expect(page).not_to have_content("R100") }
|
71
|
-
end
|
72
|
-
|
73
|
-
it "should return both complete and incomplete orders when only complete orders is not checked" do
|
74
|
-
Spree::Order.create! email: "incomplete@example.com", completed_at: nil, state: 'cart'
|
75
|
-
click_on 'Filter'
|
76
|
-
uncheck "q_completed_at_not_null"
|
77
|
-
click_on 'Filter Results'
|
78
|
-
|
79
|
-
expect(page).to have_content("R200")
|
80
|
-
expect(page).to have_content("incomplete@example.com")
|
81
|
-
end
|
82
|
-
|
83
|
-
it "should be able to filter risky orders" do
|
84
|
-
# Check risky and filter
|
85
|
-
check "q_considered_risky_eq"
|
86
|
-
click_on 'Filter Results'
|
87
|
-
|
88
|
-
# Insure checkbox still checked
|
89
|
-
expect(find("#q_considered_risky_eq")).to be_checked
|
90
|
-
# Insure we have the risky order, R100
|
91
|
-
within_row(1) do
|
92
|
-
expect(page).to have_content("R100")
|
93
|
-
end
|
94
|
-
# Insure the non risky order is not present
|
95
|
-
expect(page).not_to have_content("R200")
|
96
|
-
end
|
97
|
-
|
98
|
-
it "should be able to filter on variant_sku" do
|
99
|
-
click_on 'Filter'
|
100
|
-
fill_in "q_line_items_variant_sku_eq", with: order1.line_items.first.variant.sku
|
101
|
-
click_on 'Filter Results'
|
102
|
-
|
103
|
-
within_row(1) do
|
104
|
-
expect(page).to have_content(order1.number)
|
105
|
-
end
|
106
|
-
|
107
|
-
expect(page).not_to have_content(order2.number)
|
108
|
-
end
|
109
|
-
|
110
|
-
context "when pagination is really short" do
|
111
|
-
before do
|
112
|
-
@old_per_page = Spree::Config[:orders_per_page]
|
113
|
-
Spree::Config[:orders_per_page] = 1
|
114
|
-
end
|
115
|
-
|
116
|
-
after do
|
117
|
-
Spree::Config[:orders_per_page] = @old_per_page
|
118
|
-
end
|
119
|
-
|
120
|
-
# Regression test for #4004
|
121
|
-
it "should be able to go from page to page for incomplete orders" do
|
122
|
-
Spree::Order.destroy_all
|
123
|
-
2.times { Spree::Order.create! email: "incomplete@example.com", completed_at: nil, state: 'cart' }
|
124
|
-
click_on 'Filter'
|
125
|
-
uncheck "q_completed_at_not_null"
|
126
|
-
click_on 'Filter Results'
|
127
|
-
within(".pagination") do
|
128
|
-
click_link "2"
|
129
|
-
end
|
130
|
-
expect(page).to have_content("incomplete@example.com")
|
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
|
-
fill_in "q_created_at_gt", with: Date.current
|
137
|
-
click_on 'Filter Results'
|
138
|
-
|
139
|
-
within_row(1) { expect(page).to have_content("R100") }
|
140
|
-
|
141
|
-
# Ensure that the other order doesn't show up
|
142
|
-
within("table#listing_orders") { expect(page).not_to have_content("R200") }
|
143
|
-
end
|
144
|
-
|
145
|
-
context "filter on promotions" do
|
146
|
-
let!(:promotion) { create(:promotion_with_item_adjustment) }
|
147
|
-
|
148
|
-
before do
|
149
|
-
order1.promotions << promotion
|
150
|
-
order1.save
|
151
|
-
visit spree.admin_orders_path
|
152
|
-
end
|
153
|
-
|
154
|
-
it "only shows the orders with the selected promotion" do
|
155
|
-
select promotion.name, from: "Promotion"
|
156
|
-
click_on 'Filter Results'
|
157
|
-
within_row(1) { expect(page).to have_content("R100") }
|
158
|
-
within("table#listing_orders") { expect(page).not_to have_content("R200") }
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
it "should be able to apply a ransack filter by clicking a quickfilter icon", js: true do
|
163
|
-
label_pending = page.find '.label-pending'
|
164
|
-
parent_td = label_pending.find(:xpath, '..')
|
165
|
-
|
166
|
-
# Click the quick filter Pending for order #R100
|
167
|
-
within(parent_td) do
|
168
|
-
find('.js-add-filter').click
|
169
|
-
end
|
170
|
-
|
171
|
-
expect(page).to have_content("R100")
|
172
|
-
expect(page).not_to have_content("R200")
|
173
|
-
end
|
174
|
-
|
175
|
-
context "filter on shipment state" do
|
176
|
-
it "only shows the orders with the selected shipment state" do
|
177
|
-
select Spree.t("payment_states.#{order1.shipment_state}"), from: "Shipment State"
|
178
|
-
click_on 'Filter Results'
|
179
|
-
within_row(1) { expect(page).to have_content("R100") }
|
180
|
-
within("table#listing_orders") { expect(page).not_to have_content("R200") }
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
context "filter on payment state" do
|
185
|
-
it "only shows the orders with the selected payment state" do
|
186
|
-
select Spree.t("payment_states.#{order1.payment_state}"), from: "Payment State"
|
187
|
-
click_on 'Filter Results'
|
188
|
-
within_row(1) { expect(page).to have_content("R100") }
|
189
|
-
within("table#listing_orders") { expect(page).not_to have_content("R200") }
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
# regression tests for https://github.com/spree/spree/issues/6888
|
194
|
-
context "per page dropdown", js: true do
|
195
|
-
before do
|
196
|
-
select "45", from: "per_page"
|
197
|
-
sleep(1)
|
198
|
-
expect(page).to have_select("per_page", selected: "45")
|
199
|
-
end
|
200
|
-
|
201
|
-
it "adds per_page parameter to url" do
|
202
|
-
expect(current_url).to match(/per_page\=45/)
|
203
|
-
end
|
204
|
-
|
205
|
-
it "can be used with search filtering" do
|
206
|
-
click_on 'Filter'
|
207
|
-
fill_in "q_number_cont", with: "R200"
|
208
|
-
click_on 'Filter Results'
|
209
|
-
expect(page).not_to have_content("R100")
|
210
|
-
within_row(1) { expect(page).to have_content("R200") }
|
211
|
-
expect(current_url).to match(/per_page\=45/)
|
212
|
-
expect(page).to have_select("per_page", selected: "45")
|
213
|
-
select "60", from: "per_page"
|
214
|
-
sleep(1)
|
215
|
-
expect(page).to have_select("per_page", selected: "60")
|
216
|
-
expect(page).not_to have_content("R100")
|
217
|
-
within_row(1) { expect(page).to have_content("R200") }
|
218
|
-
expect(current_url).to match(/per_page\=60/)
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
222
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Log entries", :type => :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
let!(:payment) { create(:payment) }
|
7
|
-
|
8
|
-
context "with a successful log entry" do
|
9
|
-
before do
|
10
|
-
response = ActiveMerchant::Billing::Response.new(
|
11
|
-
true,
|
12
|
-
"Transaction successful",
|
13
|
-
:transid => "ABCD1234"
|
14
|
-
)
|
15
|
-
|
16
|
-
payment.log_entries.create(
|
17
|
-
:source => payment.source,
|
18
|
-
:details => response.to_yaml
|
19
|
-
)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "shows a successful attempt" do
|
23
|
-
visit spree.admin_order_payments_path(payment.order)
|
24
|
-
find("#payment_#{payment.id} a").click
|
25
|
-
click_link "Logs"
|
26
|
-
within("#listing_log_entries") do
|
27
|
-
expect(page).to have_content("Transaction successful")
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context "with a failed log entry" do
|
33
|
-
before do
|
34
|
-
response = ActiveMerchant::Billing::Response.new(
|
35
|
-
false,
|
36
|
-
"Transaction failed",
|
37
|
-
:transid => "ABCD1234"
|
38
|
-
)
|
39
|
-
|
40
|
-
payment.log_entries.create(
|
41
|
-
:source => payment.source,
|
42
|
-
:details => response.to_yaml
|
43
|
-
)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "shows a failed attempt" do
|
47
|
-
visit spree.admin_order_payments_path(payment.order)
|
48
|
-
find("#payment_#{payment.id} a").click
|
49
|
-
click_link "Logs"
|
50
|
-
within("#listing_log_entries") do
|
51
|
-
expect(page).to have_content("Transaction failed")
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|