Skip to content

Commit b10cee9

Browse files
author
Alexander Akimov
authored
Merge pull request #3647 from magento-tsg/2.2-develop-pr70
[TSG] Backporting for 2.2 (pr70) (2.2)
2 parents d8ec98c + 3dbf04d commit b10cee9

File tree

38 files changed

+1947
-94
lines changed

38 files changed

+1947
-94
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductToCartActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<waitForElementNotVisible selector="{{StorefrontProductPageSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdded"/>
2828
<waitForElementVisible selector="{{StorefrontProductPageSection.addToCartButtonTitleIsAddToCart}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAddToCart"/>
2929
<waitForPageLoad stepKey="waitForPageLoad"/>
30+
<waitForElementVisible selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForProductAddedMessage"/>
3031
<see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
3132
</actionGroup>
3233

app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\Framework\DataObject\IdentityInterface;
1111
use Magento\Framework\Indexer\CacheContext;
1212

13+
/**
14+
* Abstract class for CatalogRule indexers.
15+
*/
1316
abstract class AbstractIndexer implements IndexerActionInterface, MviewActionInterface, IdentityInterface
1417
{
1518
/**
@@ -66,7 +69,6 @@ public function executeFull()
6669
{
6770
$this->indexBuilder->reindexFull();
6871
$this->_eventManager->dispatch('clean_cache_by_tags', ['object' => $this]);
69-
//TODO: remove after fix fpc. MAGETWO-50668
7072
$this->getCacheManager()->clean($this->getIdentities());
7173
}
7274

@@ -137,8 +139,9 @@ public function executeRow($id)
137139
abstract protected function doExecuteRow($id);
138140

139141
/**
140-
* @return \Magento\Framework\App\CacheInterface|mixed
142+
* Get cache manager
141143
*
144+
* @return \Magento\Framework\App\CacheInterface|mixed
142145
* @deprecated 100.0.7
143146
*/
144147
private function getCacheManager()

app/code/Magento/Checkout/Test/Mftf/ActionGroup/GoToCheckoutFromMinicartActionGroup.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
-->
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<!-- Go to checkout from minicart -->
1212
<actionGroup name="GoToCheckoutFromMinicartActionGroup">
1313
<waitForElement selector="{{StorefrontMinicartSection.showCart}}" stepKey="waitMiniCartSectionShow" />
1414
<click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/>
15-
<click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/>
15+
<waitForElementVisible selector="{{StorefrontMinicartSection.goToCheckout}}" time="30" stepKey="waitForGoToCheckoutButtonVisible"/>
16+
<click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="clickGoToCheckoutButton"/>
1617
<waitForPageLoad stepKey="waitForPageLoad"/>
1718
</actionGroup>
1819
</actionGroups>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<element name="postcode" type="input" selector="input[name=postcode]"/>
2020
<element name="country" type="select" selector="select[name=country_id]"/>
2121
<element name="telephone" type="input" selector="input[name=telephone]"/>
22-
<element name="firstShippingMethod" type="radio" selector="#checkout-shipping-method-load input[type='radio']"/>
22+
<element name="firstShippingMethod" type="radio" selector="#checkout-shipping-method-load input[type='radio']" timeout="30"/>
2323
<element name="selectedShippingAddress" type="text" selector=".shipping-address-item.selected-item"/>
2424
<element name="newAddressButton" type="button" selector="#checkout-step-shipping button"/>
2525
<element name="next" type="button" selector="[data-role='opc-continue']"/>

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: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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="StorefrontOnePageCheckoutDataWhenChangeQtyTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Checkout via Guest Checkout"/>
15+
<title value="One page Checkout Customer data when changing Product Qty"/>
16+
<description value="One page Checkout Customer data when changing Product Qty"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-13609"/>
19+
<useCaseId value="MAGETWO-96711"/>
20+
<group value="checkout"/>
21+
</annotations>
22+
<before>
23+
<!--Create a product-->
24+
<createData entity="SimpleProduct3" stepKey="createProduct"/>
25+
</before>
26+
<after>
27+
<!--Delete created data-->
28+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
29+
</after>
30+
31+
<!--Add product to cart and checkout-->
32+
<amOnPage url="{{StorefrontProductPage.url($$createProduct.name$$)}}" stepKey="amOnSimpleProductPage"/>
33+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage">
34+
<argument name="productName" value="$createProduct.name$$"/>
35+
</actionGroup>
36+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
37+
<fillField selector="{{CheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/>
38+
<fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/>
39+
<fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/>
40+
<fillField selector="{{CheckoutShippingSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="enterStreet"/>
41+
<fillField selector="{{CheckoutShippingSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="enterCity"/>
42+
<selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{CustomerAddressSimple.state}}" stepKey="selectRegion"/>
43+
<fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="enterPostcode"/>
44+
<fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="enterTelephone"/>
45+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
46+
47+
<!--Grab customer data to check it-->
48+
<grabValueFrom selector="{{CheckoutShippingSection.email}}" stepKey="grabEmail"/>
49+
<grabValueFrom selector="{{CheckoutShippingSection.firstName}}" stepKey="grabFirstName"/>
50+
<grabValueFrom selector="{{CheckoutShippingSection.lastName}}" stepKey="grabLastName"/>
51+
<grabValueFrom selector="{{CheckoutShippingSection.street}}" stepKey="grabStreet"/>
52+
<grabValueFrom selector="{{CheckoutShippingSection.city}}" stepKey="grabCity"/>
53+
<grabTextFrom selector="{{CheckoutShippingSection.region}}" stepKey="grabRegion"/>
54+
<grabValueFrom selector="{{CheckoutShippingSection.postcode}}" stepKey="grabPostcode"/>
55+
<grabValueFrom selector="{{CheckoutShippingSection.telephone}}" stepKey="grabTelephone"/>
56+
57+
<!--Select shipping method and finalize checkout-->
58+
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod"/>
59+
<waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
60+
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
61+
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
62+
<seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/>
63+
64+
<!--Go to cart page, update qty and proceed to checkout-->
65+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/>
66+
<see userInput="Shopping Cart" stepKey="seeCartPageIsOpened"/>
67+
<fillField selector="{{CheckoutCartProductSection.productQuantityByName($$createProduct.name$$)}}" userInput="2" stepKey="updateProductQty"/>
68+
<click selector="{{CheckoutCartProductSection.updateShoppingCartButton}}" stepKey="clickUpdateShoppingCart"/>
69+
<grabValueFrom selector="{{CheckoutCartProductSection.productQuantityByName($$createProduct.name$$)}}" stepKey="grabQty"/>
70+
<assertEquals expected="2" actual="$grabQty" stepKey="assertQty"/>
71+
<click selector="{{StorefrontCheckoutCartSummarySection.proceedToCheckout}}" stepKey="clickProceedToCheckout"/>
72+
73+
<!--Check that form is filled with customer data-->
74+
<grabValueFrom selector="{{CheckoutShippingSection.email}}" stepKey="grabEmail1"/>
75+
<grabValueFrom selector="{{CheckoutShippingSection.firstName}}" stepKey="grabFirstName1"/>
76+
<grabValueFrom selector="{{CheckoutShippingSection.lastName}}" stepKey="grabLastName1"/>
77+
<grabValueFrom selector="{{CheckoutShippingSection.street}}" stepKey="grabStreet1"/>
78+
<grabValueFrom selector="{{CheckoutShippingSection.city}}" stepKey="grabCity1"/>
79+
<grabTextFrom selector="{{CheckoutShippingSection.region}}" stepKey="grabRegion1"/>
80+
<grabValueFrom selector="{{CheckoutShippingSection.postcode}}" stepKey="grabPostcode1"/>
81+
<grabValueFrom selector="{{CheckoutShippingSection.telephone}}" stepKey="grabTelephone1"/>
82+
83+
<assertEquals expected="$grabEmail" actual="$grabEmail1" stepKey="assertEmail"/>
84+
<assertEquals expected="$grabFirstName" actual="$grabFirstName1" stepKey="assertFirstName"/>
85+
<assertEquals expected="$grabLastName" actual="$grabLastName1" stepKey="assertLastName"/>
86+
<assertEquals expected="$grabStreet" actual="$grabStreet1" stepKey="assertStreet"/>
87+
<assertEquals expected="$grabCity" actual="$grabCity1" stepKey="assertCity"/>
88+
<assertEquals expected="$grabRegion" actual="$grabRegion1" stepKey="assertRegion"/>
89+
<assertEquals expected="$grabPostcode" actual="$grabPostcode1" stepKey="assertPostcode"/>
90+
<assertEquals expected="$grabTelephone" actual="$grabTelephone1" stepKey="assertTelephone"/>
91+
</test>
92+
</tests>
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/checkout-data.js

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
*/
1111
define([
1212
'jquery',
13-
'Magento_Customer/js/customer-data'
13+
'Magento_Customer/js/customer-data',
14+
'jquery/jquery-storageapi'
1415
], function ($, storage) {
1516
'use strict';
1617

@@ -23,24 +24,35 @@ define([
2324
storage.set(cacheKey, data);
2425
},
2526

27+
/**
28+
* @return {*}
29+
*/
30+
initData = function () {
31+
return {
32+
'selectedShippingAddress': null, //Selected shipping address pulled from persistence storage
33+
'shippingAddressFromData': null, //Shipping address pulled from persistence storage
34+
'newCustomerShippingAddress': null, //Shipping address pulled from persistence storage for customer
35+
'selectedShippingRate': null, //Shipping rate pulled from persistence storage
36+
'selectedPaymentMethod': null, //Payment method pulled from persistence storage
37+
'selectedBillingAddress': null, //Selected billing address pulled from persistence storage
38+
'billingAddressFromData': null, //Billing address pulled from persistence storage
39+
'newCustomerBillingAddress': null //Billing address pulled from persistence storage for new customer
40+
};
41+
},
42+
2643
/**
2744
* @return {*}
2845
*/
2946
getData = function () {
3047
var data = storage.get(cacheKey)();
3148

3249
if ($.isEmptyObject(data)) {
33-
data = {
34-
'selectedShippingAddress': null, //Selected shipping address pulled from persistence storage
35-
'shippingAddressFromData': null, //Shipping address pulled from persistence storage
36-
'newCustomerShippingAddress': null, //Shipping address pulled from persistence storage for customer
37-
'selectedShippingRate': null, //Shipping rate pulled from persistence storage
38-
'selectedPaymentMethod': null, //Payment method pulled from persistence storage
39-
'selectedBillingAddress': null, //Selected billing address pulled from persistence storage
40-
'billingAddressFromData': null, //Billing address pulled from persistence storage
41-
'newCustomerBillingAddress': null //Billing address pulled from persistence storage for new customer
42-
};
43-
saveData(data);
50+
data = $.initNamespaceStorage('mage-cache-storage').localStorage.get(cacheKey);
51+
52+
if ($.isEmptyObject(data)) {
53+
data = initData();
54+
saveData(data);
55+
}
4456
}
4557

4658
return data;

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
},

app/code/Magento/Customer/Test/Mftf/ActionGroup/OpenEditCustomerFromAdminActionGroup.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
*/
77
-->
88
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10-
<actionGroup name="OpenEditCustomerFromAdminActionGroup">
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="OpenEditCustomerFromAdminActionGroup" extends="clearFiltersAdminDataGrid">
1111
<arguments>
1212
<argument name="customer"/>
1313
</arguments>
14-
<amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/>
15-
<waitForPageLoad stepKey="waitForPageLoad1" />
14+
<amOnPage url="{{AdminCustomerPage.url}}" before="waitForPageLoad" stepKey="navigateToCustomers"/>
1615
<click selector="{{AdminCustomerFiltersSection.filtersButton}}" stepKey="openFilter"/>
1716
<fillField userInput="{{customer.email}}" selector="{{AdminCustomerFiltersSection.emailInput}}" stepKey="filterEmail"/>
1817
<click selector="{{AdminCustomerFiltersSection.apply}}" stepKey="applyFilter"/>

0 commit comments

Comments
 (0)