From 9ffcdc60c5afa199d760d74e1b127ab69878c703 Mon Sep 17 00:00:00 2001 From: Anna Pak Date: Sun, 4 Oct 2020 15:26:12 +0300 Subject: [PATCH 01/57] refactoring of AdminCreateInvoiceTest --- .../Test/Mftf/Test/AdminCreateInvoiceTest.xml | 93 +++++++------------ 1 file changed, 31 insertions(+), 62 deletions(-) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml index 73c126bb7794f..e6a0a8b3661dd 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml @@ -18,77 +18,46 @@ - + + - + + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - + - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - From 0c14e5ffd0778b5d7d203b3b74deea361a3d3f80 Mon Sep 17 00:00:00 2001 From: Anna Pak Date: Sun, 4 Oct 2020 15:38:27 +0300 Subject: [PATCH 02/57] refactored --- .../Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml index e6a0a8b3661dd..f91c8d9993044 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml @@ -55,7 +55,7 @@ - + From ea995471fc9a9c0f75ad3dae3cbfbaba215327f0 Mon Sep 17 00:00:00 2001 From: Anna Pak Date: Mon, 5 Oct 2020 13:16:32 +0300 Subject: [PATCH 03/57] wrap openOrder action with ActionGroup Please enter the commit message for your changes. Lines starting --- .../Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml index f91c8d9993044..f79154398eaff 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml @@ -45,7 +45,9 @@ - + + + From 3e467313566cb38f7af8bb6c5d9b991b35d0dcbe Mon Sep 17 00:00:00 2001 From: Anna Pak Date: Mon, 5 Oct 2020 14:14:04 +0300 Subject: [PATCH 04/57] deprecating old test Please enter the commit message for your changes. Lines starting --- .../Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml index f79154398eaff..49ae1844a1cf1 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml @@ -8,7 +8,7 @@ - + From 7806115a430973fec96cef5be76de5d30cf81a76 Mon Sep 17 00:00:00 2001 From: Oleh Usik Date: Wed, 4 Nov 2020 12:41:57 +0200 Subject: [PATCH 05/57] Assert discount --- ...ssertStorefrontCartDiscountActionGroup.xml | 21 +++++++++++++++++++ ...tCheckoutWithCouponAndZeroSubtotalTest.xml | 6 ++++-- ...efrontUKCustomerCheckoutWithCouponTest.xml | 6 ++++-- ...eConditionAndFreeShippingIsAppliedTest.xml | 4 +++- ...inCreateCartPriceRuleEmptyFromDateTest.xml | 6 ++++-- ...inCreateCartPriceRuleForCouponCodeTest.xml | 6 ++++-- ...ateCartPriceRuleForGeneratedCouponTest.xml | 6 ++++-- ...talAndVerifyRuleConditionIsAppliedTest.xml | 4 +++- ...oryAndVerifyRuleConditionIsAppliedTest.xml | 4 +++- ...ghtAndVerifyRuleConditionIsAppliedTest.xml | 4 +++- .../StorefrontCartPriceRuleCountryTest.xml | 6 ++++-- .../StorefrontCartPriceRulePostcodeTest.xml | 6 ++++-- .../StorefrontCartPriceRuleQuantityTest.xml | 6 ++++-- .../Test/StorefrontCartPriceRuleStateTest.xml | 6 ++++-- .../StorefrontCartPriceRuleSubtotalTest.xml | 6 ++++-- ...ValueWithFullDiscountUsingCartRuleTest.xml | 6 ++++-- 16 files changed, 77 insertions(+), 26 deletions(-) create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCartDiscountActionGroup.xml diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCartDiscountActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCartDiscountActionGroup.xml new file mode 100644 index 0000000000000..ed34b460d6158 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCartDiscountActionGroup.xml @@ -0,0 +1,21 @@ + + + + + + + Assert that the provided Discount is present in the Storefront Shopping Cart. + + + + + + + + diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml index f910a9d47244f..fbfd781505ab7 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml @@ -47,8 +47,10 @@ - - + + + + diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml index d037718a1ec94..fd38120aab98b 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml @@ -75,8 +75,10 @@ - - + + + + diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml index 88853b2c40d9a..96da616818ae1 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml @@ -107,6 +107,8 @@ - + + + diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml index e206633808057..65bb0b4cbfb99 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml @@ -87,8 +87,10 @@ - - + + + + diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml index 16af210066997..198ba1cd64f35 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml @@ -80,7 +80,9 @@ - - + + + + diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml index 6577ff9440456..70624a4e2e339 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml @@ -84,7 +84,9 @@ - - + + + + diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml index da8c8e4bc1f9d..1fe97b1f45036 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml @@ -116,6 +116,8 @@ - + + + diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml index f6e736c73db74..c80f43385d166 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml @@ -118,6 +118,8 @@ - + + + diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml index 5f110f7074f6f..cd72ec8529816 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml @@ -106,6 +106,8 @@ - + + + diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleCountryTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleCountryTest.xml index ea96fa41e5cad..3b54df544210f 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleCountryTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleCountryTest.xml @@ -77,8 +77,10 @@ - - + + + + diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRulePostcodeTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRulePostcodeTest.xml index 62c494b988bbd..d0cba156f635e 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRulePostcodeTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRulePostcodeTest.xml @@ -81,8 +81,10 @@ - - + + + + diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleQuantityTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleQuantityTest.xml index 70ed09df7a2cc..1a449017e0386 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleQuantityTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleQuantityTest.xml @@ -83,7 +83,9 @@ - - + + + + diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleStateTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleStateTest.xml index da9ca9055d31b..68f6fc93eab94 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleStateTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleStateTest.xml @@ -77,8 +77,10 @@ - - + + + + diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleSubtotalTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleSubtotalTest.xml index ce0d814e50308..0ffe1516d0232 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleSubtotalTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleSubtotalTest.xml @@ -81,7 +81,9 @@ - - + + + + diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml index 1178ca2cfb328..8df45937bb542 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml @@ -117,8 +117,10 @@ - - + + + + From d157d42ebef3a903b39c3a8e224ab0646b91061d Mon Sep 17 00:00:00 2001 From: Anna Pak Date: Mon, 23 Nov 2020 10:41:42 +0200 Subject: [PATCH 06/57] AdminCreateInvoiceTest deprecated --- .../Test/Mftf/Test/AdminCreateInvoiceTest.xml | 96 ++++++++++++------- .../Test/Mftf/Test/AdminInvoiceOrderTest.xml | 65 +++++++++++++ 2 files changed, 127 insertions(+), 34 deletions(-) create mode 100644 app/code/Magento/Sales/Test/Mftf/Test/AdminInvoiceOrderTest.xml diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml index 49ae1844a1cf1..3e8fd1e42c12b 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml @@ -12,54 +12,82 @@ - + <title value="DEPRECATED. Admin should be able to create an invoice"/> <description value="Admin should be able to create an invoice"/> <severity value="MAJOR"/> <testCaseId value="MAGETWO-72096"/> <group value="sales"/> + <skip> + <issueID value="DEPRECATED">Use AdminInvoiceOrderTest instead</issueID> + </skip> </annotations> - - <before> + <before> <createData entity="_defaultCategory" stepKey="createCategory"/> - <createData entity="_defaultProduct" stepKey="createSimpleProductApi"> + <createData entity="_defaultProduct" stepKey="createProduct"> <requiredEntity createDataKey="createCategory"/> </createData> - <createData entity="GuestCart" stepKey="createGuestCart"/> - <createData entity="SimpleCartItem" stepKey="addCartItem"> - <requiredEntity createDataKey="createGuestCart"/> - <requiredEntity createDataKey="createSimpleProductApi"/> - </createData> - <createData entity="GuestAddressInformation" stepKey="addGuestOrderAddress"> - <requiredEntity createDataKey="createGuestCart"/> - </createData> - <updateData createDataKey="createGuestCart" entity="GuestOrderPaymentMethod" stepKey="sendGuestPaymentInformation"> - <requiredEntity createDataKey="createGuestCart"/> - </updateData> </before> - <after> - <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <deleteData createDataKey="createSimpleProductApi" stepKey="deleteSimpleProductApi"/> <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> + <deleteData createDataKey="createCategory" stepKey="deleteProduct1"/> + <deleteData createDataKey="createProduct" stepKey="deleteCategory1"/> </after> - <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin1"/> - - <actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="openOrder"> - <argument name="entity_id" value="$createGuestCart.return$"/> - </actionGroup> - - <actionGroup ref="AdminCreateInvoiceActionGroup" stepKey="createInvoice"/> + <!-- todo: Create an order via the api instead of driving the browser --> + <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/> + <actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addToCart"/> + <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/> + <actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickCart"/> + <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <fillField selector="{{CheckoutShippingGuestInfoSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/> + <fillField selector="{{CheckoutShippingGuestInfoSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/> + <fillField selector="{{CheckoutShippingGuestInfoSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/> + <fillField selector="{{CheckoutShippingGuestInfoSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="enterStreet"/> + <fillField selector="{{CheckoutShippingGuestInfoSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="enterCity"/> + <selectOption selector="{{CheckoutShippingGuestInfoSection.region}}" userInput="{{CustomerAddressSimple.state}}" stepKey="selectRegion"/> + <fillField selector="{{CheckoutShippingGuestInfoSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="enterPostcode"/> + <fillField selector="{{CheckoutShippingGuestInfoSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="enterTelephone"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> + <click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/> + <actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="clickNext"/> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> + <waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/> + <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> + <!-- end todo --> - <actionGroup ref="FilterInvoiceGridByOrderIdWithCleanFiltersActionGroup" stepKey="filterInvoiceGridByOrderId"> - <argument name="orderId" value="$createGuestCart.return$"/> - </actionGroup> - - <actionGroup ref="AdminSelectFirstGridRowActionGroup" stepKey="openInvoiceFromGrid"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin1"/> - <actionGroup ref="AdminOrderViewCheckStatusActionGroup" stepKey="checkIfOrderStatusIsProcessing"> - <argument name="status" value="Processing"/> - </actionGroup> + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask3"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/> + <fillField selector="{{AdminOrdersGridSection.search}}" userInput="{$grabOrderNumber}" stepKey="searchOrderNum"/> + <click selector="{{AdminOrdersGridSection.submitSearch}}" stepKey="submitSearch"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask4"/> + <actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/> + <actionGroup ref="AdminClickInvoiceButtonOrderViewActionGroup" stepKey="clickInvoice"/> + <actionGroup ref="AdminInvoiceClickSubmitActionGroup" stepKey="clickSubmitInvoice"/> + <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeSuccessMessage"/> + <click selector="{{AdminOrderDetailsOrderViewSection.invoices}}" stepKey="clickInvoices"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask5" /> + <see selector="{{AdminOrderDetailsInvoicesSection.content}}" userInput="{$grabOrderNumber}" stepKey="seeInvoice1"/> + <see selector="{{AdminOrderDetailsInvoicesSection.content}}" userInput="John Doe" stepKey="seeInvoice2"/> + <click selector="{{AdminOrderDetailsOrderViewSection.information}}" stepKey="clickInformation"/> + <waitForLoadingMaskToDisappear stepKey="waitForOrderInformationTabLoadingMask"/> + <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Processing" stepKey="seeOrderStatus"/> + <amOnPage url="{{AdminInvoicesPage.url}}" stepKey="goToInvoices"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask6" /> + <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridInitial"/> + <click selector="{{AdminInvoicesGridSection.filter}}" stepKey="clickFilters"/> + <fillField selector="{{AdminInvoicesFiltersSection.orderNum}}" userInput="{$grabOrderNumber}" stepKey="searchOrderNum2"/> + <click selector="{{AdminInvoicesFiltersSection.applyFilters}}" stepKey="clickApplyFilters"/> + <click selector="{{AdminInvoicesGridSection.firstRow}}" stepKey="clickInvoice2"/> + <see selector="{{AdminInvoiceDetailsInformationSection.orderStatus}}" userInput="Processing" stepKey="seeOrderStatus2"/> </test> -</tests> +</tests> \ No newline at end of file diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminInvoiceOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminInvoiceOrderTest.xml new file mode 100644 index 0000000000000..14fe9c1ece95b --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminInvoiceOrderTest.xml @@ -0,0 +1,65 @@ +<?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="AdminInvoiceOrderTest"> + <annotations> + <features value="Sales"/> + <stories value="Create an Invoice via the Admin"/> + <title value="Admin should be able to create an invoice"/> + <description value="Admin should be able to create an invoice"/> + <severity value="MAJOR"/> + <testCaseId value="MAGETWO-72096"/> + <group value="sales"/> + </annotations> + + <before> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="_defaultProduct" stepKey="createSimpleProductApi"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <createData entity="GuestCart" stepKey="createGuestCart"/> + <createData entity="SimpleCartItem" stepKey="addCartItem"> + <requiredEntity createDataKey="createGuestCart"/> + <requiredEntity createDataKey="createSimpleProductApi"/> + </createData> + <createData entity="GuestAddressInformation" stepKey="addGuestOrderAddress"> + <requiredEntity createDataKey="createGuestCart"/> + </createData> + <updateData createDataKey="createGuestCart" entity="GuestOrderPaymentMethod" stepKey="sendGuestPaymentInformation"> + <requiredEntity createDataKey="createGuestCart"/> + </updateData> + </before> + + <after> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createSimpleProductApi" stepKey="deleteSimpleProductApi"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> + </after> + + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin1"/> + + <actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="openOrder"> + <argument name="entity_id" value="$createGuestCart.return$"/> + </actionGroup> + + <actionGroup ref="AdminCreateInvoiceActionGroup" stepKey="createInvoice"/> + + <actionGroup ref="FilterInvoiceGridByOrderIdWithCleanFiltersActionGroup" stepKey="filterInvoiceGridByOrderId"> + <argument name="orderId" value="$createGuestCart.return$"/> + </actionGroup> + + <actionGroup ref="AdminSelectFirstGridRowActionGroup" stepKey="openInvoiceFromGrid"/> + + <actionGroup ref="AdminOrderViewCheckStatusActionGroup" stepKey="checkIfOrderStatusIsProcessing"> + <argument name="status" value="Processing"/> + </actionGroup> + + </test> +</tests> From b23cad2a6a4741d85471c856d2aa8c07e44ba0f6 Mon Sep 17 00:00:00 2001 From: Anna Pak <a.pak@atwix.com> Date: Mon, 23 Nov 2020 10:48:15 +0200 Subject: [PATCH 07/57] refactored --- .../Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml | 2 +- app/code/Magento/Sales/Test/Mftf/Test/AdminInvoiceOrderTest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml index 3e8fd1e42c12b..1916fb9ebdbbb 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml @@ -18,7 +18,7 @@ <testCaseId value="MAGETWO-72096"/> <group value="sales"/> <skip> - <issueID value="DEPRECATED">Use AdminInvoiceOrderTest instead</issueID> + <issueId value="DEPRECATED">Use AdminInvoiceOrderTest instead</issueId> </skip> </annotations> <before> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminInvoiceOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminInvoiceOrderTest.xml index 14fe9c1ece95b..3b28fd10d58b9 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminInvoiceOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminInvoiceOrderTest.xml @@ -46,7 +46,7 @@ <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin1"/> <actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="openOrder"> - <argument name="entity_id" value="$createGuestCart.return$"/> + <argument name="entityId" value="$createGuestCart.return$"/> </actionGroup> <actionGroup ref="AdminCreateInvoiceActionGroup" stepKey="createInvoice"/> From 2d8be9cd0387dc81d2086e9f5f766efc2cd1d813 Mon Sep 17 00:00:00 2001 From: Anna Pak <a.pak@atwix.com> Date: Mon, 23 Nov 2020 11:26:49 +0200 Subject: [PATCH 08/57] refactored --- .../Magento/Sales/Test/Mftf/Test/AdminInvoiceOrderTest.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminInvoiceOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminInvoiceOrderTest.xml index 3b28fd10d58b9..922037fe4a3cd 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminInvoiceOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminInvoiceOrderTest.xml @@ -35,6 +35,9 @@ <updateData createDataKey="createGuestCart" entity="GuestOrderPaymentMethod" stepKey="sendGuestPaymentInformation"> <requiredEntity createDataKey="createGuestCart"/> </updateData> + + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> + </before> <after> @@ -42,8 +45,6 @@ <deleteData createDataKey="createSimpleProductApi" stepKey="deleteSimpleProductApi"/> <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> - - <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin1"/> <actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="openOrder"> <argument name="entityId" value="$createGuestCart.return$"/> From 97e34547ec7acfadffec4951d4dadd9cae3531f5 Mon Sep 17 00:00:00 2001 From: Anna Pak <a.pak@atwix.com> Date: Mon, 23 Nov 2020 21:14:35 +0200 Subject: [PATCH 09/57] Refactored AdminMassProductPriceUpdateTest --- ...inCheckProductOnProductGridActionGroup.xml | 22 +++++++++ .../AdminSetPriceForMassUpdateActionGroup.xml | 24 ++++++++++ .../Test/AdminMassProductPriceUpdateTest.xml | 48 ++++++++++++++----- 3 files changed, 81 insertions(+), 13 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetPriceForMassUpdateActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml new file mode 100644 index 0000000000000..34c9c1edf50cb --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCheckProductOnProductGridActionGroup"> + <annotations> + <description>Check the product on the Product Grid</description> + </annotations> + <arguments> + <argument name="product" type="entity"/> + </arguments> + + <checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku(product.sku)}}" stepKey="selectProduct"/> + + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetPriceForMassUpdateActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetPriceForMassUpdateActionGroup.xml new file mode 100644 index 0000000000000..b00f181c92360 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetPriceForMassUpdateActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSetPriceForMassUpdateActionGroup"> + <annotations> + <description>Click the "Change" checkbox for the "Price" field. Set new price.</description> + </annotations> + <arguments> + <argument name="price" type="string"/> + </arguments> + + <scrollTo stepKey="scrollToPriceCheckBox" selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" x="0" y="-160"/> + <click selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" stepKey="selectPriceCheckBox"/> + <fillField stepKey="fillPrice" selector="{{AdminEditProductAttributesSection.AttributePrice}}" userInput="{{price}}"/> + + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml index 070c07d9feb7d..b3cf6e357fd6a 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml @@ -41,19 +41,27 @@ <actionGroup ref="SortProductsByIdDescendingActionGroup" stepKey="sortProductsByIdDescending"/> <!--Select products--> - <checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku($$simpleProduct1.sku$$)}}" stepKey="selectFirstProduct"/> - <checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku($$simpleProduct2.sku$$)}}" stepKey="selectSecondProduct"/> + <actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectFirstProduct"> + <argument name="product" value="$simpleProduct1$"/> + </actionGroup> + <actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectSecondProduct"> + <argument name="product" value="$simpleProduct2$"/> + </actionGroup> <!-- Update product price--> - <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickDropdown"/> - <click selector="{{AdminProductGridSection.bulkActionOption('Update attributes')}}" stepKey="clickChangeStatus"/> - <waitForPageLoad stepKey="waitForProductAttributePageToLoad"/> - <scrollTo stepKey="scrollToPriceCheckBox" selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" x="0" y="-160"/> - <click selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" stepKey="selectPriceCheckBox"/> - <fillField stepKey="fillPrice" selector="{{AdminEditProductAttributesSection.AttributePrice}}" userInput="90.99"/> - <click stepKey="clickOnSaveButton" selector="{{AdminEditProductAttributesSection.Save}}"/> - <waitForPageLoad stepKey="waitForUpdatedProductToSave" /> - <see selector="{{AdminProductMessagesSection.successMessage}}" userInput="Message is added to queue" stepKey="seeAttributeUpateSuccessMsg"/> + <actionGroup ref="AdminClickMassUpdateProductAttributesActionGroup" stepKey="clickDropdown"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickChangeStatus"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductAttributePageToLoad"/> + + <actionGroup ref="AdminSetPriceForMassUpdateActionGroup" stepKey="scrollToPriceCheckBox"> + <argument name="price" value="90.99"/> + </actionGroup> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectPriceCheckBox"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillPrice"/> + + <actionGroup ref="AdminSaveProductsMassAttributesUpdateActionGroup" stepKey="clickOnSaveButton"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForUpdatedProductToSave"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeAttributeUpateSuccessMsg"/> <!-- Start message queue --> <actionGroup ref="CliConsumerStartActionGroup" stepKey="startMessageQueueConsumer"> @@ -64,7 +72,21 @@ <magentoCLI command="cron:run --group=index" stepKey="runCron"/> <!--Verify product name, sku and updated price--> - <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$simpleProduct1.sku$$)}}"/> + <!-- <actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToFirstProductEditPage"> + <argument name="productId" value="$$simpleProduct1.id$$"/> + </actionGroup> --> + <actionGroup ref="AssertProductInfoOnEditPageActionGroup" stepKey="waitForFirstProductToLoad"> + <argument name="product" value="$$simpleProduct1$$"/> + </actionGroup> + + <!-- <actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToSecondProductEditPage"> + <argument name="productId" value="$$simpleProduct2.id$$"/> + </actionGroup> --> + <actionGroup ref="AssertProductInfoOnEditPageActionGroup" stepKey="waitForSecondProductToLoad"> + <argument name="product" value="$$simpleProduct2$$"/> + </actionGroup> + + <!-- <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$simpleProduct1.sku$$)}}"/> <waitForPageLoad stepKey="waitForFirstProductToLoad"/> <seeInField stepKey="seeFirstProductNameInField" selector="{{AdminProductFormSection.productName}}" userInput="$$simpleProduct1.name$$"/> <seeInField stepKey="seeFirstProductSkuInField" selector="{{AdminProductFormSection.productSku}}" userInput="$$simpleProduct1.sku$$"/> @@ -75,6 +97,6 @@ <waitForPageLoad stepKey="waitForSecondProductToLoad"/> <seeInField stepKey="seeSecondProductNameInField" selector="{{AdminProductFormSection.productName}}" userInput="$$simpleProduct2.name$$"/> <seeInField stepKey="seeSecondProductSkuInField" selector="{{AdminProductFormSection.productSku}}" userInput="$$simpleProduct2.sku$$"/> - <seeInField stepKey="seeSecondProductPriceInField" selector="{{AdminProductFormSection.productPrice}}" userInput="90.99"/> + <seeInField stepKey="seeSecondProductPriceInField" selector="{{AdminProductFormSection.productPrice}}" userInput="90.99"/> --> </test> </tests> From 131cd1aae2a397e81457c0daf3962db39d5c0072 Mon Sep 17 00:00:00 2001 From: Anna Pak <a.pak@atwix.com> Date: Wed, 25 Nov 2020 17:06:44 +0200 Subject: [PATCH 10/57] Refactored AdminMassProductPriceUpdateTest --- ...oductPriceUpdatedOnEditPageActionGroup.xml | 25 +++++++++ .../Test/AdminMassProductPriceUpdateTest.xml | 54 +++++++------------ 2 files changed, 45 insertions(+), 34 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertAdminProductPriceUpdatedOnEditPageActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertAdminProductPriceUpdatedOnEditPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertAdminProductPriceUpdatedOnEditPageActionGroup.xml new file mode 100644 index 0000000000000..c7a665119b328 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertAdminProductPriceUpdatedOnEditPageActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertAdminProductPriceUpdatedOnEditPageActionGroup" extends="OpenEditProductOnBackendActionGroup"> + <annotations> + <description>Validate if Product price is updated on the Product creation/edit page</description> + </annotations> + <arguments> + <argument name="product" type="entity"/> + <argument name="price" type="string"/> + </arguments> + + <waitForPageLoad stepKey="waitForProductToLoad"/> + <seeInField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="seeProductName"/> + <seeInField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="seeProductSku"/> + <seeInField selector="{{AdminProductFormSection.productPrice}}" userInput="{{price}}" stepKey="seeProductPrice"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml index b3cf6e357fd6a..42719e2d6aa12 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml @@ -25,22 +25,16 @@ </before> <after> <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> - <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> + <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> - <!--Open Product Index Page--> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/> - <!--Search products using keyword --> - <actionGroup ref="SearchProductGridByKeyword2ActionGroup" stepKey="searchByKeyword"> - <argument name="keyword" value="Testp"/> - </actionGroup> + <actionGroup ref="ClearFiltersAdminProductGridActionGroup" stepKey="searchByKeyword"/> - <!--Sort Products by ID in descending order--> <actionGroup ref="SortProductsByIdDescendingActionGroup" stepKey="sortProductsByIdDescending"/> - <!--Select products--> <actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectFirstProduct"> <argument name="product" value="$simpleProduct1$"/> </actionGroup> @@ -48,7 +42,6 @@ <argument name="product" value="$simpleProduct2$"/> </actionGroup> - <!-- Update product price--> <actionGroup ref="AdminClickMassUpdateProductAttributesActionGroup" stepKey="clickDropdown"/> <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickChangeStatus"/> <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductAttributePageToLoad"/> @@ -63,40 +56,33 @@ <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForUpdatedProductToSave"/> <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeAttributeUpateSuccessMsg"/> - <!-- Start message queue --> <actionGroup ref="CliConsumerStartActionGroup" stepKey="startMessageQueueConsumer"> <argument name="consumerName" value="{{AdminProductAttributeUpdateConsumerData.consumerName}}"/> <argument name="maxMessages" value="{{AdminProductAttributeUpdateConsumerData.messageLimit}}"/> </actionGroup> - <!-- Run cron --> + <magentoCLI command="cron:run --group=index" stepKey="runCron"/> - <!--Verify product name, sku and updated price--> - <!-- <actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToFirstProductEditPage"> - <argument name="productId" value="$$simpleProduct1.id$$"/> - </actionGroup> --> - <actionGroup ref="AssertProductInfoOnEditPageActionGroup" stepKey="waitForFirstProductToLoad"> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openFirstProduct"/> + <actionGroup ref="AssertAdminProductPriceUpdatedOnEditPageActionGroup" stepKey="waitForFirstProductToLoad"> <argument name="product" value="$$simpleProduct1$$"/> + <argument name="price" value="90.99"/> </actionGroup> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductNameInField"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductSkuInField"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductPriceInField"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnBackButton"/> - <!-- <actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToSecondProductEditPage"> - <argument name="productId" value="$$simpleProduct2.id$$"/> - </actionGroup> --> - <actionGroup ref="AssertProductInfoOnEditPageActionGroup" stepKey="waitForSecondProductToLoad"> + <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="waitForProductsToLoad"/> + + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openSecondProduct"/> + <actionGroup ref="AssertAdminProductPriceUpdatedOnEditPageActionGroup" stepKey="waitForSecondProductToLoad"> <argument name="product" value="$$simpleProduct2$$"/> - </actionGroup> - - <!-- <click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$simpleProduct1.sku$$)}}"/> - <waitForPageLoad stepKey="waitForFirstProductToLoad"/> - <seeInField stepKey="seeFirstProductNameInField" selector="{{AdminProductFormSection.productName}}" userInput="$$simpleProduct1.name$$"/> - <seeInField stepKey="seeFirstProductSkuInField" selector="{{AdminProductFormSection.productSku}}" userInput="$$simpleProduct1.sku$$"/> - <seeInField stepKey="seeFirstProductPriceInField" selector="{{AdminProductFormSection.productPrice}}" userInput="90.99"/> - <click stepKey="clickOnBackButton" selector="{{AdminGridMainControls.back}}"/> - <waitForPageLoad stepKey="waitForProductsToLoad"/> - <click stepKey="openSecondProduct" selector="{{AdminProductGridSection.productRowBySku($$simpleProduct2.sku$$)}}"/> - <waitForPageLoad stepKey="waitForSecondProductToLoad"/> - <seeInField stepKey="seeSecondProductNameInField" selector="{{AdminProductFormSection.productName}}" userInput="$$simpleProduct2.name$$"/> - <seeInField stepKey="seeSecondProductSkuInField" selector="{{AdminProductFormSection.productSku}}" userInput="$$simpleProduct2.sku$$"/> - <seeInField stepKey="seeSecondProductPriceInField" selector="{{AdminProductFormSection.productPrice}}" userInput="90.99"/> --> + <argument name="price" value="90.99"/> + </actionGroup> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductNameInField"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductSkuInField"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductPriceInField"/> + </test> </tests> From bdb653dc3ff44f1ce1486935e27873620ea3f3bd Mon Sep 17 00:00:00 2001 From: Anna Pak <a.pak@atwix.com> Date: Wed, 25 Nov 2020 17:14:32 +0200 Subject: [PATCH 11/57] delete unneeded file Please enter the commit message for your changes. Lines starting --- ...inCheckProductOnProductGridActionGroup.xml | 22 ------------------- 1 file changed, 22 deletions(-) delete mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml deleted file mode 100644 index 34c9c1edf50cb..0000000000000 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminCheckProductOnProductGridActionGroup"> - <annotations> - <description>Check the product on the Product Grid</description> - </annotations> - <arguments> - <argument name="product" type="entity"/> - </arguments> - - <checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku(product.sku)}}" stepKey="selectProduct"/> - - </actionGroup> -</actionGroups> From faf0c872ac4e03555a278009f12743c0ef0b8412 Mon Sep 17 00:00:00 2001 From: Anna Pak <a.pak@atwix.com> Date: Wed, 25 Nov 2020 17:22:58 +0200 Subject: [PATCH 12/57] revert deletion --- ...inCheckProductOnProductGridActionGroup.xml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml new file mode 100644 index 0000000000000..3bd68e80810e6 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCheckProductOnProductGridActionGroup"> + <annotations> + <description>Check the product on the Product Grid</description> + </annotations> + <arguments> + <argument name="product" type="entity"/> + </arguments> + + <checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku(product.sku)}}" stepKey="selectProduct"/> + + </actionGroup> +</actionGroups> \ No newline at end of file From dd4334df1a3c28e4ee1c84e782971d77c15622d6 Mon Sep 17 00:00:00 2001 From: Anna Pak <a.pak@atwix.com> Date: Wed, 25 Nov 2020 17:29:51 +0200 Subject: [PATCH 13/57] extended decription fo Action Group Please enter the commit message for your changes. Lines starting --- .../ActionGroup/AdminCheckProductOnProductGridActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml index 3bd68e80810e6..aebd595a919f8 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminCheckProductOnProductGridActionGroup"> <annotations> - <description>Check the product on the Product Grid</description> + <description>Check the checkbox for the product on the Product Grid</description> </annotations> <arguments> <argument name="product" type="entity"/> From 758b0d64067f7e3091b0a4a550b0a2a79e79322e Mon Sep 17 00:00:00 2001 From: Anna Pak <a.pak@atwix.com> Date: Mon, 30 Nov 2020 11:01:33 +0200 Subject: [PATCH 14/57] refactoring --- .../ActionGroup/AdminCheckProductOnProductGridActionGroup.xml | 2 +- .../Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml index aebd595a919f8..2faeea1cc299b 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml @@ -19,4 +19,4 @@ <checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku(product.sku)}}" stepKey="selectProduct"/> </actionGroup> -</actionGroups> \ No newline at end of file +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml index 42719e2d6aa12..63277e2ed88fd 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml @@ -25,7 +25,7 @@ </before> <after> <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> - <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> + <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> From ce7a3517b4d08ecd4b07eefcbf7e791e4f94db6b Mon Sep 17 00:00:00 2001 From: Anna Pak <a.pak@atwix.com> Date: Mon, 30 Nov 2020 17:06:52 +0200 Subject: [PATCH 15/57] refactored --- .../Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml index 1916fb9ebdbbb..c2070043e63de 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml @@ -90,4 +90,4 @@ <click selector="{{AdminInvoicesGridSection.firstRow}}" stepKey="clickInvoice2"/> <see selector="{{AdminInvoiceDetailsInformationSection.orderStatus}}" userInput="Processing" stepKey="seeOrderStatus2"/> </test> -</tests> \ No newline at end of file +</tests> From 52e5d2cb33ddf9412e9fda9ef0694013f9796938 Mon Sep 17 00:00:00 2001 From: Anna Pak <a.pak@atwix.com> Date: Wed, 2 Dec 2020 17:19:59 +0200 Subject: [PATCH 16/57] autoformatted --- ...inCheckProductOnProductGridActionGroup.xml | 25 ++++---- .../AdminSetPriceForMassUpdateActionGroup.xml | 7 +-- ...oductPriceUpdatedOnEditPageActionGroup.xml | 5 +- .../Test/AdminMassProductPriceUpdateTest.xml | 57 +++++++++---------- 4 files changed, 45 insertions(+), 49 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml index 2faeea1cc299b..4216f4eedfda6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="UTF-8"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. @@ -6,17 +6,16 @@ */ --> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminCheckProductOnProductGridActionGroup"> - <annotations> - <description>Check the checkbox for the product on the Product Grid</description> - </annotations> - <arguments> - <argument name="product" type="entity"/> - </arguments> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCheckProductOnProductGridActionGroup"> + <annotations> + <description>Check the checkbox for the product on the Product Grid</description> + </annotations> + <arguments> + <argument name="product" type="entity"/> + </arguments> - <checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku(product.sku)}}" stepKey="selectProduct"/> + <checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku(product.sku)}}" stepKey="selectProduct"/> - </actionGroup> -</actionGroups> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetPriceForMassUpdateActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetPriceForMassUpdateActionGroup.xml index b00f181c92360..0bae2a2f627a5 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetPriceForMassUpdateActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetPriceForMassUpdateActionGroup.xml @@ -6,8 +6,7 @@ */ --> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminSetPriceForMassUpdateActionGroup"> <annotations> <description>Click the "Change" checkbox for the "Price" field. Set new price.</description> @@ -16,9 +15,9 @@ <argument name="price" type="string"/> </arguments> - <scrollTo stepKey="scrollToPriceCheckBox" selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" x="0" y="-160"/> + <scrollTo stepKey="scrollToPriceCheckBox" selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" x="0" y="-160"/> <click selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" stepKey="selectPriceCheckBox"/> <fillField stepKey="fillPrice" selector="{{AdminEditProductAttributesSection.AttributePrice}}" userInput="{{price}}"/> </actionGroup> -</actionGroups> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertAdminProductPriceUpdatedOnEditPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertAdminProductPriceUpdatedOnEditPageActionGroup.xml index c7a665119b328..42577f5e7735d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertAdminProductPriceUpdatedOnEditPageActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertAdminProductPriceUpdatedOnEditPageActionGroup.xml @@ -6,8 +6,7 @@ */ --> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AssertAdminProductPriceUpdatedOnEditPageActionGroup" extends="OpenEditProductOnBackendActionGroup"> <annotations> <description>Validate if Product price is updated on the Product creation/edit page</description> @@ -22,4 +21,4 @@ <seeInField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="seeProductSku"/> <seeInField selector="{{AdminProductFormSection.productPrice}}" userInput="{{price}}" stepKey="seeProductPrice"/> </actionGroup> -</actionGroups> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml index 63277e2ed88fd..f76ff23a3ec97 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml @@ -6,8 +6,7 @@ */ --> -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminMassProductPriceUpdateTest"> <annotations> <stories value="Mass product update"/> @@ -36,25 +35,25 @@ <actionGroup ref="SortProductsByIdDescendingActionGroup" stepKey="sortProductsByIdDescending"/> <actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectFirstProduct"> - <argument name="product" value="$simpleProduct1$"/> + <argument name="product" value="$simpleProduct1$"/> </actionGroup> - <actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectSecondProduct"> - <argument name="product" value="$simpleProduct2$"/> + <actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectSecondProduct"> + <argument name="product" value="$simpleProduct2$"/> </actionGroup> <actionGroup ref="AdminClickMassUpdateProductAttributesActionGroup" stepKey="clickDropdown"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickChangeStatus"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductAttributePageToLoad"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickChangeStatus"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductAttributePageToLoad"/> - <actionGroup ref="AdminSetPriceForMassUpdateActionGroup" stepKey="scrollToPriceCheckBox"> - <argument name="price" value="90.99"/> - </actionGroup> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectPriceCheckBox"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillPrice"/> + <actionGroup ref="AdminSetPriceForMassUpdateActionGroup" stepKey="scrollToPriceCheckBox"> + <argument name="price" value="90.99"/> + </actionGroup> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectPriceCheckBox"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillPrice"/> <actionGroup ref="AdminSaveProductsMassAttributesUpdateActionGroup" stepKey="clickOnSaveButton"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForUpdatedProductToSave"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeAttributeUpateSuccessMsg"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForUpdatedProductToSave"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeAttributeUpateSuccessMsg"/> <actionGroup ref="CliConsumerStartActionGroup" stepKey="startMessageQueueConsumer"> <argument name="consumerName" value="{{AdminProductAttributeUpdateConsumerData.consumerName}}"/> @@ -63,26 +62,26 @@ <magentoCLI command="cron:run --group=index" stepKey="runCron"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openFirstProduct"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openFirstProduct"/> <actionGroup ref="AssertAdminProductPriceUpdatedOnEditPageActionGroup" stepKey="waitForFirstProductToLoad"> - <argument name="product" value="$$simpleProduct1$$"/> - <argument name="price" value="90.99"/> + <argument name="product" value="$$simpleProduct1$$"/> + <argument name="price" value="90.99"/> </actionGroup> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductNameInField"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductSkuInField"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductPriceInField"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnBackButton"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductNameInField"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductSkuInField"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductPriceInField"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnBackButton"/> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="waitForProductsToLoad"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openSecondProduct"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openSecondProduct"/> <actionGroup ref="AssertAdminProductPriceUpdatedOnEditPageActionGroup" stepKey="waitForSecondProductToLoad"> - <argument name="product" value="$$simpleProduct2$$"/> - <argument name="price" value="90.99"/> - </actionGroup> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductNameInField"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductSkuInField"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductPriceInField"/> + <argument name="product" value="$$simpleProduct2$$"/> + <argument name="price" value="90.99"/> + </actionGroup> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductNameInField"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductSkuInField"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductPriceInField"/> </test> -</tests> +</tests> \ No newline at end of file From a048fb7c242556759d8d15081340906b48ed26ab Mon Sep 17 00:00:00 2001 From: Anna Pak <a.pak@atwix.com> Date: Wed, 2 Dec 2020 17:30:29 +0200 Subject: [PATCH 17/57] corrected spacing --- .../AdminSetPriceForMassUpdateActionGroup.xml | 7 ++- ...oductPriceUpdatedOnEditPageActionGroup.xml | 5 +- .../Test/AdminMassProductPriceUpdateTest.xml | 57 ++++++++++--------- 3 files changed, 36 insertions(+), 33 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetPriceForMassUpdateActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetPriceForMassUpdateActionGroup.xml index 0bae2a2f627a5..b00f181c92360 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetPriceForMassUpdateActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetPriceForMassUpdateActionGroup.xml @@ -6,7 +6,8 @@ */ --> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminSetPriceForMassUpdateActionGroup"> <annotations> <description>Click the "Change" checkbox for the "Price" field. Set new price.</description> @@ -15,9 +16,9 @@ <argument name="price" type="string"/> </arguments> - <scrollTo stepKey="scrollToPriceCheckBox" selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" x="0" y="-160"/> + <scrollTo stepKey="scrollToPriceCheckBox" selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" x="0" y="-160"/> <click selector="{{AdminEditProductAttributesSection.ChangeAttributePriceToggle}}" stepKey="selectPriceCheckBox"/> <fillField stepKey="fillPrice" selector="{{AdminEditProductAttributesSection.AttributePrice}}" userInput="{{price}}"/> </actionGroup> -</actionGroups> \ No newline at end of file +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertAdminProductPriceUpdatedOnEditPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertAdminProductPriceUpdatedOnEditPageActionGroup.xml index 42577f5e7735d..c7a665119b328 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertAdminProductPriceUpdatedOnEditPageActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertAdminProductPriceUpdatedOnEditPageActionGroup.xml @@ -6,7 +6,8 @@ */ --> -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AssertAdminProductPriceUpdatedOnEditPageActionGroup" extends="OpenEditProductOnBackendActionGroup"> <annotations> <description>Validate if Product price is updated on the Product creation/edit page</description> @@ -21,4 +22,4 @@ <seeInField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="seeProductSku"/> <seeInField selector="{{AdminProductFormSection.productPrice}}" userInput="{{price}}" stepKey="seeProductPrice"/> </actionGroup> -</actionGroups> \ No newline at end of file +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml index f76ff23a3ec97..63277e2ed88fd 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml @@ -6,7 +6,8 @@ */ --> -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminMassProductPriceUpdateTest"> <annotations> <stories value="Mass product update"/> @@ -35,25 +36,25 @@ <actionGroup ref="SortProductsByIdDescendingActionGroup" stepKey="sortProductsByIdDescending"/> <actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectFirstProduct"> - <argument name="product" value="$simpleProduct1$"/> + <argument name="product" value="$simpleProduct1$"/> </actionGroup> - <actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectSecondProduct"> - <argument name="product" value="$simpleProduct2$"/> + <actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectSecondProduct"> + <argument name="product" value="$simpleProduct2$"/> </actionGroup> <actionGroup ref="AdminClickMassUpdateProductAttributesActionGroup" stepKey="clickDropdown"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickChangeStatus"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductAttributePageToLoad"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickChangeStatus"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductAttributePageToLoad"/> - <actionGroup ref="AdminSetPriceForMassUpdateActionGroup" stepKey="scrollToPriceCheckBox"> - <argument name="price" value="90.99"/> - </actionGroup> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectPriceCheckBox"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillPrice"/> + <actionGroup ref="AdminSetPriceForMassUpdateActionGroup" stepKey="scrollToPriceCheckBox"> + <argument name="price" value="90.99"/> + </actionGroup> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectPriceCheckBox"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="fillPrice"/> <actionGroup ref="AdminSaveProductsMassAttributesUpdateActionGroup" stepKey="clickOnSaveButton"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForUpdatedProductToSave"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeAttributeUpateSuccessMsg"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForUpdatedProductToSave"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeAttributeUpateSuccessMsg"/> <actionGroup ref="CliConsumerStartActionGroup" stepKey="startMessageQueueConsumer"> <argument name="consumerName" value="{{AdminProductAttributeUpdateConsumerData.consumerName}}"/> @@ -62,26 +63,26 @@ <magentoCLI command="cron:run --group=index" stepKey="runCron"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openFirstProduct"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openFirstProduct"/> <actionGroup ref="AssertAdminProductPriceUpdatedOnEditPageActionGroup" stepKey="waitForFirstProductToLoad"> - <argument name="product" value="$$simpleProduct1$$"/> - <argument name="price" value="90.99"/> + <argument name="product" value="$$simpleProduct1$$"/> + <argument name="price" value="90.99"/> </actionGroup> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductNameInField"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductSkuInField"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductPriceInField"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnBackButton"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductNameInField"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductSkuInField"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeFirstProductPriceInField"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnBackButton"/> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="waitForProductsToLoad"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openSecondProduct"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="openSecondProduct"/> <actionGroup ref="AssertAdminProductPriceUpdatedOnEditPageActionGroup" stepKey="waitForSecondProductToLoad"> - <argument name="product" value="$$simpleProduct2$$"/> - <argument name="price" value="90.99"/> - </actionGroup> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductNameInField"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductSkuInField"/> - <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductPriceInField"/> + <argument name="product" value="$$simpleProduct2$$"/> + <argument name="price" value="90.99"/> + </actionGroup> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductNameInField"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductSkuInField"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSecondProductPriceInField"/> </test> -</tests> \ No newline at end of file +</tests> From 6fc419105aa467bc909305775e8398d151969f0f Mon Sep 17 00:00:00 2001 From: Anna Pak <58164147+AnnaAPak@users.noreply.github.com> Date: Fri, 4 Dec 2020 09:33:05 +0200 Subject: [PATCH 18/57] Added line --- .../ActionGroup/AdminCheckProductOnProductGridActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml index 4216f4eedfda6..627659062b133 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml @@ -18,4 +18,4 @@ <checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku(product.sku)}}" stepKey="selectProduct"/> </actionGroup> -</actionGroups> \ No newline at end of file +</actionGroups> From 64b617f95788ea499ced46dd620bf70a07868478 Mon Sep 17 00:00:00 2001 From: Anna Pak <58164147+AnnaAPak@users.noreply.github.com> Date: Fri, 4 Dec 2020 09:34:35 +0200 Subject: [PATCH 19/57] Added space --- .../Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml index 63277e2ed88fd..8a5da6d6e3640 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml @@ -38,7 +38,7 @@ <actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectFirstProduct"> <argument name="product" value="$simpleProduct1$"/> </actionGroup> - <actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectSecondProduct"> + <actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectSecondProduct"> <argument name="product" value="$simpleProduct2$"/> </actionGroup> From 9691ef605f9f46e4ee0d4b478dc0d1f736f1d125 Mon Sep 17 00:00:00 2001 From: Anna Pak <58164147+AnnaAPak@users.noreply.github.com> Date: Fri, 4 Dec 2020 09:43:49 +0200 Subject: [PATCH 20/57] corrected spacing --- .../ActionGroup/AdminCheckProductOnProductGridActionGroup.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml index 627659062b133..0e98db3e5d8a8 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCheckProductOnProductGridActionGroup.xml @@ -9,10 +9,10 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminCheckProductOnProductGridActionGroup"> <annotations> - <description>Check the checkbox for the product on the Product Grid</description> + <description>Check the checkbox for the product on the Product Grid</description> </annotations> <arguments> - <argument name="product" type="entity"/> + <argument name="product" type="entity"/> </arguments> <checkOption selector="{{AdminProductGridSection.productRowCheckboxBySku(product.sku)}}" stepKey="selectProduct"/> From 2f10855d003758de54fb23c83a972de25b6a26a7 Mon Sep 17 00:00:00 2001 From: Vova Yatsyuk <vova.yatsyuk@gmail.com> Date: Fri, 4 Dec 2020 10:40:19 +0200 Subject: [PATCH 21/57] Allow to load base64 encoded images and fonts --- app/code/Magento/Csp/etc/config.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/code/Magento/Csp/etc/config.xml b/app/code/Magento/Csp/etc/config.xml index 6e2235479da93..07761995fdbca 100644 --- a/app/code/Magento/Csp/etc/config.xml +++ b/app/code/Magento/Csp/etc/config.xml @@ -92,6 +92,9 @@ <inline>1</inline> <eval>0</eval> <dynamic>0</dynamic> + <schemes> + <data>data</data> + </schemes> </images> <frames> <policy_id>frame-src</policy_id> @@ -120,6 +123,9 @@ <inline>1</inline> <eval>0</eval> <dynamic>0</dynamic> + <schemes> + <data>data</data> + </schemes> </fonts> </storefront> <admin> @@ -197,6 +203,9 @@ <inline>1</inline> <eval>0</eval> <dynamic>0</dynamic> + <schemes> + <data>data</data> + </schemes> </images> <frames> <policy_id>frame-src</policy_id> @@ -225,6 +234,9 @@ <inline>1</inline> <eval>0</eval> <dynamic>0</dynamic> + <schemes> + <data>data</data> + </schemes> </fonts> </admin> </policies> From 41c3aa20144741faa1a5935c1764416872166474 Mon Sep 17 00:00:00 2001 From: Renon Stewart <srenon@users.noreply.github.com> Date: Tue, 8 Dec 2020 01:16:25 -0500 Subject: [PATCH 22/57] Issues 31197 - Loading wrong order tax info --- app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php index e923b006a0ac6..1f8d0a0bc265d 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php @@ -95,7 +95,7 @@ public function getFullTaxInfo() $taxClassAmount = $this->_taxHelper->getCalculatedTaxes($source); if (empty($taxClassAmount)) { - $rates = $this->_taxOrderFactory->create()->getCollection()->loadByOrder($source)->toArray(); + $rates = $this->_taxOrderFactory->create()->getCollection()->loadByOrder($this->getOrder())->toArray(); $taxClassAmount = $this->_taxCalculation->reproduceProcess($rates['items']); } From 5559a51bccae19c3b032a3fe17e08047a67aacf8 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Wed, 16 Dec 2020 18:20:29 +0200 Subject: [PATCH 23/57] Fix ftp_nlist for empty folders return false --- lib/internal/Magento/Framework/Filesystem/Io/Ftp.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php b/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php index 04df5fd3f3a6c..4bd3e49485681 100644 --- a/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php +++ b/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php @@ -313,9 +313,10 @@ public function chmod($filename, $mode) */ public function ls($grep = null) { - $ls = @ftp_nlist($this->_conn, '.'); + $ls = @ftp_nlist($this->_conn, '.') ?? []; $list = []; + foreach ($ls as $file) { $list[] = ['text' => $file, 'id' => $this->pwd() . '/' . $file]; } From c42d022322d7e6114d6a8cd4b7029adc5e44022a Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Wed, 16 Dec 2020 18:27:40 +0200 Subject: [PATCH 24/57] Update Ftp.php --- lib/internal/Magento/Framework/Filesystem/Io/Ftp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php b/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php index 4bd3e49485681..0027329e7d54c 100644 --- a/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php +++ b/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php @@ -313,7 +313,7 @@ public function chmod($filename, $mode) */ public function ls($grep = null) { - $ls = @ftp_nlist($this->_conn, '.') ?? []; + $ls = @ftp_nlist($this->_conn, '.') ?: []; $list = []; From 5e35bb3739ca1fb526c6caf170d5c1d2e1a181d3 Mon Sep 17 00:00:00 2001 From: Vova Yatsyuk <vova.yatsyuk@gmail.com> Date: Thu, 17 Dec 2020 15:12:09 +0200 Subject: [PATCH 25/57] Fixed failed integration test --- .../Magento/Csp/Model/Collector/ConfigCollectorTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Csp/Model/Collector/ConfigCollectorTest.php b/dev/tests/integration/testsuite/Magento/Csp/Model/Collector/ConfigCollectorTest.php index 2d8cbbeedeab9..cf6287ed5b4e1 100644 --- a/dev/tests/integration/testsuite/Magento/Csp/Model/Collector/ConfigCollectorTest.php +++ b/dev/tests/integration/testsuite/Magento/Csp/Model/Collector/ConfigCollectorTest.php @@ -62,9 +62,9 @@ private function getExpectedPolicies(): array [], true ), - 'font-src' => new FetchPolicy('font-src', false, [], [], true), + 'font-src' => new FetchPolicy('font-src', false, [], ['data'], true), 'frame-src' => new FetchPolicy('frame-src', false, [], [], true, false, false, [], [], true), - 'img-src' => new FetchPolicy('img-src', false, [], [], true), + 'img-src' => new FetchPolicy('img-src', false, [], ['data'], true), 'manifest-src' => new FetchPolicy('manifest-src', false, [], [], true), 'media-src' => new FetchPolicy('media-src', false, [], [], true), 'object-src' => new FetchPolicy('object-src', false, [], [], true), From 3a808ffdac1301bfa61a2add14d41e59b5a3bd0f Mon Sep 17 00:00:00 2001 From: Sergiy Vasiutynskyi <s.vasiutynskyi@atwix.com> Date: Thu, 17 Dec 2020 16:10:03 +0200 Subject: [PATCH 26/57] Removed usage or changed value of CliIndexerReindexActionGroup action group for Catalog module --- .../Test/AddOutOfStockProductToCompareListTest.xml | 4 ++-- .../Mftf/Test/AdminAddInStockProductToTheCartTest.xml | 5 +---- ...CheckCustomAttributeValuesAfterProductSaveTest.xml | 4 +--- .../AdminSimpleProductImagesTest.xml | 4 +--- .../AdminUpdateFlatCategoryNameAndDescriptionTest.xml | 11 +++-------- .../Test/AdminUpdateSimpleProductTieredPriceTest.xml | 5 +---- ...gularPriceInStockVisibleInCatalogAndSearchTest.xml | 5 +---- ...ithRegularPriceInStockVisibleInCatalogOnlyTest.xml | 5 +---- .../Test/Mftf/Test/CheckTierPricingOfProductsTest.xml | 5 +---- .../EndToEndB2CGuestUserTest.xml | 5 +---- ...ProductAvailableAfterEnablingSubCategoriesTest.xml | 2 +- ...toreFrontProductsDisplayUsingElasticSearchTest.xml | 4 +--- .../Test/StoreFrontRecentlyViewedAtStoreLevelTest.xml | 4 +--- .../StoreFrontRecentlyViewedAtStoreViewLevelTest.xml | 4 +--- ...refrontCheckDefaultNumberProductsToDisplayTest.xml | 5 +---- .../StorefrontProductNameWithHTMLEntitiesTest.xml | 4 +--- ...oryProductAndProductCategoryPartialReindexTest.xml | 4 +--- 17 files changed, 20 insertions(+), 60 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml index 92be79fdfe720..212400ac4dd6e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml @@ -52,8 +52,8 @@ <!--Clear cache and reindex--> <comment userInput="Clear cache and reindex" stepKey="cleanCache"/> <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> -</actionGroup> + <argument name="indices" value="catalog_product_price"/> + </actionGroup> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml index 94d3b46aaa5f1..73019bb5ec0e0 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml @@ -58,10 +58,7 @@ <actionGroup ref="AdminSubmitAdvancedInventoryFormActionGroup" stepKey="clickOnDoneButton"/> <actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickOnSaveButton"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/> - <!--Clear cache and reindex--> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckCustomAttributeValuesAfterProductSaveTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckCustomAttributeValuesAfterProductSaveTest.xml index 0bdf19c9b8950..ca0616213c593 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckCustomAttributeValuesAfterProductSaveTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckCustomAttributeValuesAfterProductSaveTest.xml @@ -33,9 +33,7 @@ </createData> <!-- Create simple product --> <createData entity="SimpleProduct2" stepKey="createSimpleProduct"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexCatalogSearch"> - <argument name="indices" value="catalogsearch_fulltext"/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindexCatalogSearch"/> <!-- Login to Admin page --> <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> </before> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest/AdminSimpleProductImagesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest/AdminSimpleProductImagesTest.xml index de116b26d1414..8a33f6132aeb9 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest/AdminSimpleProductImagesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest/AdminSimpleProductImagesTest.xml @@ -141,9 +141,7 @@ <!-- Save the second product --> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct2"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml index 27a834833ed76..2124efed31293 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml @@ -34,10 +34,7 @@ <magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 1"/> <!--Open Index Management Page and Select Index mode "Update by Schedule" --> <magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" /> - <!--Run full reindex and clear caches --> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> @@ -45,9 +42,7 @@ <after> <magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/> <magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="realtime" /> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="indexerReindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="indexerReindex"/> <deleteData stepKey="deleteCategory" createDataKey="createCategory" /> <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewEn"> <argument name="customStore" value="customStoreEN"/> @@ -71,7 +66,7 @@ <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/> <!--Run full reindex and clear caches --> <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> + <argument name="indices" value="catalog_category_flat"/> </actionGroup> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml index 300b312612253..95d5e4d349478 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml @@ -26,10 +26,7 @@ </createData> <createData entity="SimpleSubCategory" stepKey="categoryEntity"/> - <!--TODO: REMOVE AFTER FIX MC-21717 --> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value="full_page"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml index 320edba5feeff..1735dc692ed3b 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml @@ -91,10 +91,7 @@ <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="clickAdminProductSEOSection1"/> <seeInField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="{{simpleProductRegularPrice245InStock.urlKey}}" stepKey="seeUrlKey"/> - <!--Run re-index task --> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <!--Verify customer see updated simple product link on category page --> <amOnPage url="{{StorefrontCategoryPage.url($$categoryEntity.name$$)}}" stepKey="openCategoryPage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml index 77c3e7548a3cf..bd3160248682e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml @@ -91,10 +91,7 @@ <click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="clickAdminProductSEOSection1"/> <seeInField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="{{simpleProductRegularPrice32501InStock.urlKey}}" stepKey="seeUrlKey"/> - <!--Run re-index task --> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <!--Verify customer see updated simple product link on category page --> <amOnPage url="{{StorefrontCategoryPage.url($$categoryEntity.name$$)}}" stepKey="openCategoryPage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml index 5f7e9c4225c00..2095d56ce6c59 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml @@ -332,10 +332,7 @@ <createData entity="CustomerAccountSharingDefault" stepKey="setConfigCustomerAccountDefault"/> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> - <!--Do reindex and flush cache--> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CGuestUserTest/EndToEndB2CGuestUserTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CGuestUserTest/EndToEndB2CGuestUserTest.xml index ff68bba78cae8..aed2976df8f73 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CGuestUserTest/EndToEndB2CGuestUserTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CGuestUserTest/EndToEndB2CGuestUserTest.xml @@ -56,10 +56,7 @@ <deleteData createDataKey="createSimpleProduct2" stepKey="deleteSimpleProduct2"/> </after> - <!--Re-index--> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <!-- Step 1: User browses catalog --> <comment userInput="Start of browsing catalog" stepKey="startOfBrowsingCatalog"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAvailableAfterEnablingSubCategoriesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAvailableAfterEnablingSubCategoriesTest.xml index 7fd752d7df98d..b5980cf977791 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAvailableAfterEnablingSubCategoriesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAvailableAfterEnablingSubCategoriesTest.xml @@ -50,7 +50,7 @@ <!--Run re-index task--> <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> + <argument name="indices" value="cataloginventory_stock"/> </actionGroup> <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToHomepage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml index cde7b14614f8e..3d3867d1efcf1 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml @@ -114,9 +114,7 @@ </createData> <magentoCron groups="index" stepKey="reindexInvalidatedIndices"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="performReindex"> - <argument name="indices" value="catalogsearch_fulltext"/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="performReindex"/> <actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanFullPageCache"> <argument name="tags" value="full_page"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontRecentlyViewedAtStoreLevelTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontRecentlyViewedAtStoreLevelTest.xml index e1b5aca6382e9..64ad348257853 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontRecentlyViewedAtStoreLevelTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontRecentlyViewedAtStoreLevelTest.xml @@ -74,9 +74,7 @@ </actionGroup> <!-- Logout Admin --> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCacheAfterDeletion"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontRecentlyViewedAtStoreViewLevelTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontRecentlyViewedAtStoreViewLevelTest.xml index 0117493906de1..4d04a25c8d12f 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontRecentlyViewedAtStoreViewLevelTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontRecentlyViewedAtStoreViewLevelTest.xml @@ -66,9 +66,7 @@ <!-- Logout Admin --> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCacheAfterDeletion"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCheckDefaultNumberProductsToDisplayTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCheckDefaultNumberProductsToDisplayTest.xml index a73bd5a533ad0..ca561e4af70de 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCheckDefaultNumberProductsToDisplayTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCheckDefaultNumberProductsToDisplayTest.xml @@ -187,10 +187,7 @@ <seeInField selector="{{AdminCatalogStorefrontConfigSection.productsPerPageAllowedValues}}" userInput="12,24,36" stepKey="seeDefaultValueAllowedNumberProductsPerPage"/> <seeInField selector="{{AdminCatalogStorefrontConfigSection.productsPerPageDefaultValue}}" userInput="12" stepKey="seeDefaultValueProductPerPage"/> - <!-- Perform reindex and flush cache --> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache"> <argument name="tags" value=""/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductNameWithDoubleQuoteTest/StorefrontProductNameWithHTMLEntitiesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductNameWithDoubleQuoteTest/StorefrontProductNameWithHTMLEntitiesTest.xml index 2156178ea88d0..9819357704d44 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductNameWithDoubleQuoteTest/StorefrontProductNameWithHTMLEntitiesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductNameWithDoubleQuoteTest/StorefrontProductNameWithHTMLEntitiesTest.xml @@ -33,9 +33,7 @@ </after> <!--Run re-index task--> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <!--Check product in category listing--> <amOnPage url="{{StorefrontCategoryPage.url($$createCategoryOne.name$$)}}" stepKey="navigateToCategoryPage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyCategoryProductAndProductCategoryPartialReindexTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyCategoryProductAndProductCategoryPartialReindexTest.xml index ce04b377300f8..cf1bb065349b6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyCategoryProductAndProductCategoryPartialReindexTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyCategoryProductAndProductCategoryPartialReindexTest.xml @@ -65,9 +65,7 @@ <after> <!-- Change "Category Products" and "Product Categories" indexers to "Update on Save" mode --> <magentoCLI command="indexer:set-mode" arguments="realtime" stepKey="setRealtimeMode"/> - <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value=""/> - </actionGroup> + <comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/> <!-- Delete data --> <deleteData createDataKey="productA" stepKey="deleteProductA"/> From 37e8487aca8692b89c9657215ea0c9618cc5d967 Mon Sep 17 00:00:00 2001 From: Anna Pak <a.pak@atwix.com> Date: Thu, 17 Dec 2020 17:55:16 +0200 Subject: [PATCH 27/57] added AdminClickRefundOfflineOnMemoDetailPageActionGroup --- ...dableProductLinkAfterPartialRefundTest.xml | 4 ++-- ...kRefundOfflineOnNewMemoPageActionGroup.xml | 19 +++++++++++++++++++ ...reateCreditMemoBankTransferPaymentTest.xml | 4 ++-- ...AdminCreateCreditMemoPartialRefundTest.xml | 4 ++-- ...nCreateCreditMemoWithPurchaseOrderTest.xml | 4 ++-- .../Test/Mftf/Test/EndToEndB2CAdminTest.xml | 4 ++-- 6 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminClickRefundOfflineOnNewMemoPageActionGroup.xml diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/StorefrontAccountDownloadableProductLinkAfterPartialRefundTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/StorefrontAccountDownloadableProductLinkAfterPartialRefundTest.xml index b89aa7d126686..41fc2850e00ff 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/StorefrontAccountDownloadableProductLinkAfterPartialRefundTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/StorefrontAccountDownloadableProductLinkAfterPartialRefundTest.xml @@ -98,8 +98,8 @@ <argument name="rowNumber" value="1"/> </actionGroup> - <click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickRefundOffline"/> - <waitForPageLoad stepKey="waitForResultPage"/> + <actionGroup ref="AdminClickRefundOfflineOnNewMemoPageActionGroup" stepKey="clickRefundOffline"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForResultPage"/> <actionGroup ref="StorefrontNotAssertDownloadableProductLinkInCustomerAccountActionGroup" stepKey="dontSeeStorefrontMyAccountDownloadableProductsLink"> <argument name="product" value="$$createDownloadableProduct$$"/> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminClickRefundOfflineOnNewMemoPageActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminClickRefundOfflineOnNewMemoPageActionGroup.xml new file mode 100644 index 0000000000000..21ca2d51a364e --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminClickRefundOfflineOnNewMemoPageActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminClickRefundOfflineOnNewMemoPageActionGroup"> + <annotations> + <description>Click the Refund Offline button on the New Memo page</description> + </annotations> + <click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickRefundOffline"/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccesMessage"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You created the credit memo." stepKey="seeSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml index 6ed8510db777c..9d1daf0d2ded1 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml @@ -85,8 +85,8 @@ </actionGroup> <!-- On order's page click 'Refund offline' button --> - <click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickRefundOffline"/> - <waitForPageLoad stepKey="waitForResultPage"/> + <actionGroup ref="AdminClickRefundOfflineOnNewMemoPageActionGroup" stepKey="clickRefundOffline"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForResultPage"/> <!-- Perform all assertions: assert refund success create message --> <see selector="{{AdminIndexManagementSection.successMessage}}" userInput="You created the credit memo." stepKey="assertRefundSuccessCreateMessage"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml index 68301187d3d31..5d2f76b80e3f8 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml @@ -78,8 +78,8 @@ </actionGroup> <!-- On order's page click 'Refund offline' button --> - <click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickRefundOffline"/> - <waitForPageLoad stepKey="waitForResultPage"/> + <actionGroup ref="AdminClickRefundOfflineOnNewMemoPageActionGroup" stepKey="clickRefundOffline"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForResultPage"/> <!-- Perform all assertions: assert refund success create message --> <waitForElementVisible selector="{{AdminIndexManagementSection.successMessage}}" stepKey="waitForSuccessMessage"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml index 141fa2a9e5d06..32c3a5e0a5846 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml @@ -88,8 +88,8 @@ </actionGroup> <!-- On order's page click 'Refund offline' button --> - <click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickRefundOffline"/> - <waitForPageLoad stepKey="waitForResultPage"/> + <actionGroup ref="AdminClickRefundOfflineOnNewMemoPageActionGroup" stepKey="clickRefundOffline"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForResultPage"/> <!-- Perform all assertions: assert refund success create message --> <see selector="{{AdminIndexManagementSection.successMessage}}" userInput="You created the credit memo." stepKey="assertRefundSuccessCreateMessage"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/EndToEndB2CAdminTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/EndToEndB2CAdminTest.xml index 6ba1c3ac3deec..2a3284e7e8e35 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/EndToEndB2CAdminTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/EndToEndB2CAdminTest.xml @@ -140,8 +140,8 @@ <argument name="billingAddress" value="US_Address_TX"/> </actionGroup> <!--Submit credit memo--> - <click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickRefundOffline" after="verifyOrderCreditMemoInformation"/> - <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the credit memo." stepKey="seeCreditMemoSuccess" after="clickRefundOffline"/> + <actionGroup ref="AdminClickRefundOfflineOnNewMemoPageActionGroup" stepKey="clickRefundOffline" after="verifyOrderCreditMemoInformation"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeCreditMemoSuccess" after="clickRefundOffline"/> <click selector="{{AdminOrderDetailsOrderViewSection.creditMemos}}" stepKey="clickOrderCreditMemosTab" after="seeCreditMemoSuccess"/> <waitForLoadingMaskToDisappear stepKey="waitForCreditMemoTabLoadingMask" after="clickOrderCreditMemosTab"/> <see selector="{{AdminOrderCreditMemosTabSection.gridRow('1')}}" userInput="{{Simple_US_Customer.firstname}}" stepKey="seeOrderCreditMemoInTabGrid" after="waitForCreditMemoTabLoadingMask"/> From 01eb68279d3f49adb66c14c351c5dd9576c39b6f Mon Sep 17 00:00:00 2001 From: Oleg Aleksin <olega@ven.com> Date: Fri, 18 Dec 2020 10:45:17 +0200 Subject: [PATCH 28/57] Fix issue with logging each cookie as separate context --- .../Magento/Framework/Stdlib/Cookie/PhpCookieManager.php | 5 ++++- .../Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Stdlib/Cookie/PhpCookieManager.php b/lib/internal/Magento/Framework/Stdlib/Cookie/PhpCookieManager.php index a5fe6f6c61506..64f04c62bbf64 100644 --- a/lib/internal/Magento/Framework/Stdlib/Cookie/PhpCookieManager.php +++ b/lib/internal/Magento/Framework/Stdlib/Cookie/PhpCookieManager.php @@ -212,7 +212,10 @@ private function checkAbilityToSendCookie($name, $value) if ($numCookies > static::MAX_NUM_COOKIES) { $this->logger->warning( new Phrase('Unable to send the cookie. Maximum number of cookies would be exceeded.'), - array_merge($_COOKIE, ['user-agent' => $this->httpHeader->getHttpUserAgent()]) + [ + 'cookies' => $_COOKIE, + 'user-agent' => $this->httpHeader->getHttpUserAgent() + ] ); } diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php index e41cbdfe51638..87e10981c802c 100644 --- a/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php +++ b/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php @@ -565,7 +565,10 @@ public function testSetTooManyCookies() ->method('warning') ->with( new Phrase('Unable to send the cookie. Maximum number of cookies would be exceeded.'), - array_merge($_COOKIE, ['user-agent' => $userAgent]) + [ + 'cookies' => $_COOKIE, + 'user-agent' => $userAgent + ] ); $this->cookieManager->setPublicCookie( From 2a712558d59eac9d4474c3e62142976b5c53dab1 Mon Sep 17 00:00:00 2001 From: Anna Pak <a.pak@atwix.com> Date: Mon, 21 Dec 2020 12:02:19 +0200 Subject: [PATCH 29/57] refactored AdminSortProductsGridByActionGroup --- ...ngeWebSiteAssignedToProductActionGroup.xml | 21 ++++++++++ .../AdminSortProductsGridByActionGroup.xml | 22 +++++++++++ .../Mftf/Test/AdminSortingByWebsitesTest.xml | 39 +++++++++---------- 3 files changed, 62 insertions(+), 20 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminChangeWebSiteAssignedToProductActionGroup.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSortProductsGridByActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminChangeWebSiteAssignedToProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminChangeWebSiteAssignedToProductActionGroup.xml new file mode 100644 index 0000000000000..76a0af8f63fd5 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminChangeWebSiteAssignedToProductActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminChangeWebSiteAssignedToProductActionGroup" extends="AddWebsiteToProductActionGroup"> + <annotations> + <description>Extends AddWebsiteToProductActionGroup. Changes website assigned to product from websiteToDeselect to website</description> + </annotations> + <arguments> + <argument name="websiteToDeselect" type="string"/> + </arguments> + + <uncheckOption selector="{{ProductInWebsitesSection.website(websiteToDeselect)}}" stepKey="uncheckWebsite" after="checkWebsite"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSortProductsGridByActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSortProductsGridByActionGroup.xml new file mode 100644 index 0000000000000..92c714c2478b0 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSortProductsGridByActionGroup.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSortProductsGridByActionGroup"> + <annotations> + <description>Sorts the Product Grid by field</description> + </annotations> + <arguments> + <argument name="field" type="string"/> + </arguments> + + <click selector="{{AdminProductGridSection.columnHeader(field)}}" stepKey="clickWebsitesHeaderToSort"/> + <waitForLoadingMaskToDisappear stepKey="waitForApplyingChanges"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml index 73aeed3af4fb0..76843b3a40fcb 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml @@ -25,7 +25,7 @@ </createData> <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> - <!--Create new website --> + <actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createAdditionalWebsite"> <argument name="newWebsiteName" value="{{customWebsite.name}}"/> <argument name="websiteCode" value="{{customWebsite.code}}"/> @@ -54,31 +54,30 @@ <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> - <!--Assign Custom Website to Simple Product --> - <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToCatalogProductGrid"/> - - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <actionGroup ref="AdminClearFiltersActionGroup" stepKey="navigateToCatalogProductGrid"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickClearFiltersInitial"/> <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="assignCustomWebsiteToProduct"> <argument name="product" value="$$productAssignedToCustomWebsite$$"/> </actionGroup> - <scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToWebsites"/> - <conditionalClick selector="{{ProductInWebsitesSection.sectionHeader}}" dependentSelector="{{AdminProductContentSection.sectionHeaderShow}}" visible="false" stepKey="expandSection"/> - <waitForPageLoad stepKey="waitForPageOpened"/> - <uncheckOption selector="{{ProductInWebsitesSection.website(_defaultWebsite.name)}}" stepKey="deselectMainWebsite"/> - <checkOption selector="{{ProductInWebsitesSection.website(customWebsite.name)}}" stepKey="selectWebsite"/> - - <actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSave"/> - <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessageAgain"/> + <actionGroup ref="AdminChangeWebSiteAssignedToProductActionGroup" stepKey="scrollToWebsites"> + <argument name="website" value="{{customWebsite.name}}"/> + <argument name="websiteToDeselect" value="{{_defaultWebsite.name}}"/> + </actionGroup> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="expandSection"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageOpened"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="deselectMainWebsite"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectWebsite"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickSave"/> + <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSaveProductMessageAgain"/> - <!--Navigate To Product Grid To Check Website Sorting--> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToCatalogProductGridToSortByWebsite"/> - - <!--Sorting works (By Websites) ASC--> - <click selector="{{AdminProductGridSection.columnHeader('Websites')}}" stepKey="clickWebsitesHeaderToSortAsc"/> + <actionGroup ref="AdminSortProductsGridByActionGroup" stepKey="clickWebsitesHeaderToSortAsc"> + <argument name="field" value="Websites"/> + </actionGroup> <see selector="{{AdminProductGridSection.productGridContentsOnRow('1')}}" userInput="Main Website" stepKey="checkIfProduct1WebsitesAsc"/> - - <!--Sorting works (By Websites) DESC--> - <click selector="{{AdminProductGridSection.columnHeader('Websites')}}" stepKey="clickWebsitesHeaderToSortDesc"/> + <actionGroup ref="AdminSortProductsGridByActionGroup" stepKey="clickWebsitesHeaderToSortDesc"> + <argument name="field" value="Websites"/> + </actionGroup> <see selector="{{AdminProductGridSection.productGridContentsOnRow('1')}}" userInput="{{customWebsite.name}}" stepKey="checkIfProduct1WebsitesDesc"/> </test> </tests> From 4b007c23916f94a1dd4acd3ebcb7d75fa2daf47b Mon Sep 17 00:00:00 2001 From: "vadim.malesh" <engcom-vendorworker-charlie@adobe.com> Date: Tue, 22 Dec 2020 13:28:26 +0200 Subject: [PATCH 30/57] added unit test; refactoring --- .../Block/Adminhtml/Order/Totals/TaxTest.php | 151 ++++++++++++------ 1 file changed, 101 insertions(+), 50 deletions(-) diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Totals/TaxTest.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Totals/TaxTest.php index 80563623e0050..222d26c30178a 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Totals/TaxTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Totals/TaxTest.php @@ -5,9 +5,6 @@ */ declare(strict_types=1); -/** - * Test class for \Magento\Sales\Block\Adminhtml\Order\Totals\TaxTest - */ namespace Magento\Sales\Test\Unit\Block\Adminhtml\Order\Totals; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -16,46 +13,75 @@ use Magento\Sales\Model\Order\Creditmemo; use Magento\Sales\Model\Order\Invoice; use Magento\Tax\Helper\Data; +use Magento\Tax\Model\ResourceModel\Sales\Order\Tax\Collection; +use Magento\Tax\Model\Sales\Order\Tax as TaxModel; +use Magento\Tax\Model\Sales\Order\TaxFactory; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; +/** + * Test for \Magento\Sales\Block\Adminhtml\Order\Totals\Tax + */ class TaxTest extends TestCase { - /** @var MockObject|Tax */ + /** + * @var array + */ + private $calculatedData = [ + 'tax' => 'tax', + 'shipping_tax' => 'shipping_tax', + ]; + + /** + * @var MockObject|Tax + */ private $taxMock; + /** + * @var Data|MockObject + */ + private $taxHelperMock; + + /** + * @var TaxFactory|MockObject + */ + private $taxOrderFactory; + + /** + * @inheridoc + */ protected function setUp(): void { - $getCalculatedTax = [ - 'tax' => 'tax', - 'shipping_tax' => 'shipping_tax', - ]; - $taxHelperMock = $this->getMockBuilder(Data::class) - ->setMethods(['getCalculatedTaxes']) + $this->taxHelperMock = $this->getMockBuilder(Data::class) + ->onlyMethods(['getCalculatedTaxes']) ->disableOriginalConstructor() ->getMock(); - $taxHelperMock->expects($this->any()) - ->method('getCalculatedTaxes') - ->willReturn($getCalculatedTax); + $this->taxOrderFactory = $this->createMock(TaxFactory::class); + + $arguments = $this->getModelArguments( + ['taxHelper' => $this->taxHelperMock, 'taxOrderFactory' => $this->taxOrderFactory] + ); $this->taxMock = $this->getMockBuilder(Tax::class) - ->setConstructorArgs($this->_getConstructArguments($taxHelperMock)) - ->setMethods(['getOrder', 'getSource']) + ->setConstructorArgs($arguments) + ->onlyMethods(['getOrder', 'getSource']) ->getMock(); } /** * Test method for getFullTaxInfo * - * @param Order $source - * @param array $getCalculatedTax - * @param array $getShippingTax + * @param Order|null $source * @param array $expectedResult + * @return void * * @dataProvider getFullTaxInfoDataProvider */ - public function testGetFullTaxInfo($source, $expectedResult) + public function testGetFullTaxInfo(?Order $source, array $expectedResult): void { + $this->taxHelperMock->expects($this->any()) + ->method('getCalculatedTaxes') + ->willReturn($this->calculatedData); $this->taxMock->expects($this->once()) ->method('getOrder') ->willReturn($source); @@ -69,13 +95,15 @@ public function testGetFullTaxInfo($source, $expectedResult) * * @param Invoice|Creditmemo $source * @param array $expectedResult + * @return void * * @dataProvider getCreditAndInvoiceFullTaxInfoDataProvider */ - public function testGetFullTaxInfoWithCreditAndInvoice( - $source, - $expectedResult - ) { + public function testGetFullTaxInfoWithCreditAndInvoice($source, array $expectedResult): void + { + $this->taxHelperMock->expects($this->any()) + ->method('getCalculatedTaxes') + ->willReturn($this->calculatedData); $this->taxMock->expects($this->once()) ->method('getSource') ->willReturn($source); @@ -84,19 +112,54 @@ public function testGetFullTaxInfoWithCreditAndInvoice( $this->assertSame($expectedResult, $actualResult); } + /** + * Test method for getFullTaxInfo when order doesn't have tax + * + * @return void + */ + public function testGetFullTaxInfoOrderWithoutTax(): void + { + $this->taxHelperMock->expects($this->once()) + ->method('getCalculatedTaxes') + ->willReturn(null); + + $orderMock = $this->createMock(Order::class); + $taxCollection = $this->createMock(Collection::class); + $taxCollection->expects($this->once()) + ->method('loadByOrder') + ->with($orderMock) + ->willReturnSelf(); + + $taxOrder = $this->createMock(TaxModel::class); + $taxOrder->expects($this->once()) + ->method('getCollection') + ->willReturn($taxCollection); + $this->taxOrderFactory->expects($this->once()) + ->method('create') + ->willReturn($taxOrder); + + $invoiceMock = $this->createMock(Invoice::class); + $this->taxMock->expects($this->once()) + ->method('getSource') + ->willReturn($invoiceMock); + $this->taxMock->expects($this->once()) + ->method('getOrder') + ->willReturn($orderMock); + + $this->assertNull($this->taxMock->getFullTaxInfo()); + } + /** * Provide the tax helper mock as a constructor argument * - * @param $taxHelperMock + * @param array $arguments * @return array */ - protected function _getConstructArguments($taxHelperMock) + private function getModelArguments(array $arguments): array { $objectManagerHelper = new ObjectManager($this); - return $objectManagerHelper->getConstructArguments( - Tax::class, - ['taxHelper' => $taxHelperMock] - ); + + return $objectManagerHelper->getConstructArguments(Tax::class, $arguments); } /** @@ -106,19 +169,15 @@ protected function _getConstructArguments($taxHelperMock) * * @return array */ - public function getFullTaxInfoDataProvider() + public function getFullTaxInfoDataProvider(): array { - $salesModelOrderMock = $this->getMockBuilder(Order::class) - ->disableOriginalConstructor() - ->getMock(); + $salesModelOrderMock = $this->createMock(Order::class); + return [ 'source is not an instance of \Magento\Sales\Model\Order' => [null, []], 'source is an instance of \Magento\Sales\Model\Order and has reasonable data' => [ $salesModelOrderMock, - [ - 'tax' => 'tax', - 'shipping_tax' => 'shipping_tax', - ], + $this->calculatedData, ] ]; } @@ -130,22 +189,14 @@ public function getFullTaxInfoDataProvider() * * @return array */ - public function getCreditAndInvoiceFullTaxInfoDataProvider() + public function getCreditAndInvoiceFullTaxInfoDataProvider(): array { - $invoiceMock = $this->getMockBuilder(Invoice::class) - ->disableOriginalConstructor() - ->getMock(); - $creditMemoMock = $this->getMockBuilder(Creditmemo::class) - ->disableOriginalConstructor() - ->getMock(); + $invoiceMock = $this->createMock(Invoice::class); + $creditMemoMock = $this->createMock(Creditmemo::class); - $expected = [ - 'tax' => 'tax', - 'shipping_tax' => 'shipping_tax', - ]; return [ - 'invoice' => [$invoiceMock, $expected], - 'creditMemo' => [$creditMemoMock, $expected] + 'invoice' => [$invoiceMock, $this->calculatedData], + 'creditMemo' => [$creditMemoMock, $this->calculatedData] ]; } } From 292c560070037f280d9953af7966af7d1acaf890 Mon Sep 17 00:00:00 2001 From: Vasya Tsviklinskyi <tsviklinskyi@gmail.com> Date: Tue, 22 Dec 2020 13:54:39 +0200 Subject: [PATCH 31/57] =?UTF-8?q?MC-39809:=20A=20Product=20with=20Customiz?= =?UTF-8?q?able=20Option=20(File)=20can=20not=20be=20added=20by=20Admin=20?= =?UTF-8?q?from=20the=20=E2=80=9CShopping=20Cart=20section=20(=E2=80=9CCus?= =?UTF-8?q?tomer's=20Activities=E2=80=9D=20column)=20to=20Order?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Magento/Bundle/Test/Unit/Model/Product/TypeTest.php | 8 +++++++- .../Magento/Catalog/Model/Product/Type/AbstractType.php | 7 +++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php index b7041051591d8..9c4d4ce00b7c0 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php @@ -11,7 +11,6 @@ use Magento\Bundle\Model\Product\Type; use Magento\Bundle\Model\ResourceModel\BundleFactory; use Magento\Bundle\Model\ResourceModel\Option\Collection; -use Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor; use Magento\Bundle\Model\ResourceModel\Selection\Collection as SelectionCollection; use Magento\Bundle\Model\ResourceModel\Selection\CollectionFactory; use Magento\Bundle\Model\Selection; @@ -28,6 +27,7 @@ use Magento\CatalogInventory\Api\StockStateInterface; use Magento\CatalogInventory\Model\StockRegistry; use Magento\CatalogInventory\Model\StockState; +use Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor; use Magento\Framework\DataObject; use Magento\Framework\EntityManager\EntityMetadataInterface; use Magento\Framework\EntityManager\MetadataPool; @@ -1548,6 +1548,10 @@ public function testPrepareForCartAdvancedSpecifyProductOptions() ->disableOriginalConstructor() ->getMock(); + $buyRequest->method('getOptions') + ->willReturn([333 => ['type' => 'image/jpeg']]); + $option->method('getId') + ->willReturn(333); $this->parentClass($group, $option, $buyRequest, $product); $product->expects($this->any()) @@ -1556,6 +1560,8 @@ public function testPrepareForCartAdvancedSpecifyProductOptions() $buyRequest->expects($this->once()) ->method('getBundleOption') ->willReturn([0, '', 'str']); + $group->expects($this->once()) + ->method('validateUserValue'); $result = $this->model->prepareForCartAdvanced($buyRequest, $product); $this->assertEquals('Please specify product option(s).', $result); diff --git a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php index f90b097415661..19f6461d44b6a 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php +++ b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php @@ -3,7 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -declare(strict_types=1); namespace Magento\Catalog\Model\Product\Type; @@ -605,7 +604,11 @@ protected function _prepareOptions(\Magento\Framework\DataObject $buyRequest, $p if ($product->getSkipCheckRequiredOption() !== true) { $group->validateUserValue($optionsFromRequest); } elseif ($optionsFromRequest !== null && isset($optionsFromRequest[$option->getId()])) { - $transport->options[$option->getId()] = $optionsFromRequest[$option->getId()]; + if (is_array($optionsFromRequest[$option->getId()])) { + $group->validateUserValue($optionsFromRequest); + } else { + $transport->options[$option->getId()] = $optionsFromRequest[$option->getId()]; + } } } catch (LocalizedException $e) { From 84b1ea0f3ff98c8e57049644fd1f456804738d0f Mon Sep 17 00:00:00 2001 From: "vadim.malesh" <engcom-vendorworker-charlie@adobe.com> Date: Tue, 22 Dec 2020 14:43:23 +0200 Subject: [PATCH 32/57] fixed unit --- .../Sales/Test/Unit/Block/Adminhtml/Order/Totals/TaxTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Totals/TaxTest.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Totals/TaxTest.php index 222d26c30178a..b0c053a36de0f 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Totals/TaxTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Totals/TaxTest.php @@ -129,6 +129,9 @@ public function testGetFullTaxInfoOrderWithoutTax(): void ->method('loadByOrder') ->with($orderMock) ->willReturnSelf(); + $taxCollection->expects($this->once()) + ->method('toArray') + ->willReturn(['items' => []]); $taxOrder = $this->createMock(TaxModel::class); $taxOrder->expects($this->once()) From e07d328c1f88e885ac6239d4689afcee09859394 Mon Sep 17 00:00:00 2001 From: tuna <ladiesman9x@gmail.com> Date: Fri, 18 Dec 2020 12:56:09 +0700 Subject: [PATCH 33/57] Update varnish 6 vcl config update --- app/code/Magento/PageCache/etc/varnish6.vcl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/PageCache/etc/varnish6.vcl b/app/code/Magento/PageCache/etc/varnish6.vcl index bce89fe263573..cc381baaf313a 100644 --- a/app/code/Magento/PageCache/etc/varnish6.vcl +++ b/app/code/Magento/PageCache/etc/varnish6.vcl @@ -62,13 +62,13 @@ sub vcl_recv { return (pass); } - # Bypass shopping cart and checkout - if (req.url ~ "/checkout") { + # Bypass customer, shopping cart, checkout + if (req.url ~ "/customer" || req.url ~ "/checkout") { return (pass); } # Bypass health check requests - if (req.url ~ "/pub/health_check.php") { + if (req.url ~ "^/(pub/)?(health_check.php)$") { return (pass); } From 1f04b0ad5871ddd04230636daa0f9d6d08a8b90c Mon Sep 17 00:00:00 2001 From: Anna Pak <a.pak@atwix.com> Date: Wed, 23 Dec 2020 18:27:38 +0200 Subject: [PATCH 34/57] Updated with StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup --- .../Test/DeleteBundleDynamicProductFromShoppingCartTest.xml | 2 +- .../Mftf/Test/DeleteBundleFixedProductFromShoppingCartTest.xml | 2 +- .../Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml | 2 +- .../Mftf/Test/StorefrontCheckoutDisabledBundleProductTest.xml | 2 +- ...orefrontInstantPurchaseFunctionalityNegativeScenarioTest.xml | 2 +- .../Mftf/Test/StorefrontInstantPurchaseFunctionalityTest.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/DeleteBundleDynamicProductFromShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/DeleteBundleDynamicProductFromShoppingCartTest.xml index 96a236336993f..a30f118bd6207 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/DeleteBundleDynamicProductFromShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/DeleteBundleDynamicProductFromShoppingCartTest.xml @@ -56,7 +56,7 @@ <waitForPageLoad stepKey="waitForPageLoad"/> <!-- Add product to the cart --> - <click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/> + <actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="clickCustomizeAndAddToCart"/> <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCart"> <argument name="productName" value="$$createBundleDynamicProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/DeleteBundleFixedProductFromShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/DeleteBundleFixedProductFromShoppingCartTest.xml index b64b59ef6109c..d1f452896c84f 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/DeleteBundleFixedProductFromShoppingCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/DeleteBundleFixedProductFromShoppingCartTest.xml @@ -48,7 +48,7 @@ <waitForPageLoad stepKey="waitForPageLoad"/> <!-- Add product to the cart --> - <click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/> + <actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="clickCustomizeAndAddToCart"/> <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCart"> <argument name="productName" value="$$createFixedBundleProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml index 38e2203b45258..73a2e4757e954 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml @@ -159,7 +159,7 @@ <!-- Add Bundle Product to cart --> <amOnPage url="{{StorefrontProductPage.url($$createFixedBundleProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToBundleProductPage"/> <waitForPageLoad stepKey="waitForFixedBundleProductPageLoad"/> - <click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/> + <actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="clickCustomizeAndAddToCart"/> <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFixedBundleProductFromStorefrontProductPage"> <argument name="productName" value="$$createFixedBundleProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutDisabledBundleProductTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutDisabledBundleProductTest.xml index f16f577a4088c..3aa93d72571f9 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutDisabledBundleProductTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutDisabledBundleProductTest.xml @@ -59,7 +59,7 @@ <amOnPage url="{{StorefrontProductPage.url($$createBundleDynamicProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToProductPage"/> <waitForPageLoad stepKey="waitForPageLoad"/> <!-- Add bundle product to the cart --> - <click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/> + <actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="clickCustomizeAndAddToCart"/> <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCart"> <argument name="productName" value="$$createBundleDynamicProduct.name$$"/> </actionGroup> diff --git a/app/code/Magento/InstantPurchase/Test/Mftf/Test/StorefrontInstantPurchaseFunctionalityNegativeScenarioTest.xml b/app/code/Magento/InstantPurchase/Test/Mftf/Test/StorefrontInstantPurchaseFunctionalityNegativeScenarioTest.xml index ecbff39807f30..c81c6d36786eb 100644 --- a/app/code/Magento/InstantPurchase/Test/Mftf/Test/StorefrontInstantPurchaseFunctionalityNegativeScenarioTest.xml +++ b/app/code/Magento/InstantPurchase/Test/Mftf/Test/StorefrontInstantPurchaseFunctionalityNegativeScenarioTest.xml @@ -129,7 +129,7 @@ <argument name="product" value="$createBundleProduct$"/> </actionGroup> <waitForElementVisible selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="waitForCustomizeAndAddToCartButton"/> - <click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/> + <actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="clickCustomizeAndAddToCart"/> <waitForPageLoad stepKey="waitForBundleProductPageLoad"/> <dontSeeElement selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="dontSeeButtonOnBundleProductPage"/> <!-- Grouped product --> diff --git a/app/code/Magento/InstantPurchase/Test/Mftf/Test/StorefrontInstantPurchaseFunctionalityTest.xml b/app/code/Magento/InstantPurchase/Test/Mftf/Test/StorefrontInstantPurchaseFunctionalityTest.xml index 59697bb6f5bdf..865852c10acfd 100644 --- a/app/code/Magento/InstantPurchase/Test/Mftf/Test/StorefrontInstantPurchaseFunctionalityTest.xml +++ b/app/code/Magento/InstantPurchase/Test/Mftf/Test/StorefrontInstantPurchaseFunctionalityTest.xml @@ -109,7 +109,7 @@ <!-- Bundle Product --> <amOnPage url="{{StorefrontProductPage.url($createBundleProduct.custom_attributes[url_key]$)}}" stepKey="openBundleProductPage"/> <waitForElementVisible selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="waitForCustomizeAndAddToCartButton"/> - <click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/> + <actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="clickCustomizeAndAddToCart"/> <waitForElementVisible selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="waitForButtonOnBundleProductPage"/> <!-- Grouped product --> <amOnPage url="{{StorefrontProductPage.url($createGroupedProduct.custom_attributes[url_key]$)}}" stepKey="openGroupedProductPage"/> From 64d2fb97a832593ff0efdd6e32c0770d73b68140 Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Wed, 23 Dec 2020 21:26:43 +0200 Subject: [PATCH 35/57] MC-39600: Create automated test for: "Change category/product url rewrite suffix in configurations" --- .../Catalog/Url/Rewrite/SuffixTest.php | 287 ++++++++++++++++++ 1 file changed, 287 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php new file mode 100644 index 0000000000000..6553dffb04df6 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php @@ -0,0 +1,287 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Model\System\Config\Backend\Catalog\Url\Rewrite; + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator; +use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; +use Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator; +use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; +use Magento\Framework\App\Cache\Type\Block; +use Magento\Framework\App\Cache\Type\Collection; +use Magento\Framework\App\Cache\TypeListInterface; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\ObjectManagerInterface; +use Magento\Store\Model\ScopeInterface; +use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\UrlRewrite\Model\Storage\DbStorage; +use PHPUnit\Framework\TestCase; + +/** + * Class checks url suffix config save behaviour + * + * @see \Magento\Catalog\Model\System\Config\Backend\Catalog\Url\Rewrite\Suffix + * + * @magentoAppArea adminhtml + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + */ +class SuffixTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var Suffix */ + private $model; + + /** @var DbStorage */ + private $urlFinder; + + /** @var StoreManagerInterface */ + private $storeManager; + + /** @var TypeListInterface */ + private $typeList; + + /** @var ScopeConfigInterface */ + private $scopeConfig; + + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** @var int */ + private $defaultStoreId; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->model = $this->objectManager->get(Suffix::class); + $this->urlFinder = $this->objectManager->get(DbStorage::class); + $this->storeManager = $this->objectManager->get(StoreManagerInterface::class); + $this->typeList = $this->objectManager->get(TypeListInterface::class); + $this->scopeConfig = $this->objectManager->get(ScopeConfigInterface::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->defaultStoreId = (int)$this->storeManager->getStore('default')->getId(); + } + + /** + * @return void + */ + public function testSaveWithError(): void + { + $this->expectException(LocalizedException::class); + $this->expectErrorMessage((string)__('Anchor symbol (#) is not supported in url rewrite suffix.')); + $this->model->setValue('.html#'); + $this->model->beforeSave(); + } + + /** + * @dataProvider wrongValuesProvider + * + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @param array $data + * @return void + */ + public function testSaveWithWrongData(array $data): void + { + $productId = (int)$this->productRepository->get('simple2')->getId(); + $this->model->addData($data); + $this->model->afterSave(); + $this->assertRewrite( + $this->scopeConfig->getValue(ProductUrlPathGenerator::XML_PATH_PRODUCT_URL_SUFFIX), + [ + 'entity_type' => ProductUrlRewriteGenerator::ENTITY_TYPE, + 'entity_id' => $productId, + 'store_id' => $this->defaultStoreId, + ] + ); + } + + /** + * @return array + */ + public function wrongValuesProvider(): array + { + return [ + 'with_wrong_path' => [ + ['path' => 'wrong_path', 'value' => 'some_test_value'], + ], + 'with_null_value' => [ + ['path' => ProductUrlPathGenerator::XML_PATH_PRODUCT_URL_SUFFIX, 'value' => null], + ], + ]; + } + + /** + * @magentoDbIsolation disabled + * + * @magentoDataFixture Magento/Catalog/_files/product_multistore_different_short_description.php + * + * @return void + */ + public function testSaveInStoreScope(): void + { + $productId = $this->productRepository->get('simple-different-short-description')->getId(); + $newSuffix = 'some_test_value_for_store'; + $storeId = $this->storeManager->getStore('fixturestore')->getId(); + $this->model->addData([ + 'path' => ProductUrlPathGenerator::XML_PATH_PRODUCT_URL_SUFFIX, + 'value' => $newSuffix, + 'scope' => ScopeInterface::SCOPE_STORES, + 'scope_id' => $storeId, + ]); + $this->model->afterSave(); + $this->assertRewrite( + $this->scopeConfig->getValue(ProductUrlPathGenerator::XML_PATH_PRODUCT_URL_SUFFIX), + [ + 'entity_type' => ProductUrlRewriteGenerator::ENTITY_TYPE, + 'entity_id' => $productId, + 'store_id' => $this->defaultStoreId, + ] + ); + $this->assertRewrite( + $newSuffix, + [ + 'entity_type' => ProductUrlRewriteGenerator::ENTITY_TYPE, + 'entity_id' => $productId, + 'store_id' => $storeId, + ] + ); + } + + /** + * @magentoDbIsolation disabled + * + * @magentoDataFixture Magento/Catalog/_files/product_two_websites.php + * + * @return void + */ + public function testSaveInWebsiteScope(): void + { + $productId = (int)$this->productRepository->get('simple-on-two-websites')->getId(); + $newSuffix = 'some_test_value_for_website'; + $website = $this->storeManager->getWebsite('test'); + $this->model->addData([ + 'path' => ProductUrlPathGenerator::XML_PATH_PRODUCT_URL_SUFFIX, + 'value' => $newSuffix, + 'scope' => ScopeInterface::SCOPE_WEBSITES, + 'scope_id' => $website->getId(), + ]); + $this->model->afterSave(); + $this->assertRewrite( + $this->scopeConfig->getValue(ProductUrlPathGenerator::XML_PATH_PRODUCT_URL_SUFFIX), + [ + 'entity_type' => ProductUrlRewriteGenerator::ENTITY_TYPE, + 'entity_id' => $productId, + 'store_id' => $this->defaultStoreId, + ] + ); + $this->assertRewrite( + $newSuffix, + [ + 'entity_type' => ProductUrlRewriteGenerator::ENTITY_TYPE, + 'entity_id' => $productId, + 'store_id' => $website->getStoreIds(), + ] + ); + } + + /** + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @magentoConfigFixture default_store catalog/seo/product_url_suffix .html_default + * + * @return void + */ + public function testSaveDefaultScopeWithOverrideStoreScope(): void + { + $productId = (int)$this->productRepository->get('simple2')->getId(); + $newSuffix = 'some_test_value'; + $this->model->addData([ + 'path' => ProductUrlPathGenerator::XML_PATH_PRODUCT_URL_SUFFIX, + 'value' => $newSuffix, + ]); + $this->model->afterSave(); + $this->assertRewrite( + '.html_default', + [ + 'entity_type' => ProductUrlRewriteGenerator::ENTITY_TYPE, + 'entity_id' => $productId, + 'store_id' => $this->defaultStoreId, + ] + ); + } + + /** + * @magentoDataFixture Magento/Catalog/_files/category.php + * + * @return void + */ + public function testSaveCategorySuffix(): void + { + $this->model->addData(['path' => CategoryUrlPathGenerator::XML_PATH_CATEGORY_URL_SUFFIX, 'value' => null]); + $this->model->afterSave(); + $this->assertRewrite('.html', ['entity_type' => CategoryUrlRewriteGenerator::ENTITY_TYPE]); + $this->checkIsCacheInvalidated(); + } + + /** + * @return void + */ + public function testDeleteCategorySuffix(): void + { + $this->model->addData( + ['path' => CategoryUrlPathGenerator::XML_PATH_CATEGORY_URL_SUFFIX, 'value' => 'test_value'] + ); + $this->model->afterDeleteCommit(); + $this->checkIsCacheInvalidated(); + } + + /** + * Check that provided cache types are invalidated + * + * @param array $cacheTypes + * @return void + */ + private function checkIsCacheInvalidated( + array $cacheTypes = [Block::TYPE_IDENTIFIER, Collection::TYPE_IDENTIFIER] + ): void { + $types = $this->typeList->getTypes(); + + foreach ($cacheTypes as $type) { + $this->assertNotNull($types[$type]); + $this->assertEquals(0, $types[$type]->getStatus()); + } + } + + /** + * Assert url rewrite rewrite + * + * @param string $expectedSuffix + * @param array $data + * @return void + */ + private function assertRewrite(string $expectedSuffix, array $data) + { + $rewrite = $this->urlFinder->findOneByData($data); + $this->assertNotNull($rewrite); + $this->assertTrue( + substr($rewrite->getRequestPath(), -strlen($expectedSuffix)) === $expectedSuffix, + 'The url rewrite suffix does not match expected value' + ); + } +} From ae96ab2081185de784b282408afa7d84a28c9635 Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Thu, 24 Dec 2020 13:10:32 +0200 Subject: [PATCH 36/57] MC-40078: Create automated test for: "Create attribute without attribute code" --- .../Product/Attribute/RepositoryTest.php | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/RepositoryTest.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/RepositoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/RepositoryTest.php new file mode 100644 index 0000000000000..94a5b52b03c5f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/RepositoryTest.php @@ -0,0 +1,145 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Model\Product\Attribute; + +use Magento\Catalog\Api\Data\ProductAttributeInterface; +use Magento\Catalog\Api\Data\ProductAttributeInterfaceFactory; +use Magento\Catalog\Setup\CategorySetup; +use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; +use Magento\Framework\Exception\InputException; +use Magento\Framework\ObjectManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Checks product attribute save behaviour. + * + * @see \Magento\Catalog\Model\Product\Attribute\Repository + * + * @magentoDbIsolation enabled + */ +class RepositoryTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var Repository */ + private $repository; + + /** @var ProductAttributeInterfaceFactory */ + private $attributeFactory; + + /** @var ProductAttributeInterface */ + private $createdAttribute; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->repository = $this->objectManager->get(Repository::class); + $this->attributeFactory = $this->objectManager->get(ProductAttributeInterfaceFactory::class); + } + + /** + * @inheritdoc + */ + protected function tearDown(): void + { + if ($this->createdAttribute instanceof ProductAttributeInterface) { + $this->repository->delete($this->createdAttribute); + } + + parent::tearDown(); + } + + /** + * @return void + */ + public function testSaveWithoutAttributeCode(): void + { + $this->createdAttribute = $this->saveAttributeWithData( + $this->hydrateData(['frontend_label' => 'Boolean Attribute']) + ); + $this->assertEquals('boolean_attribute', $this->createdAttribute->getAttributeCode()); + } + + /** + * @return void + */ + public function testSaveWithoutAttributeAndInvalidLabelCode(): void + { + $this->createdAttribute = $this->saveAttributeWithData($this->hydrateData(['frontend_label' => '/$&!/'])); + $this->assertStringStartsWith('attr_', $this->createdAttribute->getAttributeCode()); + } + + /** + * @dataProvider errorProvider + * + * @param string $fieldName + * @param string $fieldValue + * @return void + */ + public function testSaveWithInvalidCode(string $fieldName, string $fieldValue): void + { + $this->expectExceptionObject(InputException::invalidFieldValue($fieldName, $fieldValue)); + $this->createdAttribute = $this->saveAttributeWithData($this->hydrateData([$fieldName => $fieldValue])); + } + + /** + * @return array + */ + public function errorProvider():array + { + return [ + 'with_invalid_attribute_code' => [ + 'field_name' => 'attribute_code', + 'field_value' => '****', + ], + 'with_invalid_frontend_input' => [ + 'field_name' => 'frontend_input', + 'field_value' => 'invalid_input', + ], + ]; + } + + /** + * Save product attribute with data + * + * @param array $data + * @return ProductAttributeInterface + */ + private function saveAttributeWithData(array $data): ProductAttributeInterface + { + $attribute = $this->attributeFactory->create(); + $attribute->addData($data); + + return $this->repository->save($attribute); + } + + /** + * Hydrate data + * + * @param array $data + * @return array + */ + private function hydrateData(array $data): array + { + $defaultData = [ + 'entity_type_id' => CategorySetup::CATALOG_PRODUCT_ENTITY_TYPE_ID, + 'is_global' => ScopedAttributeInterface::SCOPE_GLOBAL, + 'frontend_input' => 'boolean', + 'frontend_label' => 'default label', + ]; + + return array_merge($defaultData, $data); + } +} From 06ca9b27abc155a844511d1a02fba8af13ac6dc2 Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Thu, 24 Dec 2020 13:14:29 +0200 Subject: [PATCH 37/57] MC-39600: Create automated test for: "Change category/product url rewrite suffix in configurations" --- .../System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php index 6553dffb04df6..9979e8cd6ea68 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php @@ -275,7 +275,7 @@ private function checkIsCacheInvalidated( * @param array $data * @return void */ - private function assertRewrite(string $expectedSuffix, array $data) + private function assertRewrite(string $expectedSuffix, array $data): void { $rewrite = $this->urlFinder->findOneByData($data); $this->assertNotNull($rewrite); From fe4b27b89a4e4527a34d4fceb7d690ca1b51c3e6 Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Thu, 24 Dec 2020 17:04:17 +0200 Subject: [PATCH 38/57] MC-40078: Create automated test for: "Create attribute without attribute code" --- .../Catalog/Model/Product/Attribute/RepositoryTest.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/RepositoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/RepositoryTest.php index 94a5b52b03c5f..7430ebf72f8fb 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/RepositoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/RepositoryTest.php @@ -9,6 +9,7 @@ use Magento\Catalog\Api\Data\ProductAttributeInterface; use Magento\Catalog\Api\Data\ProductAttributeInterfaceFactory; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; use Magento\Catalog\Setup\CategorySetup; use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; use Magento\Framework\Exception\InputException; @@ -28,7 +29,7 @@ class RepositoryTest extends TestCase /** @var ObjectManagerInterface */ private $objectManager; - /** @var Repository */ + /** @var ProductAttributeRepositoryInterface */ private $repository; /** @var ProductAttributeInterfaceFactory */ @@ -45,7 +46,7 @@ protected function setUp(): void parent::setUp(); $this->objectManager = Bootstrap::getObjectManager(); - $this->repository = $this->objectManager->get(Repository::class); + $this->repository = $this->objectManager->get(ProductAttributeRepositoryInterface::class); $this->attributeFactory = $this->objectManager->get(ProductAttributeInterfaceFactory::class); } @@ -97,7 +98,7 @@ public function testSaveWithInvalidCode(string $fieldName, string $fieldValue): /** * @return array */ - public function errorProvider():array + public function errorProvider(): array { return [ 'with_invalid_attribute_code' => [ From 2c80277103eab5b9c497d6c6ef32e6103ef70b32 Mon Sep 17 00:00:00 2001 From: Roman Zhupanyn <roma.dj.elf@gmail.com> Date: Thu, 24 Dec 2020 18:19:13 +0200 Subject: [PATCH 39/57] MC-39711: Create automated test for: "Filter products in admin grid" --- .../AddQuantityFilterToCollectionTest.php | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/CatalogInventory/Ui/DataProvider/Product/AddQuantityFilterToCollectionTest.php diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Ui/DataProvider/Product/AddQuantityFilterToCollectionTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Ui/DataProvider/Product/AddQuantityFilterToCollectionTest.php new file mode 100644 index 0000000000000..f0d87f06514f1 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Ui/DataProvider/Product/AddQuantityFilterToCollectionTest.php @@ -0,0 +1,133 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CatalogInventory\Ui\DataProvider\Product; + +use Magento\Framework\App\RequestInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\View\Element\UiComponent\ContextInterface; +use Magento\Framework\View\Element\UiComponentFactory; +use Magento\Framework\View\Element\UiComponentInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Checks that the product quantity filter is working correctly + * + * @magentoAppArea adminhtml + */ +class AddQuantityFilterToCollectionTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var UiComponentFactory */ + private $componentFactory; + + /** @var RequestInterface */ + private $request; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->request = $this->objectManager->get(RequestInterface::class); + $this->componentFactory = $this->objectManager->get(UiComponentFactory::class); + } + + /** + * @dataProvider quantityFilterProvider + * @magentoDataFixture Magento/Catalog/_files/multiple_products.php + * @param array $filter + * @param array $expectedProducts + * @return void + */ + public function testQuantityFilter(array $filter, array $expectedProducts): void + { + $this->request->setParams([ContextInterface::FILTER_VAR => $filter]); + $dataProviderData = $this->getComponentProvidedData('product_listing'); + $actualProducts = array_column($dataProviderData['items'], 'sku'); + $this->assertEquals($expectedProducts, $actualProducts, 'Expected products do not match actual products!'); + } + + /** + * Data provider for testQuantityFilter + * + * @return array + */ + public function quantityFilterProvider(): array + { + return [ + 'from' => [ + 'filter' => [ + 'qty' => [ + 'from' => 100, + ], + ], + 'expected_products' => [ + 'simple1', + 'simple3', + ], + ], + 'to' => [ + 'filter' => [ + 'qty' => [ + 'to' => 100, + ], + ], + 'expected_products' => [ + 'simple1', + 'simple2', + ], + ], + 'both' => [ + 'filter' => [ + 'qty' => [ + 'from' => 60, + 'to' => 130, + ], + ], + 'expected_products' => [ + 'simple1', + ], + ], + ]; + } + + /** + * Call prepare method in the child components + * + * @param UiComponentInterface $component + * @return void + */ + private function prepareChildComponents(UiComponentInterface $component): void + { + foreach ($component->getChildComponents() as $child) { + $this->prepareChildComponents($child); + } + + $component->prepare(); + } + + /** + * Get component provided data + * + * @param string $namespace + * @return array + */ + private function getComponentProvidedData(string $namespace): array + { + $component = $this->componentFactory->create($namespace); + $this->prepareChildComponents($component); + + return $component->getContext()->getDataProvider()->getData(); + } +} From 57e23c6fdcc2c4232f72fe2d5361c82b47a7a7d4 Mon Sep 17 00:00:00 2001 From: Sergiy Vasiutynskyi <s.vasiutynskyi@atwix.com> Date: Fri, 25 Dec 2020 13:32:35 +0200 Subject: [PATCH 40/57] Updated value of CliIndexerReindexActionGroup action for failed test --- .../Test/ProductAvailableAfterEnablingSubCategoriesTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAvailableAfterEnablingSubCategoriesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAvailableAfterEnablingSubCategoriesTest.xml index b5980cf977791..f7e35f1503a12 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAvailableAfterEnablingSubCategoriesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAvailableAfterEnablingSubCategoriesTest.xml @@ -50,7 +50,7 @@ <!--Run re-index task--> <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value="cataloginventory_stock"/> + <argument name="indices" value="cataloginventory_stock catalog_product_price"/> </actionGroup> <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToHomepage"/> From 9ca51cd1f92bc058a112f02fe85f6f4838261ba2 Mon Sep 17 00:00:00 2001 From: Sergiy Vasiutynskyi <s.vasiutynskyi@atwix.com> Date: Fri, 25 Dec 2020 17:03:44 +0200 Subject: [PATCH 41/57] Updated value of CliIndexerReindexActionGroup action for failed test --- .../Test/ProductAvailableAfterEnablingSubCategoriesTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAvailableAfterEnablingSubCategoriesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAvailableAfterEnablingSubCategoriesTest.xml index f7e35f1503a12..654dc727b24ca 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAvailableAfterEnablingSubCategoriesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAvailableAfterEnablingSubCategoriesTest.xml @@ -50,7 +50,7 @@ <!--Run re-index task--> <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> - <argument name="indices" value="cataloginventory_stock catalog_product_price"/> + <argument name="indices" value="catalog_product_price"/> </actionGroup> <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToHomepage"/> From f543cedd3c02ee717e23c22b833e2717566217a6 Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Mon, 28 Dec 2020 10:55:29 +0200 Subject: [PATCH 42/57] MC-39575: Create automated test for "Apply visual swatch attribute filter on layered navigation" --- .../Configurable/Listing/ConfigurableTest.php | 115 ++++++++++++++++++ .../configurable_product_with_images.php | 41 +++++++ ...figurable_product_with_images_rollback.php | 15 +++ 3 files changed, 171 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/Listing/ConfigurableTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_images.php create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_images_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/Listing/ConfigurableTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/Listing/ConfigurableTest.php new file mode 100644 index 0000000000000..f2d254af85c94 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/Listing/ConfigurableTest.php @@ -0,0 +1,115 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Swatches\Block\Product\Renderer\Configurable\Listing; + +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\Module\Manager; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\View\LayoutInterface; +use Magento\Swatches\Block\Product\Renderer\Listing\Configurable; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Tests for configurable products options block with swatch attribute. + * + * @magentoDbIsolation enabled + * @magentoAppArea frontend + */ +class ConfigurableTest extends TestCase +{ + /** + * @var ObjectManagerInterface + */ + private $objectManager; + + /** + * @var SerializerInterface + */ + private $serializer; + + /** + * @var Configurable + */ + private $block; + + /** + * @var ProductRepositoryInterface + */ + private $productRepository; + + /** + * @var ProductAttributeRepositoryInterface + */ + private $productAttributeRepository; + + /** + * @var RequestInterface + */ + private $request; + + /** + * @inheritdoc + */ + public static function setUpBeforeClass(): void + { + $objectManager = Bootstrap::getObjectManager(); + /** @var Manager $moduleManager */ + $moduleManager = $objectManager->get(Manager::class); + if (!$moduleManager->isEnabled('Magento_Catalog')) { + self::markTestSkipped('Magento_Catalog module disabled.'); + } + } + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->serializer = $this->objectManager->get(SerializerInterface::class); + $this->productAttributeRepository = $this->objectManager->get(ProductAttributeRepositoryInterface::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->block = $this->objectManager->get(LayoutInterface::class)->createBlock(Configurable::class); + $this->request = $this->objectManager->get(RequestInterface::class); + $this->request->clearParams(); + } + + /** + * @inheritdoc + */ + protected function tearDown(): void + { + $this->request->clearParams(); + + parent::tearDown(); + } + + /** + * @magentoDataFixture Magento/Swatches/_files/configurable_product_with_images.php + * @return void + */ + public function testPreSelectedGalleryConfig(): void + { + $product = $this->productRepository->get('configurable'); + $this->block->setProduct($product); + $configurableAttribute = $this->productAttributeRepository->get('visual_swatch_attribute'); + $this->request->setQueryValue('visual_swatch_attribute', $configurableAttribute->getOptions()[1]->getValue()); + $jsonConfig = $this->serializer->unserialize($this->block->getJsonConfig()); + $this->assertArrayHasKey('preSelectedGallery', $jsonConfig); + $this->assertStringEndsWith('/m/a/magento_image.jpg', $jsonConfig['preSelectedGallery']['large']); + $this->assertStringEndsWith('/m/a/magento_image.jpg', $jsonConfig['preSelectedGallery']['medium']); + $this->assertStringEndsWith('/m/a/magento_image.jpg', $jsonConfig['preSelectedGallery']['small']); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_images.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_images.php new file mode 100644 index 0000000000000..096674c5e9620 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_images.php @@ -0,0 +1,41 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductExtensionInterfaceFactory; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\ProductFactory; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Workaround\Override\Fixture\Resolver; + +Resolver::getInstance()->requireDataFixture( + 'Magento/Catalog/_files/product_image.php' +); +Resolver::getInstance()->requireDataFixture( + 'Magento/Swatches/_files/configurable_product_visual_swatch_attribute.php' +); + +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +$images = ['magento_image.jpg', 'magento_small_image.jpg', 'magento_thumbnail.jpg']; +foreach (range(1, 3) as $index) { + $product = $productRepository->get('simple_option_' . $index); + $product->setImage('/m/a/' . $images[$index - 1]) + ->setSmallImage('/m/a/' . $images[$index - 1]) + ->setThumbnail('/m/a/' . $images[$index - 1]) + ->setData('media_gallery', ['images' => [ + [ + 'file' => '/m/a/' . $images[$index - 1], + 'position' => 1, + 'label' => 'Image Alt Text', + 'disabled' => 0, + 'media_type' => 'image', + ], + ]]) + ->setCanSaveCustomOptions(true) + ->save(); +} diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_images_rollback.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_images_rollback.php new file mode 100644 index 0000000000000..c201b258c5341 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_images_rollback.php @@ -0,0 +1,15 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\TestFramework\Workaround\Override\Fixture\Resolver; + +Resolver::getInstance()->requireDataFixture( + 'Magento/Swatches/_files/configurable_product_visual_swatch_attribute_rollback.php' +); +Resolver::getInstance()->requireDataFixture( + 'Magento/Catalog/_files/product_image_rollback.php' +); From 7491d77c7b8de8a29c5d118796a67f3cb0dcfd8e Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Mon, 28 Dec 2020 13:48:51 +0200 Subject: [PATCH 43/57] MC-39575: Create automated test for "Apply visual swatch attribute filter on layered navigation" --- .../Configurable/Listing/ConfigurableTest.php | 11 ----------- .../_files/configurable_product_with_images.php | 14 +++++++------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/Listing/ConfigurableTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/Listing/ConfigurableTest.php index f2d254af85c94..58475ea879094 100644 --- a/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/Listing/ConfigurableTest.php +++ b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/Configurable/Listing/ConfigurableTest.php @@ -83,17 +83,6 @@ protected function setUp(): void $this->productRepository->cleanCache(); $this->block = $this->objectManager->get(LayoutInterface::class)->createBlock(Configurable::class); $this->request = $this->objectManager->get(RequestInterface::class); - $this->request->clearParams(); - } - - /** - * @inheritdoc - */ - protected function tearDown(): void - { - $this->request->clearParams(); - - parent::tearDown(); } /** diff --git a/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_images.php b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_images.php index 096674c5e9620..f2bcbc27dc01a 100644 --- a/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_images.php +++ b/dev/tests/integration/testsuite/Magento/Swatches/_files/configurable_product_with_images.php @@ -7,7 +7,6 @@ use Magento\Catalog\Api\Data\ProductExtensionInterfaceFactory; use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Catalog\Model\ProductFactory; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\Workaround\Override\Fixture\Resolver; @@ -21,15 +20,16 @@ $objectManager = Bootstrap::getObjectManager(); /** @var ProductRepositoryInterface $productRepository */ $productRepository = $objectManager->get(ProductRepositoryInterface::class); +$configurableProduct = $productRepository->get('configurable'); +$children = $configurableProduct->getTypeInstance()->getUsedProducts($configurableProduct); $images = ['magento_image.jpg', 'magento_small_image.jpg', 'magento_thumbnail.jpg']; -foreach (range(1, 3) as $index) { - $product = $productRepository->get('simple_option_' . $index); - $product->setImage('/m/a/' . $images[$index - 1]) - ->setSmallImage('/m/a/' . $images[$index - 1]) - ->setThumbnail('/m/a/' . $images[$index - 1]) +foreach ($children as $index => $product) { + $product->setImage('/m/a/' . $images[$index]) + ->setSmallImage('/m/a/' . $images[$index]) + ->setThumbnail('/m/a/' . $images[$index]) ->setData('media_gallery', ['images' => [ [ - 'file' => '/m/a/' . $images[$index - 1], + 'file' => '/m/a/' . $images[$index], 'position' => 1, 'label' => 'Image Alt Text', 'disabled' => 0, From 640adcdfe746f3d9acf5c6bd7afa24dd2b42a1bb Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Tue, 29 Dec 2020 11:15:27 +0200 Subject: [PATCH 44/57] MC-39598: Create automated test for: "Assign/Unassign product to websites via API" --- .../Api/ProductWebsiteLinkRepositoryTest.php | 113 ++++++++++++++++++ .../ProductWebsiteLinkRepositoryTest.php | 72 +++++++++++ 2 files changed, 185 insertions(+) create mode 100644 dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductWebsiteLinkRepositoryTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/ProductWebsiteLinkRepositoryTest.php diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductWebsiteLinkRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductWebsiteLinkRepositoryTest.php new file mode 100644 index 0000000000000..13218450e5054 --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductWebsiteLinkRepositoryTest.php @@ -0,0 +1,113 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Api; + +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Webapi\Rest\Request; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\TestCase\WebapiAbstract; + +/** + * Tests to check products to websites assigning. + * + * @see \Magento\Catalog\Model\ProductWebsiteLinkRepository + * + * @magentoAppIsolation enabled + */ +class ProductWebsiteLinkRepositoryTest extends WebapiAbstract +{ + const SERVICE_NAME = 'catalogProductWebsiteLinkRepositoryV1'; + const SERVICE_VERSION = 'V1'; + + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** @var WebsiteRepositoryInterface */ + private $websiteRepository; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->websiteRepository = $this->objectManager->get(WebsiteRepositoryInterface::class); + } + + /** + * @magentoApiDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @return void + */ + public function testSaveWebsiteLinkWithoutWebsiteId(): void + { + $serviceInfo = $this->fillServiceInfo('/V1/products/:sku/websites', Request::HTTP_METHOD_POST, 'Save'); + $requestData = ['productWebsiteLink' => ['sku' => 'simple2']]; + $this->expectException(\Exception::class); + $this->expectErrorMessage((string)__('There are not websites for assign to product')); + $this->_webApiCall($serviceInfo, $requestData); + } + + /** + * @magentoApiDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @return void + */ + public function testSaveWebsiteLinkWithUnexistingWebsiteId(): void + { + $unexistingWebsiteId = 8932568989; + $serviceInfo = $this->fillServiceInfo('/V1/products/:sku/websites', Request::HTTP_METHOD_POST, 'Save'); + $requestData = ['productWebsiteLink' => ['sku' => 'simple2', 'websiteId' => $unexistingWebsiteId]]; + $this->expectException(\Exception::class); + $this->expectExceptionMessageMatches('/Could not assign product \\\"%1\\\" to websites \\\"%2\\\"/'); + $this->_webApiCall($serviceInfo, $requestData); + } + + /** + * @magentoApiDataFixture Magento/Catalog/_files/product_with_two_websites.php + * + * @return void + */ + public function testDeleteWebsiteLink(): void + { + $productSku = 'unique-simple-azaza'; + $websiteId = (int)$this->websiteRepository->get('second_website')->getId(); + $resourcePath = sprintf('/V1/products/%s/websites/%u', $productSku, $websiteId); + $serviceInfo = $this->fillServiceInfo($resourcePath, Request::HTTP_METHOD_DELETE, 'Delete'); + $this->_webApiCall($serviceInfo); + $product = $this->productRepository->get($productSku, false, null, true); + $this->assertNotContains($websiteId, $product->getWebsiteIds()); + } + + /** + * Fill service information + * + * @param string $resourcePath + * @param string $httpMethod + * @param string $operation + * @return array + */ + private function fillServiceInfo(string $resourcePath, string $httpMethod, string $operation): array + { + return [ + 'rest' => ['resourcePath' => $resourcePath, 'httpMethod' => $httpMethod], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . $operation, + ], + ]; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductWebsiteLinkRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductWebsiteLinkRepositoryTest.php new file mode 100644 index 0000000000000..a4441c9480b25 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductWebsiteLinkRepositoryTest.php @@ -0,0 +1,72 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Model; + +use Magento\Catalog\Api\Data\ProductWebsiteLinkInterfaceFactory; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Api\ProductWebsiteLinkRepositoryInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Tests to check products to websites assigning. + * + * @see \Magento\Catalog\Model\ProductWebsiteLinkRepository + * + * @magentoAppIsolation enabled + */ +class ProductWebsiteLinkRepositoryTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var ProductWebsiteLinkRepositoryInterface */ + private $productWebsiteLinkRepository; + + /** @var ProductWebsiteLinkInterfaceFactory */ + private $productWebsiteLinkFactory; + + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** @var WebsiteRepositoryInterface */ + private $websiteRepository; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->productWebsiteLinkRepository = $this->objectManager->get(ProductWebsiteLinkRepositoryInterface::class); + $this->productWebsiteLinkFactory = $this->objectManager->get(ProductWebsiteLinkInterfaceFactory::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->websiteRepository = $this->objectManager->get(WebsiteRepositoryInterface::class); + } + + /** + * @magentoApiDataFixture Magento/Catalog/_files/product_with_two_websites.php + * + * @return void + */ + public function testDelete(): void + { + $this->markTestSkipped('Blocked by MC-40250'); + $productWebsiteLink = $this->productWebsiteLinkFactory->create(); + $productWebsiteLink->setSku('unique-simple-azaza'); + $productWebsiteLink->setWebsiteId(1); + $this->productWebsiteLinkRepository->delete($productWebsiteLink); + $product = $this->productRepository->get('unique-simple-azaza', false, null, true); + $this->assertEquals([$this->websiteRepository->get('second_website')->getId()], $product->getWebsiteIds()); + } +} From 04fd1acd367593c5080075d31602ca7dd68b70ca Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Tue, 29 Dec 2020 14:15:22 +0200 Subject: [PATCH 45/57] MC-39598: Create automated test for: "Assign/Unassign product to websites via API" --- .../Api/ProductWebsiteLinkRepositoryTest.php | 21 ++++--------------- .../ProductWebsiteLinkRepositoryTest.php | 17 ++++++++++++++- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductWebsiteLinkRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductWebsiteLinkRepositoryTest.php index 13218450e5054..fbca54acc9e0b 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductWebsiteLinkRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductWebsiteLinkRepositoryTest.php @@ -46,20 +46,6 @@ protected function setUp(): void $this->websiteRepository = $this->objectManager->get(WebsiteRepositoryInterface::class); } - /** - * @magentoApiDataFixture Magento/Catalog/_files/second_product_simple.php - * - * @return void - */ - public function testSaveWebsiteLinkWithoutWebsiteId(): void - { - $serviceInfo = $this->fillServiceInfo('/V1/products/:sku/websites', Request::HTTP_METHOD_POST, 'Save'); - $requestData = ['productWebsiteLink' => ['sku' => 'simple2']]; - $this->expectException(\Exception::class); - $this->expectErrorMessage((string)__('There are not websites for assign to product')); - $this->_webApiCall($serviceInfo, $requestData); - } - /** * @magentoApiDataFixture Magento/Catalog/_files/second_product_simple.php * @@ -67,11 +53,12 @@ public function testSaveWebsiteLinkWithoutWebsiteId(): void */ public function testSaveWebsiteLinkWithUnexistingWebsiteId(): void { + $pattern = '/(Could\\snot\\sassign\\sproduct)+([\\s\\S]*)(to\\swebsites)+([\\s\\S]*)/'; $unexistingWebsiteId = 8932568989; $serviceInfo = $this->fillServiceInfo('/V1/products/:sku/websites', Request::HTTP_METHOD_POST, 'Save'); $requestData = ['productWebsiteLink' => ['sku' => 'simple2', 'websiteId' => $unexistingWebsiteId]]; $this->expectException(\Exception::class); - $this->expectExceptionMessageMatches('/Could not assign product \\\"%1\\\" to websites \\\"%2\\\"/'); + $this->expectExceptionMessageMatches($pattern); $this->_webApiCall($serviceInfo, $requestData); } @@ -85,8 +72,8 @@ public function testDeleteWebsiteLink(): void $productSku = 'unique-simple-azaza'; $websiteId = (int)$this->websiteRepository->get('second_website')->getId(); $resourcePath = sprintf('/V1/products/%s/websites/%u', $productSku, $websiteId); - $serviceInfo = $this->fillServiceInfo($resourcePath, Request::HTTP_METHOD_DELETE, 'Delete'); - $this->_webApiCall($serviceInfo); + $serviceInfo = $this->fillServiceInfo($resourcePath, Request::HTTP_METHOD_DELETE, 'DeleteById'); + $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'websiteId' => $websiteId]); $product = $this->productRepository->get($productSku, false, null, true); $this->assertNotContains($websiteId, $product->getWebsiteIds()); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductWebsiteLinkRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductWebsiteLinkRepositoryTest.php index a4441c9480b25..9ae327036971b 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductWebsiteLinkRepositoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductWebsiteLinkRepositoryTest.php @@ -10,6 +10,7 @@ use Magento\Catalog\Api\Data\ProductWebsiteLinkInterfaceFactory; use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Catalog\Api\ProductWebsiteLinkRepositoryInterface; +use Magento\Framework\Exception\InputException; use Magento\Framework\ObjectManagerInterface; use Magento\Store\Api\WebsiteRepositoryInterface; use Magento\TestFramework\Helper\Bootstrap; @@ -55,7 +56,21 @@ protected function setUp(): void } /** - * @magentoApiDataFixture Magento/Catalog/_files/product_with_two_websites.php + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @return void + */ + public function testSaveWithoutWebsiteId(): void + { + $productWebsiteLink = $this->productWebsiteLinkFactory->create(); + $productWebsiteLink->setSku('unique-simple-azaza'); + $this->expectException(InputException::class); + $this->expectErrorMessage((string)__('There are not websites for assign to product')); + $this->productWebsiteLinkRepository->save($productWebsiteLink); + } + + /** + * @magentoDataFixture Magento/Catalog/_files/product_with_two_websites.php * * @return void */ From 9b0799b75169c7df4e85a647187e15512f71befc Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Tue, 29 Dec 2020 19:07:46 +0200 Subject: [PATCH 46/57] MC-39598: Create automated test for: "Assign/Unassign product to websites via API" --- .../Api/ProductWebsiteLinkRepositoryTest.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductWebsiteLinkRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductWebsiteLinkRepositoryTest.php index fbca54acc9e0b..0bbed6387ae57 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductWebsiteLinkRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductWebsiteLinkRepositoryTest.php @@ -7,6 +7,7 @@ namespace Magento\Catalog\Api; +use Magento\Catalog\Model\ProductWebsiteLink; use Magento\Framework\ObjectManagerInterface; use Magento\Framework\Webapi\Rest\Request; use Magento\Store\Api\WebsiteRepositoryInterface; @@ -56,7 +57,12 @@ public function testSaveWebsiteLinkWithUnexistingWebsiteId(): void $pattern = '/(Could\\snot\\sassign\\sproduct)+([\\s\\S]*)(to\\swebsites)+([\\s\\S]*)/'; $unexistingWebsiteId = 8932568989; $serviceInfo = $this->fillServiceInfo('/V1/products/:sku/websites', Request::HTTP_METHOD_POST, 'Save'); - $requestData = ['productWebsiteLink' => ['sku' => 'simple2', 'websiteId' => $unexistingWebsiteId]]; + $requestData = [ + 'productWebsiteLink' => [ + ProductWebsiteLink::KEY_SKU => 'simple2', + ProductWebsiteLink::WEBSITE_ID => $unexistingWebsiteId, + ], + ]; $this->expectException(\Exception::class); $this->expectExceptionMessageMatches($pattern); $this->_webApiCall($serviceInfo, $requestData); @@ -73,7 +79,10 @@ public function testDeleteWebsiteLink(): void $websiteId = (int)$this->websiteRepository->get('second_website')->getId(); $resourcePath = sprintf('/V1/products/%s/websites/%u', $productSku, $websiteId); $serviceInfo = $this->fillServiceInfo($resourcePath, Request::HTTP_METHOD_DELETE, 'DeleteById'); - $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'websiteId' => $websiteId]); + $this->_webApiCall( + $serviceInfo, + [ProductWebsiteLink::KEY_SKU => $productSku, ProductWebsiteLink::WEBSITE_ID => $websiteId] + ); $product = $this->productRepository->get($productSku, false, null, true); $this->assertNotContains($websiteId, $product->getWebsiteIds()); } From 2740e08869dfc8b0ea69bd20400c693e82c73a1b Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Wed, 30 Dec 2020 13:01:01 +0200 Subject: [PATCH 47/57] MC-40068: Create automated test for: "Try to delete root category by API call" --- .../Catalog/Api/CategoryRepositoryTest.php | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php index 5623edca62b9a..8e0aff81cc3b8 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php @@ -184,22 +184,49 @@ public function testDeleteNoSuchEntityException() /** * @dataProvider deleteSystemOrRootDataProvider + * + * @param int $categoryId + * @param string $exceptionMsg + * @return void */ - public function testDeleteSystemOrRoot() + public function testDeleteSystemOrRoot(int $categoryId, string $exceptionMsg): void { $this->expectException(\Exception::class); + $this->expectExceptionMessage($exceptionMsg); - $this->deleteCategory($this->modelId); + $this->deleteCategory($categoryId); } - public function deleteSystemOrRootDataProvider() + /** + * @return array + */ + public function deleteSystemOrRootDataProvider(): array { return [ - [Category::TREE_ROOT_ID], - [2] //Default root category + 'system_category' => [ + 'category_id' => Category::TREE_ROOT_ID, + 'exception_message' => $this->buildExceptionMessage(Category::TREE_ROOT_ID), + ], + 'root_category' => [ + 'category_id' => 2, + 'exception_message' => $this->buildExceptionMessage(2), + ], ]; } + /** + * Build response error message + * + * @param int $categoryId + * @return string + */ + private function buildExceptionMessage(int $categoryId): string + { + $translatedMsg = (string)__('Cannot delete category with id %1'); + + return sprintf('{"message":"%s","parameters":["%u"]}', $translatedMsg, $categoryId); + } + /** * @magentoApiDataFixture Magento/Catalog/_files/category.php */ From 10fe506d9489296e9c4b27666d3c687c07b8ba57 Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Wed, 30 Dec 2020 14:16:56 +0200 Subject: [PATCH 48/57] MC-39702: Create automated test for: "Visual swatch on the product page" --- .../Product/Renderer/ConfigurableTest.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/ConfigurableTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/ConfigurableTest.php index c900d276c7864..111d0aa08f7f5 100644 --- a/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/ConfigurableTest.php +++ b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/ConfigurableTest.php @@ -148,6 +148,32 @@ public function testGetJsonSwatchConfigUsedProductImage(): void ); } + /** + * @magentoDataFixture Magento/Swatches/_files/configurable_product_with_visual_swatch_attribute.php + * @magentoDataFixture Magento/Catalog/_files/product_image.php + * @return void + */ + public function testGetJsonSwatchConfigUsedWithSwatchImageType(): void + { + $this->updateAttributeUseProductImageFlag(); + $this->updateProductImage('simple_option_2', '/m/a/magento_image.jpg'); + $this->setSwatchImage('simple_option_2', '/m/a/magento_image.jpg'); + $expectedOptions = $this->getDefaultOptionsList(); + $expectedOptions['option 2']['value'] = $this->imageUrlBuilder->getUrl( + '/m/a/magento_image.jpg', + 'swatch_image_base' + ); + $expectedOptions['option 2']['thumb'] = $this->imageUrlBuilder->getUrl( + '/m/a/magento_image.jpg', + 'swatch_thumb_base' + ); + $this->assertOptionsData( + $this->serializer->unserialize($this->block->getJsonSwatchConfig()), + $expectedOptions, + ['swatch_input_type' => 'visual', 'use_product_image_for_swatch' => 1] + ); + } + /** * @magentoDataFixture Magento/Swatches/_files/configurable_product_with_visual_swatch_attribute.php * @return void @@ -249,4 +275,18 @@ private function updateProductImage(string $sku, string $imageName): void ->setCanSaveCustomOptions(true); $this->productResource->save($product); } + + /** + * Set swatch image for a Product. + * + * @param string $sku + * @param string $imageName + * @return void + */ + private function setSwatchImage(string $sku, string $imageName): void + { + $product = $this->productRepository->get($sku); + $product->setSwatchImage($imageName)->save($product); + } } + From bd329b681eeab9b667f2fcbe4a1aa67d23d4b3e3 Mon Sep 17 00:00:00 2001 From: Vasya Tsviklinskyi <tsviklinskyi@gmail.com> Date: Wed, 30 Dec 2020 14:46:51 +0200 Subject: [PATCH 49/57] MC-40030: Wrong currency sign in Credit Memo grid with Website scope for Price --- app/code/Magento/Sales/Ui/Component/Listing/Column/Price.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Ui/Component/Listing/Column/Price.php b/app/code/Magento/Sales/Ui/Component/Listing/Column/Price.php index 4ffb6f98447c7..cc323730f14b4 100644 --- a/app/code/Magento/Sales/Ui/Component/Listing/Column/Price.php +++ b/app/code/Magento/Sales/Ui/Component/Listing/Column/Price.php @@ -10,6 +10,7 @@ use Magento\Framework\App\ObjectManager; use Magento\Framework\View\Element\UiComponent\ContextInterface; use Magento\Framework\View\Element\UiComponentFactory; +use Magento\Store\Model\Store; use Magento\Store\Model\StoreManagerInterface; use Magento\Ui\Component\Listing\Columns\Column; use Magento\Framework\Pricing\PriceCurrencyInterface; @@ -77,8 +78,10 @@ public function prepareDataSource(array $dataSource) foreach ($dataSource['data']['items'] as & $item) { $currencyCode = isset($item['base_currency_code']) ? $item['base_currency_code'] : null; if (!$currencyCode) { + $storeId = isset($item['store_id']) && (int)$item['store_id'] !== 0 ? $item['store_id'] : + $this->context->getFilterParam('store_id', Store::DEFAULT_STORE_ID); $store = $this->storeManager->getStore( - $this->context->getFilterParam('store_id', \Magento\Store\Model\Store::DEFAULT_STORE_ID) + $storeId ); $currencyCode = $store->getBaseCurrency()->getCurrencyCode(); } From 16826bd19568a4df154f2fc787e2a89d99a2e46a Mon Sep 17 00:00:00 2001 From: Roman Zhupanyn <roma.dj.elf@gmail.com> Date: Wed, 30 Dec 2020 15:01:03 +0200 Subject: [PATCH 50/57] MC-39687: Create automated test for: "Set backorders "Allow Qty Below 0" and check indexers" --- .../Model/Config/Backend/BackordersTest.php | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Config/Backend/BackordersTest.php diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Config/Backend/BackordersTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Config/Backend/BackordersTest.php new file mode 100644 index 0000000000000..279e45fc868cc --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/Config/Backend/BackordersTest.php @@ -0,0 +1,99 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CatalogInventory\Model\Config\Backend; + +use Magento\CatalogInventory\Model\Configuration; +use Magento\CatalogInventory\Model\Indexer\Stock\Processor; +use Magento\CatalogInventory\Model\Stock; +use Magento\Config\Model\Config\BackendFactory; +use Magento\Framework\App\Config\MutableScopeConfigInterface; +use Magento\Framework\Indexer\StateInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Checks that the backorders config backend model is working correctly + */ +class BackordersTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var Backorders */ + private $backorders; + + /** @var BackendFactory */ + private $backendFactory; + + /** @var MutableScopeConfigInterface */ + private $mutableConfig; + + /** @var Processor */ + private $stockIndexerProcessor; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->backendFactory = $this->objectManager->create(BackendFactory::class); + $this->backorders = $this->backendFactory->create(Backorders::class, [ + 'data' => [ + 'path' => Configuration::XML_PATH_BACKORDERS, + ] + ]); + $this->mutableConfig = $this->objectManager->get(MutableScopeConfigInterface::class); + $this->stockIndexerProcessor = $this->objectManager->get(Processor::class); + } + + /** + * @dataProvider afterSaveDataProvider + * @param int $value + * @param int $currentValue + * @param string $expectedIndexerStatus + * @magentoDbIsolation disabled + * @return void + */ + public function testAfterSave(int $value, int $currentValue, string $expectedIndexerStatus): void + { + $this->stockIndexerProcessor->reindexAll(); + $this->mutableConfig->setValue(Configuration::XML_PATH_BACKORDERS, $currentValue); + $this->backorders->setValue((string)$value); + $this->backorders->afterSave(); + + $this->assertEquals($expectedIndexerStatus, $this->stockIndexerProcessor->getIndexer()->getStatus()); + } + + /** + * Data provider for testAfterSave + * + * @return array + */ + public function afterSaveDataProvider(): array + { + return [ + 'set_backorders' => [ + 'value' => Stock::BACKORDERS_YES_NONOTIFY, + 'current_value' => Stock::BACKORDERS_NO, + 'expected_indexer_status' => StateInterface::STATUS_INVALID, + ], + 'unset_backorders' => [ + 'value' => Stock::BACKORDERS_NO, + 'current_value' => Stock::BACKORDERS_YES_NONOTIFY, + 'expected_indexer_status' => StateInterface::STATUS_INVALID, + ], + 'same_backorders' => [ + 'value' => Stock::BACKORDERS_YES_NONOTIFY, + 'current_value' => Stock::BACKORDERS_YES_NONOTIFY, + 'expected_indexer_status' => StateInterface::STATUS_VALID, + ], + ]; + } +} From 048ada376695b0df9b5d63ab4a321a8d7302477c Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Wed, 30 Dec 2020 15:24:22 +0200 Subject: [PATCH 51/57] MC-40068: Create automated test for: "Try to delete root category by API call" --- .../testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php index 8e0aff81cc3b8..2e8eedf96b0f8 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php @@ -224,7 +224,9 @@ private function buildExceptionMessage(int $categoryId): string { $translatedMsg = (string)__('Cannot delete category with id %1'); - return sprintf('{"message":"%s","parameters":["%u"]}', $translatedMsg, $categoryId); + return TESTS_WEB_API_ADAPTER === self::ADAPTER_REST + ? sprintf('{"message":"%s","parameters":["%u"]}', $translatedMsg, $categoryId) + : $translatedMsg; } /** From c50560110e4eb940f07566ad66915c5ee58de60b Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Wed, 30 Dec 2020 15:37:34 +0200 Subject: [PATCH 52/57] MC-39702: Create automated test for: "Visual swatch on the category page" --- .../Product/Renderer/ConfigurableTest.php | 32 +++++++------------ 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/ConfigurableTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/ConfigurableTest.php index 111d0aa08f7f5..5c5b1399caed8 100644 --- a/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/ConfigurableTest.php +++ b/dev/tests/integration/testsuite/Magento/Swatches/Block/Product/Renderer/ConfigurableTest.php @@ -156,8 +156,7 @@ public function testGetJsonSwatchConfigUsedProductImage(): void public function testGetJsonSwatchConfigUsedWithSwatchImageType(): void { $this->updateAttributeUseProductImageFlag(); - $this->updateProductImage('simple_option_2', '/m/a/magento_image.jpg'); - $this->setSwatchImage('simple_option_2', '/m/a/magento_image.jpg'); + $this->updateProductImage('simple_option_2', '/m/a/magento_image.jpg', ['swatch_image']); $expectedOptions = $this->getDefaultOptionsList(); $expectedOptions['option 2']['value'] = $this->imageUrlBuilder->getUrl( '/m/a/magento_image.jpg', @@ -249,15 +248,16 @@ private function updateAttributeUseProductImageFlag(): void * * @param string $sku * @param string $imageName + * @param array $imageRoles * @return void */ - private function updateProductImage(string $sku, string $imageName): void - { + private function updateProductImage( + string $sku, + string $imageName, + array $imageRoles = ['image', 'small_image', 'thumbnail'] + ): void { $product = $this->productRepository->get($sku); $product->setStoreId(Store::DEFAULT_STORE_ID) - ->setImage($imageName) - ->setSmallImage($imageName) - ->setThumbnail($imageName) ->setData( 'media_gallery', [ @@ -273,20 +273,10 @@ private function updateProductImage(string $sku, string $imageName): void ] ) ->setCanSaveCustomOptions(true); - $this->productResource->save($product); - } + foreach ($imageRoles as $role) { + $product->setData($role, $imageName); + } - /** - * Set swatch image for a Product. - * - * @param string $sku - * @param string $imageName - * @return void - */ - private function setSwatchImage(string $sku, string $imageName): void - { - $product = $this->productRepository->get($sku); - $product->setSwatchImage($imageName)->save($product); + $this->productResource->save($product); } } - From 10272105edddaca5363e1e16ea033184b33dd009 Mon Sep 17 00:00:00 2001 From: Vasya Tsviklinskyi <tsviklinskyi@gmail.com> Date: Thu, 31 Dec 2020 09:47:11 +0200 Subject: [PATCH 53/57] MC-40030: Wrong currency sign in Credit Memo grid with Website scope for Price --- .../Ui/Component/Listing/Column/PriceTest.php | 52 +++++++++++++++++-- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Sales/Test/Unit/Ui/Component/Listing/Column/PriceTest.php b/app/code/Magento/Sales/Test/Unit/Ui/Component/Listing/Column/PriceTest.php index 4a9061c3f3c5c..449ab230b568d 100644 --- a/app/code/Magento/Sales/Test/Unit/Ui/Component/Listing/Column/PriceTest.php +++ b/app/code/Magento/Sales/Test/Unit/Ui/Component/Listing/Column/PriceTest.php @@ -17,6 +17,9 @@ use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; +/** + * Contains tests for Price class + */ class PriceTest extends TestCase { /** @@ -34,6 +37,9 @@ class PriceTest extends TestCase */ private $storeManagerMock; + /** + * @inheritDoc + */ protected function setUp(): void { $objectManager = new ObjectManager($this); @@ -57,12 +63,20 @@ protected function setUp(): void } /** - * @param $hasCurrency - * @param $dataSource - * @param $currencyCode + * Test for prepareDataSource method + * + * @param bool $hasCurrency + * @param array $dataSource + * @param string $currencyCode + * @param int|null $expectedStoreId * @dataProvider testPrepareDataSourceDataProvider */ - public function testPrepareDataSource($hasCurrency, $dataSource, $currencyCode) + public function testPrepareDataSource( + bool $hasCurrency, + array $dataSource, + string $currencyCode, + ?int $expectedStoreId = null + ): void { $itemName = 'itemName'; $oldItemValue = 'oldItemValue'; @@ -79,6 +93,7 @@ public function testPrepareDataSource($hasCurrency, $dataSource, $currencyCode) ->willReturn($currencyCode); $this->storeManagerMock->expects($hasCurrency ? $this->never() : $this->once()) ->method('getStore') + ->with($expectedStoreId) ->willReturn($store); $store->expects($hasCurrency ? $this->never() : $this->once()) ->method('getBaseCurrency') @@ -98,7 +113,12 @@ public function testPrepareDataSource($hasCurrency, $dataSource, $currencyCode) $this->assertEquals($newItemValue, $dataSource['data']['items'][0][$itemName]); } - public function testPrepareDataSourceDataProvider() + /** + * Provider for testPrepareDataSource + * + * @return array + */ + public function testPrepareDataSourceDataProvider(): array { $dataSource1 = [ 'data' => [ @@ -119,9 +139,31 @@ public function testPrepareDataSourceDataProvider() ] ] ]; + $dataSource3 = [ + 'data' => [ + 'items' => [ + [ + 'itemName' => 'oldItemValue', + 'store_id' => '2' + ] + ] + ] + ]; + $dataSource4 = [ + 'data' => [ + 'items' => [ + [ + 'itemName' => 'oldItemValue', + 'store_id' => 'abc' + ] + ] + ] + ]; return [ [true, $dataSource1, 'US'], [false, $dataSource2, 'SAR'], + [false, $dataSource3, 'SAR', 2], + [false, $dataSource4, 'SAR'], ]; } } From 245fc040700e534181cff1956688c77c17eb33d1 Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Mon, 4 Jan 2021 17:06:37 +0200 Subject: [PATCH 54/57] MC-40061: Create automated test for: "Subscribe to stock price alert" --- .../Product/Edit/Tab/Alerts/StockTest.php | 90 +++++++++++++++++++ .../Product/Form/Modifier/AlertsTest.php | 56 ++++++++++++ .../_files/product_alert_rollback.php | 33 +++++++ .../_files/stock_alert_on_second_website.php | 66 ++++++++++++++ ...stock_alert_on_second_website_rollback.php | 52 +++++++++++ 5 files changed, 297 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/StockTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AlertsTest.php create mode 100644 dev/tests/integration/testsuite/Magento/ProductAlert/_files/product_alert_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/ProductAlert/_files/stock_alert_on_second_website.php create mode 100644 dev/tests/integration/testsuite/Magento/ProductAlert/_files/stock_alert_on_second_website_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/StockTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/StockTest.php new file mode 100644 index 0000000000000..d03bc935bcd72 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/StockTest.php @@ -0,0 +1,90 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Alerts; + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\View\LayoutInterface; +use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Check stock alert grid + * + * @see \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Alerts\Stock + * + * @magentoAppArea adminhtml + */ +class StockTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var Stock */ + private $block; + + /** @var StoreManagerInterface */ + private $storeManager; + + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->block = $this->objectManager->get(LayoutInterface::class)->createBlock(Stock::class); + $this->storeManager = $this->objectManager->get(StoreManagerInterface::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + } + + /** + * @dataProvider alertsDataProvider + * + * @magentoDbIsolation disabled + * @magentoDataFixture Magento/ProductAlert/_files/product_alert.php + * @magentoDataFixture Magento/ProductAlert/_files/stock_alert_on_second_website.php + * + * @param string $sku + * @param string $expectedEmail + * @param string|null $storeCode + * @return void + */ + public function testGridCollectionWIthStoreId(string $sku, string $expectedEmail, ?string $storeCode = null): void + { + $productId = (int)$this->productRepository->get($sku)->getId(); + $storeId = $storeCode ? (int)$this->storeManager->getStore($storeCode)->getId() : null; + $this->block->getRequest()->setParams(['id' => $productId, 'store' => $storeId]); + $collection = $this->block->getPreparedCollection(); + $this->assertCount(1, $collection); + $this->assertEquals($expectedEmail, $collection->getFirstItem()->getEmail()); + } + + /** + * @return array + */ + public function alertsDataProvider(): array + { + return [ + 'without_store_id_filter' => [ + 'product_sku' => 'simple', + 'expected_customer_emails' => 'customer@example.com', + ], + 'with_store_id_filter' => [ + 'product_sku' => 'simple_on_second_website', + 'expected_customer_emails' => 'customer_second_ws_with_addr@example.com', + 'store_code' => 'fixture_third_store', + ], + ]; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AlertsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AlertsTest.php new file mode 100644 index 0000000000000..96ddc66c875b7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AlertsTest.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Ui\DataProvider\Product\Form\Modifier; + +use Magento\Framework\ObjectManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Helper\Xpath; +use PHPUnit\Framework\TestCase; + +/** + * Alerts modifier test + * + * @see \Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Alerts + * + * @magentoAppArea adminhtml + */ +class AlertsTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var Alerts */ + private $stockAlertsModifier; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->stockAlertsModifier = $this->objectManager->get(Alerts::class); + } + + /** + * @magentoConfigFixture current_store catalog/productalert/allow_stock 1 + * + * @return void + */ + public function testModifyMeta(): void + { + $meta = $this->stockAlertsModifier->modifyMeta([]); + $this->assertArrayHasKey('alerts', $meta); + $content = $meta['alerts']['children'][Alerts::DATA_SCOPE_STOCK]['arguments']['data']['config']['content']; + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath("//div[@data-grid-id='alertStock']", $content) + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/_files/product_alert_rollback.php b/dev/tests/integration/testsuite/Magento/ProductAlert/_files/product_alert_rollback.php new file mode 100644 index 0000000000000..e9c4900ded341 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ProductAlert/_files/product_alert_rollback.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Framework\Registry; +use Magento\ProductAlert\Model\StockFactory; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Workaround\Override\Fixture\Resolver; + +$objectManager = Bootstrap::getObjectManager(); +/** @var StockFactory $stockFactory */ +$stockFactory = $objectManager->get(StockFactory::class); +/** @var CustomerRepositoryInterface $customerRepository */ +$customerRepository = $objectManager->get(CustomerRepositoryInterface::class); +$customer = $customerRepository->get('customer@example.com'); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +$stockAlert = $stockFactory->create(); +$stockAlert->deleteCustomer((int)$customer->getId()); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); + +Resolver::getInstance()->requireDataFixture('Magento/Customer/_files/customer_rollback.php'); +Resolver::getInstance()->requireDataFixture('Magento/Catalog/_files/product_simple_rollback.php'); diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/_files/stock_alert_on_second_website.php b/dev/tests/integration/testsuite/Magento/ProductAlert/_files/stock_alert_on_second_website.php new file mode 100644 index 0000000000000..b9d4c4b81f69b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ProductAlert/_files/stock_alert_on_second_website.php @@ -0,0 +1,66 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\Data\ProductInterfaceFactory; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Model\Product\Visibility; +use Magento\CatalogInventory\Api\Data\StockStatusInterface; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\ProductAlert\Model\ResourceModel\Stock as StockResource; +use Magento\ProductAlert\Model\StockFactory; +use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Workaround\Override\Fixture\Resolver; + +Resolver::getInstance()->requireDataFixture('Magento/Customer/_files/customer_for_second_website_with_address.php'); + +$objectManager = Bootstrap::getObjectManager(); +/** @var StoreManagerInterface $storeManager */ +$storeManager = $objectManager->get(StoreManagerInterface::class); +$secondWebsite = $storeManager->getWebsite('test'); +/** @var ProductInterfaceFactory $productFactory */ +$productFactory = $objectManager->get(ProductInterfaceFactory::class); +/** @var ProductRepositoryInterface $peoductRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +/** @var StockFactory $stockFactory */ +$stockFactory = $objectManager->get(StockFactory::class); +/** @var StockResource $stockResource */ +$stockResource = $objectManager->get(StockResource::class); +/** @var CustomerRepositoryInterface $customerRepository */ +$customerRepository = $objectManager->get(CustomerRepositoryInterface::class); +$customer = $customerRepository->get('customer_second_ws_with_addr@example.com', (int)$secondWebsite->getId()); + + +$product = $productFactory->create(); +$product + ->setTypeId('simple') + ->setAttributeSetId(4) + ->setWebsiteIds([(int)$secondWebsite->getId()]) + ->setName('Simple Product2') + ->setSku('simple_on_second_website') + ->setPrice(10) + ->setMetaTitle('meta title2') + ->setMetaKeyword('meta keyword2') + ->setMetaDescription('meta description2') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData(['is_in_stock' => StockStatusInterface::STATUS_OUT_OF_STOCK]); + +$productRepository->save($product); + +$stockAlert = $stockFactory->create(); +$stockAlert->setCustomerId( + $customer->getId() +)->setProductId( + (int)$productRepository->get($product->getSku())->getId() +)->setWebsiteId( + (int)$secondWebsite->getId() +)->setStoreId( + (int)$storeManager->getStore('fixture_third_store')->getId() +); +$stockResource->save($stockAlert); diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/_files/stock_alert_on_second_website_rollback.php b/dev/tests/integration/testsuite/Magento/ProductAlert/_files/stock_alert_on_second_website_rollback.php new file mode 100644 index 0000000000000..0fa5f73a7927c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ProductAlert/_files/stock_alert_on_second_website_rollback.php @@ -0,0 +1,52 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\ProductAlert\Model\ResourceModel\Stock as StockResource; +use Magento\ProductAlert\Model\StockFactory; +use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Workaround\Override\Fixture\Resolver; + + +$objectManager = Bootstrap::getObjectManager(); +/** @var ProductRepositoryInterface $peoductRepository */ +$productRepository = $objectManager->get(ProductRepositoryInterface::class); +/** @var StockFactory $stockFactory */ +$stockFactory = $objectManager->get(StockFactory::class); +/** @var StockResource $stockResource */ +$stockResource = $objectManager->get(StockResource::class); +/** @var StoreManagerInterface $storeManager */ +$storeManager = $objectManager->get(StoreManagerInterface::class); +$secondWebsite = $storeManager->getWebsite('test'); +/** @var CustomerRepositoryInterface $customerRepository */ +$customerRepository = $objectManager->get(CustomerRepositoryInterface::class); +$customer = $customerRepository->get('customer_second_ws_with_addr@example.com', (int)$secondWebsite->getId()); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +try { + $productRepository->deleteById('simple_on_second_website'); +} catch (NoSuchEntityException $e) { + //already removed +} + + +$stockAlert = $stockFactory->create(); +$stockAlert->deleteCustomer((int)$customer->getId(), (int)$secondWebsite->getId()); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); + +Resolver::getInstance() + ->requireDataFixture('Magento/Customer/_files/customer_for_second_website_with_address_rollback.php'); From d866a0b69b35f7207f743d48ad9bcc2c3280f85c Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Mon, 4 Jan 2021 18:17:41 +0200 Subject: [PATCH 55/57] MC-40070: Create automated test for: "Try to save product with string type qty value" --- .../Product/Attribute/Backend/StockTest.php | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/StockTest.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/StockTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/StockTest.php new file mode 100644 index 0000000000000..24d5b668ac09c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/StockTest.php @@ -0,0 +1,62 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Model\Product\Attribute\Backend; + +use Magento\Catalog\Api\Data\ProductInterfaceFactory; +use Magento\Catalog\Model\Product; +use Magento\Eav\Model\Config; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\ObjectManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Test class for backend stock attribute model. + * + * @see \Magento\Catalog\Model\Product\Attribute\Backend\Stock + * + * @magentoAppArea adminhtml + */ +class StockTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var ProductInterfaceFactory */ + private $productFactory; + + /** @var Stock */ + private $model; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->productFactory = $this->objectManager->get(ProductInterfaceFactory::class); + $this->model = $this->objectManager->get(Stock::class); + $this->model->setAttribute( + $this->objectManager->get(Config::class)->getAttribute(Product::ENTITY, 'quantity_and_stock_status') + ); + } + + /** + * @return void + */ + public function testValidate(): void + { + $this->expectException(LocalizedException::class); + $this->expectErrorMessage((string)__('Please enter a valid number in this field.')); + $product = $this->productFactory->create(); + $product->setQuantityAndStockStatus(['qty' => 'string']); + $this->model->validate($product); + } +} From 7a1e8a88f00ceb4ff689e591eeaaa06e62fb336b Mon Sep 17 00:00:00 2001 From: Yurii Sapiha <yurasapiga93@gmail.com> Date: Tue, 5 Jan 2021 12:35:05 +0200 Subject: [PATCH 56/57] MC-40061: Create automated test for: "Subscribe to stock price alert" --- .../Block/Adminhtml/Product/Edit/Tab/Alerts/StockTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/StockTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/StockTest.php index d03bc935bcd72..b9ccfd6d52458 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/StockTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/StockTest.php @@ -60,7 +60,7 @@ protected function setUp(): void * @param string|null $storeCode * @return void */ - public function testGridCollectionWIthStoreId(string $sku, string $expectedEmail, ?string $storeCode = null): void + public function testGridCollectionWithStoreId(string $sku, string $expectedEmail, ?string $storeCode = null): void { $productId = (int)$this->productRepository->get($sku)->getId(); $storeId = $storeCode ? (int)$this->storeManager->getStore($storeCode)->getId() : null; From 6db8da7e8d8e5d0df516b501cf2473b43fcc4c8b Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Wed, 6 Jan 2021 10:18:37 +0200 Subject: [PATCH 57/57] MC-39891: Arabic text in invoice is not displayed correctly --- app/code/Magento/Sales/Model/RtlTextHandler.php | 2 +- app/code/Magento/Sales/Test/Unit/Model/RtlTextHandlerTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/RtlTextHandler.php b/app/code/Magento/Sales/Model/RtlTextHandler.php index cfb88dc63f58b..b943320e0f897 100644 --- a/app/code/Magento/Sales/Model/RtlTextHandler.php +++ b/app/code/Magento/Sales/Model/RtlTextHandler.php @@ -48,7 +48,7 @@ public function reverseRtlText(string $string): string for ($i = 0; $i < $splitTextAmount; $i++) { if ($this->isRtlText($splitText[$i])) { - for ($j = $i + 1; $j < $splitTextAmount; $j++) { + for ($j = $i; $j < $splitTextAmount; $j++) { $tmp = $this->isRtlText($splitText[$j]) ? $this->stringUtils->strrev($splitText[$j]) : $splitText[$j]; $splitText[$j] = $this->isRtlText($splitText[$i]) diff --git a/app/code/Magento/Sales/Test/Unit/Model/RtlTextHandlerTest.php b/app/code/Magento/Sales/Test/Unit/Model/RtlTextHandlerTest.php index 2faeb17dc2395..1a8159dbf4cbb 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/RtlTextHandlerTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/RtlTextHandlerTest.php @@ -62,6 +62,7 @@ public function provideRtlTexts(): array ['Herr Prof. Dr. Gerald Schüler B.A.', false],//German ['نديم مقداد نعمان القحطاني', true],//Arabic ['شهاب الفرحان', true],//Arabic + ['مرحبا ماجنت اثنان', true],//Arabic ['צבר קרליבך', true],//Hebrew ['גורי מייזליש', true],//Hebrew ['اتابک بهشتی', true],//Persian