|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | + /** |
| 4 | + * Copyright 2024 Adobe |
| 5 | + * All Rights Reserved. |
| 6 | + */ |
| 7 | +--> |
| 8 | + |
| 9 | +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 10 | + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 11 | + <test name="StorefrontCartPriceRuleOverCategoryAndQuantityTest"> |
| 12 | + <annotations> |
| 13 | + <features value="SalesRule"/> |
| 14 | + <stories value="Create cart price rule"/> |
| 15 | + <title value="Customer should see cart price rule discount for greater than quantity and parent category for the product"/> |
| 16 | + <description value="Customer should see cart price rule discount for greater than quantity and parent category for the product"/> |
| 17 | + <severity value="AVERAGE"/> |
| 18 | + <testCaseId value="AC-13476"/> |
| 19 | + <useCaseId value="ACP2E-3456"/> |
| 20 | + <group value="SalesRule"/> |
| 21 | + </annotations> |
| 22 | + |
| 23 | + <before> |
| 24 | + <!-- Create category --> |
| 25 | + <createData entity="_defaultCategory" stepKey="defaultCategory"/> |
| 26 | + |
| 27 | + <!-- Admin Login --> |
| 28 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 29 | + |
| 30 | + <!--Create cart price rule--> |
| 31 | + <actionGroup ref="AdminCreateCartPriceRuleWithConditionsAndDiscountActionGroup" stepKey="createRule"> |
| 32 | + <argument name="ruleName" value="TestSalesRule"/> |
| 33 | + <argument name="condition1" value="Products subselection"/> |
| 34 | + <argument name="condition2" value="Category"/> |
| 35 | + <argument name="ruleToChange1" value="is"/> |
| 36 | + <argument name="rule1" value="equals or greater than"/> |
| 37 | + <argument name="ruleToChange2" value="..."/> |
| 38 | + <argument name="rule2" value="3"/> |
| 39 | + <argument name="categoryName" value="{{_defaultCategory.name}}"/> |
| 40 | + </actionGroup> |
| 41 | + |
| 42 | + <!-- Create subcategories --> |
| 43 | + <createData entity="SubCategoryWithParent" stepKey="subcategory2"> |
| 44 | + <requiredEntity createDataKey="defaultCategory"/> |
| 45 | + </createData> |
| 46 | + <createData entity="SubCategoryWithParent" stepKey="subcategory3"> |
| 47 | + <requiredEntity createDataKey="subcategory2"/> |
| 48 | + </createData> |
| 49 | + |
| 50 | + <!-- Create product and assign to subcategory --> |
| 51 | + <createData entity="_defaultProduct" stepKey="createSimpleProduct"> |
| 52 | + <requiredEntity createDataKey="subcategory3"/> |
| 53 | + </createData> |
| 54 | + </before> |
| 55 | + |
| 56 | + <after> |
| 57 | + <!-- Delete created cart price rule --> |
| 58 | + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCartPriceRule"> |
| 59 | + <argument name="ruleName" value="{{TestSalesRule.name}}"/> |
| 60 | + </actionGroup> |
| 61 | + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilters"/> |
| 62 | + |
| 63 | + <!-- Delete created category and product --> |
| 64 | + <deleteData createDataKey="defaultCategory" stepKey="deleteDefaultCategory"/> |
| 65 | + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> |
| 66 | + |
| 67 | + <!-- Admin Logout --> |
| 68 | + <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> |
| 69 | + </after> |
| 70 | + |
| 71 | + <!--Go to Storefront and add product to cart and checkout from cart--> |
| 72 | + <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/> |
| 73 | + <waitForPageLoad stepKey="waitForProductPage" /> |
| 74 | + <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="3" stepKey="setQuantity"/> |
| 75 | + <actionGroup ref="StorefrontAddToCartCustomOptionsProductPageActionGroup" stepKey="AddProductToCard"> |
| 76 | + <argument name="productName" value="$$createSimpleProduct.name$$"/> |
| 77 | + </actionGroup> |
| 78 | + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/> |
| 79 | + <actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShipping"/> |
| 80 | + |
| 81 | + <!--Check totals--> |
| 82 | + <grabTextFrom selector="{{CheckoutPaymentSection.orderSummarySubtotal}}" stepKey="grabSubtotal"/> |
| 83 | + <grabTextFrom selector="{{CheckoutPaymentSection.discountPrice}}" stepKey="grabDiscount"/> |
| 84 | + <grabTextFrom selector="{{CheckoutPaymentSection.orderSummaryShippingTotal}}" stepKey="grabShippingTotal"/> |
| 85 | + <grabTextFrom selector="{{CheckoutPaymentSection.orderSummaryTotal}}" stepKey="grabTotal"/> |
| 86 | + |
| 87 | + <assertEquals stepKey="assertSubtotal"> |
| 88 | + <expectedResult type="string">$369.00</expectedResult> |
| 89 | + <actualResult type="variable">$grabSubtotal</actualResult> |
| 90 | + </assertEquals> |
| 91 | + <assertEquals stepKey="assertDiscount"> |
| 92 | + <expectedResult type="string">-$184.50</expectedResult> |
| 93 | + <actualResult type="variable">$grabDiscount</actualResult> |
| 94 | + </assertEquals> |
| 95 | + <assertEquals stepKey="assertShippingTotal"> |
| 96 | + <expectedResult type="string">$15.00</expectedResult> |
| 97 | + <actualResult type="variable">$grabShippingTotal</actualResult> |
| 98 | + </assertEquals> |
| 99 | + <assertEquals stepKey="assertTotal"> |
| 100 | + <expectedResult type="string">$199.50</expectedResult> |
| 101 | + <actualResult type="variable">$grabTotal</actualResult> |
| 102 | + </assertEquals> |
| 103 | + </test> |
| 104 | +</tests> |
0 commit comments