Sha256: 7d9e4a5604068ce4c0718f44f2d10ec23b635cc8c9be85a4bafcdf6b99e13fd3

Contents?: true

Size: 1.91 KB

Versions: 28

Compression:

Stored size: 1.91 KB

Contents

require 'test_helper'

module Workarea
  module Storefront
    class PricingOverridesSystemTest < Workarea::SystemTest
      include Admin::IntegrationTest
      include Storefront::SystemTest

      setup :setup_checkout_specs, :add_product_to_cart

      def test_overriding_order_pricing
        visit storefront.cart_path

        wait_for_xhr
        within_frame find('.admin-toolbar') do
          click_link t('workarea.admin.toolbar.adjust_order_pricing')
        end

        order = Order.not_placed.last

        assert_current_path(admin.edit_pricing_override_path(order.id))
        fill_in "override[item_prices][#{order.items.first.id}]", with: '1.50'
        click_button 'adjust_order_pricing'

        assert_current_path(storefront.cart_path)
        assert(page.has_content?(t('workarea.pricing_overrides.description')))
        assert(page.has_content?('-$7.00')) # pricing override amount
        assert(page.has_content?('$3.00')) # total
        click_link t('workarea.storefront.carts.checkout'), match: :first

        fill_in_shipping_address
        click_button t('workarea.storefront.checkouts.continue_to_shipping')

        click_button t('workarea.storefront.checkouts.continue_to_payment')
        assert_current_path(storefront.checkout_payment_path)

        fill_in_credit_card
        click_button t('workarea.storefront.checkouts.place_order')
        assert_current_path(admin.order_path(Order.placed.desc(:placed_at).first))
        assert(page.has_content?('Success'))
        assert(page.has_content?('$10.70')) # total w/ shipping
      end

      def test_not_having_permission_to_override
        admin_user.update!(super_admin: false, admin: true, orders_manager: false)

        visit storefront.cart_path

        wait_for_xhr
        within_frame find('.admin-toolbar') do
          assert(page.has_no_content?(t('workarea.admin.toolbar.adjust_order_pricing')))
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-storefront-3.5.6 test/system/workarea/storefront/pricing_overrides_system_test.rb
workarea-storefront-3.5.5 test/system/workarea/storefront/pricing_overrides_system_test.rb
workarea-storefront-3.5.4 test/system/workarea/storefront/pricing_overrides_system_test.rb
workarea-storefront-3.5.3 test/system/workarea/storefront/pricing_overrides_system_test.rb
workarea-storefront-3.5.2 test/system/workarea/storefront/pricing_overrides_system_test.rb
workarea-storefront-3.5.1 test/system/workarea/storefront/pricing_overrides_system_test.rb
workarea-storefront-3.5.0 test/system/workarea/storefront/pricing_overrides_system_test.rb
workarea-storefront-3.5.0.beta.1 test/system/workarea/storefront/pricing_overrides_system_test.rb