Skip to content

Commit

Permalink
feature #15553 Cover "Order details" scenarios in API (jakubtobiasz, …
Browse files Browse the repository at this point in the history
…Wojdylak)

This PR was merged into the 1.13 branch.

Discussion
----------

| Q               | A                                                            |
|-----------------|--------------------------------------------------------------|
| Branch?         | 1.13
| Bug fix?        | no
| New feature?    | 
| BC breaks?      | no
| Deprecations?   | 
| Related tickets | 
| License         | MIT



Commits
-------

2caee8b Cover seeing_order.feature scenario
5eba66b Cover seeing_order_with_items.feature scenario
aa35e53 Cover seeing_order_without_shipping_address.feature scenario
0091e3a Cover seeing_province_created_manually_on_order_page.feature scenario
f8afcb4 Cover seeing_shipment_shipping_date.feature scenario
4abb0ff Allow "forgetting" the response in the ApiPlatformClient
df0e954 Allow filtering adjustments by order's token value in the Admin section
d2122e0 Add a custom controller for getting adjustments for a given order
4fd3594 Cover seeing_order_discount.feature scenarios
83ec73f Cover seeing_order_aggregated_discounts.feature scenarios
4bc7507 Cover seeing_order_aggregated_taxes.feature scenarios
ed79197 [WIP] Cover seeing_order_currency_on_show.feature scenarios
99177c9 Cover seeing_order_payment_state_as_completed_if_free_order_coupon_was_applied.feature scenarios
93a19ed Cover seeing_order_payment_state_as_completed_if_order_total_is_zero.feature scenarios
3e418b3 Cover seeing_order_shipment_state_after_checkout.feature scenarios
75ef2ec Cover seeing_order_shipment_state_as_shipped_if_there_is_not_shipments_to_deliver.feature scenarios
f79bcbe Cover seeing_order_shipping_fees.feature scenarios
d6cc938 Cover seeing_order_shipping_taxes.feature scenarios
aea9f36 Cover seeing_order_shipping_total_with_applied_promotion_and_taxes.feature scenarios
ec7ac2a [WIP] Cover seeing_order_with_different_promotions.feature scenarios
99c3648 Cover scenarios in order_details folder
f8fb298 Add return type in AdjustmentInterface
70f6078 [Test][Order] Add additional fields to payload in contract tests
1ec1ff4 [Behat] Use forget response option in ManagingOrdersContext
9a0c116 [Behat] Remove unnecessary usage of forget respons option in ManagingOrdersContext
0fee660 [Behat] Reduce subresource request to one private method in ManagingOrdersContext
  • Loading branch information
GSadee committed Dec 6, 2023
2 parents f160b68 + 0fee660 commit 1b255b4
Show file tree
Hide file tree
Showing 56 changed files with 913 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: Seeing basic information about an order
And the customer chose "Free" shipping method with "Cash on Delivery" payment
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing basic information about an order
When I view the summary of the order "#00000666"
Then it should have been placed by the customer "lucy@teamlucifer.com"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: Seeing aggregated discounts of an order
And there is a customer "robin.hood@sherwood.com" that placed an order "#00000006"
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing shipping and order promotions, but the shipping promotion is not aggregated in summary's promotion total
Given the customer bought 2 "Longbow" products
And the customer chose "DHL" shipping method to "United States" with "Cash on Delivery" payment
Expand All @@ -28,7 +28,7 @@ Feature: Seeing aggregated discounts of an order
And the order's shipping total should be "$5.00"
And the order's total should be "$285.00"

@ui
@api @ui
Scenario: Seeing multiple order promotions aggregated in summary
Given there is a promotion "Big order discount"
And it gives "$70.00" discount to every order with quantity at least 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Feature: Seeing aggregated taxes of an order
And there is a customer "charles.the.great@medieval.com" that placed an order "#00000001"
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing aggregated taxes of products and shipping
Given the customer bought a single "Composite bow"
And the customer chose "DHL" shipping method to "United States" with "Offline" payment
Expand All @@ -31,7 +31,7 @@ Feature: Seeing aggregated taxes of an order
And the order's tax total should be "$25.30"
And the order's total should be "$135.30"

