From 827ac377c916d0eb77a387733a757a2b78315253 Mon Sep 17 00:00:00 2001 From: Stsiapan Korf Date: Wed, 26 Jun 2019 13:26:07 +0000 Subject: [PATCH 01/37] MC-15507: Shipping address is dropped after zip code in new billing address form is filled - Set shipping address in checkout provider --- .../Magento/Checkout/view/frontend/web/js/view/shipping.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js index c811d3a1e8369..71cdf9bd83241 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js @@ -246,9 +246,14 @@ define([ * Set shipping information handler */ setShippingInformation: function () { + var checkoutProvider = registry.get('checkoutProvider'); if (this.validateShippingInformation()) { quote.billingAddress(null); checkoutDataResolver.resolveBillingAddress(); + checkoutProvider.set( + 'shippingAddress', + $.extend(true, {}, checkoutProvider.get('shippingAddress'), quote.shippingAddress()) + ); setShippingInformationAction().done( function () { stepNavigator.next(); From 861ef75fbb90f5bb0b04b7f27833ac4c25a9c6df Mon Sep 17 00:00:00 2001 From: Ani Tumanyan Date: Wed, 10 Jul 2019 16:13:14 +0400 Subject: [PATCH 02/37] MC-15507: shipping address is dropped after zip code in new billing address form is filled - Added automated test --- ...eckoutFillNewBillingAddressActionGroup.xml | 4 + .../Checkout/Test/Mftf/Page/CheckoutPage.xml | 1 + .../Mftf/Section/CheckoutPaymentSection.xml | 2 +- .../Mftf/Section/CheckoutShippingSection.xml | 1 + .../SelectShippingAddressPopupSection.xml | 16 ++ ...AffectOnShippingAddressAfterUpdateTest.xml | 148 ++++++++++++++++++ .../Customer/Test/Mftf/Data/AddressData.xml | 15 ++ .../Customer/Test/Mftf/Data/CustomerData.xml | 14 ++ 8 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Checkout/Test/Mftf/Section/SelectShippingAddressPopupSection.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/Test/BillingAddressFormAffectOnShippingAddressAfterUpdateTest.xml diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml index 59e997eccecc0..6d92ca79000eb 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml @@ -24,6 +24,10 @@ + + + + diff --git a/app/code/Magento/Checkout/Test/Mftf/Page/CheckoutPage.xml b/app/code/Magento/Checkout/Test/Mftf/Page/CheckoutPage.xml index d3fa045e4654f..d6173dfa17916 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Page/CheckoutPage.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Page/CheckoutPage.xml @@ -14,5 +14,6 @@
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml index e1c2a3b1550f1..13bac9cefb681 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml @@ -46,7 +46,6 @@ - @@ -59,5 +58,6 @@ +
diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml index f90ec0aad4624..bf1001ad6b286 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml @@ -41,5 +41,6 @@ +
diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/SelectShippingAddressPopupSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/SelectShippingAddressPopupSection.xml new file mode 100644 index 0000000000000..ff1431ab33ba5 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Section/SelectShippingAddressPopupSection.xml @@ -0,0 +1,16 @@ + + + + +
+ + + +
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/BillingAddressFormAffectOnShippingAddressAfterUpdateTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/BillingAddressFormAffectOnShippingAddressAfterUpdateTest.xml new file mode 100644 index 0000000000000..9b2958a190be8 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Test/BillingAddressFormAffectOnShippingAddressAfterUpdateTest.xml @@ -0,0 +1,148 @@ + + + + + + + + + <description value="Billing address form does not affect shipping address after update"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-16961"/> + <useCaseId value="MC-15507"/> + <group value="checkout"/> + </annotations> + <before> + <!-- Login as Admin --> + <comment userInput="Login as Admin" stepKey="commentLoginAsAdmin"/> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + <!-- Create simple product and add to category --> + <comment userInput="Create simple product and add to category" stepKey="commentAddProductToCategory"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="SimpleProduct" stepKey="createProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <!-- Create customer --> + <comment userInput="Create customer" stepKey="commentCreateCustomer"/> + <createData entity="Simple_US_Customer_Without_Default_Address" stepKey="createCustomer"/> + </before> + <after> + <!-- Log out --> + <comment userInput="Log out" stepKey="commentLogOut"/> + <actionGroup ref="logout" stepKey="logout"/> + <!-- Delete data --> + <comment userInput="Delete data" stepKey="commentDeleteData"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + <!-- Set default configurations --> + <comment userInput="Set default configurations" stepKey="commentSetDefaultConfigurations"/> + <magentoCLI command="config:set checkout/options/enable_address_search 0" stepKey="setDefaultEnableAddressSearch"/> + <magentoCLI command="config:set checkout/options/customer_address_limit 10" stepKey="setDefaultCount"/> + </after> + <!-- Login to the Storefront as created customer --> + <comment userInput="Login to the Storefront as created customer" stepKey="commentLoginAsCustomer"/> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer"> + <argument name="Customer" value="$$createCustomer$$"/> + </actionGroup> + <!-- Add 3 addresses to Address book--> + <comment userInput="Add 3 addresses to Address book" stepKey="commentAddAddresses"/> + <actionGroup ref="StorefrontAddNewCustomerAddressActionGroup" stepKey="AddNewAddressFirst"> + <argument name="Address" value="US_Address_NY"/> + </actionGroup> + <actionGroup ref="StorefrontAddNewCustomerAddressActionGroup" stepKey="AddNewAddressSecond"> + <argument name="Address" value="US_Address_CA"/> + </actionGroup> + <actionGroup ref="StorefrontAddNewCustomerAddressActionGroup" stepKey="AddNewAddressThird"> + <argument name="Address" value="US_Address_TX"/> + </actionGroup> + <!-- Add product to the Shopping Cart --> + <comment userInput="Add product to the Shopping Cart" stepKey="commentAddProductToTheCart"/> + <amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="amOnStorefrontProductFirstPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="cartAddProductToCart"> + <argument name="product" value="$$createProduct$$"/> + <argument name="productCount" value="1"/> + </actionGroup> + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckout"/> + <click selector="{{CheckoutShippingMethodsSection.shipHereButton}}" stepKey="changeShippingAddressButton"/> + <waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNext"/> + <!-- Click next button to open payment section --> + <comment userInput="Click next button to open payment section" stepKey="commentClickToNextButton"/> + <click selector="{{CheckoutShippingGuestInfoSection.next}}" stepKey="clickNext"/> + <waitForPageLoad stepKey="waitForShipmentPageLoad"/> + <uncheckOption selector="{{CheckoutPaymentSection.billingAddressNotSameCheckbox}}" stepKey="selectPaymentSolution"/> + <waitForElement selector="{{CheckoutPaymentSection.billingAddressSelectShared}}" time="30" stepKey="waitForAddressField"/> + <selectOption selector="{{CheckoutPaymentSection.billingAddressSelectShared}}" userInput="New Address" stepKey="chooseNewAddress"/> + <waitForPageLoad stepKey="waitForNewAddressPageLoad"/> + <actionGroup ref="CheckoutFillNewBillingAddressActionGroup" stepKey="guestCheckoutFillingBillingAddress"> + <argument name="customerVar" value="CustomerEntityOne"/> + <argument name="customerAddressVar" value="CustomerAddressSimple"/> + </actionGroup> + <click selector="{{CheckoutPaymentSection.update}}" stepKey="clickUpdateButton"/> + <waitForPageLoad stepKey="waitForProcessing"/> + <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickToPlaceOrder"/> + <see userInput="Thank you for your purchase!" stepKey="seeSuccessMessage"/> + <waitForPageLoad stepKey="waitForSuccess"/> + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/> + <!-- Go to my Orders page --> + <comment userInput="Go to my Orders page" stepKey="commentOpenMyOrders"/> + <amOnPage url="{{StorefrontCustomerDashboardPage.url}}" stepKey="onMyAccount"/> + <waitForPageLoad stepKey="waitForAccountPage"/> + <click selector="{{StorefrontCustomerSidebarSection.sidebarTab('My Orders')}}" stepKey="clickOnMyOrders"/> + <waitForPageLoad stepKey="waitForOrdersLoad"/> + <!-- Click 'View Order' link on order --> + <comment userInput="Click 'View Order' link on order" stepKey="commentViewOrder"/> + <click selector="{{StorefrontCustomerOrdersGridSection.orderView({$grabOrderNumber})}}" stepKey="clickOrderView"/> + <waitForPageLoad stepKey="waitForOrderPageLoad"/> + <see selector="{{StorefrontCustomerOrderViewSection.shippingAddress}}" userInput="New York" stepKey="seeNewYorkInShippingSection"/> + <!-- Set configurations --> + <comment userInput="Set configurations" stepKey="commentSetConfigurations"/> + <magentoCLI command="config:set checkout/options/enable_address_search 1" stepKey="setEnableAddressSearch"/> + <magentoCLI command="config:set checkout/options/customer_address_limit 2" stepKey="setCount"/> + <amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="amOnStorefrontProductFirstPageSecond"/> + <waitForPageLoad stepKey="waitForPageLoadSecond"/> + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="cartAddProductToCartSecond"> + <argument name="product" value="$$createProduct$$"/> + <argument name="productCount" value="1"/> + </actionGroup> + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutSecond"/> + <click selector="{{CheckoutShippingSection.changeAddressButton}}" stepKey="clickToChangeShippingAddress"/> + <waitForPageLoad stepKey="waitForPopupLoad"/> + <fillField selector="{{SelectBillingAddressPopupSection.shippingAddressSearch}}" userInput="California" stepKey="fillAddressSearchField"/> + <waitForPageLoad stepKey="waitForAddressPopupLoad"/> + <waitForElementVisible selector="{{CheckoutShippingMethodsSection.shipHereButton}}" stepKey="waitForShipHereButton"/> + <click selector="{{CheckoutShippingMethodsSection.shipHereButton}}" stepKey="changeShippingAddress"/> + <waitForElementVisible selector="{{CheckoutShippingMethodsSection.next}}" stepKey="waitForNextButton"/> + <click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickToNextButtonSecond"/> + <waitForPageLoad stepKey="waitForNextPageLoadSecond"/> + <click selector="{{CheckoutPaymentSection.changeAddressButton('2')}}" stepKey="clickToChangePaymentAddress"/> + <waitForPageLoad stepKey="waitForPaymentAddressPopupLoad"/> + <fillField selector="{{SelectBillingAddressPopupSection.shippingAddressSearchParametrised('2')}}" userInput="New York" stepKey="fillPaymentAddressSearchField"/> + <waitForPageLoad stepKey="waitForAddressPopup"/> + <waitForElementVisible selector="{{SelectBillingAddressPopupSection.selectButton}}" stepKey="waitForSelectButton"/> + <click selector="{{SelectBillingAddressPopupSection.selectButton}}" stepKey="clickToSelectButtonSecond"/> + <waitForPageLoad stepKey="waitForPaymentLoading"/> + <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickToPlaceOrderButton"/> + <waitForPageLoad stepKey="waitForSuccessMessage"/> + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderId"/> + <!-- Go to my Orders page --> + <comment userInput="Go to my Orders page" stepKey="commentGoToMyOrders"/> + <amOnPage url="{{StorefrontCustomerDashboardPage.url}}" stepKey="openMyAccount"/> + <waitForPageLoad stepKey="waitForAccountPageLoad"/> + <click selector="{{StorefrontCustomerSidebarSection.sidebarTab('My Orders')}}" stepKey="clickToMyOrders"/> + <waitForPageLoad stepKey="waitForOrderLoad"/> + <!-- Click 'View Order' link on order from preconditions --> + <click selector="{{StorefrontCustomerOrdersGridSection.orderView({$grabOrderId})}}" stepKey="clickToOrderViewButton"/> + <waitForPageLoad stepKey="waitForOrderPage"/> + <comment userInput="Click 'View Order' link on order" stepKey="commentClickToViewOrder"/> + <see selector="{{StorefrontCustomerOrderViewSection.shippingAddress}}" userInput="California" stepKey="seeCaliforniaInShippingSection"/> + <see selector="{{StorefrontCustomerOrderViewSection.billingAddress}}" userInput="New York" stepKey="seeNewYorkInBillingSection"/> + </test> +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml b/app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml index 88f86e456e5bf..1ea7b924ba105 100755 --- a/app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml @@ -51,6 +51,21 @@ <data key="default_shipping">Yes</data> <requiredEntity type="region">RegionTX</requiredEntity> </entity> + <entity name="US_Address_TX_Without_Default" type="address"> + <data key="firstname">John</data> + <data key="lastname">Doe</data> + <data key="company">Magento</data> + <array key="street"> + <item>7700 West Parmer Lane</item> + </array> + <data key="city">Austin</data> + <data key="state">Texas</data> + <data key="country_id">US</data> + <data key="country">United States</data> + <data key="postcode">78729</data> + <data key="telephone">512-345-6789</data> + <requiredEntity type="region">RegionTX</requiredEntity> + </entity> <entity name="US_Address_TX_Default_Billing" type="address"> <data key="firstname">John</data> <data key="lastname">Doe</data> diff --git a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml index 55bc9b56c7917..d19d0bfa65186 100644 --- a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml @@ -47,6 +47,20 @@ <data key="group">General</data> <requiredEntity type="address">US_Address_TX</requiredEntity> </entity> + <entity name="Simple_US_Customer_Without_Default_Address" type="customer"> + <data key="group_id">1</data> + <data key="default_billing">true</data> + <data key="default_shipping">true</data> + <data key="email" unique="prefix">John.Doe@example.com</data> + <data key="firstname">John</data> + <data key="lastname">Doe</data> + <data key="fullname">John Doe</data> + <data key="password">pwdTest123!</data> + <data key="store_id">0</data> + <data key="website_id">0</data> + <data key="group">General</data> + <requiredEntity type="address">US_Address_TX_Without_Default</requiredEntity> + </entity> <entity name="SimpleUsCustomerWithNewCustomerGroup" type="customer"> <data key="default_billing">true</data> <data key="default_shipping">true</data> From b0c53ba72e57134025bc55e1e6b7e099c6cfccbc Mon Sep 17 00:00:00 2001 From: Yuliya Labudova <Yuliya_Labudova@epam.com> Date: Thu, 18 Jul 2019 10:21:08 +0300 Subject: [PATCH 03/37] MC-15507: Shipping address is dropped after zip code in new billing address form is filled - Fix for checkout address. --- ...AffectOnShippingAddressAfterUpdateTest.xml | 148 ------------------ .../view/frontend/web/js/view/shipping.js | 15 +- 2 files changed, 10 insertions(+), 153 deletions(-) delete mode 100644 app/code/Magento/Checkout/Test/Mftf/Test/BillingAddressFormAffectOnShippingAddressAfterUpdateTest.xml diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/BillingAddressFormAffectOnShippingAddressAfterUpdateTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/BillingAddressFormAffectOnShippingAddressAfterUpdateTest.xml deleted file mode 100644 index 9b2958a190be8..0000000000000 --- a/app/code/Magento/Checkout/Test/Mftf/Test/BillingAddressFormAffectOnShippingAddressAfterUpdateTest.xml +++ /dev/null @@ -1,148 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="BillingAddressFormAffectOnShippingAddressAfterUpdateTest"> - <annotations> - <features value="Checkout"/> - <title value="Billing address form does not affect shipping address after update"/> - <description value="Billing address form does not affect shipping address after update"/> - <severity value="CRITICAL"/> - <testCaseId value="MC-16961"/> - <useCaseId value="MC-15507"/> - <group value="checkout"/> - </annotations> - <before> - <!-- Login as Admin --> - <comment userInput="Login as Admin" stepKey="commentLoginAsAdmin"/> - <actionGroup ref="LoginAsAdmin" stepKey="login"/> - <!-- Create simple product and add to category --> - <comment userInput="Create simple product and add to category" stepKey="commentAddProductToCategory"/> - <createData entity="_defaultCategory" stepKey="createCategory"/> - <createData entity="SimpleProduct" stepKey="createProduct"> - <requiredEntity createDataKey="createCategory"/> - </createData> - <!-- Create customer --> - <comment userInput="Create customer" stepKey="commentCreateCustomer"/> - <createData entity="Simple_US_Customer_Without_Default_Address" stepKey="createCustomer"/> - </before> - <after> - <!-- Log out --> - <comment userInput="Log out" stepKey="commentLogOut"/> - <actionGroup ref="logout" stepKey="logout"/> - <!-- Delete data --> - <comment userInput="Delete data" stepKey="commentDeleteData"/> - <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <!-- Set default configurations --> - <comment userInput="Set default configurations" stepKey="commentSetDefaultConfigurations"/> - <magentoCLI command="config:set checkout/options/enable_address_search 0" stepKey="setDefaultEnableAddressSearch"/> - <magentoCLI command="config:set checkout/options/customer_address_limit 10" stepKey="setDefaultCount"/> - </after> - <!-- Login to the Storefront as created customer --> - <comment userInput="Login to the Storefront as created customer" stepKey="commentLoginAsCustomer"/> - <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer"> - <argument name="Customer" value="$$createCustomer$$"/> - </actionGroup> - <!-- Add 3 addresses to Address book--> - <comment userInput="Add 3 addresses to Address book" stepKey="commentAddAddresses"/> - <actionGroup ref="StorefrontAddNewCustomerAddressActionGroup" stepKey="AddNewAddressFirst"> - <argument name="Address" value="US_Address_NY"/> - </actionGroup> - <actionGroup ref="StorefrontAddNewCustomerAddressActionGroup" stepKey="AddNewAddressSecond"> - <argument name="Address" value="US_Address_CA"/> - </actionGroup> - <actionGroup ref="StorefrontAddNewCustomerAddressActionGroup" stepKey="AddNewAddressThird"> - <argument name="Address" value="US_Address_TX"/> - </actionGroup> - <!-- Add product to the Shopping Cart --> - <comment userInput="Add product to the Shopping Cart" stepKey="commentAddProductToTheCart"/> - <amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="amOnStorefrontProductFirstPage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="cartAddProductToCart"> - <argument name="product" value="$$createProduct$$"/> - <argument name="productCount" value="1"/> - </actionGroup> - <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckout"/> - <click selector="{{CheckoutShippingMethodsSection.shipHereButton}}" stepKey="changeShippingAddressButton"/> - <waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNext"/> - <!-- Click next button to open payment section --> - <comment userInput="Click next button to open payment section" stepKey="commentClickToNextButton"/> - <click selector="{{CheckoutShippingGuestInfoSection.next}}" stepKey="clickNext"/> - <waitForPageLoad stepKey="waitForShipmentPageLoad"/> - <uncheckOption selector="{{CheckoutPaymentSection.billingAddressNotSameCheckbox}}" stepKey="selectPaymentSolution"/> - <waitForElement selector="{{CheckoutPaymentSection.billingAddressSelectShared}}" time="30" stepKey="waitForAddressField"/> - <selectOption selector="{{CheckoutPaymentSection.billingAddressSelectShared}}" userInput="New Address" stepKey="chooseNewAddress"/> - <waitForPageLoad stepKey="waitForNewAddressPageLoad"/> - <actionGroup ref="CheckoutFillNewBillingAddressActionGroup" stepKey="guestCheckoutFillingBillingAddress"> - <argument name="customerVar" value="CustomerEntityOne"/> - <argument name="customerAddressVar" value="CustomerAddressSimple"/> - </actionGroup> - <click selector="{{CheckoutPaymentSection.update}}" stepKey="clickUpdateButton"/> - <waitForPageLoad stepKey="waitForProcessing"/> - <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickToPlaceOrder"/> - <see userInput="Thank you for your purchase!" stepKey="seeSuccessMessage"/> - <waitForPageLoad stepKey="waitForSuccess"/> - <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/> - <!-- Go to my Orders page --> - <comment userInput="Go to my Orders page" stepKey="commentOpenMyOrders"/> - <amOnPage url="{{StorefrontCustomerDashboardPage.url}}" stepKey="onMyAccount"/> - <waitForPageLoad stepKey="waitForAccountPage"/> - <click selector="{{StorefrontCustomerSidebarSection.sidebarTab('My Orders')}}" stepKey="clickOnMyOrders"/> - <waitForPageLoad stepKey="waitForOrdersLoad"/> - <!-- Click 'View Order' link on order --> - <comment userInput="Click 'View Order' link on order" stepKey="commentViewOrder"/> - <click selector="{{StorefrontCustomerOrdersGridSection.orderView({$grabOrderNumber})}}" stepKey="clickOrderView"/> - <waitForPageLoad stepKey="waitForOrderPageLoad"/> - <see selector="{{StorefrontCustomerOrderViewSection.shippingAddress}}" userInput="New York" stepKey="seeNewYorkInShippingSection"/> - <!-- Set configurations --> - <comment userInput="Set configurations" stepKey="commentSetConfigurations"/> - <magentoCLI command="config:set checkout/options/enable_address_search 1" stepKey="setEnableAddressSearch"/> - <magentoCLI command="config:set checkout/options/customer_address_limit 2" stepKey="setCount"/> - <amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="amOnStorefrontProductFirstPageSecond"/> - <waitForPageLoad stepKey="waitForPageLoadSecond"/> - <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="cartAddProductToCartSecond"> - <argument name="product" value="$$createProduct$$"/> - <argument name="productCount" value="1"/> - </actionGroup> - <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutSecond"/> - <click selector="{{CheckoutShippingSection.changeAddressButton}}" stepKey="clickToChangeShippingAddress"/> - <waitForPageLoad stepKey="waitForPopupLoad"/> - <fillField selector="{{SelectBillingAddressPopupSection.shippingAddressSearch}}" userInput="California" stepKey="fillAddressSearchField"/> - <waitForPageLoad stepKey="waitForAddressPopupLoad"/> - <waitForElementVisible selector="{{CheckoutShippingMethodsSection.shipHereButton}}" stepKey="waitForShipHereButton"/> - <click selector="{{CheckoutShippingMethodsSection.shipHereButton}}" stepKey="changeShippingAddress"/> - <waitForElementVisible selector="{{CheckoutShippingMethodsSection.next}}" stepKey="waitForNextButton"/> - <click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickToNextButtonSecond"/> - <waitForPageLoad stepKey="waitForNextPageLoadSecond"/> - <click selector="{{CheckoutPaymentSection.changeAddressButton('2')}}" stepKey="clickToChangePaymentAddress"/> - <waitForPageLoad stepKey="waitForPaymentAddressPopupLoad"/> - <fillField selector="{{SelectBillingAddressPopupSection.shippingAddressSearchParametrised('2')}}" userInput="New York" stepKey="fillPaymentAddressSearchField"/> - <waitForPageLoad stepKey="waitForAddressPopup"/> - <waitForElementVisible selector="{{SelectBillingAddressPopupSection.selectButton}}" stepKey="waitForSelectButton"/> - <click selector="{{SelectBillingAddressPopupSection.selectButton}}" stepKey="clickToSelectButtonSecond"/> - <waitForPageLoad stepKey="waitForPaymentLoading"/> - <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickToPlaceOrderButton"/> - <waitForPageLoad stepKey="waitForSuccessMessage"/> - <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderId"/> - <!-- Go to my Orders page --> - <comment userInput="Go to my Orders page" stepKey="commentGoToMyOrders"/> - <amOnPage url="{{StorefrontCustomerDashboardPage.url}}" stepKey="openMyAccount"/> - <waitForPageLoad stepKey="waitForAccountPageLoad"/> - <click selector="{{StorefrontCustomerSidebarSection.sidebarTab('My Orders')}}" stepKey="clickToMyOrders"/> - <waitForPageLoad stepKey="waitForOrderLoad"/> - <!-- Click 'View Order' link on order from preconditions --> - <click selector="{{StorefrontCustomerOrdersGridSection.orderView({$grabOrderId})}}" stepKey="clickToOrderViewButton"/> - <waitForPageLoad stepKey="waitForOrderPage"/> - <comment userInput="Click 'View Order' link on order" stepKey="commentClickToViewOrder"/> - <see selector="{{StorefrontCustomerOrderViewSection.shippingAddress}}" userInput="California" stepKey="seeCaliforniaInShippingSection"/> - <see selector="{{StorefrontCustomerOrderViewSection.billingAddress}}" userInput="New York" stepKey="seeNewYorkInBillingSection"/> - </test> -</tests> diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js index 71cdf9bd83241..d5098dbc6f734 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js @@ -246,14 +246,19 @@ define([ * Set shipping information handler */ setShippingInformation: function () { - var checkoutProvider = registry.get('checkoutProvider'); if (this.validateShippingInformation()) { quote.billingAddress(null); checkoutDataResolver.resolveBillingAddress(); - checkoutProvider.set( - 'shippingAddress', - $.extend(true, {}, checkoutProvider.get('shippingAddress'), quote.shippingAddress()) - ); + registry.async('checkoutProvider')(function (checkoutProvider) { + var shippingAddressData = checkoutData.getShippingAddressFromData(); + + if (shippingAddressData) { + checkoutProvider.set( + 'shippingAddress', + $.extend(true, {}, checkoutProvider.get('shippingAddress'), shippingAddressData) + ); + } + }); setShippingInformationAction().done( function () { stepNavigator.next(); From 11f7f3954132512dd9d8fbc0a70e81e48de7a4ba Mon Sep 17 00:00:00 2001 From: Jamie Saunders <jamie@wearec3.co.uk> Date: Tue, 23 Jul 2019 08:15:31 +0100 Subject: [PATCH 04/37] Fixes #23824: User data serialised multiple times on save when loaded via loadByUsername. Unserialises the extra data when loading a user using the loadByUsername method of the User model. --- app/code/Magento/User/Model/User.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/User/Model/User.php b/app/code/Magento/User/Model/User.php index d8040b0bbaaac..674dabb7ff166 100644 --- a/app/code/Magento/User/Model/User.php +++ b/app/code/Magento/User/Model/User.php @@ -671,6 +671,10 @@ public function loadByUsername($username) { $data = $this->getResource()->loadByUsername($username); if ($data !== false) { + if (is_string($data['extra'])) { + $data['extra'] = $this->serializer->unserialize($data['extra']); + } + $this->setData($data); $this->setOrigData(); } From 264e7c6b7b4f045857c3a8364840034a115d9a85 Mon Sep 17 00:00:00 2001 From: Ani Tumanyan <ani_tumanyan@epam.com> Date: Tue, 30 Jul 2019 14:42:55 +0400 Subject: [PATCH 05/37] MC-15507: Shipping address is dropped after zip code in new billing address form is filled - Updated automated test script --- .../Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml | 2 +- .../Checkout/Test/Mftf/Section/CheckoutShippingSection.xml | 2 +- .../Test/Mftf/Section/SelectShippingAddressPopupSection.xml | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml index e8119798bea46..0ebe78e44e7a3 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml @@ -60,6 +60,6 @@ <element name="billingAddressSelectShared" type="select" selector=".checkout-billing-address select[name='billing_address_id']"/> <element name="discount" type="block" selector="tr.totals.discount"/> <element name="discountPrice" type="text" selector=".discount .price"/> - <element name="changeAddressButton" type="button" selector="(//button[@class='action action-additional'][contains(@data-bind,'openAddressSelection')])[{{index}}]" parameterized="true"/> + <element name="changeAddressButton" type="button" selector="(//button[contains(@class,'action action-additional')][contains(@data-bind,'openAddressSelection')])[{{index}}]" parameterized="true"/> </section> </sections> diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml index 90df0c3475c41..6c2615083292e 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml @@ -44,6 +44,6 @@ <element name="addressFieldValidationError" type="text" selector="div.address div.field .field-error"/> <element name="textFieldAttrRequireMessage" type="text" selector="//input[@name='custom_attributes[{{attribute}}]']/ancestor::div[contains(@class, 'control')]/div/span" parameterized="true" timeout="30"/> <element name="textFieldAttribute" type="input" selector="[name*='custom_attributes[{{attribute}}]']" parameterized="true" timeout="30"/> - <element name="changeAddressButton" type="button" selector="//button[@class='action action-additional'][contains(@data-bind,'openAddressSelection')]"/> + <element name="changeAddressButton" type="button" selector="//button[contains(@class,'action action-additional')][contains(@data-bind,'openAddressSelection')]"/> </section> </sections> diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/SelectShippingAddressPopupSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/SelectShippingAddressPopupSection.xml index ff1431ab33ba5..965ee4f4b10d8 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/SelectShippingAddressPopupSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/SelectShippingAddressPopupSection.xml @@ -9,8 +9,8 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="SelectBillingAddressPopupSection"> - <element name="shippingAddressSearch" type="input" selector="//input[@class='admin__control-text admin__action-multiselect-search']"/> - <element name="selectButton" type="button" selector="//button[@class='action-primary action-select-billing-item']"/> - <element name="shippingAddressSearchParametrised" type="input" selector="(//input[@class='admin__control-text admin__action-multiselect-search'])[{{index}}]" parameterized="true"/> + <element name="shippingAddressSearch" type="input" selector="//input[contains(@class,'admin__control-text') and contains(@class, 'admin__action-multiselect-search')]"/> + <element name="selectButton" type="button" selector="//button[contains(@class,'action-primary') and contains(@class, 'action-select-billing-item')]"/> + <element name="shippingAddressSearchParametrised" type="input" selector="(//input[contains(@class,'admin__control-text') and contains(@class, 'admin__action-multiselect-search')])[{{index}}]" parameterized="true"/> </section> </sections> From 529e19d3e5a25c28acfd5f37799cc9558617e624 Mon Sep 17 00:00:00 2001 From: "vishalverma.magento279" <vishalverma.magento279@webkul.com> Date: Sat, 7 Sep 2019 16:08:28 +0530 Subject: [PATCH 06/37] #14012 fixed --- .../Sales/Controller/Adminhtml/Order/Invoice/Save.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php index 67a0dc469163b..b4fa6fed6cdf5 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php @@ -89,13 +89,18 @@ public function __construct( protected function _prepareShipment($invoice) { $invoiceData = $this->getRequest()->getParam('invoice'); - + $itemArr = []; + if (!isset($invoiceData['items']) || empty($invoiceData['items'])) { + $orderItems = $invoice->getOrder()->getItems(); + foreach ($orderItems as $item) { + $itemArr[$item->getId()] = (int)$item->getQtyOrdered(); + } + } $shipment = $this->shipmentFactory->create( $invoice->getOrder(), - isset($invoiceData['items']) ? $invoiceData['items'] : [], + isset($invoiceData['items']) ? $invoiceData['items'] : $itemArr, $this->getRequest()->getPost('tracking') ); - if (!$shipment->getTotalQty()) { return false; } From 3a1c9ba4b88bfc4ca921ba84e88277ae4a1e7233 Mon Sep 17 00:00:00 2001 From: Ani <ani_tumanyn@epam.com> Date: Tue, 16 Jul 2019 14:30:43 +0300 Subject: [PATCH 07/37] MC-17493: Cart/catalog rules grid missing - Added automated test script --- .../ActionGroup/CatalogPriceRuleActionGroup.xml | 9 ++++++++- .../AdminCreateCartPriceRuleActionGroup.xml | 17 ++++++++++++++++- .../Section/AdminCartPriceRulesFormSection.xml | 1 + 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml index a7500858fc94e..f2ee5dc30591b 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml @@ -57,7 +57,14 @@ <scrollToTopOfPage stepKey="scrollToTop"/> <waitForPageLoad stepKey="waitForApplied"/> </actionGroup> - + <actionGroup name="CreateMultipleWebsiteCatalogPriceRule" extends="createCatalogPriceRule"> + <arguments> + <argument name="customerGroup" defaultValue="General" type="string"/> + </arguments> + <remove keyForRemoval="selectSite"/> + <selectOption selector="{{AdminNewCatalogPriceRule.customerGroups}}" userInput="{{customerGroup}}" after="fillDiscountValue" stepKey="selectCustomerGroupMultiple"/> + <selectOption selector="{{AdminNewCatalogPriceRule.websites}}" parameterArray="['FirstWebsite', 'SecondWebsite']" after="selectCustomerGroupMultiple" stepKey="selectWebsite"/> + </actionGroup> <actionGroup name="CreateCatalogPriceRuleViaTheUi"> <arguments> <argument name="catalogRule" defaultValue="_defaultCatalogRule"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml index f9bc44a11cc47..16a19de670af3 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml @@ -105,7 +105,22 @@ <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="waitForCategoryVisible" after="openChooser"/> <checkOption selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="checkCategoryName" after="waitForCategoryVisible"/> </actionGroup> - + <actionGroup name="AdminMultiWebsiteCartPriceRuleActionGroup"> + <arguments> + <argument name="ruleName"/> + </arguments> + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> + <waitForPageLoad stepKey="waitForPriceList"/> + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{ruleName.name}}" stepKey="fillRuleName"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" parameterArray="[{{ruleName.customerGroups}}]" stepKey="selectCustomerGroup"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" parameterArray="['FirstWebsite', 'SecondWebsite']" stepKey="selectWebsite"/> + <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="{{ruleName.apply}}" stepKey="selectActionType"/> + <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="{{ruleName.discountAmount}}" stepKey="fillDiscountAmount"/> + <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> + <see selector="{{AdminCartPriceRulesFormSection.successMessage}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> + </actionGroup> <actionGroup name="CreateCartPriceRuleSecondWebsiteActionGroup"> <annotations> <description>Goes to the Admin Cart Price Rule grid page. Clicks on Add New Rule. Fills the provided Rule (Name). Selects 'Second Website' from the 'Websites' menu.</description> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml b/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml index 0755843861247..3849d153be465 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml @@ -19,6 +19,7 @@ <element name="description" type="textarea" selector="//div[@class='admin__field-control']/textarea[@name='description']"/> <element name="active" type="checkbox" selector="//div[@class='admin__actions-switch']/input[@name='is_active']/../label"/> <element name="websites" type="multiselect" selector="select[name='website_ids']"/> + <element name="websitesOptions" type="select" selector="[name='website_ids'] option"/> <element name="customerGroups" type="multiselect" selector="select[name='customer_group_ids']"/> <element name="customerGroupsOptions" type="multiselect" selector="select[name='customer_group_ids'] option"/> <element name="coupon" type="select" selector="select[name='coupon_type']"/> From 0a9727ce03f89f5f5b42405ef7d9fe7372c50776 Mon Sep 17 00:00:00 2001 From: Ani Tumanyan <ani_tumanyan@epam.com> Date: Tue, 20 Aug 2019 19:50:14 +0400 Subject: [PATCH 08/37] MC-15507: Shipping address is dropped after zip code in new billing address form is filled - Updated automated test script --- .../Test/Mftf/Page/CheckoutShippingPage.xml | 1 + .../Test/Mftf/Section/CheckoutPaymentSection.xml | 1 - .../Mftf/Section/CheckoutShippingSection.xml | 2 +- ...orefrontSelectShippingAddressPopupSection.xml | 16 ++++++++++++++++ .../Section/StorefrontCheckoutAddressSection.xml | 14 ++++++++++++++ 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Checkout/Test/Mftf/Section/StorefrontSelectShippingAddressPopupSection.xml create mode 100644 app/code/Magento/OfflinePayments/Test/Mftf/Section/StorefrontCheckoutAddressSection.xml diff --git a/app/code/Magento/Checkout/Test/Mftf/Page/CheckoutShippingPage.xml b/app/code/Magento/Checkout/Test/Mftf/Page/CheckoutShippingPage.xml index c8641f7d8fbf3..2ff10f8423b63 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Page/CheckoutShippingPage.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Page/CheckoutShippingPage.xml @@ -12,5 +12,6 @@ <section name="CheckoutShippingGuestInfoSection"/> <section name="CheckoutShippingSection"/> <section name="StorefrontCheckoutAddressPopupSection"/> + <section name="StorefrontCheckoutAddressSection"/> </page> </pages> diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml index 0ebe78e44e7a3..903c21d7ec0ca 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml @@ -60,6 +60,5 @@ <element name="billingAddressSelectShared" type="select" selector=".checkout-billing-address select[name='billing_address_id']"/> <element name="discount" type="block" selector="tr.totals.discount"/> <element name="discountPrice" type="text" selector=".discount .price"/> - <element name="changeAddressButton" type="button" selector="(//button[contains(@class,'action action-additional')][contains(@data-bind,'openAddressSelection')])[{{index}}]" parameterized="true"/> </section> </sections> diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml index 6c2615083292e..7feef60238a42 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml @@ -44,6 +44,6 @@ <element name="addressFieldValidationError" type="text" selector="div.address div.field .field-error"/> <element name="textFieldAttrRequireMessage" type="text" selector="//input[@name='custom_attributes[{{attribute}}]']/ancestor::div[contains(@class, 'control')]/div/span" parameterized="true" timeout="30"/> <element name="textFieldAttribute" type="input" selector="[name*='custom_attributes[{{attribute}}]']" parameterized="true" timeout="30"/> - <element name="changeAddressButton" type="button" selector="//button[contains(@class,'action action-additional')][contains(@data-bind,'openAddressSelection')]"/> + <element name="changeAddressButton" type="button" selector=".change-address-popup button.action.action-additional"/> </section> </sections> diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontSelectShippingAddressPopupSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontSelectShippingAddressPopupSection.xml new file mode 100644 index 0000000000000..e3c9b796ed1f1 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontSelectShippingAddressPopupSection.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="StorefrontSelectBillingAddressPopupSection"> + <element name="shippingAddressSearch" type="input" selector="//input[contains(@class,'admin__control-text') and contains(@class, 'admin__action-multiselect-search')]"/> + <element name="selectButton" type="button" selector="//button[contains(@class,'action-primary') and contains(@class, 'action-select-billing-item')]"/> + <element name="shippingAddressSearchParametrised" type="input" selector="(//input[contains(@class,'admin__control-text') and contains(@class, 'admin__action-multiselect-search')])[{{index}}]" parameterized="true"/> + </section> +</sections> diff --git a/app/code/Magento/OfflinePayments/Test/Mftf/Section/StorefrontCheckoutAddressSection.xml b/app/code/Magento/OfflinePayments/Test/Mftf/Section/StorefrontCheckoutAddressSection.xml new file mode 100644 index 0000000000000..bd986c286258e --- /dev/null +++ b/app/code/Magento/OfflinePayments/Test/Mftf/Section/StorefrontCheckoutAddressSection.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="StorefrontCheckoutAddressSection"> + <element name="changeAddressButton" type="button" selector="(//button[contains(@class,'action action-additional')][contains(@data-bind,'openAddressSelection')])[{{index}}]" parameterized="true"/> + </section> +</sections> \ No newline at end of file From ffcca867887d7e7917fe4805081642e062506657 Mon Sep 17 00:00:00 2001 From: Ani Tumanyan <ani_tumanyan@epam.com> Date: Mon, 9 Sep 2019 18:57:51 +0400 Subject: [PATCH 09/37] MC-15507: Shipping address is dropped after zip code in new billing address form is filled - Updated automated test script --- .../Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml | 1 + .../StorefrontSelectShippingAddressPopupSection.xml | 7 +++---- .../Test/Mftf/Section/StorefrontCheckoutAddressSection.xml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml index 903c21d7ec0ca..4ead6ea2109f5 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml @@ -42,6 +42,7 @@ <element name="ProductOptionLinkActiveByProductItemName" type="text" selector="//div[@class='product-item-details']//strong[@class='product-item-name'][text()='{{var1}}']//ancestor::div[@class='product-item-details']//div[@class='product options active']//a[text() = '{{var2}}']" parameterized="true" /> <element name="shipToInformation" type="text" selector="//div[@class='ship-to']//div[@class='shipping-information-content']" /> <element name="shippingMethodInformation" type="text" selector="//div[@class='ship-via']//div[@class='shipping-information-content']" /> + <element name="shippingInformationSection" type="text" selector=".ship-to .shipping-information-content" /> <element name="paymentMethodTitle" type="text" selector=".payment-method-title span" /> <element name="productOptionsByProductItemPrice" type="text" selector="//div[@class='product-item-inner']//div[@class='subtotal']//span[@class='price'][contains(.,'{{price}}')]//ancestor::div[@class='product-item-details']//div[@class='product options']" parameterized="true"/> <element name="productOptionsActiveByProductItemPrice" type="text" selector="//div[@class='subtotal']//span[@class='price'][contains(.,'{{price}}')]//ancestor::div[@class='product-item-details']//div[@class='product options active']" parameterized="true"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontSelectShippingAddressPopupSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontSelectShippingAddressPopupSection.xml index e3c9b796ed1f1..1f2cd6648f889 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontSelectShippingAddressPopupSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontSelectShippingAddressPopupSection.xml @@ -8,9 +8,8 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> - <section name="StorefrontSelectBillingAddressPopupSection"> - <element name="shippingAddressSearch" type="input" selector="//input[contains(@class,'admin__control-text') and contains(@class, 'admin__action-multiselect-search')]"/> - <element name="selectButton" type="button" selector="//button[contains(@class,'action-primary') and contains(@class, 'action-select-billing-item')]"/> - <element name="shippingAddressSearchParametrised" type="input" selector="(//input[contains(@class,'admin__control-text') and contains(@class, 'admin__action-multiselect-search')])[{{index}}]" parameterized="true"/> + <section name="StorefrontSelectShippingAddressPopupSection"> + <element name="shippingAddressSearch" type="input" selector="aside[style*='z-index'] [placeholder*='Search for city']"/> + <element name="selectButton" type="button" selector=".action-primary.action-select-billing-item"/> </section> </sections> diff --git a/app/code/Magento/OfflinePayments/Test/Mftf/Section/StorefrontCheckoutAddressSection.xml b/app/code/Magento/OfflinePayments/Test/Mftf/Section/StorefrontCheckoutAddressSection.xml index bd986c286258e..a2929c2020923 100644 --- a/app/code/Magento/OfflinePayments/Test/Mftf/Section/StorefrontCheckoutAddressSection.xml +++ b/app/code/Magento/OfflinePayments/Test/Mftf/Section/StorefrontCheckoutAddressSection.xml @@ -9,6 +9,6 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="StorefrontCheckoutAddressSection"> - <element name="changeAddressButton" type="button" selector="(//button[contains(@class,'action action-additional')][contains(@data-bind,'openAddressSelection')])[{{index}}]" parameterized="true"/> + <element name="changeAddressButton" type="button" selector=".checkout-billing-address .change-address-popup button.action-additional"/> </section> </sections> \ No newline at end of file From babd3cb4b47549eace47b6e3b4cd955a63f150b1 Mon Sep 17 00:00:00 2001 From: utietze <u.tietze@neusta.de> Date: Tue, 10 Sep 2019 21:13:44 +0200 Subject: [PATCH 10/37] Require missing "doctrine/instantiator" dependency Yea, well. If you are gonna use code from "doctrine/instantiator", you may declare that in composer.json. --- lib/internal/Magento/Framework/MessageQueue/composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/MessageQueue/composer.json b/lib/internal/Magento/Framework/MessageQueue/composer.json index 56644e428e5cb..f1397fb91afe8 100644 --- a/lib/internal/Magento/Framework/MessageQueue/composer.json +++ b/lib/internal/Magento/Framework/MessageQueue/composer.json @@ -11,7 +11,8 @@ ], "require": { "magento/framework": "*", - "php": "~7.1.3||~7.2.0||~7.3.0" + "php": "~7.1.3||~7.2.0||~7.3.0", + "doctrine/instantiator": "^1.0" }, "autoload": { "psr-4": { From bb4a4fe3b2b9cafc6af4830238241566567b7860 Mon Sep 17 00:00:00 2001 From: Yuliya Labudova <Yuliya_Labudova@epam.com> Date: Wed, 11 Sep 2019 11:20:05 +0300 Subject: [PATCH 11/37] MC-15507: Shipping address is dropped after zip code in new billing address form is filled - Delete unnecessary file. --- .../SelectShippingAddressPopupSection.xml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 app/code/Magento/Checkout/Test/Mftf/Section/SelectShippingAddressPopupSection.xml diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/SelectShippingAddressPopupSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/SelectShippingAddressPopupSection.xml deleted file mode 100644 index 965ee4f4b10d8..0000000000000 --- a/app/code/Magento/Checkout/Test/Mftf/Section/SelectShippingAddressPopupSection.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> - <section name="SelectBillingAddressPopupSection"> - <element name="shippingAddressSearch" type="input" selector="//input[contains(@class,'admin__control-text') and contains(@class, 'admin__action-multiselect-search')]"/> - <element name="selectButton" type="button" selector="//button[contains(@class,'action-primary') and contains(@class, 'action-select-billing-item')]"/> - <element name="shippingAddressSearchParametrised" type="input" selector="(//input[contains(@class,'admin__control-text') and contains(@class, 'admin__action-multiselect-search')])[{{index}}]" parameterized="true"/> - </section> -</sections> From cc70abdc388b62ca5ca58c3c41afa2b40e34ab0a Mon Sep 17 00:00:00 2001 From: Aliaksei_Manenak <Aliaksei_Manenak@epam.com> Date: Wed, 11 Sep 2019 18:36:09 +0300 Subject: [PATCH 12/37] MC-17493: Cart/catalog rules grid missing - Updated automated test script --- .../Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml | 6 +----- .../ActionGroup/AdminCreateCartPriceRuleActionGroup.xml | 3 --- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml index f2ee5dc30591b..e4aecfab549ac 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml @@ -58,12 +58,8 @@ <waitForPageLoad stepKey="waitForApplied"/> </actionGroup> <actionGroup name="CreateMultipleWebsiteCatalogPriceRule" extends="createCatalogPriceRule"> - <arguments> - <argument name="customerGroup" defaultValue="General" type="string"/> - </arguments> <remove keyForRemoval="selectSite"/> - <selectOption selector="{{AdminNewCatalogPriceRule.customerGroups}}" userInput="{{customerGroup}}" after="fillDiscountValue" stepKey="selectCustomerGroupMultiple"/> - <selectOption selector="{{AdminNewCatalogPriceRule.websites}}" parameterArray="['FirstWebsite', 'SecondWebsite']" after="selectCustomerGroupMultiple" stepKey="selectWebsite"/> + <selectOption selector="{{AdminNewCatalogPriceRule.websites}}" parameterArray="['FirstWebsite', 'SecondWebsite']" stepKey="selectWebsite"/> </actionGroup> <actionGroup name="CreateCatalogPriceRuleViaTheUi"> <arguments> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml index 16a19de670af3..8d71b8501a411 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml @@ -113,13 +113,10 @@ <waitForPageLoad stepKey="waitForPriceList"/> <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{ruleName.name}}" stepKey="fillRuleName"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" parameterArray="[{{ruleName.customerGroups}}]" stepKey="selectCustomerGroup"/> <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" parameterArray="['FirstWebsite', 'SecondWebsite']" stepKey="selectWebsite"/> <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="{{ruleName.apply}}" stepKey="selectActionType"/> <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="{{ruleName.discountAmount}}" stepKey="fillDiscountAmount"/> - <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> - <see selector="{{AdminCartPriceRulesFormSection.successMessage}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> </actionGroup> <actionGroup name="CreateCartPriceRuleSecondWebsiteActionGroup"> <annotations> From 72d25409ecb5e436522688b004626427ae2e3592 Mon Sep 17 00:00:00 2001 From: Yuliya Labudova <Yuliya_Labudova@epam.com> Date: Fri, 13 Sep 2019 11:50:01 +0300 Subject: [PATCH 13/37] MC-15507: Shipping address is dropped after zip code in new billing address form is filled - Fix modularity for test. --- .../Test/Mftf/Page/CheckoutShippingPage.xml | 1 - .../Test/Mftf/Section/CheckoutShippingSection.xml | 1 - ...torefrontSelectShippingAddressPopupSection.xml | 15 --------------- .../Section/StorefrontCheckoutAddressSection.xml | 14 -------------- 4 files changed, 31 deletions(-) delete mode 100644 app/code/Magento/Checkout/Test/Mftf/Section/StorefrontSelectShippingAddressPopupSection.xml delete mode 100644 app/code/Magento/OfflinePayments/Test/Mftf/Section/StorefrontCheckoutAddressSection.xml diff --git a/app/code/Magento/Checkout/Test/Mftf/Page/CheckoutShippingPage.xml b/app/code/Magento/Checkout/Test/Mftf/Page/CheckoutShippingPage.xml index 2ff10f8423b63..c8641f7d8fbf3 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Page/CheckoutShippingPage.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Page/CheckoutShippingPage.xml @@ -12,6 +12,5 @@ <section name="CheckoutShippingGuestInfoSection"/> <section name="CheckoutShippingSection"/> <section name="StorefrontCheckoutAddressPopupSection"/> - <section name="StorefrontCheckoutAddressSection"/> </page> </pages> diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml index 7feef60238a42..59d46e8cca696 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml @@ -44,6 +44,5 @@ <element name="addressFieldValidationError" type="text" selector="div.address div.field .field-error"/> <element name="textFieldAttrRequireMessage" type="text" selector="//input[@name='custom_attributes[{{attribute}}]']/ancestor::div[contains(@class, 'control')]/div/span" parameterized="true" timeout="30"/> <element name="textFieldAttribute" type="input" selector="[name*='custom_attributes[{{attribute}}]']" parameterized="true" timeout="30"/> - <element name="changeAddressButton" type="button" selector=".change-address-popup button.action.action-additional"/> </section> </sections> diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontSelectShippingAddressPopupSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontSelectShippingAddressPopupSection.xml deleted file mode 100644 index 1f2cd6648f889..0000000000000 --- a/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontSelectShippingAddressPopupSection.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> - <section name="StorefrontSelectShippingAddressPopupSection"> - <element name="shippingAddressSearch" type="input" selector="aside[style*='z-index'] [placeholder*='Search for city']"/> - <element name="selectButton" type="button" selector=".action-primary.action-select-billing-item"/> - </section> -</sections> diff --git a/app/code/Magento/OfflinePayments/Test/Mftf/Section/StorefrontCheckoutAddressSection.xml b/app/code/Magento/OfflinePayments/Test/Mftf/Section/StorefrontCheckoutAddressSection.xml deleted file mode 100644 index a2929c2020923..0000000000000 --- a/app/code/Magento/OfflinePayments/Test/Mftf/Section/StorefrontCheckoutAddressSection.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> - <section name="StorefrontCheckoutAddressSection"> - <element name="changeAddressButton" type="button" selector=".checkout-billing-address .change-address-popup button.action-additional"/> - </section> -</sections> \ No newline at end of file From 9bddf12fbbe2138c1484e5ed3e095e7f6dd7f735 Mon Sep 17 00:00:00 2001 From: Yuliya Labudova <Yuliya_Labudova@epam.com> Date: Mon, 16 Sep 2019 10:54:17 +0300 Subject: [PATCH 14/37] MC-15507: Shipping address is dropped after zip code in new billing address form is filled - Fix for automation test. --- .../GuestCheckoutFillNewBillingAddressActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml index 6d92ca79000eb..a1137308e8e6c 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml @@ -24,7 +24,7 @@ <fillField selector="{{CheckoutPaymentSection.guestPostcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/> <fillField selector="{{CheckoutPaymentSection.guestTelephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/> </actionGroup> - <actionGroup name="CheckoutFillNewBillingAddressActionGroup" extends="GuestCheckoutFillNewBillingAddressActionGroup"> + <actionGroup name="StorefrontCheckoutFillNewBillingAddressActionGroup" extends="GuestCheckoutFillNewBillingAddressActionGroup"> <remove keyForRemoval="enterEmail"/> <remove keyForRemoval="waitForLoading3"/> </actionGroup> From d72ba99f208d593e1adc83f597e8fb09bba28bbd Mon Sep 17 00:00:00 2001 From: Yuliya Labudova <Yuliya_Labudova@epam.com> Date: Mon, 16 Sep 2019 16:24:36 +0300 Subject: [PATCH 15/37] MC-17493: Cart/catalog rules grid missing - Fix for automation test. --- .../ActionGroup/CatalogPriceRuleActionGroup.xml | 2 +- .../AdminCreateCartPriceRuleActionGroup.xml | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml index e4aecfab549ac..39f509c68c6e4 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/CatalogPriceRuleActionGroup.xml @@ -57,7 +57,7 @@ <scrollToTopOfPage stepKey="scrollToTop"/> <waitForPageLoad stepKey="waitForApplied"/> </actionGroup> - <actionGroup name="CreateMultipleWebsiteCatalogPriceRule" extends="createCatalogPriceRule"> + <actionGroup name="AdminCreateMultipleWebsiteCatalogPriceRule" extends="createCatalogPriceRule"> <remove keyForRemoval="selectSite"/> <selectOption selector="{{AdminNewCatalogPriceRule.websites}}" parameterArray="['FirstWebsite', 'SecondWebsite']" stepKey="selectWebsite"/> </actionGroup> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml index 8d71b8501a411..537fc3fbc55ee 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml @@ -105,18 +105,17 @@ <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="waitForCategoryVisible" after="openChooser"/> <checkOption selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="checkCategoryName" after="waitForCategoryVisible"/> </actionGroup> - <actionGroup name="AdminMultiWebsiteCartPriceRuleActionGroup"> + <actionGroup name="AdminMultiWebsiteCartPriceRuleActionGroup" extends="AdminCreateCartPriceRuleActionGroup"> + <annotations> + <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Removes 'clickSaveButton' for the next data changing. Assign cart price rule to 2 websites instead of 1.</description> + </annotations> <arguments> <argument name="ruleName"/> </arguments> - <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> - <waitForPageLoad stepKey="waitForPriceList"/> - <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> - <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{ruleName.name}}" stepKey="fillRuleName"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" parameterArray="['FirstWebsite', 'SecondWebsite']" stepKey="selectWebsite"/> - <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="{{ruleName.apply}}" stepKey="selectActionType"/> - <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="{{ruleName.discountAmount}}" stepKey="fillDiscountAmount"/> + <remove keyForRemoval="clickSaveButton"/> + <remove keyForRemoval="seeSuccessMessage"/> + <remove keyForRemoval="selectWebsites"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" parameterArray="['FirstWebsite', 'SecondWebsite']" stepKey="selectWebsites" after="fillRuleName"/> </actionGroup> <actionGroup name="CreateCartPriceRuleSecondWebsiteActionGroup"> <annotations> From 94f2c18f51554c6b2296012e0c294e1c890f82e3 Mon Sep 17 00:00:00 2001 From: utietze <ulf@tietze-digital.de> Date: Mon, 16 Sep 2019 16:40:15 +0200 Subject: [PATCH 16/37] Use InvalidArgumentException from plain PHP Update Patch --- .../Magento/Framework/MessageQueue/MessageValidator.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/MessageQueue/MessageValidator.php b/lib/internal/Magento/Framework/MessageQueue/MessageValidator.php index a40bb9af1e0c4..abb2918d459ae 100644 --- a/lib/internal/Magento/Framework/MessageQueue/MessageValidator.php +++ b/lib/internal/Magento/Framework/MessageQueue/MessageValidator.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\MessageQueue; -use Doctrine\Instantiator\Exception\InvalidArgumentException; +use InvalidArgumentException; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Phrase; use Magento\Framework\Communication\ConfigInterface as CommunicationConfig; @@ -58,6 +58,7 @@ protected function getTopicSchema($topic, $requestType) * @param bool $requestType * @return void * @throws InvalidArgumentException + * @throws LocalizedException */ public function validate($topic, $message, $requestType = true) { From 6fc366c5a743b08eb61f817ca35035cf37c9a9a5 Mon Sep 17 00:00:00 2001 From: utietze <ulf@tietze-digital.de> Date: Mon, 16 Sep 2019 16:43:48 +0200 Subject: [PATCH 17/37] No need for extra doctrine dependency --- lib/internal/Magento/Framework/MessageQueue/composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/MessageQueue/composer.json b/lib/internal/Magento/Framework/MessageQueue/composer.json index f1397fb91afe8..56644e428e5cb 100644 --- a/lib/internal/Magento/Framework/MessageQueue/composer.json +++ b/lib/internal/Magento/Framework/MessageQueue/composer.json @@ -11,8 +11,7 @@ ], "require": { "magento/framework": "*", - "php": "~7.1.3||~7.2.0||~7.3.0", - "doctrine/instantiator": "^1.0" + "php": "~7.1.3||~7.2.0||~7.3.0" }, "autoload": { "psr-4": { From ebb71f8736c735b53157a5c368bf7625b7a6504e Mon Sep 17 00:00:00 2001 From: Yuliya Labudova <Yuliya_Labudova@epam.com> Date: Tue, 17 Sep 2019 10:28:29 +0300 Subject: [PATCH 18/37] MC-17493: Cart/catalog rules grid missing - Fix actionGroup's name. --- .../Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml index 537fc3fbc55ee..c840162f0d162 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml @@ -105,7 +105,7 @@ <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="waitForCategoryVisible" after="openChooser"/> <checkOption selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="checkCategoryName" after="waitForCategoryVisible"/> </actionGroup> - <actionGroup name="AdminMultiWebsiteCartPriceRuleActionGroup" extends="AdminCreateCartPriceRuleActionGroup"> + <actionGroup name="AdminCreateMultiWebsiteCartPriceRuleActionGroup" extends="AdminCreateCartPriceRuleActionGroup"> <annotations> <description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Removes 'clickSaveButton' for the next data changing. Assign cart price rule to 2 websites instead of 1.</description> </annotations> From eabb8a3bdbaa62bf54a2e763d016e6212f84f55b Mon Sep 17 00:00:00 2001 From: Aliaksei_Manenak <Aliaksei_Manenak@epam.com> Date: Tue, 17 Sep 2019 16:31:54 +0300 Subject: [PATCH 19/37] MC-18819: Increase test coverage for Account functional area - Integration test for MC-11209 --- .../Cart/Item/Renderer/ConfigurableTest.php | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/ConfigurableTest.php diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/ConfigurableTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/ConfigurableTest.php new file mode 100644 index 0000000000000..aba813148512c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/ConfigurableTest.php @@ -0,0 +1,68 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\ConfigurableProduct\Block\Cart\Item\Renderer; + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\ConfigurableProduct\Block\Cart\Item\Renderer\Configurable as ConfigurableRenderer; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\View\LayoutInterface; + +/** + * Test \Magento\ConfigurableProduct\Block\Cart\Item\Renderer\Configurable block + * + * @magentoAppArea frontend + */ +class ConfigurableTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var ConfigurableRenderer + */ + private $block; + + /** + * @var ObjectManagerInterface + */ + private $objectManager; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->block = $this->objectManager->get(LayoutInterface::class) + ->createBlock(ConfigurableRenderer::class); + } + + /** + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + * @magentoDataFixture Magento/ConfigurableProduct/_files/quote_with_configurable_product.php + */ + public function testGetProductPriceHtml() + { + $productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $configurableProduct = $productRepository->getById(1); + + $layout = $this->objectManager->get(LayoutInterface::class); + $layout->createBlock( + \Magento\Framework\Pricing\Render::class, + 'product.price.render.default', + [ + 'data' => [ + 'price_render_handle' => 'catalog_product_prices', + 'use_link_for_as_low_as' => true + ] + ] + ); + + $this->block->setItem( + $this->block->getCheckoutSession()->getQuote()->getAllVisibleItems()[0] + ); + $html = $this->block->getProductPriceHtml($configurableProduct); + $this->assertContains('<span class="price">$10.00</span>', $html); + } +} From 8285e6a4ce6920835c5416d43cd8a2434793813d Mon Sep 17 00:00:00 2001 From: Alex Taranovsky <firster@atwix.com> Date: Wed, 11 Sep 2019 14:39:12 +0300 Subject: [PATCH 20/37] magento/magento2#: Replace deprecated message functions in the Magento_ProductAlert module. --- .../ProductAlert/Controller/Add/Price.php | 37 +++++++++++-------- .../ProductAlert/Controller/Add/Stock.php | 6 +-- .../Controller/Unsubscribe/Price.php | 21 ++++++++--- .../Controller/Unsubscribe/Stock.php | 6 +-- 4 files changed, 43 insertions(+), 27 deletions(-) diff --git a/app/code/Magento/ProductAlert/Controller/Add/Price.php b/app/code/Magento/ProductAlert/Controller/Add/Price.php index 973db8c3bf5d4..2dbcc27cd57d9 100644 --- a/app/code/Magento/ProductAlert/Controller/Add/Price.php +++ b/app/code/Magento/ProductAlert/Controller/Add/Price.php @@ -6,16 +6,17 @@ namespace Magento\ProductAlert\Controller\Add; -use Magento\Framework\App\Action\HttpGetActionInterface; -use Magento\ProductAlert\Controller\Add as AddController; -use Magento\Framework\App\Action\Context; -use Magento\Customer\Model\Session as CustomerSession; -use Magento\Store\Model\StoreManagerInterface; use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Framework\UrlInterface; +use Magento\Customer\Model\Session as CustomerSession; use Magento\Framework\App\Action\Action; +use Magento\Framework\App\Action\Context; +use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\Controller\ResultFactory; +use Magento\Framework\Controller\Result\Redirect; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\UrlInterface; +use Magento\ProductAlert\Controller\Add as AddController; +use Magento\Store\Model\StoreManagerInterface; /** * Controller for notifying about price. @@ -28,15 +29,17 @@ class Price extends AddController implements HttpGetActionInterface protected $storeManager; /** - * @var \Magento\Catalog\Api\ProductRepositoryInterface + * @var \Magento\Catalog\Api\ProductRepositoryInterface */ protected $productRepository; /** - * @param \Magento\Framework\App\Action\Context $context - * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository + * Price constructor. + * + * @param Context $context + * @param CustomerSession $customerSession + * @param StoreManagerInterface $storeManager + * @param ProductRepositoryInterface $productRepository */ public function __construct( Context $context, @@ -54,6 +57,7 @@ public function __construct( * * @param string $url * @return bool + * @throws NoSuchEntityException */ protected function isInternal($url) { @@ -68,13 +72,14 @@ protected function isInternal($url) /** * Method for adding info about product alert price. * - * @return \Magento\Framework\Controller\Result\Redirect + * @return \Magento\Framework\Controller\ResultInterface + * @throws NoSuchEntityException */ public function execute() { $backUrl = $this->getRequest()->getParam(Action::PARAM_NAME_URL_ENCODED); $productId = (int)$this->getRequest()->getParam('product_id'); - /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */ + /** @var Redirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); if (!$backUrl || !$productId) { $resultRedirect->setPath('/'); @@ -93,9 +98,9 @@ public function execute() ->setWebsiteId($store->getWebsiteId()) ->setStoreId($store->getId()); $model->save(); - $this->messageManager->addSuccess(__('You saved the alert subscription.')); + $this->messageManager->addSuccessMessage(__('You saved the alert subscription.')); } catch (NoSuchEntityException $noEntityException) { - $this->messageManager->addError(__('There are not enough parameters.')); + $this->messageManager->addErrorMessage(__('There are not enough parameters.')); if ($this->isInternal($backUrl)) { $resultRedirect->setUrl($backUrl); } else { @@ -103,7 +108,7 @@ public function execute() } return $resultRedirect; } catch (\Exception $e) { - $this->messageManager->addException( + $this->messageManager->addExceptionMessage( $e, __("The alert subscription couldn't update at this time. Please try again later.") ); diff --git a/app/code/Magento/ProductAlert/Controller/Add/Stock.php b/app/code/Magento/ProductAlert/Controller/Add/Stock.php index f36fdf5fb715e..38b22d1efb852 100644 --- a/app/code/Magento/ProductAlert/Controller/Add/Stock.php +++ b/app/code/Magento/ProductAlert/Controller/Add/Stock.php @@ -76,13 +76,13 @@ public function execute() ->setWebsiteId($store->getWebsiteId()) ->setStoreId($store->getId()); $model->save(); - $this->messageManager->addSuccess(__('Alert subscription has been saved.')); + $this->messageManager->addSuccessMessage(__('Alert subscription has been saved.')); } catch (NoSuchEntityException $noEntityException) { - $this->messageManager->addError(__('There are not enough parameters.')); + $this->messageManager->addErrorMessage(__('There are not enough parameters.')); $resultRedirect->setUrl($backUrl); return $resultRedirect; } catch (\Exception $e) { - $this->messageManager->addException( + $this->messageManager->addExceptionMessage( $e, __("The alert subscription couldn't update at this time. Please try again later.") ); diff --git a/app/code/Magento/ProductAlert/Controller/Unsubscribe/Price.php b/app/code/Magento/ProductAlert/Controller/Unsubscribe/Price.php index 2077b1ff2794b..0aabf5d96e1e7 100644 --- a/app/code/Magento/ProductAlert/Controller/Unsubscribe/Price.php +++ b/app/code/Magento/ProductAlert/Controller/Unsubscribe/Price.php @@ -6,6 +6,7 @@ namespace Magento\ProductAlert\Controller\Unsubscribe; +use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\ProductAlert\Controller\Unsubscribe as UnsubscribeController; use Magento\Framework\App\Action\Context; use Magento\Customer\Model\Session as CustomerSession; @@ -13,7 +14,10 @@ use Magento\Framework\Controller\ResultFactory; use Magento\Framework\Exception\NoSuchEntityException; -class Price extends UnsubscribeController +/** + * Class Price + */ +class Price extends UnsubscribeController implements HttpGetActionInterface { /** * @var \Magento\Catalog\Api\ProductRepositoryInterface @@ -35,6 +39,8 @@ public function __construct( } /** + * Unsubscribe action + * * @return \Magento\Framework\Controller\Result\Redirect */ public function execute() @@ -51,8 +57,13 @@ public function execute() /* @var $product \Magento\Catalog\Model\Product */ $product = $this->productRepository->getById($productId); if (!$product->isVisibleInCatalog()) { - throw new NoSuchEntityException(); + $this->messageManager->addErrorMessage( + __("The product wasn't found. Verify the product and try again.") + ); + $resultRedirect->setPath('customer/account/'); + return $resultRedirect; } + /** @var \Magento\ProductAlert\Model\Price $model */ $model = $this->_objectManager->create(\Magento\ProductAlert\Model\Price::class) ->setCustomerId($this->customerSession->getCustomerId()) @@ -67,13 +78,13 @@ public function execute() $model->delete(); } - $this->messageManager->addSuccess(__('You deleted the alert subscription.')); + $this->messageManager->addSuccessMessage(__('You deleted the alert subscription.')); } catch (NoSuchEntityException $noEntityException) { - $this->messageManager->addError(__("The product wasn't found. Verify the product and try again.")); + $this->messageManager->addErrorMessage(__("The product wasn't found. Verify the product and try again.")); $resultRedirect->setPath('customer/account/'); return $resultRedirect; } catch (\Exception $e) { - $this->messageManager->addException( + $this->messageManager->addExceptionMessage( $e, __("The alert subscription couldn't update at this time. Please try again later.") ); diff --git a/app/code/Magento/ProductAlert/Controller/Unsubscribe/Stock.php b/app/code/Magento/ProductAlert/Controller/Unsubscribe/Stock.php index 1b729f988e4a5..f8df6ae6af38d 100644 --- a/app/code/Magento/ProductAlert/Controller/Unsubscribe/Stock.php +++ b/app/code/Magento/ProductAlert/Controller/Unsubscribe/Stock.php @@ -94,13 +94,13 @@ public function execute() if ($model->getId()) { $model->delete(); } - $this->messageManager->addSuccess(__('You will no longer receive stock alerts for this product.')); + $this->messageManager->addSuccessMessage(__('You will no longer receive stock alerts for this product.')); } catch (NoSuchEntityException $noEntityException) { - $this->messageManager->addError(__('The product was not found.')); + $this->messageManager->addErrorMessage(__('The product was not found.')); $resultRedirect->setPath('customer/account/'); return $resultRedirect; } catch (\Exception $e) { - $this->messageManager->addException( + $this->messageManager->addExceptionMessage( $e, __("The alert subscription couldn't update at this time. Please try again later.") ); From f1e225d81bbb4dbb2b155531445cfc3e880db81d Mon Sep 17 00:00:00 2001 From: Daniel Filipek <d.filipek@global4net.com> Date: Sun, 22 Sep 2019 19:31:09 +0200 Subject: [PATCH 21/37] #23880 [Magento_Paypal][fix] - M2.3.2 - fix - Node <payment><payflow_advanced><user> is declared twice in Paypal module --- app/code/Magento/Paypal/etc/config.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Paypal/etc/config.xml b/app/code/Magento/Paypal/etc/config.xml index 4619fc8539442..6c0601f80137d 100644 --- a/app/code/Magento/Paypal/etc/config.xml +++ b/app/code/Magento/Paypal/etc/config.xml @@ -164,7 +164,6 @@ <title>Credit Card (Payflow Advanced) PayPal PayPal - PayPal 1 1 GET From f1a187eba85b2eaeca4c619c1482ca8916fdb284 Mon Sep 17 00:00:00 2001 From: nmalevanec Date: Fri, 12 Jan 2018 16:42:22 +0200 Subject: [PATCH 22/37] magento/magento2#13126: 2.2.2 - Duplicating Bundle Product Removes Bundle Options From Original Product (cherry picked from commit b57eb03b2f6491d271221d08b185e2ff37bfcd4c) --- .../Model/Product/CopyConstructor/Bundle.php | 11 +- .../Product/CopyConstructor/BundleTest.php | 38 ++- .../Controller/Adminhtml/ProductTest.php | 235 ++++++++++++++++++ 3 files changed, 277 insertions(+), 7 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/Controller/Adminhtml/ProductTest.php diff --git a/app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php b/app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php index 61559df4d2cf6..221a7431714df 100644 --- a/app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php +++ b/app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php @@ -27,7 +27,16 @@ public function build(Product $product, Product $duplicate) $bundleOptions = $product->getExtensionAttributes()->getBundleProductOptions() ?: []; $duplicatedBundleOptions = []; foreach ($bundleOptions as $key => $bundleOption) { - $duplicatedBundleOptions[$key] = clone $bundleOption; + $duplicatedBundleOption = clone $bundleOption; + /** + * Set option and selection ids to 'null' in order to create new option(selection) for duplicated product, + * but not modifying existing one, which led to lost of option(selection) in original product. + */ + foreach ($duplicatedBundleOption->getProductLinks() as $productLink) { + $productLink->setSelectionId(null); + } + $duplicatedBundleOption->setOptionId(null); + $duplicatedBundleOptions[$key] = $duplicatedBundleOption; } $duplicate->getExtensionAttributes()->setBundleProductOptions($duplicatedBundleOptions); } diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Product/CopyConstructor/BundleTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Product/CopyConstructor/BundleTest.php index 831098cc44c38..4df60d07d98ef 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/Product/CopyConstructor/BundleTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/Product/CopyConstructor/BundleTest.php @@ -6,6 +6,7 @@ namespace Magento\Bundle\Test\Unit\Model\Product\CopyConstructor; use Magento\Bundle\Api\Data\BundleOptionInterface; +use Magento\Bundle\Model\Link; use Magento\Bundle\Model\Product\CopyConstructor\Bundle; use Magento\Catalog\Api\Data\ProductExtensionInterface; use Magento\Catalog\Model\Product; @@ -45,6 +46,7 @@ public function testBuildNegative() */ public function testBuildPositive() { + /** @var Product|\PHPUnit_Framework_MockObject_MockObject $product */ $product = $this->getMockBuilder(Product::class) ->disableOriginalConstructor() ->getMock(); @@ -60,18 +62,42 @@ public function testBuildPositive() ->method('getExtensionAttributes') ->willReturn($extensionAttributesProduct); + $productLink = $this->getMockBuilder(Link::class) + ->setMethods(['setSelectionId']) + ->disableOriginalConstructor() + ->getMock(); + $productLink->expects($this->exactly(2)) + ->method('setSelectionId') + ->with($this->identicalTo(null)); + $firstOption = $this->getMockBuilder(BundleOptionInterface::class) + ->setMethods(['getProductLinks']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $firstOption->expects($this->once()) + ->method('getProductLinks') + ->willReturn([$productLink]); + $firstOption->expects($this->once()) + ->method('setOptionId') + ->with($this->identicalTo(null)); + $secondOption = $this->getMockBuilder(BundleOptionInterface::class) + ->setMethods(['getProductLinks']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $secondOption->expects($this->once()) + ->method('getProductLinks') + ->willReturn([$productLink]); + $secondOption->expects($this->once()) + ->method('setOptionId') + ->with($this->identicalTo(null)); $bundleOptions = [ - $this->getMockBuilder(BundleOptionInterface::class) - ->disableOriginalConstructor() - ->getMockForAbstractClass(), - $this->getMockBuilder(BundleOptionInterface::class) - ->disableOriginalConstructor() - ->getMockForAbstractClass() + $firstOption, + $secondOption ]; $extensionAttributesProduct->expects($this->once()) ->method('getBundleProductOptions') ->willReturn($bundleOptions); + /** @var Product|\PHPUnit_Framework_MockObject_MockObject $duplicate */ $duplicate = $this->getMockBuilder(Product::class) ->disableOriginalConstructor() ->getMock(); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Controller/Adminhtml/ProductTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Controller/Adminhtml/ProductTest.php new file mode 100644 index 0000000000000..f48f2019dd52b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/Controller/Adminhtml/ProductTest.php @@ -0,0 +1,235 @@ +getRequestParamsForDuplicate(); + $this->getRequest()->setParams(['type' => Type::TYPE_BUNDLE]); + $this->getRequest()->setPostValue($params); + $this->dispatch('backend/catalog/product/save'); + $this->assertSessionMessages( + $this->equalTo( + [ + 'You saved the product.', + 'You duplicated the product.', + ] + ), + MessageInterface::TYPE_SUCCESS + ); + $this->assertOptions(); + } + + /** + * Get necessary request post params for creating and duplicating bundle product. + * + * @return array + */ + private function getRequestParamsForDuplicate() + { + $product = Bootstrap::getObjectManager()->get(ProductRepositoryInterface::class)->get('simple'); + return [ + 'product' => + [ + 'attribute_set_id' => '4', + 'gift_message_available' => '0', + 'use_config_gift_message_available' => '1', + 'stock_data' => + [ + 'min_qty_allowed_in_shopping_cart' => + [ + [ + 'record_id' => '0', + 'customer_group_id' => '32000', + 'min_sale_qty' => '', + ], + ], + 'min_qty' => '0', + 'max_sale_qty' => '10000', + 'notify_stock_qty' => '1', + 'min_sale_qty' => '1', + 'qty_increments' => '1', + 'use_config_manage_stock' => '1', + 'manage_stock' => '1', + 'use_config_min_qty' => '1', + 'use_config_max_sale_qty' => '1', + 'use_config_backorders' => '1', + 'backorders' => '0', + 'use_config_notify_stock_qty' => '1', + 'use_config_enable_qty_inc' => '1', + 'enable_qty_increments' => '0', + 'use_config_qty_increments' => '1', + 'use_config_min_sale_qty' => '1', + 'is_qty_decimal' => '0', + 'is_decimal_divided' => '0', + ], + 'status' => '1', + 'affect_product_custom_options' => '1', + 'name' => 'b1', + 'price' => '', + 'weight' => '', + 'url_key' => '', + 'special_price' => '', + 'quantity_and_stock_status' => + [ + 'qty' => '', + 'is_in_stock' => '1', + ], + 'sku_type' => '0', + 'price_type' => '0', + 'weight_type' => '0', + 'website_ids' => + [ + 1 => '1', + ], + 'sku' => 'b1', + 'meta_title' => 'b1', + 'meta_keyword' => 'b1', + 'meta_description' => 'b1 ', + 'tax_class_id' => '2', + 'product_has_weight' => '1', + 'visibility' => '4', + 'country_of_manufacture' => '', + 'page_layout' => '', + 'options_container' => 'container2', + 'custom_design' => '', + 'custom_layout' => '', + 'price_view' => '0', + 'shipment_type' => '0', + 'news_from_date' => '', + 'news_to_date' => '', + 'custom_design_from' => '', + 'custom_design_to' => '', + 'special_from_date' => '', + 'special_to_date' => '', + 'description' => '', + 'short_description' => '', + 'custom_layout_update' => '', + 'image' => '', + 'small_image' => '', + 'thumbnail' => '', + ], + 'bundle_options' => + [ + 'bundle_options' => + [ + [ + 'record_id' => '0', + 'type' => 'select', + 'required' => '1', + 'title' => 'test option title', + 'position' => '1', + 'option_id' => '', + 'delete' => '', + 'bundle_selections' => + [ + [ + 'product_id' => $product->getId(), + 'name' => $product->getName(), + 'sku' => $product->getSku(), + 'price' => $product->getPrice(), + 'delete' => '', + 'selection_can_change_qty' => '', + 'selection_id' => '', + 'selection_price_type' => '0', + 'selection_price_value' => '', + 'selection_qty' => '1', + 'position' => '1', + 'option_id' => '', + 'record_id' => '1', + 'is_default' => '0', + ], + ], + 'bundle_button_proxy' => + [ + [ + 'entity_id' => '1', + ], + ], + ], + ], + ], + 'affect_bundle_product_selections' => '1', + 'back' => 'duplicate', + 'form_key' => Bootstrap::getObjectManager()->get(FormKey::class)->getFormKey(), + ]; + } + + /** + * Check options in created and duplicated products. + * + * @return void + */ + private function assertOptions() + { + $createdOptions = $this->getProductOptions('b1'); + $createdOption = array_shift($createdOptions); + $duplicatedOptions = $this->getProductOptions('b1-1'); + $duplicatedOption = array_shift($duplicatedOptions); + $this->assertNotEmpty($createdOption); + $this->assertNotEmpty($duplicatedOption); + $optionFields = ['type', 'title', 'position', 'required', 'default_title']; + foreach ($optionFields as $field) { + $this->assertSame($createdOption->getData($field), $duplicatedOption->getData($field)); + } + $createdLinks = $createdOption->getProductLinks(); + $createdLink = array_shift($createdLinks); + $duplicatedLinks = $duplicatedOption->getProductLinks(); + $duplicatedLink = array_shift($duplicatedLinks); + $this->assertNotEmpty($createdLink); + $this->assertNotEmpty($duplicatedLink); + $linkFields = [ + 'entity_id', + 'sku', + 'position', + 'is_default', + 'price', + 'qty', + 'selection_can_change_quantity', + 'price_type', + ]; + foreach ($linkFields as $field) { + $this->assertSame($createdLink->getData($field), $duplicatedLink->getData($field)); + } + } + + /** + * Get options for given product. + * + * @param string $sku + * @return OptionInterface[] + */ + private function getProductOptions(string $sku) + { + $product = Bootstrap::getObjectManager()->create(Product::class); + $productId = $product->getResource()->getIdBySku($sku); + $product->load($productId); + + return $product->getExtensionAttributes()->getBundleProductOptions(); + } +} From bf36defe362496ecb6f6b7693600a9054fbd801b Mon Sep 17 00:00:00 2001 From: nmalevanec Date: Fri, 12 Jan 2018 16:48:44 +0200 Subject: [PATCH 23/37] magento/magento2#13126: 2.2.2 - Duplicating Bundle Product Removes Bundle Options From Original Product (cherry picked from commit d8bd657c94175392eca5ad462932bc2e86c51257) --- .../Magento/Bundle/Model/Product/CopyConstructor/Bundle.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php b/app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php index 221a7431714df..20e4828835d06 100644 --- a/app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php +++ b/app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php @@ -32,7 +32,8 @@ public function build(Product $product, Product $duplicate) * Set option and selection ids to 'null' in order to create new option(selection) for duplicated product, * but not modifying existing one, which led to lost of option(selection) in original product. */ - foreach ($duplicatedBundleOption->getProductLinks() as $productLink) { + $productLinks = $duplicatedBundleOption->getProductLinks() ?: []; + foreach ($productLinks as $productLink) { $productLink->setSelectionId(null); } $duplicatedBundleOption->setOptionId(null); From d3771dd1efeebcdaa3e610884e95a88994baeaa3 Mon Sep 17 00:00:00 2001 From: Adarsh Manickam Date: Tue, 24 Sep 2019 17:14:42 +0530 Subject: [PATCH 24/37] Replaced model load with Service Contract --- .../Controller/Adminhtml/Product/Set/Edit.php | 49 +++++++++++++------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php index 6f6870cb0849f..b07cfaf36f735 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php @@ -6,45 +6,64 @@ */ namespace Magento\Catalog\Controller\Adminhtml\Product\Set; -use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; +use Magento\Framework\Registry; +use Magento\Backend\App\Action\Context; +use Magento\Framework\App\ObjectManager; +use Magento\Backend\Model\View\Result\Page; +use Magento\Framework\View\Result\PageFactory; +use Magento\Framework\Controller\ResultInterface; +use Magento\Eav\Api\AttributeSetRepositoryInterface; +use Magento\Catalog\Controller\Adminhtml\Product\Set; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\App\Action\HttpGetActionInterface; -class Edit extends \Magento\Catalog\Controller\Adminhtml\Product\Set implements HttpGetActionInterface +class Edit extends Set implements HttpGetActionInterface { /** - * @var \Magento\Framework\View\Result\PageFactory + * @var PageFactory */ protected $resultPageFactory; /** - * @param \Magento\Backend\App\Action\Context $context - * @param \Magento\Framework\Registry $coreRegistry - * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory + * @var AttributeSetRepositoryInterface + */ + protected $attributeSetRepository; + + /** + * + * @param Context $context + * @param Registry $coreRegistry + * @param PageFactory $resultPageFactory + * @param AttributeSetRepositoryInterface $attributeSetRepository */ public function __construct( - \Magento\Backend\App\Action\Context $context, - \Magento\Framework\Registry $coreRegistry, - \Magento\Framework\View\Result\PageFactory $resultPageFactory + Context $context, + Registry $coreRegistry, + PageFactory $resultPageFactory, + AttributeSetRepositoryInterface $attributeSetRepository = null ) { parent::__construct($context, $coreRegistry); $this->resultPageFactory = $resultPageFactory; + $this->attributeSetRepository = $attributeSetRepository ?: + ObjectManager::getInstance()->get(AttributeSetRepositoryInterface::class); } /** - * @return \Magento\Backend\Model\View\Result\Page + * + * @return ResultInterface + * + * @throws NoSuchEntityException */ public function execute() { $this->_setTypeId(); - $attributeSet = $this->_objectManager->create(\Magento\Eav\Model\Entity\Attribute\Set::class) - ->load($this->getRequest()->getParam('id')); - + $attributeSet = $this->attributeSetRepository->get($this->getRequest()->getParam('id')); if (!$attributeSet->getId()) { return $this->resultRedirectFactory->create()->setPath('catalog/*/index'); } - $this->_coreRegistry->register('current_attribute_set', $attributeSet); - /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ + /** @var Page $resultPage */ $resultPage = $this->resultPageFactory->create(); $resultPage->setActiveMenu('Magento_Catalog::catalog_attributes_sets'); $resultPage->getConfig()->getTitle()->prepend(__('Attribute Sets')); From 635c373b87ea9217d883b84e77d547b6600d6b6a Mon Sep 17 00:00:00 2001 From: Prabhu Ram Date: Tue, 24 Sep 2019 11:36:58 -0500 Subject: [PATCH 25/37] MC-20255: Category Breadcrumbs are missing url_path - Added category_url_path --- .../Model/Resolver/Category/DataProvider/Breadcrumbs.php | 3 ++- app/code/Magento/CatalogGraphQl/etc/schema.graphqls | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/DataProvider/Breadcrumbs.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/DataProvider/Breadcrumbs.php index 9e23c4f1e9736..4b217d77f686c 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/DataProvider/Breadcrumbs.php +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/DataProvider/Breadcrumbs.php @@ -41,7 +41,7 @@ public function getData(string $categoryPath): array if (count($parentCategoryIds)) { $collection = $this->collectionFactory->create(); - $collection->addAttributeToSelect(['name', 'url_key']); + $collection->addAttributeToSelect(['name', 'url_key', 'url_path']); $collection->addAttributeToFilter('entity_id', $parentCategoryIds); foreach ($collection as $category) { @@ -50,6 +50,7 @@ public function getData(string $categoryPath): array 'category_name' => $category->getName(), 'category_level' => $category->getLevel(), 'category_url_key' => $category->getUrlKey(), + 'category_url_path' => $category->getUrlPath(), ]; } } diff --git a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls index 76a58857cebc2..f4b1320485ab0 100644 --- a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls +++ b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls @@ -231,6 +231,7 @@ type Breadcrumb @doc(description: "Breadcrumb item."){ category_name: String @doc(description: "Category name.") category_level: Int @doc(description: "Category level.") category_url_key: String @doc(description: "Category URL key.") + category_url_path: String @doc(description: "Category URL path.") } type CustomizableRadioOption implements CustomizableOptionInterface @doc(description: "CustomizableRadioOption contains information about a set of radio buttons that are defined as part of a customizable option.") { From b7faf2473d5e077d5054bb0dec6c1099bd03e9a8 Mon Sep 17 00:00:00 2001 From: Prabhu Ram Date: Tue, 24 Sep 2019 14:21:04 -0500 Subject: [PATCH 26/37] MC-20255: Category Breadcrumbs are missing url_path - Added api functional test --- .../Magento/GraphQl/Catalog/CategoryTest.php | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoryTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoryTest.php index cc0ef7aaf0f5c..8f0260a1b1dae 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoryTest.php @@ -502,6 +502,57 @@ public function testAnchorCategory() $this->assertEquals($expectedResponse, $response); } + /** + * @magentoApiDataFixture Magento/Catalog/_files/categories.php + */ + public function testBreadCrumbs() + { + /** @var CategoryCollection $categoryCollection */ + $categoryCollection = $this->objectManager->create(CategoryCollection::class); + $categoryCollection->addFieldToFilter('name', 'Category 1.1.1'); + /** @var CategoryInterface $category */ + $category = $categoryCollection->getFirstItem(); + $categoryId = $category->getId(); + $this->assertNotEmpty($categoryId, "Preconditions failed: category is not available."); + $query = <<graphQlQuery($query); + $expectedResponse = [ + 'category' => [ + 'name' => 'Category 1.1.1', + 'breadcrumbs' => [ + [ + 'category_id' => 3, + 'category_name' => "Category 1", + 'category_level' => 2, + 'category_url_key' => "category-1", + 'category_url_path' => "category-1" + ], + [ + 'category_id' => 4, + 'category_name' => "Category 1.1", + 'category_level' => 3, + 'category_url_key' => "category-1-1", + 'category_url_path' => "category-1/category-1-1" + ], + ] + ] + ]; + $this->assertEquals($expectedResponse, $response); + } + /** * @param ProductInterface $product * @param array $actualResponse From cd63f18ab7be3acb4cc3b6804bd72a8d286a82d2 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <51681487+engcom-Foxtrot@users.noreply.github.com> Date: Wed, 25 Sep 2019 13:18:09 +0300 Subject: [PATCH 27/37] magento/magento2#24674: Static tests fix. --- .../Catalog/Controller/Adminhtml/Product/Set/Edit.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php index b07cfaf36f735..178615d0c6a24 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php @@ -17,6 +17,9 @@ use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\App\Action\HttpGetActionInterface; +/** + * Edit attribute set controller. + */ class Edit extends Set implements HttpGetActionInterface { /** @@ -30,7 +33,6 @@ class Edit extends Set implements HttpGetActionInterface protected $attributeSetRepository; /** - * * @param Context $context * @param Registry $coreRegistry * @param PageFactory $resultPageFactory @@ -49,10 +51,7 @@ public function __construct( } /** - * - * @return ResultInterface - * - * @throws NoSuchEntityException + * @inheritdoc */ public function execute() { From 41e9fff03dfdb9e55faf3fe25541b81981cb7c5c Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky Date: Wed, 25 Sep 2019 13:48:03 +0300 Subject: [PATCH 28/37] magento/magento2#23827: Integration test fix. --- .../testsuite/Magento/User/Model/UserTest.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php index a6fc9999ad267..ba273f3d1b738 100644 --- a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php @@ -6,7 +6,6 @@ namespace Magento\User\Model; -use Magento\Framework\Serialize\Serializer\Json; use Magento\Framework\Encryption\Encryptor; /** @@ -29,11 +28,6 @@ class UserTest extends \PHPUnit\Framework\TestCase */ protected static $_newRole; - /** - * @var Json - */ - private $serializer; - /** * @var Encryptor */ @@ -47,9 +41,6 @@ protected function setUp() $this->_dateTime = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Framework\Stdlib\DateTime::class ); - $this->serializer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - Json::class - ); $this->encryptor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( Encryptor::class ); @@ -133,7 +124,7 @@ public function testSaveExtra() $this->_model->loadByUsername(\Magento\TestFramework\Bootstrap::ADMIN_NAME); $this->_model->saveExtra(['test' => 'val']); $this->_model->loadByUsername(\Magento\TestFramework\Bootstrap::ADMIN_NAME); - $extra = $this->serializer->unserialize($this->_model->getExtra()); + $extra = $this->_model->getExtra(); $this->assertEquals($extra['test'], 'val'); } From fd4f88d17e90656b91642caa2185177c813d8c4c Mon Sep 17 00:00:00 2001 From: Ravi Chandra Date: Wed, 25 Sep 2019 19:42:47 +0530 Subject: [PATCH 29/37] Fixed LayeredNavigation color filter show only loader for out of stock product --- .../Catalog/view/frontend/templates/product/list.phtml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml index ce44884a575b8..efcf2a3e4aaf4 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml @@ -72,7 +72,9 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class); getReviewsSummaryHtml($_product, $templateType) ?> getProductPrice($_product) ?> - getProductDetailsHtml($_product) ?> + isAvailable()): ?> + getProductDetailsHtml($_product) ?> +
escapeHtmlAttr($position) : '' ?>> From 6bcc8ff98c1f0dd779f68758f0c8cce788b887da Mon Sep 17 00:00:00 2001 From: Prabhu Ram Date: Wed, 25 Sep 2019 09:38:22 -0500 Subject: [PATCH 30/37] MC-20255: Category Breadcrumbs are missing url_path - Static test fix --- .../Model/Resolver/Category/DataProvider/Breadcrumbs.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/DataProvider/Breadcrumbs.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/DataProvider/Breadcrumbs.php index 4b217d77f686c..863e621bd8df3 100644 --- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/DataProvider/Breadcrumbs.php +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/DataProvider/Breadcrumbs.php @@ -29,8 +29,11 @@ public function __construct( } /** + * Get breadcrumbs data + * * @param string $categoryPath * @return array + * @throws \Magento\Framework\Exception\LocalizedException */ public function getData(string $categoryPath): array { From 629fcdfc22c35ce0cc2f3732b54b9885e8b2b362 Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Mon, 23 Sep 2019 20:43:19 +0200 Subject: [PATCH 31/37] Satisfy static and integration tests. --- .../Magento/Bundle/Model/Product/CopyConstructor/Bundle.php | 3 +++ .../Magento/Bundle/Controller/Adminhtml/ProductTest.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php b/app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php index 20e4828835d06..ecbf4cc80a3ae 100644 --- a/app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php +++ b/app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php @@ -8,6 +8,9 @@ use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product\Type; +/** + * Provides duplicating bundle options and selections + */ class Bundle implements \Magento\Catalog\Model\Product\CopyConstructorInterface { /** diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Controller/Adminhtml/ProductTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Controller/Adminhtml/ProductTest.php index f48f2019dd52b..4c598c16c3c47 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Controller/Adminhtml/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Controller/Adminhtml/ProductTest.php @@ -10,6 +10,7 @@ use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product\Type; +use Magento\Framework\App\Request\Http as HttpRequest; use Magento\Framework\Data\Form\FormKey; use Magento\Framework\Message\MessageInterface; use Magento\TestFramework\Helper\Bootstrap; @@ -30,6 +31,7 @@ class ProductTest extends AbstractBackendController public function testDuplicateProduct() { $params = $this->getRequestParamsForDuplicate(); + $this->getRequest()->setMethod(HttpRequest::METHOD_POST); $this->getRequest()->setParams(['type' => Type::TYPE_BUNDLE]); $this->getRequest()->setPostValue($params); $this->dispatch('backend/catalog/product/save'); @@ -49,6 +51,7 @@ public function testDuplicateProduct() * Get necessary request post params for creating and duplicating bundle product. * * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ private function getRequestParamsForDuplicate() { From 2cab120ea86e431a7bc8196d8e94f9524e204e42 Mon Sep 17 00:00:00 2001 From: Ravi Chandra Date: Thu, 26 Sep 2019 10:32:24 +0530 Subject: [PATCH 32/37] Static Tests build --- .../Magento/Catalog/view/frontend/templates/product/list.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml index efcf2a3e4aaf4..8c32302cf7c29 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml @@ -72,7 +72,7 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class); getReviewsSummaryHtml($_product, $templateType) ?> getProductPrice($_product) ?> - isAvailable()): ?> + isAvailable()) :?> getProductDetailsHtml($_product) ?> From 3f8060aa5a125e4af4fe8788d4c03083572848af Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky Date: Wed, 25 Sep 2019 17:06:38 +0300 Subject: [PATCH 33/37] magento/magento2#24645: Added unit test. --- .../Unit/Controller/Unsubscribe/PriceTest.php | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 app/code/Magento/ProductAlert/Test/Unit/Controller/Unsubscribe/PriceTest.php diff --git a/app/code/Magento/ProductAlert/Test/Unit/Controller/Unsubscribe/PriceTest.php b/app/code/Magento/ProductAlert/Test/Unit/Controller/Unsubscribe/PriceTest.php new file mode 100644 index 0000000000000..a07c93337c041 --- /dev/null +++ b/app/code/Magento/ProductAlert/Test/Unit/Controller/Unsubscribe/PriceTest.php @@ -0,0 +1,125 @@ +objectManager = new ObjectManager($this); + $this->requestMock = $this->createMock(Http::class); + $this->resultFactoryMock = $this->createMock(ResultFactory::class); + $this->resultRedirectMock = $this->createMock(Redirect::class); + $this->messageManagerMock = $this->createMock(Manager::class); + $this->productMock = $this->createMock(Product::class); + $this->contextMock = $this->createMock(Context::class); + $this->customerSessionMock = $this->createMock(Session::class); + $this->productRepositoryMock = $this->createMock(ProductRepositoryInterface::class); + $this->resultFactoryMock->expects($this->any()) + ->method('create') + ->with(ResultFactory::TYPE_REDIRECT) + ->willReturn($this->resultRedirectMock); + $this->contextMock->expects($this->any())->method('getRequest')->willReturn($this->requestMock); + $this->contextMock->expects($this->any())->method('getResultFactory')->willReturn($this->resultFactoryMock); + $this->contextMock->expects($this->any())->method('getMessageManager')->willReturn($this->messageManagerMock); + + $this->priceController = $this->objectManager->getObject( + Price::class, + [ + 'context' => $this->contextMock, + 'customerSession' => $this->customerSessionMock, + 'productRepository' => $this->productRepositoryMock, + ] + ); + } + + public function testProductIsNotVisibleInCatalog() + { + $productId = 123; + $this->requestMock->expects($this->any())->method('getParam')->with('product')->willReturn($productId); + $this->productRepositoryMock->expects($this->any()) + ->method('getById') + ->with($productId) + ->willReturn($this->productMock); + $this->productMock->expects($this->any())->method('isVisibleInCatalog')->willReturn(false); + $this->messageManagerMock->expects($this->once())->method('addErrorMessage')->with(__("The product wasn't found. Verify the product and try again.")); + $this->resultRedirectMock->expects($this->once())->method('setPath')->with('customer/account/'); + + $this->assertEquals( + $this->resultRedirectMock, + $this->priceController->execute() + ); + } +} From d9dcd9f849e33cbef68158ec595466d0cea212a1 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov Date: Thu, 26 Sep 2019 09:53:34 -0500 Subject: [PATCH 34/37] Make property private --- .../Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php index 178615d0c6a24..89d2c1b8a066e 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php @@ -30,7 +30,7 @@ class Edit extends Set implements HttpGetActionInterface /** * @var AttributeSetRepositoryInterface */ - protected $attributeSetRepository; + private $attributeSetRepository; /** * @param Context $context From 4799d8f935fc334b1ea0cfad1a09e2b6b34d5f69 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov Date: Thu, 26 Sep 2019 14:24:23 -0500 Subject: [PATCH 35/37] magento-engcom/magento2ce#3285: Fixed minor code style issues --- .../Framework/MessageQueue/MessageValidator.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/MessageQueue/MessageValidator.php b/lib/internal/Magento/Framework/MessageQueue/MessageValidator.php index abb2918d459ae..7c1a947623e9f 100644 --- a/lib/internal/Magento/Framework/MessageQueue/MessageValidator.php +++ b/lib/internal/Magento/Framework/MessageQueue/MessageValidator.php @@ -11,8 +11,7 @@ use Magento\Framework\Communication\ConfigInterface as CommunicationConfig; /** - * Class MessageValidator to validate message with topic schema - * + * Class MessageValidator to validate message with topic schema. */ class MessageValidator { @@ -90,6 +89,8 @@ public function validate($topic, $message, $requestType = true) } /** + * Validate queue message. + * * @param string $message * @param string $messageType * @param string $topic @@ -105,6 +106,8 @@ protected function validateMessage($message, $messageType, $topic) } /** + * Validate message primitive type. + * * @param string $message * @param string $messageType * @param string $topic @@ -136,6 +139,8 @@ protected function validatePrimitiveType($message, $messageType, $topic) } /** + * Validate class type + * * @param string $message * @param string $messageType * @param string $topic @@ -168,6 +173,8 @@ protected function validateClassType($message, $messageType, $topic) } /** + * Returns message real type + * * @param string $message * @return string */ From 1ed98c65e632fc649de46cf5b97d994784cfe6f1 Mon Sep 17 00:00:00 2001 From: Eden Date: Fri, 27 Sep 2019 14:03:54 +0700 Subject: [PATCH 36/37] Resolve Suggested Terms Yes/No not in camel case #24739 --- .../view/adminhtml/layout/search_term_grid_block.xml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/app/code/Magento/Search/view/adminhtml/layout/search_term_grid_block.xml b/app/code/Magento/Search/view/adminhtml/layout/search_term_grid_block.xml index 38c6fa52455b9..e7f31097368e2 100644 --- a/app/code/Magento/Search/view/adminhtml/layout/search_term_grid_block.xml +++ b/app/code/Magento/Search/view/adminhtml/layout/search_term_grid_block.xml @@ -81,16 +81,7 @@ 1 display_in_terms options - - - 1 - yes - - - 0 - no - - + From dfd481d22616708a7e55d7b8757581e90ba4f41c Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky Date: Thu, 26 Sep 2019 12:58:06 +0300 Subject: [PATCH 37/37] magento/magento2#24043: Better exception handling during cli commands. --- .../Magento/Framework/Console/Cli.php | 11 ++- .../Framework/Console/Test/Unit/CliTest.php | 81 +++++++++++++++++++ 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 lib/internal/Magento/Framework/Console/Test/Unit/CliTest.php diff --git a/lib/internal/Magento/Framework/Console/Cli.php b/lib/internal/Magento/Framework/Console/Cli.php index 34fd6316ce454..6aab9c03ff7b2 100644 --- a/lib/internal/Magento/Framework/Console/Cli.php +++ b/lib/internal/Magento/Framework/Console/Cli.php @@ -19,6 +19,7 @@ use Magento\Setup\Application; use Magento\Setup\Console\CompilerPreparation; use Magento\Setup\Model\ObjectManagerProvider; +use Psr\Log\LoggerInterface; use Symfony\Component\Console; use Magento\Framework\Config\ConfigOptionsListConstants; @@ -61,6 +62,11 @@ class Cli extends Console\Application */ private $objectManager; + /** + * @var LoggerInterface + */ + private $logger; + /** * @param string $name the application name * @param string $version the application version @@ -94,6 +100,7 @@ public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN') parent::__construct($name, $version); $this->serviceManager->setService(\Symfony\Component\Console\Application::class, $this); + $this->logger = $this->objectManager->get(LoggerInterface::class); } /** @@ -107,7 +114,9 @@ public function doRun(Console\Input\InputInterface $input, Console\Output\Output try { $exitCode = parent::doRun($input, $output); } catch (\Exception $e) { - $output->writeln($e->getTraceAsString()); + $errorMessage = $e->getMessage() . PHP_EOL . $e->getTraceAsString(); + $this->logger->error($errorMessage); + $this->initException = $e; } if ($this->initException) { diff --git a/lib/internal/Magento/Framework/Console/Test/Unit/CliTest.php b/lib/internal/Magento/Framework/Console/Test/Unit/CliTest.php new file mode 100644 index 0000000000000..6e7bf049c4301 --- /dev/null +++ b/lib/internal/Magento/Framework/Console/Test/Unit/CliTest.php @@ -0,0 +1,81 @@ +inputMock = $this->getMockBuilder(InputInterface::class) + ->getMockForAbstractClass(); + $this->outputMock = $this->getMockBuilder(OutputInterface::class) + ->getMockForAbstractClass(); + $this->cli = new Cli(); + } + + /** + * Make sure exception message is displayed and trace is logged. + * + * @expectedException \Exception + * @expectedExceptionMessage Test message + */ + public function testDoRunExceptionLogging() + { + $e = new \Exception('Test message'); + $this->inputMock->expects($this->once())->method('getFirstArgument')->willThrowException($e); + $loggerMock = $this->createMock(LoggerInterface::class); + $loggerMock->expects($this->once()) + ->method('error') + ->with($e->getMessage() . PHP_EOL . $e->getTraceAsString()); + $this->injectMock($loggerMock, 'logger'); + + $this->cli->doRun($this->inputMock, $this->outputMock); + } + + /** + * Inject mock to Cli property. + * + * @param MockObject $mockObject + * @param string $propertyName + * @throws \ReflectionException + */ + private function injectMock(MockObject $mockObject, string $propertyName): void + { + $reflection = new \ReflectionClass(Cli::class); + $reflectionProperty = $reflection->getProperty($propertyName); + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue($this->cli, $mockObject); + } +}