Skip to content

Commit

Permalink
Add test for order_details_spec
Browse files Browse the repository at this point in the history
The test interacts with the headless browser, but manipulates the order
behind the scenes to simulate the shipping of the order in a second tab
  • Loading branch information
nirnaeth committed Oct 4, 2023
1 parent e6e74f6 commit 4a4bf62
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions backend/spec/features/admin/orders/order_details_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,33 @@
expect(page).not_to have_selector('.fa-arrows-h')
expect(page).not_to have_selector('.fa-trash')
end

context 'and on the cart page the cart is emptied' do
it 'should show the empty cart page' do
order = create(:order_ready_to_ship)

visit spree.cart_admin_order_path(order)
order.fulfill!

## simulate shipping order in another tab
shipment = order.shipments.first
order.shipping.ship(
inventory_units: shipment.inventory_units,
stock_location: shipment.stock_location,
address: order.ship_address,
shipping_method: shipment.shipping_method
)

click_on 'Empty Cart'

accept_alert 'Are you sure you want to delete this record?' do
click_icon :ok
end

expect(page.current_path).to eq(spree.cart_admin_order_path(order))
expect(page).not_to have_content(order.line_items.first.variant.sku)
end
end
end
end

Expand Down

0 comments on commit 4a4bf62

Please sign in to comment.