Skip to content

Commit 8b5549c

Browse files
committed
MC-39353: Incorrect Quantity Shipped Displayed on order detail page on the front
- MFTF test and the solution
1 parent e00d2fc commit 8b5549c

File tree

5 files changed

+157
-1
lines changed

5 files changed

+157
-1
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="StorefrontCustomerOrderShipmentPage" url="sales/order/shipment/order_id/{{var1}}" area="storefront" module="Magento_Customer" parameterized="true">
12+
<section name="StorefrontCustomerOrderSection"/>
13+
</page>
14+
</pages>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertStorefrontOrderShipmentsQtyShippedActionGroup">
12+
<annotations>
13+
<description>Verify Customer Order Shipments Qty Shipped</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="expectedQtyShipped" type="string" defaultValue="0"/>
17+
</arguments>
18+
<grabTextFrom selector="{{StorefrontSalesOrderShipmentSection.salesOrderQtyShipped}}" stepKey="grabSalesOrderQtyShipped"/>
19+
<assertEquals stepKey="assertOrderQtyShipped">
20+
<actualResult type="string">$grabSalesOrderQtyShipped</actualResult>
21+
<expectedResult type="string">{{expectedQtyShipped}}</expectedResult>
22+
</assertEquals>
23+
</actionGroup>
24+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="StorefrontSalesOrderShipmentSection">
12+
<element name="salesOrderQtyShipped" type="text" selector="//td[@data-th='Qty Shipped']"/>
13+
</section>
14+
</sections>
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontVerifyOrderShipmentForDecimalQuantityTest">
12+
<annotations>
13+
<title value="Incorrect Quantity Shipped Displayed on order detail page on the front"/>
14+
<stories value="Verify shipment quantity for decimal quantity at frontend order shipment tab"/>
15+
<description value="Verify shipment quantity for decimal quantity at frontend order shipment tab"/>
16+
<features value="Sales"/>
17+
<testCaseId value="MC-39777"/>
18+
<useCaseId value="MC-39353"/>
19+
<severity value="MAJOR"/>
20+
<group value="Sales"/>
21+
</annotations>
22+
<before>
23+
<createData entity="_defaultCategory" stepKey="createSimpleCategory"/>
24+
<createData entity="SimpleProduct" stepKey="createSimpleProduct">
25+
<requiredEntity createDataKey="createSimpleCategory"/>
26+
</createData>
27+
<createData entity="Simple_US_Customer" stepKey="createSimpleUsCustomer">
28+
<field key="group_id">1</field>
29+
</createData>
30+
</before>
31+
<after>
32+
<!--Clear Filters-->
33+
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="ClearFiltersAfter"/>
34+
<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderListingFilters"/>
35+
<deleteData createDataKey="createSimpleCategory" stepKey="deletePreReqCategory"/>
36+
<deleteData createDataKey="createSimpleProduct" stepKey="deletePreReqSimpleProduct"/>
37+
<!--Logout from customer account-->
38+
<amOnPage url="{{StorefrontCustomerLogoutPage.url}}" stepKey="logoutCustomerOne"/>
39+
<waitForPageLoad stepKey="waitLogoutCustomerOne"/>
40+
<deleteData createDataKey="createSimpleUsCustomer" stepKey="deleteCustomer"/>
41+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
42+
</after>
43+
<!--Step1. Login as admin. Go to Catalog > Products page. Filtering *prod1*. Open *prod1* to edit-->
44+
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin" />
45+
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="filterGroupedProductOptions">
46+
<argument name="product" value="$$createSimpleProduct$$"/>
47+
</actionGroup>
48+
<!-- Step2. Update product Advanced Inventory Setting.
49+
Set *Qty Uses Decimals* to *Yes* and *Enable Qty Increments* to *Yes* and *Qty Increments* to *2.14*. -->
50+
<actionGroup ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup" stepKey="openProduct"/>
51+
<actionGroup ref="AdminClickOnAdvancedInventoryLinkActionGroup" stepKey="clickOnAdvancedInventoryLink"/>
52+
<actionGroup ref="AdminSetQtyUsesDecimalsConfigActionGroup" stepKey="setQtyUsesDecimalsConfig">
53+
<argument name="value" value="Yes"/>
54+
</actionGroup>
55+
<actionGroup ref="AdminSetEnableQtyIncrementsActionGroup" stepKey="setEnableQtyIncrements">
56+
<argument name="value" value="Yes"/>
57+
</actionGroup>
58+
<actionGroup ref="AdminSetQtyIncrementsForProductActionGroup" stepKey="setQtyIncrementsValue">
59+
<argument name="qty" value="2.14"/>
60+
</actionGroup>
61+
<actionGroup ref="AdminSetMinAllowedQtyForProductActionGroup" stepKey="fillMiniAllowedQty">
62+
<argument name="qty" value="2.14"/>
63+
</actionGroup>
64+
<actionGroup ref="AdminSubmitAdvancedInventoryFormActionGroup" stepKey="clickOnDoneButton"/>
65+
66+
<!--Step3. Save the product-->
67+
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickOnSaveButton"/>
68+
<!--Step4. Open *Customer view* (Go to *Store Front*). Open *prod1* page (Find via search and click on product name) -->
69+
<!--Step5. Log in to Storefront as Customer-->
70+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="signUpNewUser">
71+
<argument name="Customer" value="$$createSimpleUsCustomer$$"/>
72+
</actionGroup>
73+
<!--Step6. Go to product page-->
74+
<amOnPage url="$$createSimpleProduct.custom_attributes[url_key]$$.html" stepKey="navigateToSimpleProductPage"/>
75+
<waitForPageLoad stepKey="waitForCatalogPageLoad"/>
76+
<!--Step7. Add Product to Shopping Cart-->
77+
<actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage">
78+
<argument name="productName" value="$$createSimpleProduct.name$$"/>
79+
</actionGroup>
80+
81+
<!--Step8. Navigate to checkout-->
82+
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="openCheckoutPage"/>
83+
<!--Step9. Click next button to open payment section-->
84+
<actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="clickNext"/>
85+
<!--Step10. Click place order-->
86+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="placeOrder"/>
87+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
88+
<!--Step11. Go to admin Order page for newly created order-->
89+
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="filterOrdersGridById">
90+
<argument name="orderId" value="{$grabOrderNumber}"/>
91+
</actionGroup>
92+
93+
<click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction"/>
94+
<click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="clickSubmitShipment"/>
95+
96+
<actionGroup ref="StorefrontNavigateToCustomerOrdersHistoryPageActionGroup" stepKey="goToOrderHistoryPage"/>
97+
<!--Step12. Go to Customer Order Shipment Page and Checking the correctness of displayed Qty Shipped -->
98+
<amOnPage url="{{StorefrontCustomerOrderShipmentPage.url({$grabOrderNumber})}}" stepKey="amOnOrderShipmentPage"/>
99+
<waitForPageLoad time="30" stepKey="waitForOrderShipmentsPageLoad"/>
100+
<actionGroup ref="AssertStorefrontOrderShipmentsQtyShippedActionGroup" stepKey="verifyAssertOrderShipments">
101+
<argument name="expectedQtyShipped" value="2.14"/>
102+
</actionGroup>
103+
</test>
104+
</tests>

app/code/Magento/Sales/view/frontend/templates/order/shipment/items/renderer/default.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@
4242
<td class="col sku" data-th="<?= $block->escapeHtml(__('SKU')) ?>">
4343
<?= /* @noEscape */ $block->prepareSku($block->getSku()) ?>
4444
</td>
45-
<td class="col qty" data-th="<?= $block->escapeHtml(__('Qty Shipped')) ?>"><?= (int) $_item->getQty() ?></td>
45+
<td class="col qty" data-th="<?= $block->escapeHtml(__('Qty Shipped')) ?>"><?= (float) $_item->getQty() ?></td>
4646
</tr>

0 commit comments

Comments
 (0)