Skip to content

Commit d0994c3

Browse files
ENGCOM-8447: Fixed issue 29920 - "Item in Cart" not pluralized correctly #29923
2 parents a284b63 + 727a042 commit d0994c3

File tree

6 files changed

+61
-7
lines changed

6 files changed

+61
-7
lines changed

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartSummarySection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="CheckoutCartSummarySection">
12+
<element name="itemsInCartLabel" type="text" selector="//*[@id='opc-sidebar']/div[1]/div/div[1]/strong/span[2]"/>
1213
<element name="orderTotal" type="input" selector=".grand.totals .amount .price"/>
1314
<element name="subTotal" type="input" selector="span[data-th='Subtotal']"/>
1415
<element name="expandShoppingCartSummary" type="button" selector="//*[contains(@class, 'items-in-cart')][not(contains(@class, 'active'))]"/>

app/code/Magento/Checkout/Test/Mftf/Section/StorefrontMinicartSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@
4444
<element name="productQuantity" type="input" selector="//*[@id='mini-cart']//a[contains(text(),'{{productName}}')]/../..//div[@class='details-qty qty']//input[@data-item-qty='{{qty}}']" parameterized="true"/>
4545
<element name="productImage" type="text" selector="//ol[@id='mini-cart']//img[@class='product-image-photo']"/>
4646
<element name="productSubTotal" type="text" selector="//div[@class='subtotal']//span/span[@class='price']"/>
47+
<element name="productCountLabel" type="text" selector="//*[@id='minicart-content-wrapper']/div[2]/div[1]/span[2]"/>
4748
</section>
4849
</sections>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddProductWithAllTypesOfCustomOptionToTheShoppingCartTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
<!-- Assert Product Count in Mini Cart -->
106106
<actionGroup ref="StorefrontAssertMiniCartItemCountActionGroup" stepKey="assertProductCountAndTextInMiniCart">
107107
<argument name="productCount" value="2"/>
108-
<argument name="productCountText" value="2 Item in Cart"/>
108+
<argument name="productCountText" value="2 Items in Cart"/>
109109
</actionGroup>
110110

111111
<!--Assert Product Items in Mini cart-->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
9+
<test name="StorefrontCheckoutSummaryItemsInCartLabelPluralizedTest">
10+
<annotations>
11+
<features value="Checkout"/>
12+
<stories value="Checkout page order summary section 'Item in Cart' is pluralized correctly or not"/>
13+
<title value="'Item in Cart' is pluralized correctly"/>
14+
<description value="When adding more then 1 item and check checkout page order summary section text 'Items in Cart' is pluralized correctly or not"/>
15+
<severity value="AVERAGE"/>
16+
<group value="Checkout"/>
17+
</annotations>
18+
<before>
19+
<createData entity="_defaultCategory" stepKey="createCategory"/>
20+
<createData entity="ApiSimpleProduct" stepKey="createProduct">
21+
<requiredEntity createDataKey="createCategory"/>
22+
<field key="price">100.00</field>
23+
</createData>
24+
</before>
25+
<after>
26+
<deleteData createDataKey="createProduct" stepKey="deleteSimpleProduct"/>
27+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
28+
</after>
29+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
30+
<argument name="productUrl" value="$createProduct.custom_attributes[url_key]$"/>
31+
</actionGroup>
32+
<actionGroup ref="StorefrontEnterProductQuantityAndAddToTheCartActionGroup" stepKey="enterProductQuantityAndAddToTheCart">
33+
<argument name="quantity" value="1"/>
34+
</actionGroup>
35+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart"/>
36+
<see selector="{{StorefrontMinicartSection.productCountLabel}}" userInput="Item in Cart" stepKey="seeProductCountLabel"/>
37+
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="openCheckoutPage"/>
38+
<waitForPageLoad stepKey="waitForBundleProductCreatePageToLoad"/>
39+
<see selector="{{CheckoutCartSummarySection.itemsInCartLabel}}" userInput="Item in Cart" stepKey="seeFirstProductInList"/>
40+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPageAgain">
41+
<argument name="productUrl" value="$createProduct.custom_attributes[url_key]$"/>
42+
</actionGroup>
43+
<actionGroup ref="StorefrontEnterProductQuantityAndAddToTheCartActionGroup" stepKey="enterProductQuantityAndAddToTheCartAgain">
44+
<argument name="quantity" value="4"/>
45+
</actionGroup>
46+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCartAgain"/>
47+
<see selector="{{StorefrontMinicartSection.productCountLabel}}" userInput="Items in Cart" stepKey="seeProductCountLabelAgain"/>
48+
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="openCheckoutPageAgain"/>
49+
<waitForPageLoad stepKey="waitForBundleProductCreatePageToLoadAgain"/>
50+
<see selector="{{CheckoutCartSummarySection.itemsInCartLabel}}" userInput="Items in Cart" stepKey="seeFirstProductInListAgain"/>
51+
</test>
52+
</tests>

app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535
<span class="count" if="maxItemsToDisplay < getCartLineItemsCount()" text="maxItemsToDisplay"/>
3636
<translate args="'of'" if="maxItemsToDisplay < getCartLineItemsCount()"/>
3737
<span class="count" text="getCartParam('summary_count')"/>
38-
<!-- ko if: (getCartLineItemsCount() === 1) -->
39-
<span translate="'Item in Cart'"/>
40-
<!--/ko-->
41-
<!-- ko if: (getCartLineItemsCount() > 1) -->
38+
<!-- ko if: (getCartParam('summary_count') > 1) -->
4239
<span translate="'Items in Cart'"/>
4340
<!--/ko-->
41+
<!-- ko if: (getCartParam('summary_count') === 1) -->
42+
<span translate="'Item in Cart'"/>
43+
<!--/ko-->
4444
</div>
4545

4646
<each args="getRegion('subtotalContainer')" render=""/>

app/code/Magento/Checkout/view/frontend/web/template/summary/cart-items.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
<translate args="maxCartItemsToDisplay" if="maxCartItemsToDisplay < getCartLineItemsCount()"/>
1111
<translate args="'of'" if="maxCartItemsToDisplay < getCartLineItemsCount()"/>
1212
<span data-bind="text: getCartSummaryItemsCount()"></span>
13-
<translate args="'Item in Cart'" if="getCartLineItemsCount() === 1"/>
14-
<translate args="'Items in Cart'" if="getCartLineItemsCount() > 1"/>
13+
<translate args="'Item in Cart'" if="getCartSummaryItemsCount() === 1"/>
14+
<translate args="'Items in Cart'" if="getCartSummaryItemsCount() > 1"/>
1515
</strong>
1616
</div>
1717
<div class="content minicart-items" data-role="content">

0 commit comments

Comments
 (0)