@ui
@api @ui
Scenario: Seeing aggregated taxes of multiple products from different tax rates and shipping
Given the customer bought a single "Composite bow"
And the customer bought a "Claymore" and a "Bastard sword"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Feature: Seeing the currency an order has been placed in on it's details page
And there is a customer "Satin" identified by an email "satin@teamlucifer.com" and a password "pswd"
And I am logged in as an administrator

@ui
@api @ui
Scenario: All prices are in the base currency when the client haven't chosen any other
Given there is a customer "satin@teamlucifer.com" that placed an order "#00000666"
And the customer bought a single "Angel T-Shirt"
Expand All @@ -31,14 +31,14 @@ Feature: Seeing the currency an order has been placed in on it's details page
And the customer chose "DHL" shipping method with "Cash on Delivery" payment
When I view the summary of the order "#00000666"
And I check "Angel T-Shirt" data
Then its discounted unit price should be $5.00
And its unit price should be $20.00
And its subtotal should be $5.00
And its discount should be -$10.00
And its tax should be $0.50
And its total should be $5.50
And the order's items total should be "$5.50"
Then the order's items total should be "$5.50"
And the order's shipping total should be "$20.00"
And the order's tax total should be "$0.50"
And the order's promotion total should be "-$15.00"
And the order's total should be "$25.50"
And its unit price should be $20.00
And its total should be $5.50
And its discounted unit price should be $5.00
And its subtotal should be $5.00
And its discount should be -$10.00
And its tax should be $0.50
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feature: Seeing discounts of an order
And there is a customer "lucy@teamlucifer.com" that placed an order "#00000666"
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing promotion discount on order while buying at least 3 items
Given the promotion gives "$15.00" discount to every order with quantity at least 3
And the customer bought 4 "Angel T-Shirt" products
Expand All @@ -26,7 +26,7 @@ Feature: Seeing discounts of an order
And the order's promotion discount should be "-$15.00" from "Holiday promotion" promotion
And the order's total should be "$141.00"

@ui
@api @ui
Scenario: Seeing promotion discount on order's items while buying a product from a promoted taxon
Given the promotion gives "$10.00" off on every product classified as "T-Shirts"
And the customer bought a single "Angel T-Shirt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ Feature: Seeing order item detailed data
And the customer chose "Free" shipping method to "United States" with "Cash on Delivery" payment
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing details of item in one row
Given I view the summary of the order "#00000666"
When I check "Iron Man T-Shirt" data
When I check "Marvel T-Shirt" data
Then its code should be "IRON_MAN_T_SHIRT"
And its unit price should be $49.00
And its discounted unit price should be $44.00
And its total should be $193.60
And its quantity should be 4
And its discounted unit price should be $44.00
And its subtotal should be $176.00
And its tax should be $17.60
And its total should be $193.60
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ Feature: Seeing included in price taxes of order items
And there is a customer "lucy@teamlucifer.com" that placed an order "#00000666"
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing included in price taxes of order items are not counted in taxes total
Given the customer bought 2 "Winchester M1866" products
And the customer chose "Free" shipping method to "United States" with "Offline" payment
When I view the summary of the order "#00000666"
And I check "Winchester M1866" data
Then its tax included in price should be $40.00
And the order's tax total should be "$40.00"
Then the order's tax total should be "$40.00"
And the order's total should be "$440.00"
And its tax included in price should be $40.00
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feature: Seeing taxes of order items
And there is a customer "lucy@teamlucifer.com" that placed an order "#00000666"
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing taxes of order items
Given the customer bought a "PHP T-Shirt" and a "Symfony2 T-Shirt"
And the customer chose "Free" shipping method to "United States" with "Offline" payment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feature: Seeing order items with proper names
And the customer chose "Free" shipping method to "United States" with "Cash on Delivery" payment
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing order items with proper names
Given the product "Angel T-Shirt" was renamed to "Devil Cardigan"
And the product "Angel Mug" was renamed to "Devil Glass"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Feature: Placing an order
And there is a customer "sylius@example.com" that placed an order "#00000022"
And I am logged in as an administrator

