|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | + /** |
| 4 | + * Copyright 2024 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="StorefrontPaypalExpressCheckoutPaymentMethodDiscountTest"> |
| 11 | + <annotations> |
| 12 | + <features value="PayPal"/> |
| 13 | + <stories value="Paypal express checkout with discount"/> |
| 14 | + <title value="Paypal Express Checkout with payment method discount"/> |
| 15 | + <description value="Place an order with discount for using paypal express checkout as payment method applied"/> |
| 16 | + <severity value="CRITICAL"/> |
| 17 | + <testCaseId value="AC-12676"/> |
| 18 | + <useCaseId value="ACP2E-3163"/> |
| 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 | + <!-- US Customer is created --> |
| 27 | + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> |
| 28 | + <!-- Create new cart price rule --> |
| 29 | + <createData entity="SalesRuleDiscountOnPayPalExpressCheckoutAsPaymentMethod" stepKey="createCartPriceRule"/> |
| 30 | + <!-- Admin login --> |
| 31 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 32 | + <!-- Search Cart Price Rule and go to edit Cart Price Rule --> |
| 33 | + <actionGroup ref="AdminOpenCartPriceRulesPageActionGroup" stepKey="amOnCartPriceList"/> |
| 34 | + <fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="$$createCartPriceRule.name$$" |
| 35 | + stepKey="fillFieldFilterByName"/> |
| 36 | + <click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="clickSearchButton"/> |
| 37 | + <see selector="{{AdminCartPriceRulesSection.nameColumns}}" userInput="$$createCartPriceRule.name$$" |
| 38 | + stepKey="seeRuleName"/> |
| 39 | + <click selector="{{AdminCartPriceRulesSection.rowContainingText($$createCartPriceRule.name$$)}}" |
| 40 | + stepKey="goToEditRule"/> |
| 41 | + <actionGroup ref="AdminCartPriceRuleFillPaymentConditionActionGroup" stepKey="setCartAttributeConditionForCartPriceRule"> |
| 42 | + <argument name="paymentMethodName" value="PayPal Express Checkout"/> |
| 43 | + </actionGroup> |
| 44 | + <actionGroup ref="AdminCartPriceRuleSaveActionGroup" stepKey="saveCartPriceRule"/> |
| 45 | + </before> |
| 46 | + <after> |
| 47 | + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> |
| 48 | + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> |
| 49 | + <!-- Delete Cart Price Rule --> |
| 50 | + <deleteData createDataKey="createCartPriceRule" stepKey="deleteCartPriceRule"/> |
| 51 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 52 | + </after> |
| 53 | + <!-- Login to StoreFront --> |
| 54 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="storefrontCustomerLogin"> |
| 55 | + <argument name="Customer" value="$$createCustomer$$"/> |
| 56 | + </actionGroup> |
| 57 | + <!-- Add product to cart --> |
| 58 | + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> |
| 59 | + <argument name="product" value="$$createProduct$$"/> |
| 60 | + </actionGroup> |
| 61 | + <!-- Goto Checkout Page --> |
| 62 | + <actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="goToCheckout"/> |
| 63 | + <actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShipping" /> |
| 64 | + <actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/> |
| 65 | + <!-- Assert order total before applying selecting payment method --> |
| 66 | + <actionGroup ref="AssertStorefrontCheckoutPaymentSummaryTotalActionGroup" stepKey="assertSummaryTotalBeforeDiscount"> |
| 67 | + <argument name="orderTotal" value="$128.00"/> |
| 68 | + </actionGroup> |
| 69 | + <!-- Click on PayPal payment radio button --> |
| 70 | + <waitForElementClickable selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="waitForPayPalRadioButton"/> |
| 71 | + <click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="selectPaypalPayment"/> |
| 72 | + <!-- Assert order total before applying selecting payment method --> |
| 73 | + <actionGroup ref="AssertStorefrontCheckoutPaymentSummaryTotalActionGroup" stepKey="assertSummaryTotalAfterDiscount"> |
| 74 | + <argument name="orderTotal" value="$91.10"/> |
| 75 | + </actionGroup> |
| 76 | + <actionGroup ref="SwitchToPayPalGroupBtnActionGroup" stepKey="clickPayPalBtn"/> |
| 77 | + <!-- Login to Paypal in-context and verify order total on paypal page--> |
| 78 | + <actionGroup ref="StorefrontLoginToPayPalPaymentAccountTwoStepActionGroup" stepKey="loginToPayPal"/> |
| 79 | + <waitForText selector="{{PayPalPaymentSection.orderTotalOnPaypalCheckout}}" userInput="$91.10" stepKey="verifyOrderTotalOnPaypalPage"/> |
| 80 | + <!-- Click PayPal button and go back to Magento site --> |
| 81 | + <actionGroup ref="StorefrontPaypalSwitchBackToMagentoFromCheckoutPageActionGroup" stepKey="confirmPaymentAndGoBackToMagento"/> |
| 82 | + <!-- I see order successful Page --> |
| 83 | + <actionGroup ref="AssertStorefrontCheckoutSuccessActionGroup" stepKey="assertOrderSuccess"/> |
| 84 | + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="orderNumber"/> |
| 85 | + <assertNotEmpty stepKey="assertOrderIdIsNotEmpty"> |
| 86 | + <actualResult type="const">$orderNumber</actualResult> |
| 87 | + </assertNotEmpty> |
| 88 | + </test> |
| 89 | +</tests> |
0 commit comments