|
| 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 | + |
| 9 | +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 10 | + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 11 | + <test name="StorefrontCashOnDeliveryPaymentForSpecificCountryTest"> |
| 12 | + <annotations> |
| 13 | + <title value="OnePageCheckout Cash on Delivery method is not visible, if it is not allowed for that specific Country."/> |
| 14 | + <description value="OnePageCheckout Cash on Delivery method is visible only for the allowed Countries, while disappears if the billing address selected from the not allowed Countries."/> |
| 15 | + <stories value="OnePageCheckout Cash on Delivery method disappears, if the address changed to the Country which is not allowed for it."/> |
| 16 | + <features value="OnePageCheckout"/> |
| 17 | + <severity value="AVERAGE"/> |
| 18 | + <testCaseId value=""/> |
| 19 | + <useCaseId value="ACP2E-862"/> |
| 20 | + <group value="checkout"/> |
| 21 | + </annotations> |
| 22 | + <before> |
| 23 | + <!--Enable Cash On Delivery payment method--> |
| 24 | + <magentoCLI command="config:set {{CashOnDeliveryEnableConfigData.path}} {{CashOnDeliveryEnableConfigData.value}}" stepKey="enableCashOnDelivery"/> |
| 25 | + <!--Allow Cash On Delivery for Specific Country--> |
| 26 | + <magentoCLI command="config:set payment/cashondelivery/allowspecific 1" stepKey="allowSpecificValue"/> |
| 27 | + <magentoCLI command="config:set payment/cashondelivery/specificcountry GB" stepKey="specificCountryValue"/> |
| 28 | + |
| 29 | + <!--Create Simple Product--> |
| 30 | + <createData entity="SimpleProduct2" stepKey="createSimpleProduct"/> |
| 31 | + <!--Create Customer--> |
| 32 | + <createData entity="Simple_US_Customer_US_UK_Addresses" stepKey="createCustomer"/> |
| 33 | + </before> |
| 34 | + <after> |
| 35 | + <magentoCLI command="config:set payment/cashondelivery/allowspecific 0" stepKey="allowSpecificValue"/> |
| 36 | + <magentoCLI command="config:set payment/cashondelivery/specificcountry ''" stepKey="specificCountryValue"/> |
| 37 | + <!--Disable Cash On Delivery method--> |
| 38 | + <magentoCLI command="config:set {{CashOnDeliveryDisabledConfigData.path}} {{CashOnDeliveryDisabledConfigData.value}}" stepKey="disabledCashOnDelivery"/> |
| 39 | + |
| 40 | + <!--Customer log out--> |
| 41 | + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> |
| 42 | + <!--Delete created product--> |
| 43 | + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> |
| 44 | + <!--Delete Customer--> |
| 45 | + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> |
| 46 | + </after> |
| 47 | + |
| 48 | + <!--Login as Customer--> |
| 49 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin"> |
| 50 | + <argument name="Customer" value="$$createCustomer$$"/> |
| 51 | + </actionGroup> |
| 52 | + |
| 53 | + <!--Add Simple Product to cart--> |
| 54 | + <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToSimpleProductPage"/> |
| 55 | + <waitForPageLoad stepKey="waitForSimpleProductPageLoad"/> |
| 56 | + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"> |
| 57 | + <argument name="productName" value="$$createSimpleProduct.name$$"/> |
| 58 | + </actionGroup> |
| 59 | + |
| 60 | + <!--Go to Cart and click 'Proceed To Checkout' button--> |
| 61 | + <actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCartPage"/> |
| 62 | + <actionGroup ref="StorefrontClickProceedToCheckoutActionGroup" stepKey="clickProceedToCheckout"/> |
| 63 | + <waitForElement selector="{{CheckoutShippingSection.shippingTab}}" stepKey="waitForCheckoutPage"/> |
| 64 | + |
| 65 | + <!-- Select Shipping Method--> |
| 66 | + <actionGroup ref="StorefrontSetShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod"/> |
| 67 | + |
| 68 | + <!--Click next button to open payment section--> |
| 69 | + <actionGroup ref="StorefrontGuestCheckoutProceedToPaymentStepActionGroup" stepKey="clickNext"/> |
| 70 | + |
| 71 | + <!--Uncheck billing and shipping addresses are same--> |
| 72 | + <uncheckOption selector="{{CheckoutPaymentSection.billingAddressNotSameCheckbox}}" stepKey="uncheckSameBillingAndShippingAddress"/> |
| 73 | + |
| 74 | + <!--Select another existing address option from dropdown--> |
| 75 | + <selectOption selector="{{CheckoutPaymentSection.billingAddressSelectShared}}" userInput="{{UK_Not_Default_Address.street[0]}}" stepKey="chooseAnotherExistingAddress"/> |
| 76 | + <click selector="{{CheckoutPaymentSection.update}}" stepKey="clickUpdateButton"/> |
| 77 | + <waitForPageLoad stepKey="waitForNewAddressPageLoad"/> |
| 78 | + |
| 79 | + <!--Assert COD payment method is available for the specific allowed Country--> |
| 80 | + <seeElement selector="input#cashondelivery" stepKey="seeCodPaymentMethod"/> |
| 81 | + |
| 82 | + <!--Select payment method--> |
| 83 | + <click selector="{{StorefrontCheckoutPaymentMethodsSection.cashOnDelivery}}" stepKey="selectCashOnDeliveryMethod"/> |
| 84 | + |
| 85 | + <!--Billing is same as shipping--> |
| 86 | + <checkOption selector="#billing-address-same-as-shipping-cashondelivery" stepKey="selectPaymentSolution" /> |
| 87 | + <waitForPageLoad stepKey="waitForPageLoad"/> |
| 88 | + |
| 89 | + <!--Assert COD payment method not available anymore--> |
| 90 | + <dontSeeElement selector="input#cashondelivery" stepKey="dontSeeCodPaymentMethod"/> |
| 91 | + </test> |
| 92 | +</tests> |
0 commit comments