diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml index 93664ffa64218..3320f69b393a1 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml @@ -1026,6 +1026,19 @@ 2 EavStockItem + + Testp + testsku + simple + 4 + 4 + 560.00 + testurl- + 1 + 25 + 200 + EavStock100 + ProductOptionMultiSelect diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionActionGroup.xml index 66f89bfc37365..42608bf36096b 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionActionGroup.xml @@ -9,13 +9,13 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - + - - - - + + + + @@ -25,8 +25,8 @@ - + - + - \ No newline at end of file + diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleConditionsSectionActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleConditionsSectionActionGroup.xml deleted file mode 100644 index ab45aae46db1d..0000000000000 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleConditionsSectionActionGroup.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleLabelsSectionActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleLabelsSectionActionGroup.xml index 4133cc44ebc15..e9d5f07701bd8 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleLabelsSectionActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleLabelsSectionActionGroup.xml @@ -9,10 +9,10 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - + - - + + - \ No newline at end of file + diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AssertCartPriceRuleSuccessSaveMessageActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AssertCartPriceRuleSuccessSaveMessageActionGroup.xml index 8fe0250307c6a..dbfef4c006696 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AssertCartPriceRuleSuccessSaveMessageActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AssertCartPriceRuleSuccessSaveMessageActionGroup.xml @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AssertStorefrontMiniCartItemsActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AssertStorefrontMiniCartItemsActionGroup.xml index f9c9a9fd357ee..f99e39411ac7a 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AssertStorefrontMiniCartItemsActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AssertStorefrontMiniCartItemsActionGroup.xml @@ -21,4 +21,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml index fa474194635e6..57ed2b67be10e 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml @@ -13,4 +13,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontClickOnMiniCartActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontClickOnMiniCartActionGroup.xml index 59028ee1a17b5..498695dee9336 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontClickOnMiniCartActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontClickOnMiniCartActionGroup.xml @@ -13,4 +13,4 @@ - \ No newline at end of file + diff --git a/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml b/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml index 3e1a247c7a1e2..219fac4e92424 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml @@ -241,7 +241,89 @@ Percent of product price discount 50 - + + Cart Price Rule For RuleCondition And FreeShipping + Description for Cart Price Rule + Yes + Main Website + NOT LOGGED IN + No Coupon + Percent of product price discount + 50 + 0 + 0 + 0 + For matching items only + Free Shipping in conditions + Free Shipping in conditions + + + Cart Price Rule For Rule Condition + Description for Cart Price Rule + Yes + Main Website + NOT LOGGED IN + No Coupon + 560 + Percent of product price discount + 50 + 0 + 0 + 0 + No + Free Shipping in Rule conditions + Free Shipping in Rule conditions + + + Cart Price Rule Condition Not Applied + Description for Cart Price Rule + Yes + Main Website + NOT LOGGED IN + No Coupon + 3 + Percent of product price discount + 50 + 0 + 0 + 0 + No + Total Items Quantity-Not Applied test + Total Items Quantity-Not Applied test + + + Cart Price Rule With Weight Condition Applied + Description for Cart Price Rule + Yes + Main Website + NOT LOGGED IN + No Coupon + 200 + Percent of product price discount + 50 + 0 + 0 + 0 + No + Total Weight is 200 + Total Weight is 200 + + + Cart Price Rule With Category Condition Applied + Description for Cart Price Rule + Yes + Main Website + NOT LOGGED IN + No Coupon + Percent of product price discount + 50 + 0 + 0 + 0 + No + Product attribute combination - Category + Product attribute combination - Category + Cart Price Rule Main Website @@ -249,7 +331,6 @@ Percent of product price discount 50 - Cart Price Rule Main Website @@ -257,4 +338,4 @@ Percent of product price discount 50 - \ No newline at end of file + diff --git a/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml b/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml index e5e21df91930a..b0d4d6bcdc9a1 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml @@ -46,6 +46,8 @@ + + diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml new file mode 100644 index 0000000000000..33184f79f6f0c --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml @@ -0,0 +1,113 @@ + + + + + + + + <description value="Test log in to Cart Price Rules and Create Cart Price Rule And Verify Rule Condition And Free Shipping Is Applied"/> + <testCaseId value="MC-15604"/> + <severity value="CRITICAL"/> + <group value="SalesRule"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="defaultSimpleProduct" stepKey="initialSimpleProduct"/> + </before> + <after> + <deleteData stepKey="deleteProduct" createDataKey="initialSimpleProduct"/> + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCreatedCartPriceRule"> + <argument name="ruleName" value="{{CartPriceRuleConditionAndFreeShippingApplied.name}}"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!--Create cart price rule as per data and verify AssertCartPriceRuleSuccessSaveMessage--> + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> + <waitForPageLoad stepKey="waitForPriceList"/> + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{CartPriceRuleConditionAndFreeShippingApplied.name}}" stepKey="fillRuleName"/> + <fillField selector="{{AdminCartPriceRulesFormSection.description}}" userInput="{{CartPriceRuleConditionAndFreeShippingApplied.description}}" stepKey="fillDescription"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="{{CartPriceRuleConditionAndFreeShippingApplied.websites}}" stepKey="selectWebsites"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" parameterArray="[{{CartPriceRuleConditionAndFreeShippingApplied.customerGroups}}]" stepKey="selectCustomerGroup"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="{{CartPriceRuleConditionAndFreeShippingApplied.coupon_type}}" stepKey="selectCouponType"/> + <scrollTo selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="scrollToActionsHeader"/> + <actionGroup ref="AdminCreateCartPriceRuleActionsSectionDiscountFieldsActionGroup" stepKey="createActiveCartPriceRuleActionsSection"> + <argument name="rule" value="CartPriceRuleConditionAndFreeShippingApplied"/> + </actionGroup> + <actionGroup ref="AdminCreateCartPriceRuleActionsSectionFreeShippingActionGroup" stepKey="createActiveCartPriceRuleFreeShippingActionsSection"> + <argument name="freeShippingOption" value="{{CartPriceRuleConditionAndFreeShippingApplied.simple_free_shipping}}"/> + </actionGroup> + <actionGroup ref="AdminCreateCartPriceRuleLabelsSectionActionGroup" stepKey="createActiveCartPriceRuleLabelsSection"> + <argument name="rule" value="CartPriceRuleConditionAndFreeShippingApplied"/> + </actionGroup> + <actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="seeAssertCartPriceRuleSuccessSaveMessage"/> + + <!--Search created cart price rule in grid--> + <actionGroup ref="AdminFilterCartPriceRuleActionGroup" stepKey="searchCreatedCartPriceRuleInGrid"> + <argument name="ruleName" value="CartPriceRuleConditionAndFreeShippingApplied.name"/> + </actionGroup> + + <!--Go to cart price rule form page and verify AssertCartPriceRuleForm--> + <waitForPageLoad stepKey="waitForAdminCartPriceRuleEditPageLoad"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{CartPriceRuleConditionAndFreeShippingApplied.name}}" stepKey="seeRuleName"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.description}}" userInput="{{CartPriceRuleConditionAndFreeShippingApplied.description}}" stepKey="seeDescription"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="{{CartPriceRuleConditionAndFreeShippingApplied.websites}}" stepKey="seeWebsites"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="{{CartPriceRuleConditionAndFreeShippingApplied.customerGroups}}" stepKey="seeCustomerGroup"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="{{CartPriceRuleConditionAndFreeShippingApplied.coupon_type}}" stepKey="seeCouponType"/> + <scrollTo selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickActionsHeader"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.actionsHeader}}" visible="true" stepKey="clickExpandActions"/> + <see selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="{{CartPriceRuleConditionAndFreeShippingApplied.simple_action}}" stepKey="seeActionApplyType"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="{{CartPriceRuleConditionAndFreeShippingApplied.discount_amount}}" stepKey="seeDiscountAmount"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.freeShipping}}" userInput="{{CartPriceRuleConditionAndFreeShippingApplied.simple_free_shipping}}" stepKey="seeFreeShipping"/> + <scrollTo selector="{{AdminCartPriceRulesFormSection.labelsHeader}}" stepKey="clickLabelsHeader"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.labelsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.labelsHeader}}" visible="true" stepKey="clickToExpandLabels"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.defaultRuleLabelAllStoreViews}}" userInput="{{CartPriceRuleConditionAndFreeShippingApplied.defaultRuleLabelAllStoreViews}}" stepKey="seeDefaultRuleLabelAllStoreViews"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.defaultStoreView}}" userInput="{{CartPriceRuleConditionAndFreeShippingApplied.defaultStoreView}}" stepKey="seeDefaultStoreView"/> + + <!--Go to storefront page and verify created product--> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <argument name="product" value="$$initialSimpleProduct$$"/> + </actionGroup> + <!--Click on Add To Cart button--> + <actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="clickOnAddToCartButton"/> + <!--Click on mini cart--> + <actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart"/> + + <!--Open mini cart and verify Shopping cart subtotal equals to grand total--> + <actionGroup ref="AssertStorefrontMiniCartItemsActionGroup" stepKey="verifyCartSubtotalEqualsGrandTotal"> + <argument name="productName" value="$$initialSimpleProduct.name$$"/> + <argument name="productPrice" value="$560.00"/> + <argument name="cartSubtotal" value="$560.00" /> + <argument name="qty" value="1"/> + </actionGroup> + + <!--Click on view and edit cart link--> + <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <waitForPageLoad stepKey="waitForViewAndEditCartToOpen"/> + <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" visible="true" stepKey="clickEstimateShippingAndTaxToOpen"/> + <waitForPageLoad stepKey="waitForEstimateShippingAndTaxToOpen"/> + <selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="{{US_Address_CA.country_id}}" stepKey="selectUnitedStatesCountry"/> + <waitForPageLoad stepKey="waitToSelectCountry"/> + <selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{US_Address_CA.state}}" stepKey="selectCaliforniaRegion"/> + <waitForPageLoad stepKey="waitToSelectState"/> + <fillField selector="{{CheckoutCartSummarySection.postcode}}" userInput="{{US_Address_CA.postcode}}" stepKey="inputPostCode"/> + <!--After selecting country, province and postcode, verify AssertCartPriceRuleConditionIsApplied and AssertCartPriceRuleFreeShippingIsApplied--> + <actionGroup ref="StorefrontCheckCartActionGroup" stepKey="cartAssert"> + <argument name="subtotal" value="$560.00"/> + <argument name="shipping" value="$0.00"/> + <argument name="shippingMethod" value="Flat Rate - Fixed"/> + <argument name="total" value="$280.00"/> + </actionGroup> + <see selector="{{CheckoutCartSummarySection.shipping}}" userInput="$0.00" stepKey="seeAssertFreeShippingConditionApplied"/> + <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$280.00" stepKey="seeAssertDiscountAmountAppliedForMatchingItemsConditionIsTrue"/> + </test> +</tests> \ No newline at end of file diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml new file mode 100644 index 0000000000000..22628e599823d --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml @@ -0,0 +1,115 @@ +<?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="AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest"> + <annotations> + <stories value="Create Sales Rule"/> + <title value="Create Cart Price Rule And Verify Rule Condition Is Not Applied"/> + <description value="Test log in to Cart Price Rules and Create Cart Price Rule And Verify Rule Condition Is Not Applied"/> + <testCaseId value="MC-15606"/> + <severity value="CRITICAL"/> + <group value="SalesRule"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="defaultSimpleProduct" stepKey="initialSimpleProduct"/> + </before> + <after> + <deleteData stepKey="deleteProduct" createDataKey="initialSimpleProduct"/> + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCreatedCartPriceRule"> + <argument name="ruleName" value="{{CartPriceRuleConditionNotApplied.name}}"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!--Create cart price rule as per data and verify AssertCartPriceRuleSuccessSaveMessage--> + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> + <waitForPageLoad stepKey="waitForPriceList"/> + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{CartPriceRuleConditionNotApplied.name}}" stepKey="fillRuleName"/> + <fillField selector="{{AdminCartPriceRulesFormSection.description}}" userInput="{{CartPriceRuleConditionNotApplied.description}}" stepKey="fillDescription"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="{{CartPriceRuleConditionNotApplied.websites}}" stepKey="selectWebsites"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" parameterArray="[{{CartPriceRuleConditionNotApplied.customerGroups}}]" stepKey="selectCustomerGroup"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="{{CartPriceRuleConditionNotApplied.coupon_type}}" stepKey="selectCouponType"/> + <scrollTo selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="scrollToConditionsHeader"/> + + <!-- Fill condition 1: Total Items Quantity --> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="expandConditions"/> + <click selector="{{AdminCartPriceRulesFormSection.newCondition}}" stepKey="clickNewCondition"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelect}}" userInput="Total Items Quantity" stepKey="selectCondition"/> + <waitForPageLoad stepKey="waitForConditionLoad"/> + <click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" stepKey="clickEllipsis"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--1')}}" userInput="{{CartPriceRuleConditionNotApplied.totalItemQuantity}}" stepKey="fillTotalItemQuantity"/> + <actionGroup ref="AdminCreateCartPriceRuleActionsSectionDiscountFieldsActionGroup" stepKey="createActiveCartPriceRuleActionsSection"> + <argument name="rule" value="CartPriceRuleConditionNotApplied"/> + </actionGroup> + <actionGroup ref="AdminCreateCartPriceRuleActionsSectionFreeShippingActionGroup" stepKey="createActiveCartPriceRuleFreeShippingActionsSection"> + <argument name="freeShippingOption" value="{{CartPriceRuleConditionNotApplied.simple_free_shipping}}"/> + </actionGroup> + <scrollTo selector="{{AdminCartPriceRulesFormSection.labelsHeader}}" stepKey="scrollToLabelsHeader"/> + <actionGroup ref="AdminCreateCartPriceRuleLabelsSectionActionGroup" stepKey="createActiveCartPriceRuleLabelsSection"> + <argument name="rule" value="CartPriceRuleConditionNotApplied"/> + </actionGroup> + <actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="seeAssertCartPriceRuleSuccessSaveMessage"/> + + <!--Search created cart price rule in grid--> + <actionGroup ref="AdminFilterCartPriceRuleActionGroup" stepKey="searchCreatedCartPriceRuleInGrid"> + <argument name="ruleName" value="CartPriceRuleConditionNotApplied.name"/> + </actionGroup> + + <!--Go to cart price rule form page and verify AssertCartPriceRuleForm--> + <waitForPageLoad stepKey="waitForAdminCartPriceRuleEditPageLoad"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{CartPriceRuleConditionNotApplied.name}}" stepKey="seeRuleName"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.description}}" userInput="{{CartPriceRuleConditionNotApplied.description}}" stepKey="seeDescription"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="{{CartPriceRuleConditionNotApplied.websites}}" stepKey="seeWebsites"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="{{CartPriceRuleConditionNotApplied.customerGroups}}" stepKey="seeCustomerGroup"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="{{CartPriceRuleConditionNotApplied.coupon_type}}" stepKey="seeCouponType"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditions"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--1')}}" userInput="{{CartPriceRuleConditionNotApplied.totalItemQuantity}}" stepKey="seeTotalItemQuantity"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.actionsHeader}}" visible="true" stepKey="clickExpandActions"/> + <see selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="{{CartPriceRuleConditionNotApplied.simple_action}}" stepKey="seeActionApplyType"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="{{CartPriceRuleConditionNotApplied.discount_amount}}" stepKey="seeDiscountAmount"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.freeShipping}}" userInput="{{CartPriceRuleConditionNotApplied.simple_free_shipping}}" stepKey="seeFreeShipping"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.labelsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.labelsHeader}}" visible="true" stepKey="clickToExpandLabels"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.defaultRuleLabelAllStoreViews}}" userInput="{{CartPriceRuleConditionNotApplied.defaultRuleLabelAllStoreViews}}" stepKey="seeDefaultRuleLabelAllStoreViews"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.defaultStoreView}}" userInput="{{CartPriceRuleConditionNotApplied.defaultStoreView}}" stepKey="seeDefaultStoreView"/> + + <!--Go to storefront page and verify created product--> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <argument name="product" value="$$initialSimpleProduct$$"/> + </actionGroup> + <fillField selector="{{StorefrontProductInfoMainSection.qty}}" userInput="2" stepKey="fillProductQuantity"/> + <!--Click on Add To Cart button--> + <actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="clickOnAddToCartButton"/> + <!--Click on mini cart--> + <actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart"/> + + <!--Open mini cart and verify Shopping cart subtotal equals to grand total--> + <actionGroup ref="AssertStorefrontMiniCartItemsActionGroup" stepKey="verifyCartSubtotalEqualsGrandTotal"> + <argument name="productName" value="$$initialSimpleProduct.name$$"/> + <argument name="productPrice" value="$560.00"/> + <argument name="cartSubtotal" value="$1,120.00" /> + <argument name="qty" value="2"/> + </actionGroup> + + <!--Click on view and edit cart link--> + <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <waitForPageLoad stepKey="waitForViewAndEditCartToOpen"/> + <!--Verify AssertCartPriceRuleConditionIsNotApplied(Shopping cart subtotal equals to grand total - price rule has not been applied)--> + <actionGroup ref="StorefrontCheckCartActionGroup" stepKey="cartAssert"> + <argument name="subtotal" value="$1,120.00"/> + <argument name="shipping" value="$10.00"/> + <argument name="shippingMethod" value="Flat Rate - Fixed"/> + <argument name="total" value="$1,130.00"/> + </actionGroup> + <dontSee selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="dontSeeAssertDiscountAmountForRuleConditionNotApplied"/> + </test> +</tests> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml new file mode 100644 index 0000000000000..ab62e51414e85 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml @@ -0,0 +1,122 @@ +<?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="AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest"> + <annotations> + <stories value="Create Sales Rule"/> + <title value="Create Cart Price Rule For Matching Subtotal And Verify Rule Condition Is Applied"/> + <description value="Test log in to Cart Price Rules and Create Cart Price Rule For Matching Subtotal And Verify Rule Condition Is Applied"/> + <testCaseId value="MC-15605"/> + <severity value="CRITICAL"/> + <group value="SalesRule"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="defaultSimpleProduct" stepKey="initialSimpleProduct"/> + </before> + <after> + <deleteData stepKey="deleteProduct" createDataKey="initialSimpleProduct"/> + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCreatedCartPriceRule"> + <argument name="ruleName" value="{{CartPriceRuleConditionAppliedForSubtotal.name}}"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!--Create cart price rule as per data and verify AssertCartPriceRuleSuccessSaveMessage--> + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> + <waitForPageLoad stepKey="waitForPriceList"/> + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.name}}" stepKey="fillRuleName"/> + <fillField selector="{{AdminCartPriceRulesFormSection.description}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.description}}" stepKey="fillDescription"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.websites}}" stepKey="selectWebsites"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" parameterArray="[{{CartPriceRuleConditionAppliedForSubtotal.customerGroups}}]" stepKey="selectCustomerGroup"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.coupon_type}}" stepKey="selectCouponType"/> + + <!-- Expand the conditions section --> + <scrollTo selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="scrollToConditionsHeader"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditions"/> + <click selector="{{AdminCartPriceRulesFormSection.newCondition}}" stepKey="clickNewCondition"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelect}}" userInput="Subtotal" stepKey="selectCondition1"/> + <waitForPageLoad stepKey="waitForConditionLoad"/> + <click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" stepKey="clickEllipsis"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--1')}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.subtotal}}" stepKey="fillSubtotalParameter"/> + <actionGroup ref="AdminCreateCartPriceRuleActionsSectionDiscountFieldsActionGroup" stepKey="createActiveCartPriceRuleActionsSection"> + <argument name="rule" value="CartPriceRuleConditionAppliedForSubtotal"/> + </actionGroup> + <actionGroup ref="AdminCreateCartPriceRuleActionsSectionFreeShippingActionGroup" stepKey="createActiveCartPriceRuleFreeShippingActionsSection"> + <argument name="freeShippingOption" value="{{CartPriceRuleConditionAppliedForSubtotal.simple_free_shipping}}"/> + </actionGroup> + <scrollTo selector="{{AdminCartPriceRulesFormSection.labelsHeader}}" stepKey="scrollToLabelsHeader"/> + <actionGroup ref="AdminCreateCartPriceRuleLabelsSectionActionGroup" stepKey="createActiveCartPriceRuleLabelsSection"> + <argument name="rule" value="CartPriceRuleConditionAppliedForSubtotal"/> + </actionGroup> + <actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="seeAssertCartPriceRuleSuccessSaveMessage"/> + + <!--Search created cart price rule in grid--> + <actionGroup ref="AdminFilterCartPriceRuleActionGroup" stepKey="searchCreatedCartPriceRuleInGrid"> + <argument name="ruleName" value="CartPriceRuleConditionAppliedForSubtotal.name"/> + </actionGroup> + + <!--Go to cart price rule form page and verify AssertCartPriceRuleForm--> + <waitForPageLoad stepKey="waitForAdminCartPriceRuleEditPageLoad"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.name}}" stepKey="seeRuleName"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.description}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.description}}" stepKey="seeDescription"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.websites}}" stepKey="seeWebsites"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.customerGroups}}" stepKey="seeCustomerGroup"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.coupon_type}}" stepKey="seeCouponType"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditions2"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--1')}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.subtotal}}" stepKey="seeSubtotalParameter"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.actionsHeader}}" visible="true" stepKey="clickExpandActions"/> + <see selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.simple_action}}" stepKey="seeActionApplyType"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.discount_amount}}" stepKey="seeDiscountAmount"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.freeShipping}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.simple_free_shipping}}" stepKey="seeFreeShipping"/> + <scrollTo selector="{{AdminCartPriceRulesFormSection.labelsHeader}}" stepKey="scrollToTheLabelsHeader"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.labelsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.labelsHeader}}" visible="true" stepKey="clickToExpandLabels"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.defaultRuleLabelAllStoreViews}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.defaultRuleLabelAllStoreViews}}" stepKey="seeDefaultRuleLabelAllStoreViews"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.defaultStoreView}}" userInput="{{CartPriceRuleConditionAppliedForSubtotal.defaultStoreView}}" stepKey="seeDefaultStoreView"/> + + <!--Go to storefront page and verify created product--> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <argument name="product" value="$$initialSimpleProduct$$"/> + </actionGroup> + <!--Click on Add To Cart button--> + <actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="clickOnAddToCartButton"/> + <!--Click on mini cart--> + <actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart"/> + + <!--Open mini cart and verify Shopping cart subtotal equals to grand total--> + <actionGroup ref="AssertStorefrontMiniCartItemsActionGroup" stepKey="verifyCartSubtotalEqualsGrandTotal"> + <argument name="productName" value="$$initialSimpleProduct.name$$"/> + <argument name="productPrice" value="$560.00"/> + <argument name="cartSubtotal" value="$560.00" /> + <argument name="qty" value="1"/> + </actionGroup> + + <!--Click on view and edit cart link--> + <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <waitForPageLoad stepKey="waitForViewAndEditCartToOpen"/> + <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" visible="true" stepKey="clickEstimateShippingAndTaxToOpen"/> + <waitForPageLoad stepKey="waitForEstimateShippingAndTaxToOpen"/> + <selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="{{US_Address_CA.country_id}}" stepKey="selectUnitedStatesCountry"/> + <waitForPageLoad stepKey="waitToSelectCountry"/> + <selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{US_Address_CA.state}}" stepKey="selectCaliforniaRegion"/> + <waitForPageLoad stepKey="waitToSelectState"/> + <fillField selector="{{CheckoutCartSummarySection.postcode}}" userInput="{{US_Address_CA.postcode}}" stepKey="inputPostCode"/> + <!--After selecting country, province and postcode, verify AssertCartPriceRuleConditionIsApplied if Subtotal condition is True--> + <actionGroup ref="StorefrontCheckCartActionGroup" stepKey="cartAssert"> + <argument name="subtotal" value="$560.00"/> + <argument name="shipping" value="$5.00"/> + <argument name="shippingMethod" value="Flat Rate - Fixed"/> + <argument name="total" value="$285.00"/> + </actionGroup> + <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$280.00" stepKey="seeAssertDiscountAmountAppliedForSubtotalConditionIsTrue"/> + </test> +</tests> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml new file mode 100644 index 0000000000000..e1a4ca40fd710 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml @@ -0,0 +1,124 @@ +<?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="AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest"> + <annotations> + <stories value="Create Sales Rule"/> + <title value="Create Cart Price Rule With Matching Category And Verify Rule Condition Is Applied"/> + <description value="Test log in to Cart Price Rules and Create Cart Price Rule With Matching Category And Verify Rule Condition Is Applied"/> + <testCaseId value="MC-15608"/> + <severity value="CRITICAL"/> + <group value="SalesRule"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin"> + <argument name="category" value="$$createCategory$$"/> + <argument name="simpleProduct" value="_defaultProduct"/> + </actionGroup> + </before> + <after> + <deleteData createDataKey="createCategory" stepKey="deletePreReqCategory"/> + <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteSimpleProduct"> + <argument name="product" value="_defaultProduct"/> + </actionGroup> + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCreatedCartPriceRule"> + <argument name="ruleName" value="{{CartPriceRuleConditionAppliedForCategory.name}}"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!--Create cart price rule as per data and verify AssertCartPriceRuleSuccessSaveMessage--> + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> + <waitForPageLoad stepKey="waitForPriceList"/> + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{CartPriceRuleConditionAppliedForCategory.name}}" stepKey="fillRuleName"/> + <fillField selector="{{AdminCartPriceRulesFormSection.description}}" userInput="{{CartPriceRuleConditionAppliedForCategory.description}}" stepKey="fillDescription"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="{{CartPriceRuleConditionAppliedForCategory.websites}}" stepKey="selectWebsites"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" parameterArray="[{{CartPriceRuleConditionAppliedForCategory.customerGroups}}]" stepKey="selectCustomerGroup"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="{{CartPriceRuleConditionAppliedForCategory.coupon_type}}" stepKey="selectCouponType"/> + <scrollTo selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="scrollToConditionsHeader"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditions"/> + <click selector="{{AdminCartPriceRulesFormSection.addNewCondition('1')}}" stepKey="clickOnAddNewCondition"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelectDropdown('1')}}" userInput="Product attribute combination" stepKey="selectProductAttributeCombination"/> + <waitForPageLoad stepKey="waitForConditionLoad"/> + <click selector="{{AdminCartPriceRulesFormSection.addNewCondition('1--1')}}" stepKey="clickOnTheAddNewCondition"/> + <waitForPageLoad stepKey="waitForToggleLoad"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelectDropdown('1--1')}}" userInput="Category" stepKey="selectCategory"/> + <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" stepKey="waitForEllipsis"/> + <click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" stepKey="clickOnEllipsis"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--1--1')}}" userInput="$$createCategory.id$$" stepKey="fillTotalItemQuantity"/> + <actionGroup ref="AdminCreateCartPriceRuleActionsSectionDiscountFieldsActionGroup" stepKey="createActiveCartPriceRuleActionsSection"> + <argument name="rule" value="CartPriceRuleConditionAppliedForCategory"/> + </actionGroup> + <actionGroup ref="AdminCreateCartPriceRuleActionsSectionFreeShippingActionGroup" stepKey="createActiveCartPriceRuleFreeShippingActionsSection"> + <argument name="freeShippingOption" value="{{CartPriceRuleConditionAppliedForCategory.simple_free_shipping}}"/> + </actionGroup> + <scrollTo selector="{{AdminCartPriceRulesFormSection.labelsHeader}}" stepKey="scrollToLabelsHeader"/> + <actionGroup ref="AdminCreateCartPriceRuleLabelsSectionActionGroup" stepKey="createActiveCartPriceRuleLabelsSection"> + <argument name="rule" value="CartPriceRuleConditionAppliedForCategory"/> + </actionGroup> + <actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="seeAssertCartPriceRuleSuccessSaveMessage"/> + + <!--Search created cart price rule in grid--> + <actionGroup ref="AdminFilterCartPriceRuleActionGroup" stepKey="searchCreatedCartPriceRuleInGrid"> + <argument name="ruleName" value="CartPriceRuleConditionAppliedForCategory.name"/> + </actionGroup> + + <!--Go to cart price rule form page and verify AssertCartPriceRuleForm--> + <waitForPageLoad stepKey="waitForAdminCartPriceRuleEditPageLoad"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{CartPriceRuleConditionAppliedForCategory.name}}" stepKey="seeRuleName"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.description}}" userInput="{{CartPriceRuleConditionAppliedForCategory.description}}" stepKey="seeDescription"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="{{CartPriceRuleConditionAppliedForCategory.websites}}" stepKey="seeWebsites"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="{{CartPriceRuleConditionAppliedForCategory.customerGroups}}" stepKey="seeCustomerGroup"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="{{CartPriceRuleConditionAppliedForCategory.coupon_type}}" stepKey="seeCouponType"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditionHeader"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--1--1')}}" userInput="$$createCategory.id$$" stepKey="seeCategoryParameter"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.actionsHeader}}" visible="true" stepKey="clickExpandActions"/> + <see selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="{{CartPriceRuleConditionAppliedForCategory.simple_action}}" stepKey="seeActionApplyType"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="{{CartPriceRuleConditionAppliedForCategory.discount_amount}}" stepKey="seeDiscountAmount"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.freeShipping}}" userInput="{{CartPriceRuleConditionAppliedForCategory.simple_free_shipping}}" stepKey="seeFreeShipping"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.labelsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.labelsHeader}}" visible="true" stepKey="clickToExpandLabels"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.defaultRuleLabelAllStoreViews}}" userInput="{{CartPriceRuleConditionAppliedForCategory.defaultRuleLabelAllStoreViews}}" stepKey="seeDefaultRuleLabelAllStoreViews"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.defaultStoreView}}" userInput="{{CartPriceRuleConditionAppliedForCategory.defaultStoreView}}" stepKey="seeDefaultStoreView"/> + + <!--Go to storefront page and verify created product--> + <amOnPage url="{{StorefrontProductPage.url(_defaultProduct.urlKey)}}" stepKey="onCategoryPage"/> + <waitForPageLoad stepKey="waitForCategoryPageLoad"/> + <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="openProductPageAndVerifyProduct"> + <argument name="productName" value="_defaultProduct.name"/> + </actionGroup> + + <!--Click on mini cart--> + <actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart"/> + + <!--Open mini cart and verify Shopping cart subtotal equals to grand total--> + <actionGroup ref="AssertStorefrontMiniCartItemsActionGroup" stepKey="verifyCartSubtotalEqualsGrandTotal"> + <argument name="productName" value="{{_defaultProduct.name}}"/> + <argument name="productPrice" value="$123.00"/> + <argument name="cartSubtotal" value="$123.00" /> + <argument name="qty" value="1"/> + </actionGroup> + + <!--Click on view and edit cart link--> + <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <waitForPageLoad stepKey="waitForViewAndEditToOpen"/> + <!--Verify AssertCartPriceRuleConditionIsApplied if condition category id is matching--> + <actionGroup ref="StorefrontCheckCartActionGroup" stepKey="cartAssert"> + <argument name="subtotal" value="$123.00"/> + <argument name="shipping" value="$5.00"/> + <argument name="shippingMethod" value="Flat Rate - Fixed"/> + <argument name="total" value="$66.50"/> + </actionGroup> + <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$61.50" stepKey="seeAssertDiscountAmountAppliedForMatchingCategory"/> + </test> +</tests> \ No newline at end of file diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml new file mode 100644 index 0000000000000..c62b0dd869281 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml @@ -0,0 +1,112 @@ +<?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="AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest"> + <annotations> + <stories value="Create Sales Rule"/> + <title value="Create Cart Price Rule With Matching Total Weight And Verify Rule Condition Is Applied"/> + <description value="Test log in to Cart Price Rules and Create Cart Price Rule With Matching Total Weight And Verify Rule Condition Is Applied"/> + <testCaseId value="MC-15609"/> + <severity value="CRITICAL"/> + <group value="SalesRule"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/> + <createData entity="defaultSimpleProductWeight200" stepKey="initialSimpleProduct"/> + </before> + <after> + <deleteData stepKey="deleteProduct" createDataKey="initialSimpleProduct"/> + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCreatedCartPriceRule"> + <argument name="ruleName" value="{{CartPriceRuleConditionAppliedForWeight.name}}"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <!--Create cart price rule as per data and verify AssertCartPriceRuleSuccessSaveMessage--> + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> + <waitForPageLoad stepKey="waitForPriceList"/> + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{CartPriceRuleConditionAppliedForWeight.name}}" stepKey="fillRuleName"/> + <fillField selector="{{AdminCartPriceRulesFormSection.description}}" userInput="{{CartPriceRuleConditionAppliedForWeight.description}}" stepKey="fillDescription"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="{{CartPriceRuleConditionAppliedForWeight.websites}}" stepKey="selectWebsites"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" parameterArray="[{{CartPriceRuleConditionAppliedForWeight.customerGroups}}]" stepKey="selectCustomerGroup"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="{{CartPriceRuleConditionAppliedForWeight.coupon_type}}" stepKey="selectCouponType"/> + <scrollTo selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="scrollToConditionsHeader"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditions"/> + <click selector="{{AdminCartPriceRulesFormSection.newCondition}}" stepKey="clickOnNewCondition"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelect}}" userInput="Total Weight" stepKey="selectTotalWeight"/> + <waitForPageLoad stepKey="waitForThirdConditionLoad"/> + <click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" stepKey="clickOnEllipsis"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--1')}}" userInput="{{CartPriceRuleConditionAppliedForWeight.totalWeight}}" stepKey="fillTotalItemQuantity"/> + <actionGroup ref="AdminCreateCartPriceRuleActionsSectionDiscountFieldsActionGroup" stepKey="createActiveCartPriceRuleActionsSection"> + <argument name="rule" value="CartPriceRuleConditionAppliedForWeight"/> + </actionGroup> + <actionGroup ref="AdminCreateCartPriceRuleActionsSectionFreeShippingActionGroup" stepKey="createActiveCartPriceRuleFreeShippingActionsSection"> + <argument name="freeShippingOption" value="{{CartPriceRuleConditionAppliedForWeight.simple_free_shipping}}"/> + </actionGroup> + <scrollTo selector="{{AdminCartPriceRulesFormSection.labelsHeader}}" stepKey="scrollToLabelsHeader"/> + <actionGroup ref="AdminCreateCartPriceRuleLabelsSectionActionGroup" stepKey="createActiveCartPriceRuleLabelsSection"> + <argument name="rule" value="CartPriceRuleConditionAppliedForWeight"/> + </actionGroup> + <actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="seeAssertCartPriceRuleSuccessSaveMessage"/> + + <!--Search created cart price rule in grid--> + <actionGroup ref="AdminFilterCartPriceRuleActionGroup" stepKey="searchCreatedCartPriceRuleInGrid"> + <argument name="ruleName" value="CartPriceRuleConditionAppliedForWeight.name"/> + </actionGroup> + + <!--Go to cart price rule form page and verify AssertCartPriceRuleForm--> + <waitForPageLoad stepKey="waitForAdminCartPriceRuleEditPageLoad"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{CartPriceRuleConditionAppliedForWeight.name}}" stepKey="seeRuleName"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.description}}" userInput="{{CartPriceRuleConditionAppliedForWeight.description}}" stepKey="seeDescription"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="{{CartPriceRuleConditionAppliedForWeight.websites}}" stepKey="seeWebsites"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="{{CartPriceRuleConditionAppliedForWeight.customerGroups}}" stepKey="seeCustomerGroup"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="{{CartPriceRuleConditionAppliedForWeight.coupon_type}}" stepKey="seeCouponType"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditionHeader"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--1')}}" userInput="{{CartPriceRuleConditionAppliedForWeight.totalWeight}}" stepKey="seeTotalWeightParameter"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.actionsHeader}}" visible="true" stepKey="clickExpandActions"/> + <see selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="{{CartPriceRuleConditionAppliedForWeight.simple_action}}" stepKey="seeActionApplyType"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="{{CartPriceRuleConditionAppliedForWeight.discount_amount}}" stepKey="seeDiscountAmount"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.freeShipping}}" userInput="{{CartPriceRuleConditionAppliedForWeight.simple_free_shipping}}" stepKey="seeFreeShipping"/> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.labelsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.labelsHeader}}" visible="true" stepKey="clickToExpandLabels"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.defaultRuleLabelAllStoreViews}}" userInput="{{CartPriceRuleConditionAppliedForWeight.defaultRuleLabelAllStoreViews}}" stepKey="seeDefaultRuleLabelAllStoreViews"/> + <seeInField selector="{{AdminCartPriceRulesFormSection.defaultStoreView}}" userInput="{{CartPriceRuleConditionAppliedForWeight.defaultStoreView}}" stepKey="seeDefaultStoreView"/> + + <!--Go to storefront page and verify created product--> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKey" stepKey="openProductPageAndVerifyProduct"> + <argument name="product" value="$$initialSimpleProduct$$"/> + </actionGroup> + <!--Click on Add To Cart button--> + <actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="clickOnAddToCartButton"/> + <!--Click on mini cart--> + <actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickOnMiniCart"/> + + <!--Open mini cart and verify Shopping cart subtotal equals to grand total--> + <actionGroup ref="AssertStorefrontMiniCartItemsActionGroup" stepKey="verifyCartSubtotalEqualsGrandTotal"> + <argument name="productName" value="$$initialSimpleProduct.name$$"/> + <argument name="productPrice" value="$560.00"/> + <argument name="cartSubtotal" value="$560.00" /> + <argument name="qty" value="1"/> + </actionGroup> + + <!--Click on view and edit cart link--> + <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> + <waitForPageLoad stepKey="waitForViewAndEditCartToOpen"/> + <!--Verify AssertCartPriceRuleConditionIsApplied if condition Total Weight equals 200 is true--> + <actionGroup ref="StorefrontCheckCartActionGroup" stepKey="cartAssert"> + <argument name="subtotal" value="$560.00"/> + <argument name="shipping" value="$5.00"/> + <argument name="shippingMethod" value="Flat Rate - Fixed"/> + <argument name="total" value="$285.00"/> + </actionGroup> + <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$280.00" stepKey="seeAssertDiscountAmountAppliedForWeightConditionIsTrue"/> + </test> +</tests> \ No newline at end of file diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithComplexConditionsAndVerifyDeleteMessageTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithComplexConditionsAndVerifyDeleteMessageTest.xml index 4403010e1ffc9..7baec93c73905 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithComplexConditionsAndVerifyDeleteMessageTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithComplexConditionsAndVerifyDeleteMessageTest.xml @@ -24,31 +24,38 @@ <actionGroup ref="AdminCreateCartPriceRuleRuleInfoSectionActionGroup" stepKey="createActiveCartPriceRuleRuleInfoSection"> <argument name="ruleName" value="ActiveSalesRuleWithComplexConditions"/> </actionGroup> - <!--Fill values for Condition Section--> - <actionGroup ref="AdminCreateCartPriceRuleConditionsSectionSubtotalActionGroup" stepKey="createActiveCartPriceRuleConditionsSubtotalSection"> - <argument name="ruleName" value="ActiveSalesRuleWithComplexConditions"/> - <argument name="condition1" value="Subtotal"/> - </actionGroup> - <actionGroup ref="AdminCreateCartPriceRuleConditionsSectionShippingCountryActionGroup" stepKey="createActiveCartPriceRuleConditionsShippingCountrySection"> - <argument name="ruleName" value="ActiveSalesRuleWithComplexConditions"/> - <argument name="condition2" value="Shipping Country"/> - </actionGroup> - <actionGroup ref="AdminCreateCartPriceRuleConditionsSectionShippingPostcodeActionGroup" stepKey="createActiveCartPriceRuleConditionsShippingPostcodeSection"> - <argument name="ruleName" value="ActiveSalesRuleWithComplexConditions"/> - <argument name="condition3" value="Shipping Postcode"/> - </actionGroup> + <!-- Expand the conditions section --> + <conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditions"/> + <!-- Fill condition 1: Subtotal --> + <click selector="{{AdminCartPriceRulesFormSection.newCondition}}" stepKey="clickNewCondition1"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelect}}" userInput="Subtotal" stepKey="selectCondition1"/> + <waitForPageLoad stepKey="waitForConditionLoad1"/> + <click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" stepKey="clickEllipsis1"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--1')}}" userInput="{{ActiveSalesRuleWithComplexConditions.subtotal}}" stepKey="fillSubtotalParameter1"/> + <!-- Fill condition 2: Country --> + <click selector="{{AdminCartPriceRulesFormSection.newCondition}}" stepKey="clickNewCondition2"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelect}}" userInput="Shipping Country" stepKey="selectCondition2"/> + <waitForPageLoad stepKey="waitForConditionLoad2"/> + <click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" stepKey="clickEllipsis2"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.selectCountryDropdown}}" userInput="{{ActiveSalesRuleWithComplexConditions.shippingCountry}}" stepKey="fillShippingCountryParameter2"/> + <!-- Fill condition 3: Shipping Postcode--> + <click selector="{{AdminCartPriceRulesFormSection.newCondition}}" stepKey="clickNewCondition3"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelect}}" userInput="Shipping Postcode" stepKey="selectCondition3"/> + <waitForPageLoad stepKey="waitForConditionLoad3"/> + <click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" stepKey="clickEllipsis3"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--3')}}" userInput="{{ActiveSalesRuleWithComplexConditions.shippingPostcode}}" stepKey="fillShippingPostcodeParameter"/> <!--Fill values for Action Section--> <actionGroup ref="AdminCreateCartPriceRuleActionsSectionDiscountFieldsActionGroup" stepKey="createActiveCartPriceRuleActionsSection"> - <argument name="ruleName" value="ActiveSalesRuleWithComplexConditions"/> + <argument name="rule" value="ActiveSalesRuleWithComplexConditions"/> </actionGroup> <actionGroup ref="AdminCreateCartPriceRuleActionsSectionShippingAmountActionGroup" stepKey="createActiveCartPriceRuleShippingAmountActionsSection"/> <actionGroup ref="AdminCreateCartPriceRuleActionsSectionSubsequentRulesActionGroup" stepKey="createActiveCartPriceRuleDiscardSubsequentRulesActionsSection"/> <actionGroup ref="AdminCreateCartPriceRuleActionsSectionFreeShippingActionGroup" stepKey="createActiveCartPriceRuleFreeShippingActionsSection"> - <argument name="ruleName" value="{{ActiveSalesRuleWithComplexConditions.simple_free_shipping}}"/> + <argument name="freeShippingOption" value="{{ActiveSalesRuleWithComplexConditions.simple_free_shipping}}"/> </actionGroup> <!--Fill values for Labels Section--> <actionGroup ref="AdminCreateCartPriceRuleLabelsSectionActionGroup" stepKey="createActiveCartPriceRuleLabelsSection"> - <argument name="ruleName" value="ActiveSalesRuleWithComplexConditions"/> + <argument name="rule" value="ActiveSalesRuleWithComplexConditions"/> </actionGroup> <actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="assertVerifyCartPriceRuleSuccessSaveMessage"/> </before> @@ -66,4 +73,4 @@ <argument name="ruleName" value="ActiveSalesRuleWithComplexConditions.name"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests>