|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | + /** |
| 4 | + * Copyright © Magento, Inc. All rights reserved. |
| 5 | + * See COPYING.txt for license details. |
| 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="StorefrontPaypalExpressCheckoutWithDiscountCouponTest"> |
| 11 | + <annotations> |
| 12 | + <features value="PayPal"/> |
| 13 | + <stories value="Paypal express checkout with discount"/> |
| 14 | + <title value="Paypal Express Checkout with discount coupon applied"/> |
| 15 | + <description value="Place an order with discount coupon applied using paypal express checkout as payment method"/> |
| 16 | + <severity value="CRITICAL"/> |
| 17 | + <testCaseId value="AC-6152"/> |
| 18 | + </annotations> |
| 19 | + <before> |
| 20 | + <!-- Simple product is created --> |
| 21 | + <createData entity="SimpleProduct" stepKey="createProduct"/> |
| 22 | + <!-- US Customer is created --> |
| 23 | + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> |
| 24 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 25 | + <!-- Delete all existing cart price rules --> |
| 26 | + <actionGroup ref="AdminCartPriceRuleDeleteAllActionGroup" stepKey="deleteAllCartPriceRules"/> |
| 27 | + <!-- Create new cart price rule --> |
| 28 | + <createData entity="SalesRuleSpecificCouponWithPercentDiscount" stepKey="createCartPriceRule"/> |
| 29 | + <createData entity="SimpleSalesRuleCoupon" stepKey="createCouponForCartPriceRule"> |
| 30 | + <requiredEntity createDataKey="createCartPriceRule"/> |
| 31 | + </createData> |
| 32 | + <!-- Configure Paypal Express Checkout --> |
| 33 | + <actionGroup ref="AdminPayPalExpressCheckoutEnableActionGroup" stepKey="ConfigPayPalExpress"> |
| 34 | + <argument name="credentials" value="SamplePaypalExpressConfig2"/> |
| 35 | + </actionGroup> |
| 36 | + </before> |
| 37 | + <after> |
| 38 | + <magentoCLI command="config:set payment/paypal_express/active 0" stepKey="disablePayPalExpress"/> |
| 39 | + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> |
| 40 | + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> |
| 41 | + <!-- Delete Cart Price Rule --> |
| 42 | + <deleteData createDataKey="createCartPriceRule" stepKey="deleteCartPriceRule"/> |
| 43 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 44 | + </after> |
| 45 | + <!-- Login to StoreFront --> |
| 46 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="storefrontCustomerLogin"> |
| 47 | + <argument name="Customer" value="$$createCustomer$$"/> |
| 48 | + </actionGroup> |
| 49 | + <!-- Add product to cart --> |
| 50 | + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> |
| 51 | + <argument name="product" value="$$createProduct$$"/> |
| 52 | + </actionGroup> |
| 53 | + <!-- Goto Checkout Page --> |
| 54 | + <actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="goToCheckout"/> |
| 55 | + <actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShipping" /> |
| 56 | + <actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/> |
| 57 | + <!-- Assert order total before applying coupon --> |
| 58 | + <actionGroup ref="AssertStorefrontCheckoutPaymentSummaryTotalActionGroup" stepKey="assertSummaryTotalBeforeCoupon"> |
| 59 | + <argument name="orderTotal" value="$128.00"/> |
| 60 | + </actionGroup> |
| 61 | + <!-- Apply Discount Coupon to the Order and assert order total --> |
| 62 | + <actionGroup ref="StorefrontApplyDiscountCodeActionGroup" stepKey="applyDiscountCoupon"> |
| 63 | + <argument name="discountCode" value="$$createCouponForCartPriceRule.code$$"/> |
| 64 | + </actionGroup> |
| 65 | + <actionGroup ref="AssertStorefrontCheckoutPaymentSummaryTotalActionGroup" stepKey="assertSummaryTotalAfterCoupon"> |
| 66 | + <argument name="orderTotal" value="$110.70"/> |
| 67 | + </actionGroup> |
| 68 | + <!-- Click on PayPal payment radio button --> |
| 69 | + <waitForElementClickable selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="waitForPayPalRadioButton"/> |
| 70 | + <click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="selectPaypalPayment"/> |
| 71 | + <actionGroup ref="SwitchToPayPalGroupBtnActionGroup" stepKey="clickPayPalBtn"/> |
| 72 | + <!-- Login to Paypal in-context and verify order total on paypal page--> |
| 73 | + <actionGroup ref="StorefrontLoginToPayPalPaymentAccountTwoStepActionGroup" stepKey="loginToPayPal"/> |
| 74 | + <waitForText selector="{{PayPalPaymentSection.orderTotalOnPaypalCheckout}}" userInput="$110.70" stepKey="verifyOrderTotalOnPaypalPage"/> |
| 75 | + <!-- Click PayPal button and go back to Magento site --> |
| 76 | + <actionGroup ref="StorefrontPaypalSwitchBackToMagentoFromCheckoutPageActionGroup" stepKey="confirmPaymentAndGoBackToMagento"/> |
| 77 | + <!-- I see order successful Page --> |
| 78 | + <actionGroup ref="AssertStorefrontCheckoutSuccessActionGroup" stepKey="assertOrderSuccess"/> |
| 79 | + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="orderNumber"/> |
| 80 | + <assertNotEmpty stepKey="assertOrderIdIsNotEmpty"> |
| 81 | + <actualResult type="const">$orderNumber</actualResult> |
| 82 | + </assertNotEmpty> |
| 83 | + </test> |
| 84 | +</tests> |
0 commit comments