From c27fae689bf618912951b36597b0abef183c3497 Mon Sep 17 00:00:00 2001 From: Veronika Kurochkina Date: Wed, 15 Aug 2018 15:15:00 +0300 Subject: [PATCH 01/27] MAGETWO-71375: Zero Subtotal Orders have incorrect status - Add authorize payment action --- app/code/Magento/Payment/etc/config.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Payment/etc/config.xml b/app/code/Magento/Payment/etc/config.xml index 9fe859c96a941..663734fb066c7 100644 --- a/app/code/Magento/Payment/etc/config.xml +++ b/app/code/Magento/Payment/etc/config.xml @@ -13,6 +13,7 @@ Magento\Payment\Model\Method\Free pending No Payment Information Required + authorize 0 1 From 8e36968a9633ae51986e55665ad354288d592b72 Mon Sep 17 00:00:00 2001 From: Oksana_Kremen Date: Thu, 23 Aug 2018 12:04:21 +0300 Subject: [PATCH 02/27] MAGETWO-91521: Reports / Sales / Tax report show incorrect amount - Fixed to correct db field to retrieve tax amount - Removed incorrect calculating order subtotals and totals count in Tax report --- app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php | 1 - .../Magento/Tax/Model/ResourceModel/Report/Tax/Createdat.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php index 79deb27423be5..7ca6b803f5b2b 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php @@ -123,7 +123,6 @@ protected function _prepareColumns() [ 'header' => __('Orders'), 'index' => 'orders_count', - 'total' => 'sum', 'type' => 'number', 'sortable' => false, 'header_css_class' => 'col-qty', diff --git a/app/code/Magento/Tax/Model/ResourceModel/Report/Tax/Createdat.php b/app/code/Magento/Tax/Model/ResourceModel/Report/Tax/Createdat.php index ebf699db552d6..4f26d155acdea 100644 --- a/app/code/Magento/Tax/Model/ResourceModel/Report/Tax/Createdat.php +++ b/app/code/Magento/Tax/Model/ResourceModel/Report/Tax/Createdat.php @@ -84,7 +84,7 @@ protected function _aggregateByOrder($aggregationField, $from, $to) 'order_status' => 'e.status', 'percent' => 'MAX(tax.' . $connection->quoteIdentifier('percent') . ')', 'orders_count' => 'COUNT(DISTINCT e.entity_id)', - 'tax_base_amount_sum' => 'SUM(tax.base_amount * e.base_to_global_rate)', + 'tax_base_amount_sum' => 'SUM(tax.base_real_amount * e.base_to_global_rate)', ]; $select = $connection->select()->from( From bfbb981c9f118cf6d157dc858a4b0397f86a5190 Mon Sep 17 00:00:00 2001 From: David Grigoryan Date: Wed, 5 Sep 2018 13:57:52 +0400 Subject: [PATCH 03/27] MAGETWO-91521: Reports / Sales / Tax report show incorrect amount - Add automated test --- .../Mftf/Section/AdminProductFormSection.xml | 1 + .../Mftf/ActionGroup/AdminTaxActionGroup.xml | 39 ++++ .../Tax/Test/Mftf/Data/TaxCodeData.xml | 12 + .../Mftf/Section/AdminTaxReportsSection.xml | 19 ++ .../Mftf/Section/AdminTaxRulesSection.xml | 8 + .../Test/Mftf/Test/AdminTaxReportGridTest.xml | 221 ++++++++++++++++++ 6 files changed, 300 insertions(+) create mode 100644 app/code/Magento/Tax/Test/Mftf/Section/AdminTaxReportsSection.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml index 604eba61a05af..81dda688c4d23 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml @@ -20,6 +20,7 @@ + diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml index 6d6e5cea0fd34..7a2e5ddf54da2 100644 --- a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml @@ -100,4 +100,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml b/app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml index e786616119c92..6f666c18b7ac0 100644 --- a/app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml +++ b/app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml @@ -26,4 +26,16 @@ * 0 + + California + United States + 35005 + 7.25 + + + California + United States + 35005 + 0.125 + diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxReportsSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxReportsSection.xml new file mode 100644 index 0000000000000..80101687e173e --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxReportsSection.xml @@ -0,0 +1,19 @@ + + + + +
+ + + + + + +
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRulesSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRulesSection.xml index f7b72263c1255..6f103573ad2d2 100644 --- a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRulesSection.xml +++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRulesSection.xml @@ -19,5 +19,13 @@ + + + + + + + + diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml new file mode 100644 index 0000000000000..2bb3f1282e49f --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml @@ -0,0 +1,221 @@ + + + + + + + + + + <description value="Tax Report Grid displays Tax amount in rows 'Total' and 'Subtotal' is a sum of all tax amounts"/> + <severity value="MAJOR"/> + <testCaseId value="MAGETWO-94338"/> + <group value="Tax"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + + <!-- Go to tax rule page --> + <actionGroup ref="addNewTaxRuleActionGroup" stepKey="addFirstTaxRuleActionGroup"/> + <fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="TaxRule1"/> + + <!-- Add NY and CA tax rules --> + <actionGroup ref="addNewTaxRateNoZip" stepKey="addNYTaxRate"> + <argument name="taxCode" value="SimpleTaxWithZipCode"/> + </actionGroup> + + <actionGroup ref="addProductTaxClass" stepKey="addProductTaxClass"> + <argument name="prodTaxClassName" value="TaxClasses1"/> + </actionGroup> + + <click stepKey="disableDefaultProdTaxClass" selector="{{AdminTaxRulesSection.defaultTaxClass}}"/> + + <click stepKey="clickSave" selector="{{AdminStoresMainActionsSection.saveButton}}"/> + <waitForPageLoad stepKey="waitForNewTaxRuleCreated"/> + + <!-- Go to tax rule page to create second Tax Rule--> + <actionGroup ref="addNewTaxRuleActionGroup" stepKey="addSecondTaxRuleActionGroup"/> + <fillField stepKey="fillSecondRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="TaxRule2"/> + + <actionGroup ref="addNewTaxRateNoZip" stepKey="addCATaxRate"> + <argument name="taxCode" value="SimpleSecondTaxWithZipCode"/> + </actionGroup> + + <actionGroup ref="addProductTaxClass" stepKey="addSecondProductTaxClass"> + <argument name="prodTaxClassName" value="TaxClasses2"/> + </actionGroup> + + <click stepKey="disableSecondProdTaxClass" selector="{{AdminTaxRulesSection.defaultTaxClass}}"/> + <click stepKey="clickSaveBtn" selector="{{AdminStoresMainActionsSection.saveButton}}"/> + <waitForPageLoad stepKey="waitForSecondTaxRuleCreated"/> + + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="_defaultProduct" stepKey="firstProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + + <createData entity="_defaultProduct" stepKey="secondProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + + <!--Open Created products. In Tax Class select new created Product Tax classes.--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex"/> + <waitForPageLoad stepKey="wait1"/> + <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid"/> + <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku"> + <argument name="product" value="$$firstProduct$$"/> + </actionGroup> + <actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openFirstProductForEdit"/> + <selectOption selector="{{AdminProductFormSection.productTaxClass}}" stepKey="selectTexClassForFirstProduct" userInput="TaxClasses1"/> + <!-- Save the second product --> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveFirstProduct"/> + <waitForPageLoad stepKey="waitForFirstProductSaved"/> + + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="againGoToProductIndex"/> + <waitForPageLoad stepKey="wait2"/> + <actionGroup ref="resetProductGridToDefaultView" stepKey="resetSecondProductGrid"/> + <actionGroup ref="filterProductGridBySku" stepKey="filterSecondProductGridBySku"> + <argument name="product" value="$$secondProduct$$"/> + </actionGroup> + <actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openSecondProductForEdit"/> + <selectOption selector="{{AdminProductFormSection.productTaxClass}}" stepKey="selectTexClassForSecondProduct" userInput="TaxClasses2"/> + <!-- Save the second product --> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveSecondProduct"/> + <waitForPageLoad stepKey="waitForSecondProductSaved"/> + + <!--Create an order with these 2 products in that zip code.--> + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> + <waitForPageLoad stepKey="waitForIndexPageLoad"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> + <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> + <click selector="{{AdminOrderFormActionSection.CreateNewCustomer}}" stepKey="clickCreateCustomer"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> + + <!--Check if order can be submitted without the required fields including email address--> + <scrollToTopOfPage stepKey="scrollToTopOfOrderFormPage" after="seeNewOrderPageTitle"/> + <actionGroup ref="addSimpleProductToOrder" stepKey="addFirstProductToOrder" after="scrollToTopOfOrderFormPage"> + <argument name="product" value="$$firstProduct$$"/> + </actionGroup> + <actionGroup ref="addSimpleProductToOrder" stepKey="addSecondProductToOrder" after="addFirstProductToOrder"> + <argument name="product" value="$$secondProduct$$"/> + </actionGroup> + + <!--Fill customer group and customer email--> + <selectOption selector="{{AdminOrderFormAccountSection.group}}" userInput="{{GeneralCustomerGroup.code}}" stepKey="selectCustomerGroup" after="addSecondProductToOrder"/> + <fillField selector="{{AdminOrderFormAccountSection.email}}" userInput="{{Simple_US_Customer.email}}" stepKey="fillCustomerEmail" after="selectCustomerGroup"/> + + <!--Fill customer address information--> + <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress" after="fillCustomerEmail"> + <argument name="customer" value="Simple_US_Customer"/> + <argument name="address" value="US_Address_TX"/> + </actionGroup> + + <!-- Select shipping --> + <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping" after="fillCustomerAddress"/> + + <!--Submit Order and verify information--> + <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="clickSubmitOrder" after="selectFlatRateShipping"/> + <seeInCurrentUrl url="{{AdminOrderDetailsPage.url}}" stepKey="seeViewOrderPage" after="clickSubmitOrder"/> + <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the order." stepKey="seeSuccessMessage" after="seeViewOrderPage"/> + + <!--Create Invoice and Shipment for this Order.--> + <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoiceInPageTitle" after="clickInvoiceButton"/> + <waitForPageLoad stepKey="waitForInvoicePageOpened"/> + + <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> + <waitForPageLoad stepKey="waitForInvoiceSaved"/> + + <click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction" after="waitForInvoiceSaved"/> + <seeInCurrentUrl url="{{AdminShipmentNewPage.url}}" stepKey="seeOrderShipmentUrl" after="clickShipAction"/> + <!--Submit Shipment--> + <click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="clickSubmitShipment" after="seeOrderShipmentUrl"/> + <waitForPageLoad stepKey="waitForShipmentSaved"/> + + <!--Go to "Reports" -> "Sales" -> "Tax"--> + <amOnPage url="/admin/reports/report_sales/tax/" stepKey="navigateToReportsTaxPage"/> + <waitForPageLoad stepKey="waitForReportsTaxPageLoad"/> + + <!--click "here" to refresh last day's statistics --> + <click stepKey="clickRefrashStatisticsHere" selector="{{AdminTaxReportsSection.refreshStatistics}}"/> + <waitForPageLoad stepKey="waitForRefrash"/> + + <!--Select Dates--> + <fillField selector="{{AdminTaxReportsSection.fromDate}}" userInput="05/16/2018" stepKey="fillDateFrom"/> + <click selector="{{AdminTaxReportsSection.toDate}}" stepKey="clickDateTo"/> + <click selector="{{AdminTaxReportsSection.goTodayButton}}" stepKey="clickGoTodayDate"/> + <!--Click "Show report" in the upper right corner.--> + <click selector="{{AdminTaxReportsSection.showReportButton}}" stepKey="clickShowReportButton"/> + + <!--Tax Report Grid displays Tax amount in rows. "Total" and "Subtotal" is a sum of all tax amounts--> + <grabTextFrom selector="{{AdminTaxReportsSection.taxRuleAmount('TaxRate1')}}" stepKey="amountOfFirstTaxRate"/> + <grabTextFrom selector="{{AdminTaxReportsSection.taxRuleAmount('TaxRate2')}}" stepKey="amountOfSecondTaxRate"/> + <grabTextFrom selector="{{AdminTaxReportsSection.taxRuleAmount('Subtotal')}}" stepKey="amountOfSubtotalTaxRate"/> + <assertEquals stepKey="assertSubtotalFirstField"> + <expectedResult type="string">$0.87</expectedResult> + <actualResult type="variable">amountOfFirstTaxRate</actualResult> + </assertEquals> + + <assertEquals stepKey="assertSubtotalSecondField"> + <expectedResult type="string">$0.02</expectedResult> + <actualResult type="variable">amountOfSecondTaxRate</actualResult> + </assertEquals> + + <assertEquals stepKey="assertSubtotalField"> + <expectedResult type="string">$0.89</expectedResult> + <actualResult type="variable">amountOfSubtotalTaxRate</actualResult> + </assertEquals> + + <after> + <!-- Go to the tax rule page and delete the row we created--> + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulesPage"/> + <waitForPageLoad stepKey="waitForRulesPage"/> + + <actionGroup ref="deleteEntitySecondaryGrid" stepKey="deleteRule"> + <argument name="name" value="TaxRule1"/> + <argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> + </actionGroup> + + <actionGroup ref="deleteEntitySecondaryGrid" stepKey="deleteSecondRule"> + <argument name="name" value="TaxRule2"/> + <argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> + </actionGroup> + + <!-- Go to the tax rate page --> + <amOnPage url="{{AdminTaxRateGridPage.url}}" stepKey="goToTaxRatesPage"/> + <waitForPageLoad stepKey="waitForRatesPage"/> + + <!-- Delete the two tax rates that were created --> + <actionGroup ref="deleteEntitySecondaryGrid" stepKey="deleteNYRate"> + <argument name="name" value="{{SimpleTaxWithZipCode.state}}-{{SimpleTaxWithZipCode.rate}}"/> + <argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> + </actionGroup> + + <actionGroup ref="deleteEntitySecondaryGrid" stepKey="deleteCARate"> + <argument name="name" value="{{SimpleSecondTaxWithZipCode.state}}-{{SimpleSecondTaxWithZipCode.rate}}"/> + <argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> + </actionGroup> + + <deleteData createDataKey="firstProduct" stepKey="deleteFirstProduct"/> + <deleteData createDataKey="secondProduct" stepKey="deleteSecondProduct"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + + <actionGroup ref="deleteProductTaxClass" stepKey="deleteFirstProductTaxClass"> + <argument name="taxClassName" value="TaxClasses1"/> + </actionGroup> + + <actionGroup ref="deleteProductTaxClass" stepKey="deleteSecondProductTaxClass"> + <argument name="taxClassName" value="TaxClasses2"/> + </actionGroup> + + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> + </after> + </test> +</tests> From c5f9b0888e57a4eef7b954d3452ed41782a16701 Mon Sep 17 00:00:00 2001 From: David Grigoryan <david_grigoryan@epam.com> Date: Mon, 3 Sep 2018 13:15:30 +0400 Subject: [PATCH 04/27] MAGETWO-71375: Zero Subtotal Orders have incorrect status - Add automation test --- .../StorefrontShippmentFromActionGroup.xml | 17 +++ ...SubtotalOrdersWithProcessingStatusTest.xml | 100 ++++++++++++++++++ .../AdminCartPriceRulesFormSection.xml | 1 + .../Mftf/Data/StorePaymentMethodsData.xml | 30 ++++++ .../Mftf/Data/StoreShippingMethodsData.xml | 30 ++++++ .../Metadata/store_payment_methods-meta.xml | 46 ++++++++ .../Metadata/store_shipping_methods-meta.xml | 38 +++++++ 7 files changed, 262 insertions(+) create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontShippmentFromActionGroup.xml create mode 100644 app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml create mode 100644 app/code/Magento/Store/Test/Mftf/Data/StorePaymentMethodsData.xml create mode 100644 app/code/Magento/Store/Test/Mftf/Data/StoreShippingMethodsData.xml create mode 100644 app/code/Magento/Store/Test/Mftf/Metadata/store_payment_methods-meta.xml create mode 100644 app/code/Magento/Store/Test/Mftf/Metadata/store_shipping_methods-meta.xml diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontShippmentFromActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontShippmentFromActionGroup.xml new file mode 100644 index 0000000000000..c14b55d0ea663 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontShippmentFromActionGroup.xml @@ -0,0 +1,17 @@ +<?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="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> + <!--Fill shipment form for free shipping--> + <actionGroup name="ShipmentFormFreeShippingActionGroup" extends="ShipmentFormActionGroup"> + <see userInput="$0.00 Free Free Shipping" selector="{{CheckoutShippingMethodsSection.shippingMethodRowByName('Free Shipping')}}" stepKey="seeShippingMethod" after="clickToChooseState"/> + <click selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('Free Shipping')}}" stepKey="selectFlatShippingMethod" after="seeShippingMethod"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask" after="selectFlatShippingMethod"/> + </actionGroup> +</actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml new file mode 100644 index 0000000000000..3ef8ba7397e61 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml @@ -0,0 +1,100 @@ +<?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="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="ZeroSubtotalOrdersWithProcessingStatusTest"> + <annotations> + <features value="Checkout"/> + <stories value="MAGETWO-71375: Zero Subtotal Orders have incorrect status"/> + <title value="Checking status of Zero Subtotal Orders with 'Processing' New Order Status"/> + <description value="Created order should be in Processing status"/> + <severity value="MAJOR"/> + <testCaseId value="MAGETWO-94178"/> + <group value="checkout"/> + </annotations> + <before> + <createData entity="SimpleSubCategory" stepKey="simplecategory"/> + <createData entity="SimpleProduct" stepKey="simpleproduct"> + <requiredEntity createDataKey="simplecategory"/> + </createData> + <createData entity="PaymentMethodsSettingConfig" stepKey="paymentMethodsSettingConfig"/> + <createData entity="FreeShippingMethodsSettingConfig" stepKey="freeShippingMethodsSettingConfig"/> + <!--Go to Admin page--> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + + <after> + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteSalesRule"> + <argument name="ruleName" value="{{ApiSalesRule.name}}"/> + </actionGroup> + <createData entity="DefaultShippingMethodsConfig" stepKey="defaultShippingMethodsConfig"/> + <createData entity="DisableFreeShippingConfig" stepKey="disableFreeShippingConfig"/> + <createData entity="DisablePaymentMethodsSettingConfig" stepKey="disablePaymentMethodsSettingConfig"/> + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> + <deleteData createDataKey="simpleproduct" stepKey="deleteProduct"/> + <deleteData createDataKey="simplecategory" stepKey="deleteCategory"/> + </after> + + <!--Open MARKETING > Cart Price Rules--> + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> + <waitForPageLoad stepKey="waitForRulesPage"/> + + <!--Add New Rule--> + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{ApiSalesRule.name}}" stepKey="fillRuleName"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsite"/> + <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="chooseNotLoggedInCustomerGroup"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="selectCouponType"/> + <fillField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{_defaultCoupon.code}}" stepKey="fillCouponCode"/> + <fillField selector="{{AdminCartPriceRulesFormSection.userPerCoupon}}" userInput="99" stepKey="fillUserPerCoupon"/> + <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Percent of product price discount" stepKey="selectActionType"/> + <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="100" stepKey="fillDiscountAmount"/> + <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> + <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> + + <!--Proceed to store front and place an order with free shipping using created coupon--> + <!--Add product to card--> + <actionGroup ref="AddSimpleProductToCart" stepKey="AddProductToCard"> + <argument name="product" value="$$simpleproduct$$"/> + </actionGroup> + + <!--Proceed to shipment--> + <click selector="{{ProductCardSection.showCard}}" stepKey="clickToOpenCard"/> + <click selector="{{ProductCardSection.proceed}}" stepKey="clickToProceedToCheckout"/> + <waitForPageLoad stepKey="waitForTheFormIsOpened"/> + + <!--Fill shipping form--> + <actionGroup ref="ShipmentFormFreeShippingActionGroup" stepKey="shipmentFormFreeShippingActionGroup"/> + + <click selector="{{ProductCardSection.addCoupon}}" stepKey="clickToAddDiscount"/> + <fillField selector="{{ProductCardSection.addCode}}" userInput="{{_defaultCoupon.code}}" stepKey="TypeDiscountCode"/> + <click selector="{{ProductCardSection.applyDiscount}}" stepKey="clickToApplyDiscount"/> + <waitForPageLoad stepKey="WaitForDiscountToBeAdded"/> + <see userInput="Your coupon was successfully applied." stepKey="verifyText"/> + + <waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/> + <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> + + <!--Proceed to Admin panel > SALES > Orders. Created order should be in Processing status--> + <amOnPage url="/admin/sales/order/" stepKey="navigateToSalesOrderPage"/> + <waitForPageLoad stepKey="waitForSalesOrderPageLoaded"/> + + <!-- Open Order --> + <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <argument name="orderId" value="$grabOrderNumber"/> + </actionGroup> + <click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/> + <waitForPageLoad stepKey="waitForCreatedOrderPageOpened"/> + + <!--Verify that Created order is in Processing status--> + <see selector="{{AdminShipmentOrderInformationSection.orderStatus}}" userInput="Processing" stepKey="seeShipmentOrderStatus"/> + </test> +</tests> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml b/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml index f31ff1a456898..fc32ce2950802 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml @@ -20,6 +20,7 @@ <element name="customerGroups" type="multiselect" selector="select[name='customer_group_ids']"/> <element name="coupon" type="select" selector="select[name='coupon_type']"/> <element name="couponCode" type="input" selector="input[name='coupon_code']"/> + <element name="userPerCoupon" type="input" selector="input[name='uses_per_coupon']"/> <element name="useAutoGeneration" type="checkbox" selector="input[name='use_auto_generation']"/> <!-- Actions sub-form --> diff --git a/app/code/Magento/Store/Test/Mftf/Data/StorePaymentMethodsData.xml b/app/code/Magento/Store/Test/Mftf/Data/StorePaymentMethodsData.xml new file mode 100644 index 0000000000000..912399142fa61 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/Data/StorePaymentMethodsData.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="PaymentMethodsSettingConfig" type="zero_subtotal_checkout_config_state"> + <requiredEntity type="active">active</requiredEntity> + <requiredEntity type="order_status">orderStatus</requiredEntity> + </entity> + <entity name="active" type="active"> + <data key="value">1</data> + </entity> + <entity name="orderStatus" type="order_status"> + <data key="value">processing</data> + </entity> + + <entity name="DisablePaymentMethodsSettingConfig" type="use_system_value_config_state"> + <requiredEntity type="zeroSubEnable">zeroSubEnable</requiredEntity> + <requiredEntity type="zeroSubOrderStatus">zeroSubOrderStatus</requiredEntity> + </entity> + <entity name="zeroSubEnable" type="zeroSubEnable"> + <data key="value">1</data> + </entity> + <entity name="zeroSubOrderStatus" type="zeroSubOrderStatus"> + <data key="value">1</data> + </entity> +</entities> diff --git a/app/code/Magento/Store/Test/Mftf/Data/StoreShippingMethodsData.xml b/app/code/Magento/Store/Test/Mftf/Data/StoreShippingMethodsData.xml new file mode 100644 index 0000000000000..6e3e7ce7eb0d3 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/Data/StoreShippingMethodsData.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="FreeShippingMethodsSettingConfig" type="free_shipping_config_state"> + <requiredEntity type="active">active</requiredEntity> + </entity> + <entity name="active" type="active"> + <data key="value">1</data> + </entity> + + <!-- default configuration used to restore Magento config --> + <entity name="DefaultShippingMethodsConfig" type="free_shipping_config_state"> + <requiredEntity type="active">DefaultFreeShipping</requiredEntity> + </entity> + <entity name="DefaultFreeShipping" type="active"> + <data key="value">0</data> + </entity> + + <entity name="DisableFreeShippingConfig" type="disable_free_shipping_config_state"> + <requiredEntity type="disableFreeShipping">disableFreeShipping</requiredEntity> + </entity> + <entity name="disableFreeShipping" type="disableFreeShipping"> + <data key="value">1</data> + </entity> +</entities> diff --git a/app/code/Magento/Store/Test/Mftf/Metadata/store_payment_methods-meta.xml b/app/code/Magento/Store/Test/Mftf/Metadata/store_payment_methods-meta.xml new file mode 100644 index 0000000000000..cbad7265cbbd6 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/Metadata/store_payment_methods-meta.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd"> + <operation name="EnableZeroSubtotalCheckoutConfigState" dataType="zero_subtotal_checkout_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/payment/" method="POST"> + <object key="groups" dataType="zero_subtotal_checkout_config_state"> + <object key="free" dataType="zero_subtotal_checkout_config_state"> + <object key="fields" dataType="zero_subtotal_checkout_config_state"> + <object key="active" dataType="active"> + <field key="value">string</field> + </object> + <object key="order_status" dataType="order_status"> + <field key="value">string</field> + </object> + </object> + </object> + </object> + </operation> + + <operation name="DisablePaymentMethodsSettingConfig" dataType="use_system_value_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/payment/" method="POST"> + <object key="groups" dataType="use_system_value_config_state"> + <object key="free" dataType="use_system_value_config_state"> + <object key="fields" dataType="use_system_value_config_state"> + <object key="active" dataType="use_system_value_config_state"> + <object key="inherit" dataType="zeroSubEnable"> + <field key="value">integer</field> + </object> + </object> + <object key="order_status" dataType="use_system_value_config_state"> + <object key="inherit" dataType="zeroSubOrderStatus"> + <field key="value">integer</field> + </object> + </object> + </object> + </object> + </object> + </operation> + +</operations> + diff --git a/app/code/Magento/Store/Test/Mftf/Metadata/store_shipping_methods-meta.xml b/app/code/Magento/Store/Test/Mftf/Metadata/store_shipping_methods-meta.xml new file mode 100644 index 0000000000000..83288ecfdaf71 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/Metadata/store_shipping_methods-meta.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd"> + <operation name="EnableFreeShippingConfigState" dataType="free_shipping_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/carriers/" method="POST"> + <object key="groups" dataType="free_shipping_config_state"> + <object key="freeshipping" dataType="free_shipping_config_state"> + <object key="fields" dataType="free_shipping_config_state"> + <object key="active" dataType="active"> + <field key="value">string</field> + </object> + </object> + </object> + </object> + </operation> + + <operation name="DisableFreeShippingConfigState" dataType="disable_free_shipping_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/carriers/" method="POST"> + <object key="groups" dataType="disable_free_shipping_config_state"> + <object key="freeshipping" dataType="disable_free_shipping_config_state"> + <object key="fields" dataType="disable_free_shipping_config_state"> + <object key="active" dataType="disable_free_shipping_config_state"> + <object key="inherit" dataType="disableFreeShipping"> + <field key="value">integer</field> + </object> + </object> + </object> + </object> + </object> + </operation> + +</operations> + From 3ef83dbf870eaf5ed0d8817feece24f6d57b2f32 Mon Sep 17 00:00:00 2001 From: Oleksandr_Hodzevych <Oleksandr_Hodzevych@epam.com> Date: Thu, 6 Sep 2018 16:55:24 +0300 Subject: [PATCH 05/27] MAGETWO-91659: Cannot set Phone Number not required - Fixed checking is required field telephone --- app/code/Magento/Customer/Helper/Address.php | 19 +++++++++ .../Customer/Test/Unit/Helper/AddressTest.php | 39 +++++++++++++++++++ .../view/base/ui_component/customer_form.xml | 3 -- 3 files changed, 58 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Customer/Helper/Address.php b/app/code/Magento/Customer/Helper/Address.php index c74c62dc6d98c..b6897bca585af 100644 --- a/app/code/Magento/Customer/Helper/Address.php +++ b/app/code/Magento/Customer/Helper/Address.php @@ -391,4 +391,23 @@ public function isAttributeVisible($code) } return false; } + + /** + * Retrieve attribute required + * + * @param string $code + * @return bool + * @throws NoSuchEntityException + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function isAttributeRequired($code) + { + $attributeMetadata = $this->_addressMetadataService->getAttributeMetadata($code); + + if ($attributeMetadata) { + return $attributeMetadata->isRequired(); + } + + return false; + } } diff --git a/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php b/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php index 74af4ec57c77f..fd06f778efe45 100644 --- a/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php +++ b/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php @@ -414,4 +414,43 @@ public function isAttributeVisibleDataProvider() ['invalid_code', false] ]; } + + /** + * Test is required filed by attribute code + * + * @param string $attributeCode + * @param bool $isMetadataExists + * @dataProvider isAttributeRequiredDataProvider + * @covers \Magento\Customer\Helper\Address::isAttributeRequired() + * @return void + */ + public function testIsAttributeRequired($attributeCode, $isMetadataExists) + { + $attributeMetadata = null; + if ($isMetadataExists) { + $attributeMetadata = $this->getMockBuilder(\Magento\Customer\Api\Data\AttributeMetadataInterface::class) + ->getMockForAbstractClass(); + $attributeMetadata->expects($this->once()) + ->method('isRequired') + ->willReturn(true); + } + $this->addressMetadataService->expects($this->once()) + ->method('getAttributeMetadata') + ->with($attributeCode) + ->willReturn($attributeMetadata); + $this->assertEquals($isMetadataExists, $this->helper->isAttributeRequired($attributeCode)); + } + + /** + * Data provider for test testIsAttributeRequire + * + * @return array + */ + public function isAttributeRequiredDataProvider() + { + return [ + ['fax', true], + ['invalid_code', false] + ]; + } } diff --git a/app/code/Magento/Customer/view/base/ui_component/customer_form.xml b/app/code/Magento/Customer/view/base/ui_component/customer_form.xml index 4de6644b948fb..d2a9b3f44624d 100644 --- a/app/code/Magento/Customer/view/base/ui_component/customer_form.xml +++ b/app/code/Magento/Customer/view/base/ui_component/customer_form.xml @@ -486,9 +486,6 @@ </item> </argument> <settings> - <validation> - <rule name="required-entry" xsi:type="boolean">true</rule> - </validation> <dataType>text</dataType> </settings> </field> From 5e67143a6762bc0012668ac834b14b4d06e38381 Mon Sep 17 00:00:00 2001 From: Oksana_Kremen <Oksana_Kremen@epam.com> Date: Fri, 7 Sep 2018 14:29:07 +0300 Subject: [PATCH 06/27] MAGETWO-91717: Using a number in module name will cause custom message consumers in xml to be invalid - Changed restriction pattern to allow numbers in service name and service method name --- .../Test/Unit/Consumer/Config/XsdTest.php | 122 +++++++++++++++++- .../Framework/MessageQueue/etc/queue_base.xsd | 4 +- 2 files changed, 120 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/MessageQueue/Test/Unit/Consumer/Config/XsdTest.php b/lib/internal/Magento/Framework/MessageQueue/Test/Unit/Consumer/Config/XsdTest.php index 2e0120ad7ea82..b99dc6a3ff902 100644 --- a/lib/internal/Magento/Framework/MessageQueue/Test/Unit/Consumer/Config/XsdTest.php +++ b/lib/internal/Magento/Framework/MessageQueue/Test/Unit/Consumer/Config/XsdTest.php @@ -10,15 +10,26 @@ class XsdTest extends \PHPUnit\Framework\TestCase /** * @var string */ - protected $_schemaFile; + private $schemaFile; + /** + * @var string + */ + private $schemaQueueFile; + + /** + * Set up. + * + * @return void + */ protected function setUp() { if (!function_exists('libxml_set_external_entity_loader')) { $this->markTestSkipped('Skipped on HHVM. Will be fixed in MAGETWO-45033'); } $urnResolver = new \Magento\Framework\Config\Dom\UrnResolver(); - $this->_schemaFile = $urnResolver->getRealPath('urn:magento:framework-message-queue:etc/consumer.xsd'); + $this->schemaFile = $urnResolver->getRealPath('urn:magento:framework-message-queue:etc/consumer.xsd'); + $this->schemaQueueFile = $urnResolver->getRealPath('urn:magento:framework-message-queue:etc/queue.xsd'); } /** @@ -29,13 +40,13 @@ protected function setUp() public function testExemplarXml($fixtureXml, array $expectedErrors) { $validationState = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class); - $validationState->expects($this->any()) + $validationState->expects($this->atLeastOnce()) ->method('isValidationRequired') ->willReturn(true); $messageFormat = '%message%'; $dom = new \Magento\Framework\Config\Dom($fixtureXml, $validationState, [], null, null, $messageFormat); $actualErrors = []; - $actualResult = $dom->validate($this->_schemaFile, $actualErrors); + $actualResult = $dom->validate($this->schemaFile, $actualErrors); $this->assertEquals(empty($expectedErrors), $actualResult, "Validation result is invalid."); $this->assertEquals($expectedErrors, $actualErrors, "Validation errors does not match."); } @@ -125,4 +136,107 @@ public function exemplarXmlDataProvider() ]; // @codingStandardsIgnoreEnd } + + /** + * @param string $fixtureXml + * @param array $expectedErrors + * @dataProvider exemplarQueueXmlDataProvider + */ + public function testExemplarQueueXml($fixtureXml, array $expectedErrors) + { + $validationState = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class); + $validationState->expects($this->atLeastOnce()) + ->method('isValidationRequired') + ->willReturn(true); + $messageFormat = '%message%'; + $dom = new \Magento\Framework\Config\Dom($fixtureXml, $validationState, [], null, null, $messageFormat); + $actualErrors = []; + $actualResult = $dom->validate($this->schemaQueueFile, $actualErrors); + $this->assertEquals(empty($expectedErrors), $actualResult, "Validation result is invalid."); + $this->assertEquals($expectedErrors, $actualErrors, "Validation errors does not match."); + } + + /** + * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function exemplarQueueXmlDataProvider() + { + // @codingStandardsIgnoreStart + return [ + 'valid' => [ + '<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/queue.xsd"> + <broker topic="asd" > + <queue name="queue1" consumer="consumer1" handler="handlerClassOne1::handlerMethod1" consumerInstance="consumerClass1" maxMessages="5"/> + <queue name="queue2" consumer="consumer2" handler="handlerClassOne2::handlerMethod2" consumerInstance="consumerClass2" maxMessages="5"/> + </broker> + </config>', + [], + ], + 'invalid handler format' => [ + '<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/queue.xsd"> + <broker topic="asd" > + <queue name="queue1" consumer="consumer1" handler="handlerClass_One1::handlerMethod1" consumerInstance="consumerClass1" maxMessages="5"/> + <queue name="queue2" consumer="consumer2" handler="handlerClassOne2::handler_Method2" consumerInstance="consumerClass2" maxMessages="5"/> + </broker> + </config>', + [ + "Element 'queue', attribute 'handler': [facet 'pattern'] The value 'handlerClass_One1::handlerMethod1' is not accepted by the pattern '[a-zA-Z0-9\\\\]+::[a-zA-Z0-9]+'.", + "Element 'queue', attribute 'handler': 'handlerClass_One1::handlerMethod1' is not a valid value of the atomic type 'handlerType'.", + "Element 'queue', attribute 'handler': [facet 'pattern'] The value 'handlerClassOne2::handler_Method2' is not accepted by the pattern '[a-zA-Z0-9\\\\]+::[a-zA-Z0-9]+'.", + "Element 'queue', attribute 'handler': 'handlerClassOne2::handler_Method2' is not a valid value of the atomic type 'handlerType'.", + ], + ], + 'invalid instance format' => [ + '<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/queue.xsd"> + <broker topic="asd" > + <queue name="queue1" consumer="consumer1" handler="handlerClassOne1::handlerMethod1" consumerInstance="consumer_Class1" maxMessages="5"/> + <queue name="queue2" consumer="consumer2" handler="handlerClassOne2::handlerMethod2" consumerInstance="consumerClass_2" maxMessages="5"/> + </broker> + </config>', + [ + "Element 'queue', attribute 'consumerInstance': [facet 'pattern'] The value 'consumer_Class1' is not accepted by the pattern '[a-zA-Z0-9\\\\]+'.", + "Element 'queue', attribute 'consumerInstance': 'consumer_Class1' is not a valid value of the atomic type 'instanceType'.", + "Element 'queue', attribute 'consumerInstance': [facet 'pattern'] The value 'consumerClass_2' is not accepted by the pattern '[a-zA-Z0-9\\\\]+'.", + "Element 'queue', attribute 'consumerInstance': 'consumerClass_2' is not a valid value of the atomic type 'instanceType'.", + ], + ], + 'invalid maxMessages format' => [ + '<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/queue.xsd"> + <broker topic="asd" > + <queue name="queue1" consumer="consumer1" handler="handlerClassOne1::handlerMethod1" consumerInstance="consumerClass1" maxMessages="ABC"/> + <queue name="queue2" consumer="consumer2" handler="handlerClassOne2::handlerMethod2" consumerInstance="consumerClass2" maxMessages="5"/> + </broker> + </config>', + [ + "Element 'queue', attribute 'maxMessages': 'ABC' is not a valid value of the atomic type 'xs:integer'.", + ], + ], + 'unexpected element' => [ + '<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/queue.xsd"> + <broker topic="asd" > + <queue name="queue1" consumer="consumer1" handler="handlerClassOne1::handlerMethod1" consumerInstance="consumerClass1" maxMessages="2"/> + <queue name="queue2" consumer="consumer2" handler="handlerClassOne2::handlerMethod2" consumerInstance="consumerClass2" maxMessages="5"/> + <unexpected name="queue2"/> + </broker> + </config>', + [ + "Element 'unexpected': This element is not expected. Expected is ( queue ).", + ], + ], + 'unexpected attribute' => [ + '<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/queue.xsd"> + <broker topic="asd" > + <queue name="queue1" consumer="consumer1" handler="handlerClassOne1::handlerMethod1" consumerInstance="consumerClass1" maxMessages="2"/> + <queue name="queue2" consumer="consumer2" handler="handlerClassOne2::handlerMethod2" consumerInstance="consumerClass2" maxMessages="5" unexpected="unexpected"/> + </broker> + </config>', + [ + "Element 'queue', attribute 'unexpected': The attribute 'unexpected' is not allowed.", + ], + ], + ]; + // @codingStandardsIgnoreEnd + } } + diff --git a/lib/internal/Magento/Framework/MessageQueue/etc/queue_base.xsd b/lib/internal/Magento/Framework/MessageQueue/etc/queue_base.xsd index 4b326d637f274..bede197ec34de 100644 --- a/lib/internal/Magento/Framework/MessageQueue/etc/queue_base.xsd +++ b/lib/internal/Magento/Framework/MessageQueue/etc/queue_base.xsd @@ -41,7 +41,7 @@ </xs:documentation> </xs:annotation> <xs:restriction base="xs:string"> - <xs:pattern value="[a-zA-Z\\]+" /> + <xs:pattern value="[a-zA-Z0-9\\]+" /> <xs:minLength value="4" /> </xs:restriction> </xs:simpleType> @@ -53,7 +53,7 @@ </xs:documentation> </xs:annotation> <xs:restriction base="xs:string"> - <xs:pattern value="[a-zA-Z\\]+::[a-zA-Z]+" /> + <xs:pattern value="[a-zA-Z0-9\\]+::[a-zA-Z0-9]+" /> <xs:minLength value="5" /> </xs:restriction> </xs:simpleType> From ad5710702bb15dcd55939bbbebe3d1fefdd88f36 Mon Sep 17 00:00:00 2001 From: Lusine Hakobyan <lusine_hakobyan@epam.com> Date: Fri, 7 Sep 2018 18:52:27 +0400 Subject: [PATCH 07/27] MAGETWO-71375: Zero Subtotal Orders have incorrect status - Update automated test --- .../Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml index 3ef8ba7397e61..ea31a40301719 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml @@ -7,7 +7,7 @@ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="ZeroSubtotalOrdersWithProcessingStatusTest"> <annotations> <features value="Checkout"/> From e624c715d8abad0484ba48fbec4aa97d675aba5e Mon Sep 17 00:00:00 2001 From: David Grigoryan <david_grigoryan@epam.com> Date: Fri, 7 Sep 2018 19:43:08 +0400 Subject: [PATCH 08/27] MAGETWO-91521: Reports / Sales / Tax report show incorrect amount - Update automated test based on comments --- .../Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml | 5 +++-- app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml | 6 +++--- .../Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml index 7a2e5ddf54da2..64302fa11d007 100644 --- a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml @@ -7,7 +7,7 @@ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <!-- Change the tax configuration to display in cart and checkout flow --> <actionGroup name="editTaxConfigurationByUI"> <!-- navigate to the tax configuration page --> @@ -130,12 +130,13 @@ <argument name="taxClassName" type="string"/> </arguments> <!-- Go to tax rule page --> - <amOnPage url="/admin/tax/rule/new" stepKey="goToNewTaxRulePage"/> + <amOnPage url="{{AdminNewTaxRulePage.url}}" stepKey="goToNewTaxRulePage"/> <waitForPageLoad stepKey="waitForTaxRatePage"/> <click stepKey="clickAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> <scrollTo stepKey="scrollToAdditionalSettings" selector="{{AdminTaxRulesSection.additionalSettings}}"/> <moveMouseOver stepKey="hoverDeleteElement" selector="{{AdminTaxRulesSection.deleteTaxClassName(taxClassName)}}"/> <click stepKey="deleteFirstTaxClass" selector="{{AdminTaxRulesSection.deleteTaxClass(taxClassName)}}"/> + <waitForElementVisible selector="{{AdminTaxRulesSection.popUpDialogOK}}" stepKey="waitForElementBecomeVisible"/> <click stepKey="acceptPopUpDialog" selector="{{AdminTaxRulesSection.popUpDialogOK}}"/> <waitForPageLoad stepKey="waitForProductTaxClassDeleted"/> </actionGroup> diff --git a/app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml b/app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml index 6f666c18b7ac0..9fdc5f2780068 100644 --- a/app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml +++ b/app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml @@ -7,7 +7,7 @@ --> <entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> <entity name="SimpleTaxNY" type="tax"> <data key="state">New York</data> <data key="country">United States</data> @@ -29,13 +29,13 @@ <entity name="SimpleTaxWithZipCode" type="tax"> <data key="state">California</data> <data key="country">United States</data> - <data key="zip">35005</data> + <data key="zip">78729</data> <data key="rate">7.25</data> </entity> <entity name="SimpleSecondTaxWithZipCode" type="tax"> <data key="state">California</data> <data key="country">United States</data> - <data key="zip">35005</data> + <data key="zip">78729</data> <data key="rate">0.125</data> </entity> </entities> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml index 2bb3f1282e49f..fedf2af8bd1a2 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml @@ -7,7 +7,7 @@ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminTaxReportGridTest"> <annotations> <features value="Tax"/> From 88bc248371941af6384db67463c72455f1d3d8e6 Mon Sep 17 00:00:00 2001 From: Aliaksei_Manenak <Aliaksei_Manenak@epam.com> Date: Mon, 10 Sep 2018 11:12:10 +0300 Subject: [PATCH 09/27] MAGETWO-91742: "Sort by" not working on Catalog Search results page - Added hint under configuration. --- app/code/Magento/Catalog/etc/adminhtml/system.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/etc/adminhtml/system.xml b/app/code/Magento/Catalog/etc/adminhtml/system.xml index 71a799fd22427..d6c98b92596fd 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/system.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/system.xml @@ -83,8 +83,9 @@ <backend_model>Magento\Catalog\Model\Indexer\Product\Flat\System\Config\Mode</backend_model> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="default_sort_by" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> + <field id="default_sort_by" translate="label comment" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> <label>Product Listing Sort by</label> + <comment>Applies to category pages</comment> <source_model>Magento\Catalog\Model\Config\Source\ListSort</source_model> </field> <field id="list_allow_all" translate="label comment" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1"> From f47347fdc2e92668ad5ea40a5e6ec9fee2238b0e Mon Sep 17 00:00:00 2001 From: Nikita Chubukov <nikita_chubukov@epam.com> Date: Wed, 5 Sep 2018 18:14:28 +0300 Subject: [PATCH 10/27] MAGETWO-91531: Some products use Categories Path for Product URLs - Change logic for obtaining URL of product if "Use Categories Path for Product URLs" option enabled --- .../Magento/Catalog/Model/Product/Url.php | 21 ++++++++++++++++++- .../ResourceModel/Product/Collection.php | 7 ++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Url.php b/app/code/Magento/Catalog/Model/Product/Url.php index c291dc33fedab..aff3d558dbdab 100644 --- a/app/code/Magento/Catalog/Model/Product/Url.php +++ b/app/code/Magento/Catalog/Model/Product/Url.php @@ -7,6 +7,7 @@ use Magento\UrlRewrite\Model\UrlFinderInterface; use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; +use Magento\Framework\App\Config\ScopeConfigInterface; /** * Product Url model @@ -45,6 +46,11 @@ class Url extends \Magento\Framework\DataObject */ protected $urlFinder; + /** + * @var \Magento\Framework\App\Config\ScopeConfigInterface + */ + private $scopeConfig; + /** * @param \Magento\Framework\UrlFactory $urlFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager @@ -52,6 +58,7 @@ class Url extends \Magento\Framework\DataObject * @param \Magento\Framework\Session\SidResolverInterface $sidResolver * @param UrlFinderInterface $urlFinder * @param array $data + * @param ScopeConfigInterface|null $scopeConfig */ public function __construct( \Magento\Framework\UrlFactory $urlFactory, @@ -59,7 +66,8 @@ public function __construct( \Magento\Framework\Filter\FilterManager $filter, \Magento\Framework\Session\SidResolverInterface $sidResolver, UrlFinderInterface $urlFinder, - array $data = [] + array $data = [], + ScopeConfigInterface $scopeConfig = null ) { parent::__construct($data); $this->urlFactory = $urlFactory; @@ -67,6 +75,8 @@ public function __construct( $this->filter = $filter; $this->sidResolver = $sidResolver; $this->urlFinder = $urlFinder; + $this->scopeConfig = $scopeConfig ?: + \Magento\Framework\App\ObjectManager::getInstance()->get(ScopeConfigInterface::class); } /** @@ -157,10 +167,19 @@ public function getUrl(\Magento\Catalog\Model\Product $product, $params = []) UrlRewrite::ENTITY_TYPE => \Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator::ENTITY_TYPE, UrlRewrite::STORE_ID => $storeId, ]; + $useCategories = $this->scopeConfig->getValue( + \Magento\Catalog\Helper\Product::XML_PATH_PRODUCT_URL_USE_CATEGORY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + if ($categoryId) { $filterData[UrlRewrite::METADATA]['category_id'] = $categoryId; + } elseif (!$useCategories) { + $filterData[UrlRewrite::METADATA]['category_id'] = ''; } + $rewrite = $this->urlFinder->findOneByData($filterData); + if ($rewrite) { $requestPath = $rewrite->getRequestPath(); $product->setRequestPath($requestPath); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php index 4384effc4e359..b4470e6b3cae5 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php @@ -1412,8 +1412,13 @@ protected function _addUrlRewrite() ['cu' => $this->getTable('catalog_url_rewrite_product_category')], 'u.url_rewrite_id=cu.url_rewrite_id' )->where('cu.category_id IN (?)', $this->_urlRewriteCategory); + } else { + $select->joinLeft( + ['cu' => $this->getTable('catalog_url_rewrite_product_category')], + 'u.url_rewrite_id=cu.url_rewrite_id' + )->where('cu.url_rewrite_id IS NULL'); } - + // more priority is data with category id $urlRewrites = []; From 463a18335577e0126de58edea0a0134dc17bae73 Mon Sep 17 00:00:00 2001 From: Yauhen_Lyskavets <yauhen_lyskavets@epam.com> Date: Mon, 10 Sep 2018 19:07:02 +0300 Subject: [PATCH 11/27] MAGETWO-91768: Customer section not updated after subscription declined - Fix added --- .../Newsletter/Controller/Subscriber/Unsubscribe.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php b/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php index efc469e15deaa..28abdef1f2ad8 100644 --- a/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php +++ b/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php @@ -9,8 +9,9 @@ class Unsubscribe extends \Magento\Newsletter\Controller\Subscriber { /** - * Unsubscribe newsletter - * @return void + * Unsubscribe newsletter. + * + * @return \Magento\Backend\Model\View\Result\Redirect */ public function execute() { @@ -27,6 +28,9 @@ public function execute() $this->messageManager->addException($e, __('Something went wrong while unsubscribing you.')); } } - $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl()); + /** @var \Magento\Backend\Model\View\Result\Redirect $redirect */ + $redirect = $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT); + $redirectUrl = $this->_redirect->getRedirectUrl(); + return $redirect->setUrl($redirectUrl); } } From 515810005cbbfdd788ad3156dc064961836d2a5a Mon Sep 17 00:00:00 2001 From: Lusine Hakobyan <lusine_hakobyan@epam.com> Date: Tue, 11 Sep 2018 10:48:07 +0400 Subject: [PATCH 12/27] MAGETWO-71375: Zero Subtotal Orders have incorrect status - Update automated test according to review --- .../Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml index ea31a40301719..2dcd98211c4db 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml @@ -36,7 +36,7 @@ <createData entity="DefaultShippingMethodsConfig" stepKey="defaultShippingMethodsConfig"/> <createData entity="DisableFreeShippingConfig" stepKey="disableFreeShippingConfig"/> <createData entity="DisablePaymentMethodsSettingConfig" stepKey="disablePaymentMethodsSettingConfig"/> - <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> + <actionGroup ref="logout" stepKey="logout"/> <deleteData createDataKey="simpleproduct" stepKey="deleteProduct"/> <deleteData createDataKey="simplecategory" stepKey="deleteCategory"/> </after> From 2b6dd1da4ab2e90e3facd9b269eaa81a22b1668d Mon Sep 17 00:00:00 2001 From: Lusine Hakobyan <lusine_hakobyan@epam.com> Date: Tue, 11 Sep 2018 11:01:00 +0400 Subject: [PATCH 13/27] MAGETWO-91521: Reports / Sales / Tax report show incorrect amount - Update automated test according to comments --- app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml index fedf2af8bd1a2..1a8a56760b25b 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml @@ -215,7 +215,7 @@ <argument name="taxClassName" value="TaxClasses2"/> </actionGroup> - <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> + <actionGroup ref="logout" stepKey="logout"/> </after> </test> </tests> From 4249d9a79d5fae65845a58807c2f44600935de87 Mon Sep 17 00:00:00 2001 From: Dzmitry Tabusheu <dzmitry_tabusheu@epam.com> Date: Mon, 10 Sep 2018 15:11:44 +0300 Subject: [PATCH 14/27] MAGETWO-69959: [GitHub] On editing a Bundle product from shopping cart the user defined quantities of the options are overwritten #4942 - Added user defined quantities of bundle options to bundle json config --- .../Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php index 542f170da8c3a..3bf4fd5709702 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php @@ -178,6 +178,10 @@ public function getJsonConfig() $configValue = $preConfiguredValues->getData('bundle_option/' . $optionId); if ($configValue) { $defaultValues[$optionId] = $configValue; + $configQty = $preConfiguredValues->getData('bundle_option_qty/' . $optionId); + if ($configQty) { + $options[$optionId]['selections'][$configValue]['qty'] = $configQty; + } } } $position++; From c9b75ab3855065441bcb0c37fac40c312072cc63 Mon Sep 17 00:00:00 2001 From: Nikita Chubukov <nikita_chubukov@epam.com> Date: Tue, 11 Sep 2018 17:22:25 +0300 Subject: [PATCH 15/27] MAGETWO-69274: Admin able to send order comment email without Sales Email privileges - Added additional check of possibility to sending email to user --- app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php index 1912655a9292d..10b80b6f4e527 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php @@ -88,7 +88,8 @@ public function getStatuses() */ public function canSendCommentEmail() { - return $this->_salesData->canSendOrderCommentEmail($this->getOrder()->getStore()->getId()); + return $this->_salesData->canSendOrderCommentEmail($this->getOrder()->getStore()->getId()) + && $this->_authorization->isAllowed('Magento_Sales::email'); } /** From 28066af727297dfb5b8bc2693385227bee34e274 Mon Sep 17 00:00:00 2001 From: Yauhen_Lyskavets <yauhen_lyskavets@epam.com> Date: Wed, 12 Sep 2018 16:34:36 +0300 Subject: [PATCH 16/27] MAGETWO-91694: Product does not get removed from flat product table after getting disabled - Fix added - Refactoring --- .../Indexer/Product/Flat/Action/Eraser.php | 64 +++++++++++++++++-- .../Model/Indexer/Product/Flat/Action/Row.php | 1 + 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php index 8182e6f07fab1..85f73044643a9 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php @@ -8,6 +8,8 @@ namespace Magento\Catalog\Model\Indexer\Product\Flat\Action; use Magento\Framework\App\ResourceConnection; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Store\Model\Store; class Eraser { @@ -50,12 +52,7 @@ public function __construct( */ public function removeDeletedProducts(array &$ids, $storeId) { - $select = $this->connection->select()->from( - $this->productIndexerHelper->getTable('catalog_product_entity') - )->where( - 'entity_id IN(?)', - $ids - ); + $select = $this->getSelectForProducts($ids); $result = $this->connection->query($select); $existentProducts = []; @@ -69,6 +66,61 @@ public function removeDeletedProducts(array &$ids, $storeId) $this->deleteProductsFromStore($productsToDelete, $storeId); } + /** + * Remove products with "Disabled" status from the flat table(s). + * + * @param array $ids + * @param int $storeId + * @return void + */ + public function removeDisabledProducts(array &$ids, $storeId) + { + /* @var $statusAttribute \Magento\Eav\Model\Entity\Attribute */ + $statusAttribute = $this->productIndexerHelper->getAttribute('status'); + + $select = $this->getSelectForProducts($ids); + $select->joinLeft( + ['status_global_attr' => $statusAttribute->getBackendTable()], + ' status_global_attr.attribute_id = ' . (int)$statusAttribute->getAttributeId() + . ' AND status_global_attr.store_id = ' . Store::DEFAULT_STORE_ID, + [] + ); + $select->joinLeft( + ['status_attr' => $statusAttribute->getBackendTable()], + ' status_attr.attribute_id = ' . (int)$statusAttribute->getAttributeId() + . ' AND status_attr.store_id = ' . $storeId, + [] + ); + $select->where('IFNULL(status_attr.value, status_global_attr.value) = ?', Status::STATUS_DISABLED); + + $result = $this->connection->query($select); + + $disabledProducts = []; + foreach ($result->fetchAll() as $product) { + $disabledProducts[] = $product['entity_id']; + } + + if (!empty($disabledProducts)) { + $ids = array_diff($ids, $disabledProducts); + $this->deleteProductsFromStore($disabledProducts, $storeId); + } + } + + /** + * Get Select object for existed products. + * + * @param array $ids + * @return \Magento\Framework\DB\Select + */ + private function getSelectForProducts(array $ids) + { + $productTable = $this->productIndexerHelper->getTable('catalog_product_entity'); + $select = $this->connection->select()->from($productTable) + ->columns('entity_id') + ->where('entity_id IN(?)', $ids); + return $select; + } + /** * Delete products from flat table(s) * diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php index b5dbdb68606ff..19fa9aed485b0 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php @@ -74,6 +74,7 @@ public function execute($id = null) $tableExists = $this->_isFlatTableExists($store->getId()); if ($tableExists) { $this->flatItemEraser->removeDeletedProducts($ids, $store->getId()); + $this->flatItemEraser->removeDisabledProducts($ids, $store->getId()); } if (isset($ids[0])) { if (!$tableExists) { From 5c86bf382b18e40b65f2843a0103b01064ca8004 Mon Sep 17 00:00:00 2001 From: Yauhen_Lyskavets <yauhen_lyskavets@epam.com> Date: Thu, 20 Sep 2018 17:30:01 +0300 Subject: [PATCH 17/27] MAGETWO-91694: Product does not get removed from flat product table after getting disabled - Fix units --- .../Test/Unit/Model/Indexer/Product/Flat/Action/EraserTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/Action/EraserTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/Action/EraserTest.php index cc6f5d84ef001..c04428eadef0d 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/Action/EraserTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/Action/EraserTest.php @@ -54,6 +54,7 @@ public function testRemoveDeletedProducts() $productsToDeleteIds = [1, 2]; $select = $this->createMock(\Magento\Framework\DB\Select::class); $select->expects($this->once())->method('from')->with('catalog_product_entity')->will($this->returnSelf()); + $select->expects($this->once())->method('columns')->with('entity_id')->will($this->returnSelf()); $select->expects($this->once())->method('where')->with('entity_id IN(?)', $productsToDeleteIds) ->will($this->returnSelf()); $products = [['entity_id' => 2]]; From 9446176ec52f41b39ac0023f8fb91852fc30b3dc Mon Sep 17 00:00:00 2001 From: Yauhen_Lyskavets <yauhen_lyskavets@epam.com> Date: Fri, 21 Sep 2018 12:57:42 +0300 Subject: [PATCH 18/27] MAGETWO-91768: Customer section not updated after subscription declined - Code mess fix --- .../Magento/Newsletter/Controller/Subscriber/Unsubscribe.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php b/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php index 28abdef1f2ad8..de5f635693a93 100644 --- a/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php +++ b/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php @@ -6,7 +6,9 @@ */ namespace Magento\Newsletter\Controller\Subscriber; -class Unsubscribe extends \Magento\Newsletter\Controller\Subscriber +use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; + +class Unsubscribe extends \Magento\Newsletter\Controller\Subscriber implements HttpGetActionInterface { /** * Unsubscribe newsletter. From c10859daaf3fb786ba119abb7edb4fb8509de93f Mon Sep 17 00:00:00 2001 From: Yauhen_Lyskavets <yauhen_lyskavets@epam.com> Date: Fri, 21 Sep 2018 14:19:53 +0300 Subject: [PATCH 19/27] MAGETWO-91694: Product does not get removed from flat product table after getting disabled - Statics fix --- .../Catalog/Model/Indexer/Product/Flat/Action/Eraser.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php index 85f73044643a9..6762602aecaf1 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php @@ -11,6 +11,9 @@ use Magento\Catalog\Model\Product\Attribute\Source\Status; use Magento\Store\Model\Store; +/** + * Flat item eraser. Used to clear items from the catalog flat table. + */ class Eraser { /** From 0926605abee3b4f062df325325e130267e977c88 Mon Sep 17 00:00:00 2001 From: Yauhen_Lyskavets <yauhen_lyskavets@epam.com> Date: Fri, 21 Sep 2018 14:38:24 +0300 Subject: [PATCH 20/27] MAGETWO-91768: Customer section not updated after subscription declined - Statics fix --- .../Magento/Newsletter/Controller/Subscriber/Unsubscribe.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php b/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php index de5f635693a93..83a28e04fd2c1 100644 --- a/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php +++ b/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php @@ -1,6 +1,5 @@ <?php /** - * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ @@ -8,6 +7,9 @@ use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; +/** + * Customers unsubscribe controller. + */ class Unsubscribe extends \Magento\Newsletter\Controller\Subscriber implements HttpGetActionInterface { /** From 02cbc33f3bb4c400e545b072f484a1dfc8c993b1 Mon Sep 17 00:00:00 2001 From: Yauhen_Lyskavets <yauhen_lyskavets@epam.com> Date: Fri, 21 Sep 2018 14:52:45 +0300 Subject: [PATCH 21/27] MAGETWO-91768: Customer section not updated after subscription declined - Statics fix --- .../Magento/Newsletter/Controller/Subscriber/Unsubscribe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php b/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php index 83a28e04fd2c1..88fa128162700 100644 --- a/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php +++ b/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php @@ -8,7 +8,7 @@ use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; /** - * Customers unsubscribe controller. + * Controller for unsubscribing customers. */ class Unsubscribe extends \Magento\Newsletter\Controller\Subscriber implements HttpGetActionInterface { From b7f7a581706842af57f5475f6ad303fc46f381b7 Mon Sep 17 00:00:00 2001 From: Oksana_Kremen <Oksana_Kremen@epam.com> Date: Fri, 21 Sep 2018 15:27:00 +0300 Subject: [PATCH 22/27] MAGETWO-91717: Using a number in module name will cause custom message consumers in xml to be invalid - Statics fix --- .../Framework/MessageQueue/Test/Unit/Consumer/Config/XsdTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/internal/Magento/Framework/MessageQueue/Test/Unit/Consumer/Config/XsdTest.php b/lib/internal/Magento/Framework/MessageQueue/Test/Unit/Consumer/Config/XsdTest.php index b99dc6a3ff902..448a8a3db7407 100644 --- a/lib/internal/Magento/Framework/MessageQueue/Test/Unit/Consumer/Config/XsdTest.php +++ b/lib/internal/Magento/Framework/MessageQueue/Test/Unit/Consumer/Config/XsdTest.php @@ -239,4 +239,3 @@ public function exemplarQueueXmlDataProvider() // @codingStandardsIgnoreEnd } } - From 060cbbaec83f089f998df9e8beff35d57df7e49f Mon Sep 17 00:00:00 2001 From: Oksana_Kremen <Oksana_Kremen@epam.com> Date: Fri, 21 Sep 2018 15:34:44 +0300 Subject: [PATCH 23/27] MAGETWO-91521: Reports / Sales / Tax report show incorrect amount - Statics fix --- .../Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php | 7 ++++--- .../Tax/Model/ResourceModel/Report/Tax/Createdat.php | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php index 7ca6b803f5b2b..f65a2b964fb38 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php @@ -53,7 +53,8 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc + * * @codeCoverageIgnore */ protected function _construct() @@ -64,7 +65,7 @@ protected function _construct() } /** - * {@inheritdoc} + * @inheritdoc */ public function getResourceCollectionName() { @@ -74,7 +75,7 @@ public function getResourceCollectionName() } /** - * {@inheritdoc} + * @inheritdoc */ protected function _prepareColumns() { diff --git a/app/code/Magento/Tax/Model/ResourceModel/Report/Tax/Createdat.php b/app/code/Magento/Tax/Model/ResourceModel/Report/Tax/Createdat.php index 4f26d155acdea..60cb6fe2898ae 100644 --- a/app/code/Magento/Tax/Model/ResourceModel/Report/Tax/Createdat.php +++ b/app/code/Magento/Tax/Model/ResourceModel/Report/Tax/Createdat.php @@ -11,6 +11,9 @@ */ namespace Magento\Tax\Model\ResourceModel\Report\Tax; +/** + * Class for tax report resource model with aggregation by created at + */ class Createdat extends \Magento\Reports\Model\ResourceModel\Report\AbstractReport { /** From 698875ad16857f69444346341f4862cd51adba7f Mon Sep 17 00:00:00 2001 From: Nikita Chubukov <nikita_chubukov@epam.com> Date: Fri, 21 Sep 2018 16:04:53 +0300 Subject: [PATCH 24/27] MAGETWO-91531: Some products use Categories Path for Product URLs - Fix of Static test --- app/code/Magento/Catalog/Model/Product/Url.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Url.php b/app/code/Magento/Catalog/Model/Product/Url.php index aff3d558dbdab..f3ac9f55d1aea 100644 --- a/app/code/Magento/Catalog/Model/Product/Url.php +++ b/app/code/Magento/Catalog/Model/Product/Url.php @@ -79,16 +79,6 @@ public function __construct( \Magento\Framework\App\ObjectManager::getInstance()->get(ScopeConfigInterface::class); } - /** - * Retrieve URL Instance - * - * @return \Magento\Framework\UrlInterface - */ - private function getUrlInstance() - { - return $this->urlFactory->create(); - } - /** * Retrieve URL in current store * @@ -213,6 +203,7 @@ public function getUrl(\Magento\Catalog\Model\Product $product, $params = []) $routeParams['_query'] = []; } - return $this->getUrlInstance()->setScope($storeId)->getUrl($routePath, $routeParams); + $url = $this->urlFactory->create()->setScope($storeId); + return $url->getUrl($routePath, $routeParams); } } From 1d912436262fc3f5ff76635bdd9f1885c216372e Mon Sep 17 00:00:00 2001 From: Veronika Kurochkina <veronika_kurochkina@epam.com> Date: Fri, 21 Sep 2018 17:03:36 +0300 Subject: [PATCH 25/27] MAGETWO-91659: Cannot set Phone Number not required - Fix static tests --- app/code/Magento/Customer/Helper/Address.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/code/Magento/Customer/Helper/Address.php b/app/code/Magento/Customer/Helper/Address.php index b6897bca585af..cfc76753fa10a 100644 --- a/app/code/Magento/Customer/Helper/Address.php +++ b/app/code/Magento/Customer/Helper/Address.php @@ -127,6 +127,8 @@ public function getBookUrl() } /** + * Retrieve edit url. + * * @return void */ public function getEditUrl() @@ -134,6 +136,8 @@ public function getEditUrl() } /** + * Retrieve delete url. + * * @return void */ public function getDeleteUrl() @@ -141,6 +145,8 @@ public function getDeleteUrl() } /** + * Retrieve create url. + * * @return void */ public function getCreateUrl() @@ -148,6 +154,8 @@ public function getCreateUrl() } /** + * Retrieve block renderer. + * * @param string $renderer * @return \Magento\Framework\View\Element\BlockInterface */ @@ -204,6 +212,8 @@ public function getStreetLines($store = null) } /** + * Retrieve address format. + * * @param string $code * @return Format|string */ From 8874953e4f0aa54c0a4673e8b7ee1a20f2784d28 Mon Sep 17 00:00:00 2001 From: Veronika Kurochkina <veronika_kurochkina@epam.com> Date: Wed, 26 Sep 2018 15:24:59 +0300 Subject: [PATCH 26/27] MAGETWO-91521: Reports / Sales / Tax report show incorrect amount - Update automated test --- .../Tax/Test/Mftf/Data/TaxCodeData.xml | 4 ++-- .../Mftf/Section/AdminTaxRulesSection.xml | 1 + .../Test/Mftf/Test/AdminTaxReportGridTest.xml | 23 ++++++++++--------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml b/app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml index 9fdc5f2780068..36929ef2e3fa1 100644 --- a/app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml +++ b/app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml @@ -27,13 +27,13 @@ <data key="rate">0</data> </entity> <entity name="SimpleTaxWithZipCode" type="tax"> - <data key="state">California</data> + <data key="state">Texas</data> <data key="country">United States</data> <data key="zip">78729</data> <data key="rate">7.25</data> </entity> <entity name="SimpleSecondTaxWithZipCode" type="tax"> - <data key="state">California</data> + <data key="state">Texas</data> <data key="country">United States</data> <data key="zip">78729</data> <data key="rate">0.125</data> diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRulesSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRulesSection.xml index 6f103573ad2d2..4fadce2998676 100644 --- a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRulesSection.xml +++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRulesSection.xml @@ -19,6 +19,7 @@ <element name="country" type="select" selector="#tax_country_id"/> <element name="rate" type="input" selector="#rate"/> <element name="save" type="button" selector=".action-save" timeout="30"/> + <element name="saveRule" type="button" selector="#save" timeout="30"/> <element name="additionalSettings" type="button" selector="#details-summarybase_fieldset"/> <element name="productAddNewTaxClass" type="button" selector="//*[@id='tax_product_class']/following-sibling::section//*[contains(text(),'Add New Tax Class')]"/> <element name="fieldProdNewTaxClass" type="input" selector="//*[@id='tax_product_class']/following-sibling::section//input[@class='mselect-input']"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml index 1a8a56760b25b..68fe8087c4fcd 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml @@ -35,8 +35,8 @@ </actionGroup> <click stepKey="disableDefaultProdTaxClass" selector="{{AdminTaxRulesSection.defaultTaxClass}}"/> - - <click stepKey="clickSave" selector="{{AdminStoresMainActionsSection.saveButton}}"/> + <waitForPageLoad stepKey="waitForTaxRulePage"/> + <click stepKey="clickSave" selector="{{AdminTaxRulesSection.saveRule}}"/> <waitForPageLoad stepKey="waitForNewTaxRuleCreated"/> <!-- Go to tax rule page to create second Tax Rule--> @@ -52,7 +52,8 @@ </actionGroup> <click stepKey="disableSecondProdTaxClass" selector="{{AdminTaxRulesSection.defaultTaxClass}}"/> - <click stepKey="clickSaveBtn" selector="{{AdminStoresMainActionsSection.saveButton}}"/> + <waitForPageLoad stepKey="waitForTaxRulePage2"/> + <click stepKey="clickSaveBtn" selector="{{AdminTaxRulesSection.saveRule}}"/> <waitForPageLoad stepKey="waitForSecondTaxRuleCreated"/> <createData entity="_defaultCategory" stepKey="createCategory"/> @@ -97,7 +98,7 @@ <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> <click selector="{{AdminOrderFormActionSection.CreateNewCustomer}}" stepKey="clickCreateCustomer"/> <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> - + <waitForPageLoad stepKey="waitForPage" time="60"/> <!--Check if order can be submitted without the required fields including email address--> <scrollToTopOfPage stepKey="scrollToTopOfOrderFormPage" after="seeNewOrderPageTitle"/> <actionGroup ref="addSimpleProductToOrder" stepKey="addFirstProductToOrder" after="scrollToTopOfOrderFormPage"> @@ -145,7 +146,7 @@ <!--click "here" to refresh last day's statistics --> <click stepKey="clickRefrashStatisticsHere" selector="{{AdminTaxReportsSection.refreshStatistics}}"/> - <waitForPageLoad stepKey="waitForRefrash"/> + <waitForPageLoad stepKey="waitForRefresh"/> <!--Select Dates--> <fillField selector="{{AdminTaxReportsSection.fromDate}}" userInput="05/16/2018" stepKey="fillDateFrom"/> @@ -153,23 +154,23 @@ <click selector="{{AdminTaxReportsSection.goTodayButton}}" stepKey="clickGoTodayDate"/> <!--Click "Show report" in the upper right corner.--> <click selector="{{AdminTaxReportsSection.showReportButton}}" stepKey="clickShowReportButton"/> - + <waitForPageLoad time="60" stepKey="waitForReload"/> <!--Tax Report Grid displays Tax amount in rows. "Total" and "Subtotal" is a sum of all tax amounts--> - <grabTextFrom selector="{{AdminTaxReportsSection.taxRuleAmount('TaxRate1')}}" stepKey="amountOfFirstTaxRate"/> - <grabTextFrom selector="{{AdminTaxReportsSection.taxRuleAmount('TaxRate2')}}" stepKey="amountOfSecondTaxRate"/> + <grabTextFrom selector="{{AdminTaxReportsSection.taxRuleAmount('Texas-0.125')}}" stepKey="amountOfFirstTaxRate"/> + <grabTextFrom selector="{{AdminTaxReportsSection.taxRuleAmount('Texas-7.25')}}" stepKey="amountOfSecondTaxRate"/> <grabTextFrom selector="{{AdminTaxReportsSection.taxRuleAmount('Subtotal')}}" stepKey="amountOfSubtotalTaxRate"/> <assertEquals stepKey="assertSubtotalFirstField"> - <expectedResult type="string">$0.87</expectedResult> + <expectedResult type="string">$0.15</expectedResult> <actualResult type="variable">amountOfFirstTaxRate</actualResult> </assertEquals> <assertEquals stepKey="assertSubtotalSecondField"> - <expectedResult type="string">$0.02</expectedResult> + <expectedResult type="string">$8.92</expectedResult> <actualResult type="variable">amountOfSecondTaxRate</actualResult> </assertEquals> <assertEquals stepKey="assertSubtotalField"> - <expectedResult type="string">$0.89</expectedResult> + <expectedResult type="string">$9.07</expectedResult> <actualResult type="variable">amountOfSubtotalTaxRate</actualResult> </assertEquals> From 6a36742e070e0ece9fe0670d9935bfead70e552a Mon Sep 17 00:00:00 2001 From: Veronika Kurochkina <veronika_kurochkina@epam.com> Date: Wed, 26 Sep 2018 19:54:05 +0300 Subject: [PATCH 27/27] MAGETWO-71375: Zero Subtotal Orders have incorrect status - Update automation test --- .../StorefrontShippmentFromActionGroup.xml | 14 +++++++++++++- .../Test/Mftf/Section/CheckoutShippingSection.xml | 1 + .../ZeroSubtotalOrdersWithProcessingStatusTest.xml | 10 +++++----- .../Section/AdminCartPriceRulesFormSection.xml | 1 - .../Test/Mftf/Section/DiscountSection.xml | 3 ++- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontShippmentFromActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontShippmentFromActionGroup.xml index c14b55d0ea663..354ad6d2b44ba 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontShippmentFromActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontShippmentFromActionGroup.xml @@ -9,9 +9,21 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> <!--Fill shipment form for free shipping--> - <actionGroup name="ShipmentFormFreeShippingActionGroup" extends="ShipmentFormActionGroup"> + <actionGroup name="ShipmentFormFreeShippingActionGroup"> + <fillField selector="{{CheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="setCustomerEmail"/> + <fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="SetCustomerFirstName"/> + <fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="SetCustomerLastName"/> + <fillField selector="{{CheckoutShippingSection.street}}" userInput="{{CustomerAddressSimple.street}}" stepKey="SetCustomerStreetAddress"/> + <fillField selector="{{CheckoutShippingSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="SetCustomerCity"/> + <fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="SetCustomerZipCode"/> + <fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="SetCustomerPhoneNumber"/> + <click selector="{{CheckoutShippingSection.region}}" stepKey="clickToSetState"/> + <click selector="{{CheckoutShippingSection.state}}" stepKey="clickToChooseState"/> <see userInput="$0.00 Free Free Shipping" selector="{{CheckoutShippingMethodsSection.shippingMethodRowByName('Free Shipping')}}" stepKey="seeShippingMethod" after="clickToChooseState"/> <click selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('Free Shipping')}}" stepKey="selectFlatShippingMethod" after="seeShippingMethod"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask" after="selectFlatShippingMethod"/> + <click selector="{{CheckoutShippingSection.next}}" stepKey="clickToSaveShippingInfo"/> + <waitForPageLoad time="5" stepKey="waitForReviewAndPaymentsPageIsLoaded"/> + <seeInCurrentUrl url="payment" stepKey="reviewAndPaymentIsShown"/> </actionGroup> </actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml index 494a365ffd507..ff7f8995c0681 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml @@ -31,6 +31,7 @@ <element name="next" type="button" selector="button.button.action.continue.primary" timeout="30"/> <element name="firstShippingMethod" type="radio" selector="//*[@id='checkout-shipping-method-load']//input[@class='radio']"/> <element name="defaultShipping" type="button" selector=".billing-address-details"/> + <element name="state" type="button" selector="//*[text()='Alabama']"/> <element name="stateInput" type="input" selector="input[name=region]"/> </section> </sections> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml index 2dcd98211c4db..aaedaedb7236c 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml @@ -66,16 +66,16 @@ </actionGroup> <!--Proceed to shipment--> - <click selector="{{ProductCardSection.showCard}}" stepKey="clickToOpenCard"/> - <click selector="{{ProductCardSection.proceed}}" stepKey="clickToProceedToCheckout"/> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickToOpenCard"/> + <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="clickToProceedToCheckout"/> <waitForPageLoad stepKey="waitForTheFormIsOpened"/> <!--Fill shipping form--> <actionGroup ref="ShipmentFormFreeShippingActionGroup" stepKey="shipmentFormFreeShippingActionGroup"/> - <click selector="{{ProductCardSection.addCoupon}}" stepKey="clickToAddDiscount"/> - <fillField selector="{{ProductCardSection.addCode}}" userInput="{{_defaultCoupon.code}}" stepKey="TypeDiscountCode"/> - <click selector="{{ProductCardSection.applyDiscount}}" stepKey="clickToApplyDiscount"/> + <click selector="{{DiscountSection.DiscountTab}}" stepKey="clickToAddDiscount"/> + <fillField selector="{{DiscountSection.DiscountInput}}" userInput="{{_defaultCoupon.code}}" stepKey="TypeDiscountCode"/> + <click selector="{{DiscountSection.ApplyCodeBtn}}" stepKey="clickToApplyDiscount"/> <waitForPageLoad stepKey="WaitForDiscountToBeAdded"/> <see userInput="Your coupon was successfully applied." stepKey="verifyText"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml b/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml index 951909e22bcef..d8253505c42e4 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml @@ -20,7 +20,6 @@ <element name="customerGroups" type="multiselect" selector="select[name='customer_group_ids']"/> <element name="coupon" type="select" selector="select[name='coupon_type']"/> <element name="couponCode" type="input" selector="input[name='coupon_code']"/> - <element name="userPerCoupon" type="input" selector="input[name='uses_per_coupon']"/> <element name="useAutoGeneration" type="checkbox" selector="input[name='use_auto_generation']"/> <element name="userPerCoupon" type="input" selector="//input[@name='uses_per_coupon']"/> <element name="userPerCustomer" type="input" selector="//input[@name='uses_per_customer']"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Section/DiscountSection.xml b/app/code/Magento/SalesRule/Test/Mftf/Section/DiscountSection.xml index cbab097c5291b..e14bfb554b3f6 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Section/DiscountSection.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Section/DiscountSection.xml @@ -8,8 +8,9 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="DiscountSection"> - <element name="DiscountTab" type="button" selector="//strong[text()='Apply Discount Code']"/> + <element name="DiscountTab" type="button" selector="//*[text()='Apply Discount Code']"/> <element name="CouponInput" type="input" selector="#coupon_code"/> + <element name="DiscountInput" type="input" selector="#discount-code"/> <element name="ApplyCodeBtn" type="button" selector="//span[text()='Apply Discount']"/> </section> </sections>