@ui
@api @ui
Scenario: Verifying that order has new state right after checkout
Given the customer bought 3 "Iron Maiden T-Shirt" products
And the customer chose "Free" shipping method to "United States" with "Offline" payment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Feature: Seeing payment state as paid after checkout steps if order total is zer
And the customer chose "Free" shipping method
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing payment state as paid on orders list
When I browse orders
Then the order "#00000666" should have order payment state "Paid"
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ Feature: Seeing payment state as paid after checkout steps if order total is zer
And the customer chose "Free" shipping method
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing payment state as paid on orders list
When I browse orders
Then the order "#00000666" should have order payment state "Paid"

@ui
@api @no-ui
Scenario: Seeing payment state as paid on order's summary
When I view the summary of the order "#00000666"
Then I should be informed that there are no payments

@ui @no-api
Scenario: Seeing payment state as paid on order's summary
When I view the summary of the order "#00000666"
Then I should be informed that there are no payments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ Feature: Seeing shipping states of an order after checkout steps
And the customer chose "Free" shipping method with "Cash on Delivery" payment
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing ready order shipping state
When I browse orders
Then order "#00000666" should have shipment state ready
Then order "#00000666" should have shipment state "ready"

@ui
@api @ui
Scenario: Seeing shipped order shipping state
Given this order has already been shipped
When I browse orders
Then order "#00000666" should have shipment state shipped
Then order "#00000666" should have shipment state "shipped"

@ui
@api @ui
Scenario: Seeing cancelled order shipping state
Given the customer cancelled this order
When I browse orders
Then order "#00000666" should have shipment state cancelled
Then order "#00000666" should have shipment state "cancelled"
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ Feature: Seeing shipping states of an order as shipped if there are no shipments
And the customer chose "Cash on Delivery" payment
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing shipping state as shipped on orders list
When I browse orders
Then the order "#00000666" should have order shipping state "Shipped"

@ui
@api @ui
Scenario: Seeing shipping state as shipped on order's summary
When I view the summary of the order "#00000666"
Then it should have order's shipping state "Shipped"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Feature: Seeing shipping fees of an order
And the customer bought a single "Angel T-Shirt"
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing Free shipping of an order
Given the customer chose "Free" shipping method to "United States" with "Offline" payment
When I view the summary of the order "#00000666"
Expand All @@ -24,7 +24,7 @@ Feature: Seeing shipping fees of an order
And the order's shipping total should be "$0.00"
And the order's total should be "$39.00"

@ui
@api @ui
Scenario: Seeing shipping fee of an order
Given the customer chose "DHL" shipping method to "United States" with "Offline" payment
When I view the summary of the order "#00000666"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: Seeing taxes of an order
And there is a customer "lucy@teamlucifer.com" that placed an order "#00000666"
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing taxes of order items and shipping
Given the customer bought a single "Symfony2 T-Shirt"
And the customer chose "DHL" shipping method to "United States" with "Offline" payment
Expand All @@ -28,7 +28,7 @@ Feature: Seeing taxes of an order
And the order's tax total should be "$34.50"
And the order's total should be "$184.50"

@ui
@api @ui
Scenario: Seeing taxes of items and shipping from paid order
Given the customer bought a single "Symfony2 T-Shirt"
And the customer chose "DHL" shipping method to "United States" with "Offline" payment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Feature: Seeing shipping total with applied promotion and taxes
And the customer bought a single "Gryffindor scarf"
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing taxes of order items and shipping with applied promotion
Given the customer chose "Owl post" shipping method to "United States" with "Offline" payment
When I view the summary of the order "#00000777"
Expand All @@ -30,7 +30,7 @@ Feature: Seeing shipping total with applied promotion and taxes
And the order's tax total should be "$24.15"
And the order's total should be "$129.15"

