Skip to content

Commit 045b3a0

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-72879' into 2.2-develop-pr70
2 parents b6ee63d + c0a74ad commit 045b3a0

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
<element name="viewAndEditCart" type="button" selector=".action.viewcart" timeout="30"/>
2323
<element name="miniCartItemsText" type="text" selector=".minicart-items"/>
2424
<element name="miniCartSubtotalField" type="text" selector=".block-minicart .amount span.price"/>
25+
<element name="itemQuantity" type="input" selector="//a[text()='{{productName}}']/../..//input[contains(@class,'cart-item-qty')]" parameterized="true"/>
26+
<element name="itemQuantityUpdate" type="button" selector="//a[text()='{{productName}}']/../..//span[text()='Update']" parameterized="true"/>
2527
<element name="emptyCart" type="text" selector=".counter.qty.empty"/>
2628
</section>
2729
</sections>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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="StorefrontUpdateQtyInShoppingCartAfterUpdateInMinicartTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Checkout via Guest Checkout"/>
15+
<title value="Check updating shopping cart while updating items from minicart"/>
16+
<description value="Check updating shopping cart while updating items from minicart"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="MC-13626"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
<before>
22+
<!--Create category-->
23+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
24+
<!--Create product-->
25+
<createData entity="SimpleProduct" stepKey="createProduct">
26+
<requiredEntity createDataKey="createCategory"/>
27+
</createData>
28+
</before>
29+
<after>
30+
<!--Delete product-->
31+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
32+
<!--Delete category-->
33+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
34+
</after>
35+
36+
<!--Open Product Page-->
37+
<amOnPage url="{{StorefrontProductPage.url($$createProduct.name$$)}}" stepKey="openProductPage"/>
38+
<!--Add product to cart-->
39+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addProductToCart">
40+
<argument name="productName" value="$$createProduct.name$$"/>
41+
</actionGroup>
42+
43+
<!--Go to Shopping cart-->
44+
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openShoppingCart"/>
45+
<!--Check quantity in Shopping cart-->
46+
<grabValueFrom selector="{{CheckoutCartProductSection.productQuantityByName($$createProduct.name$$)}}" stepKey="grabQtyFromShoppingCart"/>
47+
<assertEquals expected="1" actual="$grabQtyFromShoppingCart" stepKey="assertQtyInShoppingCart"/>
48+
49+
<!--Open minicart-->
50+
<click selector="{{StorefrontMinicartSection.showCart}}" stepKey="openMiniCart"/>
51+
<waitForElementVisible selector="{{StorefrontMinicartSection.itemQuantity($$createProduct.name$$)}}" stepKey="waitForItemQuantity"/>
52+
<pressKey selector="{{StorefrontMinicartSection.itemQuantity($$createProduct.name$$)}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::BACKSPACE]" stepKey="clearQtyField"/>
53+
<fillField selector="{{StorefrontMinicartSection.itemQuantity($$createProduct.name$$)}}" userInput="5" stepKey="fillQtyField"/>
54+
<waitForElementVisible selector="{{StorefrontMinicartSection.itemQuantityUpdate($$createProduct.name$$)}}" stepKey="waitForUpdateButton"/>
55+
<click selector="{{StorefrontMinicartSection.itemQuantityUpdate($$createProduct.name$$)}}" stepKey="clickUpdateButton"/>
56+
<waitForAjaxLoad stepKey="waitForAjaxLoad"/>
57+
<!--Check quantity in shopping cart after updating-->
58+
<grabValueFrom selector="{{CheckoutCartProductSection.productQuantityByName($$createProduct.name$$)}}" stepKey="grabQtyFromShoppingCart1"/>
59+
<assertEquals expected="5" actual="$grabQtyFromShoppingCart1" stepKey="assertQtyInShoppingCart1"/>
60+
</test>
61+
</tests>

app/code/Magento/Checkout/view/frontend/web/js/sidebar.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ define([
2525
}
2626
},
2727
scrollHeight: 0,
28+
shoppingCartUrl: window.checkout.shoppingCartUrl,
2829

2930
/**
3031
* Create sidebar.
@@ -227,6 +228,10 @@ define([
227228

228229
if (!_.isUndefined(productData)) {
229230
$(document).trigger('ajax:updateCartItemQty');
231+
232+
if (window.location.href === this.shoppingCartUrl) {
233+
window.location.reload(false);
234+
}
230235
}
231236
this._hideItemButton(elem);
232237
},

0 commit comments

Comments
 (0)