|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | + /** |
| 4 | + * Copyright 2025 Adobe |
| 5 | + * All Rights Reserved. |
| 6 | + */ |
| 7 | +--> |
| 8 | +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 9 | + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 10 | + <test name="StorefrontRewardPointsAppliedAfterApplyingCouponTest"> |
| 11 | + <annotations> |
| 12 | + <features value="PayPal"/> |
| 13 | + <stories value="Paypal express checkout with a discount and reward points"/> |
| 14 | + <title value="Reward Points should be added to orders after applying coupon and using PayPal Express payment method"/> |
| 15 | + <description value="Reward points should be added to a customer’s account when applied with a coupon code during checkout with the PayPal Express payment method. "/> |
| 16 | + <severity value="MAJOR"/> |
| 17 | + <testCaseId value="AC-6036"/> |
| 18 | + <useCaseId value="ACP2E-1029"/> |
| 19 | + <group value="3rd_party_integration"/> |
| 20 | + <group value="paypalExpress"/> |
| 21 | + <group value="pr_exclude"/> |
| 22 | + </annotations> |
| 23 | + <before> |
| 24 | + <!-- Simple product is created --> |
| 25 | + <createData entity="SimpleProduct" stepKey="createProduct"/> |
| 26 | + |
| 27 | + <!-- US Customer is created --> |
| 28 | + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> |
| 29 | + |
| 30 | + <!-- Setup Paypal Express --> |
| 31 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 32 | + <actionGroup ref="AdminPayPalExpressCheckoutEnableActionGroup" stepKey="configPayPalExpress"> |
| 33 | + <argument name="credentials" value="SamplePaypalExpressConfig2"/> |
| 34 | + </actionGroup> |
| 35 | + <magentoCLI command="config:set {{StorefrontPaypalExpressSalePaymentActionOptionConfigData.path}} {{StorefrontPaypalExpressSalePaymentActionOptionConfigData.value}}" stepKey="setPaymentAction"/> |
| 36 | + |
| 37 | + <!-- Delete all existing cart price rules --> |
| 38 | + <actionGroup ref="AdminCartPriceRuleDeleteAllActionGroup" stepKey="deleteAllCartPriceRules"/> |
| 39 | + |
| 40 | + <!-- Create a cart price rule --> |
| 41 | + <actionGroup ref="AdminOpenCartPriceRulesPageActionGroup" stepKey="amOnCartPriceList"/> |
| 42 | + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> |
| 43 | + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{_defaultCoupon.code}}" stepKey="fillRuleName"/> |
| 44 | + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> |
| 45 | + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="General" stepKey="selectCustomerGroup"/> |
| 46 | + <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="selectCouponType"/> |
| 47 | + <fillField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{_defaultCoupon.code}}" stepKey="fillCouponCode"/> |
| 48 | + <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> |
| 49 | + <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="selectActionType"/> |
| 50 | + <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="0.99" stepKey="fillDiscountAmount"/> |
| 51 | + <fillField selector="{{AdminCartPriceRulesFormSection.addRewardPoints}}" userInput="100" stepKey="fillRewardPoints"/> |
| 52 | + <click selector="{{AdminCartPriceRulesFormSection.saveAndContinue}}" stepKey="clickSaveAndContinueButton"/> |
| 53 | + </before> |
| 54 | + <after> |
| 55 | + <magentoCLI command="config:set payment/paypal_express/active 0" stepKey="disablePayPalExpress"/> |
| 56 | + <magentoCLI command="config:set {{StorefrontPaypalExpressAuthorizationPaymentActionOptionConfigData.path}} {{StorefrontPaypalExpressAuthorizationPaymentActionOptionConfigData.value}}" stepKey="setPaymentAction"/> |
| 57 | + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> |
| 58 | + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> |
| 59 | + <!--Delete cart price rule--> |
| 60 | + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCartPriceRule"> |
| 61 | + <argument name="ruleName" value="{{_defaultCoupon.code}}"/> |
| 62 | + </actionGroup> |
| 63 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 64 | + </after> |
| 65 | + <!-- Login to StoreFront --> |
| 66 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="storefrontCustomerLogin"> |
| 67 | + <argument name="Customer" value="$$createCustomer$$"/> |
| 68 | + </actionGroup> |
| 69 | + <!-- Add product to cart --> |
| 70 | + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> |
| 71 | + <argument name="product" value="$$createProduct$$"/> |
| 72 | + </actionGroup> |
| 73 | + <!-- Goto Checkout Page --> |
| 74 | + <actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="goToCheckout"/> |
| 75 | + <actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShipping" /> |
| 76 | + <actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/> |
| 77 | + <!-- Apply Coupon Code to the Order --> |
| 78 | + <actionGroup ref="StorefrontApplyDiscountCodeActionGroup" stepKey="applyDiscountCoupon"> |
| 79 | + <argument name="discountCode" value="{{_defaultCoupon.code}}"/> |
| 80 | + </actionGroup> |
| 81 | + <!-- Click on PayPal payment radio button --> |
| 82 | + <waitForElementClickable selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="waitForPayPalRadioButton"/> |
| 83 | + <click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="selectPaypalPayment"/> |
| 84 | + <actionGroup ref="SwitchToPayPalGroupBtnActionGroup" stepKey="clickPayPalBtn"/> |
| 85 | + <!-- Login to PayPal in-context and verify order total on PayPal page--> |
| 86 | + <actionGroup ref="StorefrontLoginToPayPalPaymentAccountTwoStepActionGroup" stepKey="loginToPayPal"/> |
| 87 | + <waitForText selector="{{PayPalPaymentSection.orderTotalOnPaypalCheckout}}" userInput="$127.01" stepKey="verifyOrderTotalOnPaypalPage"/> |
| 88 | + <!-- Click PayPal button and go back to Magento site --> |
| 89 | + <actionGroup ref="StorefrontPaypalSwitchBackToMagentoFromCheckoutPageActionGroup" stepKey="confirmPaymentAndGoBackToMagento"/> |
| 90 | + <!-- I see order successful Page --> |
| 91 | + <actionGroup ref="AssertStorefrontCheckoutSuccessActionGroup" stepKey="assertOrderSuccess"/> |
| 92 | + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="orderNumber"/> |
| 93 | + <assertNotEmpty stepKey="assertOrderIdIsNotEmpty"> |
| 94 | + <actualResult type="const">$orderNumber</actualResult> |
| 95 | + </assertNotEmpty> |
| 96 | + <!-- Navigate to customer Dashboard Page --> |
| 97 | + <amOnPage url="{{StorefrontCustomerDashboardPage.url}}" stepKey="navigateToCustomerDashboardPage"/> |
| 98 | + <waitForPageLoad stepKey="waitForCustomerDashboardPageLoad"/> |
| 99 | + </test> |
| 100 | +</tests> |
0 commit comments