Fix product ordering pricing and improve acceptance user product ordering coverage
This commit is contained in:
@@ -7,8 +7,11 @@ Feature: Ordering a product as a user
|
||||
And I am on the user homepage
|
||||
When the user scans a table QR code
|
||||
And the user clicks on the order 'Heineken beer' twice
|
||||
And the user clicks on the order product button 'Apple Pie'
|
||||
And the user clicks on the user order button
|
||||
Then the user order 'Heineken beer' should be in the order list with price
|
||||
And the user order total should not be visible for only one order
|
||||
When the user clicks on the order product button 'Apple pie'
|
||||
Then the user order total should be visible with the correct total price
|
||||
When the user clicks on the user order button
|
||||
Then the user should be redirected to the user order overview page
|
||||
And the user order should be created as a new order
|
||||
When the user order gets marked as being in process
|
||||
@@ -18,4 +21,18 @@ Feature: Ordering a product as a user
|
||||
When the user orders list gets closed
|
||||
Then the user should be redirected to the archived list path
|
||||
|
||||
@javascript
|
||||
Scenario: Resetting an active order
|
||||
Given There is an open supplier with a menu
|
||||
And I am signed in as a user
|
||||
And I am on the user homepage
|
||||
When the user scans a table QR code
|
||||
And the user clicks on the order 'Heineken beer' twice
|
||||
And the user clicks on the order product button 'Apple pie'
|
||||
And the user clicks on the clear order for the last order button
|
||||
And the user clicks on the clear order for the last order button
|
||||
Then the user should see an empty active order panel
|
||||
And the user clicks on the order 'Heineken beer' twice
|
||||
And the user clicks on the user order button
|
||||
Then an order with 2 products 'Heineken beer' should have been created
|
||||
And no order for the product 'Apple pie' should have been created
|
||||
|
||||
@@ -3,3 +3,13 @@ step "A new order is placed" do
|
||||
@list = create :list, state: 'active', supplier: @supplier, table: @table, section: @section, user_ids: [@user.id]
|
||||
@order = @list.place_order products: {@product.id => 2}, user: @user
|
||||
end
|
||||
|
||||
step "an order with :quantity products :product_name should have been created" do |quantity, product_name|
|
||||
concerning_product = Product.find_by_name(product_name)
|
||||
ProductOrder.find_by_quantity_and_product_id(quantity.to_i, concerning_product.id).should be_present
|
||||
end
|
||||
|
||||
step "no order for the product :product_name should have been created" do |product_name|
|
||||
concerning_product = Product.find_by_name(product_name)
|
||||
ProductOrder.find_by_product_id(concerning_product.id).should_not be_present
|
||||
end
|
||||
|
||||
@@ -45,3 +45,38 @@ end
|
||||
step "the user page should have product information :product_description" do |product_description|
|
||||
page.should have_content product_description
|
||||
end
|
||||
|
||||
step "the user order :product_name should be in the order list with price" do |product_name|
|
||||
concerning_product = Product.find_by_name(product_name)
|
||||
ember_order = ember_store['product_orders'].find{|po| po['product_id'] == concerning_product.id}
|
||||
quantity = ember_order['quantity']
|
||||
order_price = quantity * concerning_product.price
|
||||
within '.product-orders .product-order' do
|
||||
page.should have_content product_name
|
||||
if quantity > 1
|
||||
page.should have_content "#{quantity} x"
|
||||
end
|
||||
page.should have_content order_price
|
||||
end
|
||||
end
|
||||
|
||||
step "the user order total should not be visible for only one order" do
|
||||
page.should_not have_selector ".product-orders .total"
|
||||
end
|
||||
|
||||
step "the user order total should be visible with the correct total price" do
|
||||
within ".product-orders .total" do
|
||||
page.should have_content "8.96" # more dynamic in the future if needed
|
||||
end
|
||||
end
|
||||
|
||||
step "the user clicks on the clear order for the last order button" do
|
||||
within page.all('.product-orders .product-order').last do
|
||||
find('.product-order-remove').click
|
||||
end
|
||||
end
|
||||
|
||||
step "the user should see an empty active order panel" do
|
||||
no_orders_message = page.evaluate_script(%|t('product_orders.no_orders')|)
|
||||
page.find('.product-orders').text.should == no_orders_message
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user