|
| 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="CreateBillingAgreementFromCustomersAccountTest"> |
| 11 | + <annotations> |
| 12 | + <features value="PayPal"/> |
| 13 | + <stories value="Billing Agreement"/> |
| 14 | + <title value="Create Billing Agreement from customer's Account"/> |
| 15 | + <description value="Create Billing Agreement from customer's Account"/> |
| 16 | + <severity value="MAJOR"/> |
| 17 | + <testCaseId value="AC-5101"/> |
| 18 | + <group value="paypal"/> |
| 19 | + </annotations> |
| 20 | + <before> |
| 21 | + <!--Enable free shipping method --> |
| 22 | + <magentoCLI command="config:set {{EnableFreeShippingConfigData.path}} {{EnableFreeShippingConfigData.value}}" stepKey="enableFreeShipping"/> |
| 23 | + |
| 24 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 25 | + <!-- New Customer --> |
| 26 | + <createData entity="Simple_US_Customer" stepKey="createCustomer"> |
| 27 | + <field key="firstname">John1</field> |
| 28 | + <field key="lastname">Doe1</field> |
| 29 | + </createData> |
| 30 | + <actionGroup ref="AdminPayPalExpressCheckoutEnableActionGroup" stepKey="ConfigPayPalExpress"> |
| 31 | + <argument name="credentials" value="SamplePaypalExpressConfig2"/> |
| 32 | + </actionGroup> |
| 33 | + <actionGroup ref="AdminPayPalExpressCheckoutEnableBillingAgreementActionGroup" stepKey="enableBillingAgreement"> |
| 34 | + <argument name="countryCode" value="us"/> |
| 35 | + </actionGroup> |
| 36 | + </before> |
| 37 | + <after> |
| 38 | + <magentoCLI command="config:set {{DisableFreeShippingConfigData.path}} {{DisableFreeShippingConfigData.value}}" stepKey="disableFreeShipping"/> |
| 39 | + <magentoCLI command="config:set paypal/general/merchant_country US" stepKey="setMerchantCountry"/> |
| 40 | + <magentoCLI command="config:set payment/paypal_express/active 0" stepKey="disablePayPalExpress"/> |
| 41 | + <magentoCLI command="config:set payment/wps_express/active 0" stepKey="disableWPSExpress"/> |
| 42 | + <magentoCLI command="config:set payment/hosted_pro/active 0" stepKey="disableHostedProExpress"/> |
| 43 | + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> |
| 44 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 45 | + </after> |
| 46 | + <!--Log in to Storefront as Customer--> |
| 47 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="signUpNewUser"> |
| 48 | + <argument name="Customer" value="$$createCustomer$$"/> |
| 49 | + </actionGroup> |
| 50 | + <!-- Go to Billing Agreement Section and click on dropdown--> |
| 51 | + <click selector="{{StorefrontCustomerSidebarSection.sidebarCurrentTab('Billing Agreements')}}" stepKey="clickOnMyOrders"/> |
| 52 | + <selectOption selector ="{{StorefrontBillingAgreementSection.billingAgreementDropdown}}" userInput="PayPal Billing Agreement" stepKey="enableSandboxMode"/> |
| 53 | + <click selector="{{StorefrontBillingAgreementSection.createButton}}" stepKey="clickCreateButton"/> |
| 54 | + <reloadPage stepKey="refreshPage1"/> |
| 55 | + <reloadPage stepKey="refreshPage2"/> |
| 56 | + <reloadPage stepKey="refreshPage3"/> |
| 57 | + <!-- Login to paypal to create Billing Agreement--> |
| 58 | + <click selector="{{StorefrontBillingAgreementSection.expandLogin}}" stepKey="expandLogin"/> |
| 59 | + <waitForPageLoad stepKey="waitToLoadLoginPage" time="10"/> |
| 60 | + <click selector="{{StorefrontBillingAgreementSection.loginButton}}" stepKey="clickOnLogin"/> |
| 61 | + <waitForPageLoad stepKey="waitForBillingAgreementPage" time="10"/> |
| 62 | + <actionGroup ref="BillingAgreementPayPalPaymentActionGroup" stepKey="loginPaypal"/> |
| 63 | + <click selector="{{StorefrontBillingAgreementSection.agreeAndContinue}}" stepKey="clickContinue"/> |
| 64 | + <waitForPageLoad stepKey="waitForAgreeAndContinue"/> |
| 65 | + <grabTextFrom selector="{{StorefrontBillingAgreementSection.billingAgreementId}}" stepKey="billingID"/> |
| 66 | + <grabTextFrom selector="{{StorefrontBillingAgreementSection.successMessageNew}}" stepKey="grabSuccessMessage"/> |
| 67 | + <waitForPageLoad stepKey="waitToGrabSuccessMessage" time="10"/> |
| 68 | + <!-- Assert Billing Agreement ID in Storefront--> |
| 69 | + <assertStringContainsString stepKey="AssertProduct2"> |
| 70 | + <actualResult type="const">$grabSuccessMessage</actualResult> |
| 71 | + <expectedResult type="string">$billingID</expectedResult> |
| 72 | + </assertStringContainsString> |
| 73 | + <!-- Go to "all customers" page in Admin --> |
| 74 | + <actionGroup ref="AdminOpenCustomersGridActionGroup" stepKey="navigateToCustomersPage"/> |
| 75 | + <!-- Filter by first customer email and Verify Billing Agreement ID--> |
| 76 | + <actionGroup ref="AdminFilterCustomerGridByEmail" stepKey="filterByFullValue"> |
| 77 | + <argument name="email" value="$$createCustomer.email$$"/> |
| 78 | + </actionGroup><actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="openCustomerEditPage"/> |
| 79 | + <click selector="{{AdminCustomerInformationSection.billingAgreements}}" stepKey="clickOnBillingAgreements"/> |
| 80 | + <grabTextFrom selector="{{AdminBillingAgreementSection.billingAgreementId}}" stepKey="grabBillingID"/> |
| 81 | + <assertEquals stepKey="assertSecondProductMapPrice"> |
| 82 | + <actualResult type="const">$grabBillingID</actualResult> |
| 83 | + <expectedResult type="string">$billingID</expectedResult> |
| 84 | + </assertEquals> |
| 85 | + </test> |
| 86 | +</tests> |
0 commit comments