@ui @domain
@api @ui @domain
Scenario: Seeing taxes of order items and multiple shipments with applied promotion
Given the store has "Pigeon post" shipping method with "$16.00" fee within the "US" zone
And shipping method "Pigeon post" belongs to "Shipping Services" tax category
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ Feature: Seeing order with different promotions
And there is a customer "lucy@teamlucifer.com" that placed an order "#00000666"
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing prices and discount prices of order item
Given the customer bought 2 "PHP T-Shirt" products
And the customer bought a single "Symfony Mug"
And the customer chose "Free" shipping method to "United States" with "Offline" payment
When I view the summary of the order "#00000666"
Then the "PHP T-Shirt" product's unit price should be "$60.00"
And the "PHP T-Shirt" product's item discount should be "-$20.00"
And the "PHP T-Shirt" product's order discount should be "~ -$3.34"
And the "PHP T-Shirt" product's discounted unit price should be "$36.66"
And the "PHP T-Shirt" product's quantity should be 2
And the "PHP T-Shirt" product's item discount should be "-$20.00"
And the "PHP T-Shirt" product's order discount should be "~ -$3.34"
And the "PHP T-Shirt" product's subtotal should be "$73.33"
And the "Symfony Mug" product's unit price should be "$40.00"
And the "Symfony Mug" product's item discount should be "$0.00"
And the "Symfony Mug" product's order discount should be "~ -$3.33"
And the "Symfony Mug" product's discounted unit price should be "$36.67"
And the "Symfony Mug" product's quantity should be 1
And the "Symfony Mug" product's item discount should be "$0.00"
And the "Symfony Mug" product's order discount should be "~ -$3.33"
And the "Symfony Mug" product's subtotal should be "$36.67"
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feature: Seeing an order with its items
And the customer chose "Free" shipping method to "United States" with "Cash on Delivery" payment
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing order items
When I view the summary of the order "#00000666"
Then it should have 2 items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Feature: Seeing an order without shipping address
And the customer chose "Cash on Delivery" payment
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing basic information about an order
When I view the summary of the order "#00000666"
Then it should have been placed by the customer "lucy@teamlucifer.com"
And it should be billed to "Mike Ross", "350 5th Ave", "10118", "New York", "United States"
And it should have "Mike Ross", "350 5th Ave", "10118", "New York", "United States" as its billing address
And it should be paid with "Cash on Delivery"
And it should have no shipping address set
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Feature: Seeing province created manually on order summary page
And the customer chose "DHL" shipping method with "Cash on Delivery" payment
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing manually definied province on order summary page
When I view the summary of the order "#00000666"
Then I should see "East of England" as province in the shipping address
And I should see "East of England" ad province in the billing address
And I should see "East of England" as province in the billing address
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feature: Seeing shipment shipping date
And it is "20-02-2020 10:30:05" now
And I am logged in as an administrator

@ui
@api @ui
Scenario: Seeing shipped at date
When I view the summary of the order "#00000777"
And I ship this order
Expand Down
19 changes: 11 additions & 8 deletions src/Sylius/Behat/Client/ApiClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,24 @@

interface ApiClientInterface
{
public function request(RequestInterface $request): Response;
public function request(RequestInterface $request, bool $forgetResponse = true): Response;

public function index(string $resource, array $queryParameters = []): Response;
/**
* @param array<string, mixed> $queryParameters
*/
public function index(string $resource, array $queryParameters = [], bool $forgetResponse = false): Response;

public function showByIri(string $iri): Response;
public function showByIri(string $iri, bool $forgetResponse = false): Response;

public function subResourceIndex(string $resource, string $subResource, string $id): Response;
public function subResourceIndex(string $resource, string $subResource, string $id, array $queryParameters = [], bool $forgetResponse = false): Response;

public function show(string $resource, string $id): Response;
public function show(string $resource, string $id, bool $forgetResponse = false): Response;

public function create(?RequestInterface $request = null): Response;
public function create(?RequestInterface $request = null, bool $forgetResponse = false): Response;

public function update(): Response;
public function update(bool $forgetResponse = false): Response;

public function delete(string $resource, string $id): Response;
public function delete(string $resource, string $id, bool $forgetResponse = false): Response;

public function filter(): Response;

Expand Down
Loading

0 comments on commit 1b255b4

Please sign in to comment.