Skip to content

Commit e1821e5

Browse files
Merge remote-tracking branch 'remotes/github/MAGETWO-71344' into EPAM-PR-30
2 parents 6dddbad + ed6e711 commit e1821e5

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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="StoreFrontUpdateShoppingCartWhileUpdateMinicartTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<title value="Check updating shopping cart while updating items from minicart"/>
15+
<description value="Check updating shopping cart while updating items from minicart"/>
16+
<severity value="AVERAGE"/>
17+
<testCaseId value="MAGETWO-97280"/>
18+
<useCaseId value="MAGETWO-71344"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
22+
<before>
23+
<!--Create product-->
24+
<createData entity="SimpleProduct2" stepKey="createProduct"/>
25+
</before>
26+
27+
<after>
28+
<!--Delete created data-->
29+
<deleteData createDataKey="createProduct" stepKey="deleteProduct" />
30+
</after>
31+
32+
<!--Add product to cart-->
33+
<amOnPage url="$$createProduct.name$$.html" stepKey="navigateToProductPage"/>
34+
<waitForPageLoad stepKey="waitForProductPage"/>
35+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage">
36+
<argument name="productName" value="$$createProduct.name$$"/>
37+
</actionGroup>
38+
39+
<!--Go to Shopping cart and check Qty-->
40+
<actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCart"/>
41+
<grabValueFrom selector="{{CheckoutCartProductSection.ProductQuantityByName($$createProduct.name$$)}}" stepKey="grabQtyShoppingCart"/>
42+
<assertEquals expected="1" actual="$grabQtyShoppingCart" stepKey="assertQtyShoppingCart"/>
43+
44+
<!--Open minicart and change Qty-->
45+
<click selector="{{StorefrontMinicartSection.showCart}}" stepKey="openMiniCart"/>
46+
<waitForElementVisible selector="{{StorefrontMinicartSection.quantity}}" stepKey="waitForElementQty"/>
47+
<pressKey selector="{{StorefrontMinicartSection.itemQuantity($$createProduct.name$$)}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::BACKSPACE]" stepKey="deleteFiled"/>
48+
<fillField selector="{{StorefrontMinicartSection.itemQuantity($$createProduct.name$$)}}" userInput="5" stepKey="changeQty"/>
49+
<click selector="{{StorefrontMinicartSection.itemQuantityUpdate($$createProduct.name$$)}}" stepKey="updateQty"/>
50+
<waitForAjaxLoad stepKey="waitForAjaxLoad"/>
51+
52+
<!--Check Qty in shopping cart after updating-->
53+
<grabValueFrom selector="{{CheckoutCartProductSection.ProductQuantityByName($$createProduct.name$$)}}" stepKey="grabQtyShoppingCart1"/>
54+
<assertEquals expected="5" actual="$grabQtyShoppingCart1" stepKey="assertQtyShoppingCart1"/>
55+
</test>
56+
</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)