|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | + /** |
| 4 | + * Copyright 2025 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="StorefrontCartPriceRuleAutoAndCouponTest"> |
| 12 | + <annotations> |
| 13 | + <features value="SalesRule"/> |
| 14 | + <title value="Verify auto and coupon cart price rules apply together in cart"/> |
| 15 | + <stories value="Verifies that both an automatic 50% discount and a $10 coupon discount are applied correctly in the shopping cart."/> |
| 16 | + <description value="Checks 50% auto discount, $10 off with '1234' coupon, correct totals, and 'Discount Subsequent Rules' disabled in Cart Price Rule settings."/> |
| 17 | + <testCaseId value="AC-5133"/> |
| 18 | + <severity value="MAJOR"/> |
| 19 | + <group value="SalesRule"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <!-- Precondition1: Create simple product with price $100 --> |
| 23 | + <createData entity="SimpleProduct2" stepKey="createSimpleProduct"> |
| 24 | + <field key="price">100</field> |
| 25 | + </createData> |
| 26 | + <!-- Precondition 2: Create two cart price rules --> |
| 27 | + <createData entity="TenDollarDiscount" stepKey="createCouponRule"/> |
| 28 | + <createData entity="ApiSalesRuleCoupon" stepKey="createCartPriceRuleCoupon"> |
| 29 | + <requiredEntity createDataKey="createCouponRule"/> |
| 30 | + </createData> |
| 31 | + <createData entity="AutoRule50Percent" stepKey="createCouponRule2"/> |
| 32 | + </before> |
| 33 | + <after> |
| 34 | + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> |
| 35 | + <deleteData createDataKey="createCouponRule" stepKey="deleteCartPriceRule"/> |
| 36 | + <deleteData createDataKey="createCouponRule2" stepKey="deleteCartPriceRule2"/> |
| 37 | + </after> |
| 38 | + <!-- Step 1 and Step 2: Go to storefront and add simple product to the cart --> |
| 39 | + <actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="navigateToSimpleProductPage"> |
| 40 | + <argument name="productUrlKey" value="$$createSimpleProduct.custom_attributes[url_key]$$"/> |
| 41 | + </actionGroup> |
| 42 | + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCart"> |
| 43 | + <argument name="productName" value="$$createSimpleProduct.name$$"/> |
| 44 | + <argument name="productCount" value="1"/> |
| 45 | + </actionGroup> |
| 46 | + <!-- Step 3: Go to shopping cart page --> |
| 47 | + <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goToCartPage"/> |
| 48 | + <!-- Validate auto 50% discount is applied --> |
| 49 | + <waitForText selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$100.00" stepKey="seeSubtotalBeforeCoupon"/> |
| 50 | + <waitForText selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$50.00" stepKey="seeDiscountBeforeCoupon"/> |
| 51 | + <waitForText selector="{{CheckoutCartSummarySection.total}}" userInput="$50.00" stepKey="seeOrderTotalBeforeCoupon"/> |
| 52 | + <!-- Step 4: Apply discount code from second rule --> |
| 53 | + <actionGroup ref="StorefrontApplyCouponActionGroup" stepKey="applyCoupon"> |
| 54 | + <argument name="coupon" value="$$createCartPriceRuleCoupon$$"/> |
| 55 | + </actionGroup> |
| 56 | + <!-- Validate both discounts are applied correctly --> |
| 57 | + <waitForText selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$100.00" stepKey="seeSubtotalAfterCoupon"/> |
| 58 | + <waitForText selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$60.00" stepKey="seeDiscountAfterCoupon"/> |
| 59 | + <waitForText selector="{{CheckoutCartSummarySection.total}}" userInput="$40.00" stepKey="seeOrderTotalAfterCoupon"/> |
| 60 | + </test> |
| 61 | +</tests> |
0 commit comments