|
| 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="StorefrontAssertCartPriceRuleWithShippingMethodSetAsConditionTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Shipping"/> |
| 14 | + <stories value="Cart price rules"/> |
| 15 | + <title value="Assert cart price rule with shipping conditions"/> |
| 16 | + <description value="In Storefront assert cart price rule with shipping method condition is successfully applied"/> |
| 17 | + <severity value="AVERAGE"/> |
| 18 | + <testCaseId value="AC-9560"/> |
| 19 | + <group value="shipping"/> |
| 20 | + <group value="SalesRule"/> |
| 21 | + </annotations> |
| 22 | + <before> |
| 23 | + <createData entity="ApiSimpleProductWithCustomPrice" stepKey="createProduct"/> |
| 24 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 25 | + <!-- Create cart price rule with shipping method condition --> |
| 26 | + <!-- Delete existing cart price rule --> |
| 27 | + <actionGroup ref="AdminCartPriceRuleDeleteAllActionGroup" stepKey="deleteAllExistingCartPriceRules"/> |
| 28 | + <actionGroup ref="AdminOpenNewCartPriceRuleFormPageActionGroup" stepKey="createCartPriceRule"/> |
| 29 | + <actionGroup ref="AdminCartPriceRuleFillMainInfoActionGroup" stepKey="fillCartPriceRuleMainInfo"> |
| 30 | + <argument name="name" value="{{CartPriceRuleFreeShippingWithCouponAppliedOnly.name}}"/> |
| 31 | + <argument name="description" value="{{CartPriceRuleFreeShippingWithCouponAppliedOnly.description}}"/> |
| 32 | + </actionGroup> |
| 33 | + <!-- Specify coupon --> |
| 34 | + <actionGroup ref="AdminCartPriceRuleFillCouponInfoActionGroup" stepKey="fillCartPriceRuleCouponInfo"/> |
| 35 | + <!-- Add condition for the cart price rule (If ALL of these conditions are TRUE : Shipping Method is [flatrate] Fixed) --> |
| 36 | + <actionGroup ref="AdminCartPriceRuleFillShippingConditionActionGroup" stepKey="setCartAttributeConditionForCartPriceRule"/> |
| 37 | + <actionGroup ref="AdminCreateCartPriceRuleActionsSectionDiscountFieldsActionGroup" stepKey="fillCartPriceRuleActionsSection"> |
| 38 | + <argument name="rule" value="CartPriceRuleFreeShippingWithCouponAppliedOnly"/> |
| 39 | + </actionGroup> |
| 40 | + <!-- Click on apply to shipping amount--> |
| 41 | + <actionGroup ref="AdminCreateCartPriceRuleActionsSectionShippingAmountActionGroup" stepKey="clickOnApplyToShippingMethod"/> |
| 42 | + <!-- In action tab under Free Shipping select For shipment with matching items --> |
| 43 | + <actionGroup ref="AdminCreateCartPriceRuleActionsSectionFreeShippingActionGroup" stepKey="fillCartPriceRuleFreeShippingActionsSection"> |
| 44 | + <argument name="freeShippingOption" value="{{CartPriceRuleFreeShippingWithCouponAppliedOnly.simple_free_shipping}}"/> |
| 45 | + </actionGroup> |
| 46 | + <!-- Save the cart price rule --> |
| 47 | + <actionGroup ref="AdminCartPriceRuleSaveActionGroup" stepKey="saveCartPriceRule"/> |
| 48 | + </before> |
| 49 | + <after> |
| 50 | + <!-- Delete product --> |
| 51 | + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> |
| 52 | + <!-- Delete cart price rule for free shipping --> |
| 53 | + <actionGroup ref="AdminCartPriceRuleDeleteAllActionGroup" stepKey="deleteAllCartPriceRules"/> |
| 54 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 55 | + </after> |
| 56 | + <!-- Add product to cart and check shipping prices --> |
| 57 | + <actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="navigateToProductPage"> |
| 58 | + <argument name="productUrlKey" value="$createProduct.custom_attributes[url_key]$"/> |
| 59 | + </actionGroup> |
| 60 | + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart"> |
| 61 | + <argument name="product" value="$createProduct$" /> |
| 62 | + <argument name="productCount" value="1" /> |
| 63 | + </actionGroup> |
| 64 | + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/> |
| 65 | + <actionGroup ref="GuestCheckoutFillNewShippingAddressActionGroup" stepKey="guestCheckoutFillingShippingSection"> |
| 66 | + <argument name="customer" value="CustomerEntityOne" /> |
| 67 | + <argument name="address" value="CustomerAddressSimple" /> |
| 68 | + </actionGroup> |
| 69 | + <waitForPageLoad stepKey="waitForPageLoad2" /> |
| 70 | + <waitForText selector="{{CheckoutShippingMethodsSection.shippingRatePriceByName('Fixed')}}" userInput="$5.00" stepKey="assertFlatRatedMethodPrice"/> |
| 71 | + <waitForElementClickable selector="{{CheckoutShippingMethodsSection.shippingMethodFlatRate}}" stepKey="waitForFlatRateShippingMethod"/> |
| 72 | + <!-- Apply cart price rule and verify coupen is successfully applied --> |
| 73 | + <click selector="{{CheckoutShippingMethodsSection.checkShippingMethodByName('Flat Rate')}}" stepKey="selectFlatRateShippingMethod"/> |
| 74 | + <actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="goToPaymentStep"/> |
| 75 | + <actionGroup ref="StorefrontApplyDiscountCodeActionGroup" stepKey="applyCoupon"> |
| 76 | + <argument name="discountCode" value="{{_defaultCoupon.code}}"/> |
| 77 | + </actionGroup> |
| 78 | + </test> |
| 79 | +</tests> |
0 commit comments