|
| 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="ConfiguringInstantPurchaseFunctionalityTest"> |
| 12 | + <annotations> |
| 13 | + <features value="One Page Checkout"/> |
| 14 | + <stories value="Configuring instant purchase"/> |
| 15 | + <title value="Configuring instant purchase functionality test"/> |
| 16 | + <description value="Configuring instant purchase"/> |
| 17 | + <severity value="CRITICAL"/> |
| 18 | + <testCaseId value="MC-6436"/> |
| 19 | + <group value="checkout"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <!-- Configure Braintree Vault-enabled payment method --> |
| 23 | + <createData entity="BraintreeConfig" stepKey="braintreeConfigurationData"/> |
| 24 | + <createData entity="CustomBraintreeConfigurationData" stepKey="enableBraintree"/> |
| 25 | + |
| 26 | + <!-- Create customer --> |
| 27 | + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> |
| 28 | + |
| 29 | + <!-- Create product --> |
| 30 | + <createData entity="SimpleProduct2" stepKey="createProduct"/> |
| 31 | + |
| 32 | + <!-- Login as admin --> |
| 33 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
| 34 | + </before> |
| 35 | + <after> |
| 36 | + <!-- Set configs to default --> |
| 37 | + <createData entity="DefaultBraintreeConfig" stepKey="defaultBraintreeConfig"/> |
| 38 | + <createData entity="RollBackCustomBraintreeConfigurationData" stepKey="rollBackCustomBraintreeConfigurationData"/> |
| 39 | + |
| 40 | + <!-- Delete product --> |
| 41 | + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> |
| 42 | + |
| 43 | + <!-- Delete customer --> |
| 44 | + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> |
| 45 | + |
| 46 | + <!-- Admin logout --> |
| 47 | + <actionGroup ref="logout" stepKey="adminLogout"/> |
| 48 | + </after> |
| 49 | + |
| 50 | + <!-- Create store views --> |
| 51 | + <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createFirstStoreView"> |
| 52 | + <argument name="customStore" value="storeViewData1"/> |
| 53 | + </actionGroup> |
| 54 | + <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createSecondStoreView"> |
| 55 | + <argument name="customStore" value="storeViewData2"/> |
| 56 | + </actionGroup> |
| 57 | + |
| 58 | + <!-- Login to Frontend --> |
| 59 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer"> |
| 60 | + <argument name="Customer" value="$$createCustomer$$"/> |
| 61 | + </actionGroup> |
| 62 | + |
| 63 | + <!-- Add product to cart --> |
| 64 | + <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> |
| 65 | + <argument name="product" value="$$createProduct$$"/> |
| 66 | + </actionGroup> |
| 67 | + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/> |
| 68 | + |
| 69 | + <!-- Customer placed order with payment method save --> |
| 70 | + <waitForElement selector="{{CheckoutShippingMethodsSection.next}}" stepKey="waitForNextButton"/> |
| 71 | + <click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/> |
| 72 | + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPaymentSectionLoaded"/> |
| 73 | + |
| 74 | + <!-- Fill Braintree cart data --> |
| 75 | + <click selector="{{BraintreeConfigurationPaymentSection.creditCart}}" stepKey="selectBraintreePaymentMethod"/> |
| 76 | + <waitForPageLoad stepKey="waitForBraintreeFormLoad"/> |
| 77 | + <scrollTo selector="{{BraintreeConfigurationPaymentSection.creditCart}}" stepKey="scrollToCreditCardSection"/> |
| 78 | + <actionGroup ref="StorefrontFillCartDataActionGroup" stepKey="fillCartData"/> |
| 79 | + <waitForPageLoad stepKey="waitForFillCartData"/> |
| 80 | + |
| 81 | + <!-- Place order --> |
| 82 | + <click selector="{{BraintreeConfigurationPaymentSection.paymentMethodContainer}}{{CheckoutPaymentSection.placeOrder}}" stepKey="checkoutPlaceOrder"/> |
| 83 | + <waitForPageLoad stepKey="waitForPageLoad"/> |
| 84 | + <see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="waitForLoadSuccessPage"/> |
| 85 | + |
| 86 | + <!-- Go to Configuration > Sales --> |
| 87 | + <actionGroup ref="AdminOpenInstantPurchaseConfigPageActionGroup" stepKey="openInstantPurchaseConfigPage"/> |
| 88 | + |
| 89 | + <!-- Enable Instant Purchase --> |
| 90 | + <actionGroup ref="AdminChangeInstantPurchaseStatusActionGroup" stepKey="enableInstantPurchase"/> |
| 91 | + |
| 92 | + <!-- Switch to specific store view --> |
| 93 | + <actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="switchToSpecificStoreView"> |
| 94 | + <argument name="storeView" value="storeViewData1.name"/> |
| 95 | + </actionGroup> |
| 96 | + |
| 97 | + <!-- Change button text on a single store view --> |
| 98 | + <actionGroup ref="AdminChangeInstantPurchaseButtonTextActionGroup" stepKey="changeInstantPurchaseButtonText"> |
| 99 | + <argument name="buttonText" value="Quick Buy"/> |
| 100 | + </actionGroup> |
| 101 | + |
| 102 | + <!-- Verify changes on the front-end by opening a simple product as a logged in customer with saved card and address on given store view: |
| 103 | + 1. Go to Storefront page --> |
| 104 | + <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStorefrontPage"/> |
| 105 | + |
| 106 | + <!-- 2. Switch store view --> |
| 107 | + <actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="SwitchStoreView"> |
| 108 | + <argument name="storeView" value="storeViewData1"/> |
| 109 | + </actionGroup> |
| 110 | + |
| 111 | + <!-- 3. Assert customer is logged with saved card with address --> |
| 112 | + <actionGroup ref="OpenStorefrontCustomerStoredPaymentMethodsPageActionGroup" stepKey="openStorefrontCustomerStoredPaymentMethodsPage"/> |
| 113 | + <actionGroup ref="AssertStorefrontCustomerSavedCardActionGroup" stepKey="assertCustomerPaymentMethod"/> |
| 114 | + <actionGroup ref="StorefrontCustomerGoToSidebarMenu" stepKey="goToAddressBook"> |
| 115 | + <argument name="menu" value="Address Book"/> |
| 116 | + </actionGroup> |
| 117 | + <see selector="{{CheckoutOrderSummarySection.shippingAddress}}" userInput="{{US_Address_TX.street[0]}} {{US_Address_TX.city}}, {{US_Address_TX.state}}, {{US_Address_TX.postcode}}" stepKey="checkShippingAddress"/> |
| 118 | + |
| 119 | + <!-- Open product page --> |
| 120 | + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage"> |
| 121 | + <argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/> |
| 122 | + </actionGroup> |
| 123 | + |
| 124 | + <!-- Quick Buy button shows up. Clicking it opens review popup --> |
| 125 | + <actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeQuickBuyButton"> |
| 126 | + <argument name="selector" value="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}"/> |
| 127 | + <argument name="userInput" value="Quick Buy"/> |
| 128 | + </actionGroup> |
| 129 | + <click selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="clickQuickBuyButton"/> |
| 130 | + <waitForElementVisible selector="{{StorefrontInstantPurchasePopupSection.modalTitle}}" stepKey="waitForPopUpTitleVisible"/> |
| 131 | + <see selector="{{StorefrontInstantPurchasePopupSection.modalTitle}}" userInput="Instant Purchase Confirmation" stepKey="seeReviewPopUp"/> |
| 132 | + <click selector="{{StorefrontInstantPurchasePopupSection.cancel}}" stepKey="closeModalPopup"/> |
| 133 | + <waitForPageLoad stepKey="waitForClosing"/> |
| 134 | + |
| 135 | + <!-- Verify changes on the front-end by opening a simple product as a logged in customer with saved card and address on a store view for which description was not changed |
| 136 | + 1. New customer session should be started to verify changes --> |
| 137 | + <actionGroup ref="StorefrontSignOutActionGroup" stepKey="customerLogout"/> |
| 138 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginCustomer"> |
| 139 | + <argument name="Customer" value="$$createCustomer$$"/> |
| 140 | + </actionGroup> |
| 141 | + |
| 142 | + <!-- 2. Switch store view which description was not changed --> |
| 143 | + <actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="SwitchToSecondStoreView"> |
| 144 | + <argument name="storeView" value="storeViewData2"/> |
| 145 | + </actionGroup> |
| 146 | + |
| 147 | + <!-- 3. Assert customer is logged with saved card and address --> |
| 148 | + <actionGroup ref="OpenStorefrontCustomerStoredPaymentMethodsPageActionGroup" stepKey="openStorefrontCustomerPaymentMethodsPage"/> |
| 149 | + <actionGroup ref="AssertStorefrontCustomerSavedCardActionGroup" stepKey="assertPaymentMethod"/> |
| 150 | + <actionGroup ref="StorefrontCustomerGoToSidebarMenu" stepKey="openAddressBook"> |
| 151 | + <argument name="menu" value="Address Book"/> |
| 152 | + </actionGroup> |
| 153 | + <see selector="{{CheckoutOrderSummarySection.shippingAddress}}" userInput="{{US_Address_TX.street[0]}} {{US_Address_TX.city}}, {{US_Address_TX.state}}, {{US_Address_TX.postcode}}" stepKey="seeShippingAddress"/> |
| 154 | + |
| 155 | + <!-- Open product page --> |
| 156 | + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openCreatedProductPage"> |
| 157 | + <argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/> |
| 158 | + </actionGroup> |
| 159 | + |
| 160 | + <!-- Instant Purchase button shows up. Clicking it opens review popup. --> |
| 161 | + <actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeInstantPurchaseButton"> |
| 162 | + <argument name="selector" value="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}"/> |
| 163 | + <argument name="userInput" value="Instant Purchase"/> |
| 164 | + </actionGroup> |
| 165 | + <click selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="clickInstantPurchaseButton"/> |
| 166 | + <waitForElementVisible selector="{{StorefrontInstantPurchasePopupSection.modalTitle}}" stepKey="waitForPopUpVisible"/> |
| 167 | + <see selector="{{StorefrontInstantPurchasePopupSection.modalTitle}}" userInput="Instant Purchase Confirmation" stepKey="seeReviewPopUpTitle"/> |
| 168 | + <click selector="{{StorefrontInstantPurchasePopupSection.cancel}}" stepKey="closeModalPopUp"/> |
| 169 | + <waitForPageLoad stepKey="waitForModalClosing"/> |
| 170 | + |
| 171 | + <actionGroup ref="StorefrontSignOutActionGroup" stepKey="createdCustomerLogout"/> |
| 172 | + |
| 173 | + <!-- Return to configuration and disable Instant Purchase in a specific store view --> |
| 174 | + <actionGroup ref="AdminOpenInstantPurchaseConfigPageActionGroup" stepKey="openInstantPurchasePage"/> |
| 175 | + <scrollToTopOfPage stepKey="scrollToTop"/> |
| 176 | + <actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="switchToFirstSpecificStoreView"> |
| 177 | + <argument name="storeView" value="storeViewData1.name"/> |
| 178 | + </actionGroup> |
| 179 | + <actionGroup ref="AdminChangeInstantPurchaseStatusActionGroup" stepKey="disableInstantPurchase"> |
| 180 | + <argument name="status" value="0"/> |
| 181 | + </actionGroup> |
| 182 | + |
| 183 | + <!-- Verify changes on the front-end by opening a simple product as a logged in customer with saved card and address in the specific store view |
| 184 | + 1. New customer session should be started to verify changes --> |
| 185 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCreatedCustomer"> |
| 186 | + <argument name="Customer" value="$$createCustomer$$"/> |
| 187 | + </actionGroup> |
| 188 | + |
| 189 | + <!-- 2. Switch store view --> |
| 190 | + <actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="switchStoreView"> |
| 191 | + <argument name="storeView" value="storeViewData1"/> |
| 192 | + </actionGroup> |
| 193 | + |
| 194 | + <!-- 3. Assert customer is logged with saved card and address --> |
| 195 | + <actionGroup ref="OpenStorefrontCustomerStoredPaymentMethodsPageActionGroup" stepKey="openCustomerPaymentMethodsPage"/> |
| 196 | + <actionGroup ref="AssertStorefrontCustomerSavedCardActionGroup" stepKey="assertCartPaymentMethod"/> |
| 197 | + <actionGroup ref="StorefrontCustomerGoToSidebarMenu" stepKey="goToAddressBookPage"> |
| 198 | + <argument name="menu" value="Address Book"/> |
| 199 | + </actionGroup> |
| 200 | + <see selector="{{CheckoutOrderSummarySection.shippingAddress}}" userInput="{{US_Address_TX.street[0]}} {{US_Address_TX.city}}, {{US_Address_TX.state}}, {{US_Address_TX.postcode}}" stepKey="assertCustomerShippingAddress"/> |
| 201 | + |
| 202 | + <!-- Open product page --> |
| 203 | + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductIndexPage"> |
| 204 | + <argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/> |
| 205 | + </actionGroup> |
| 206 | + |
| 207 | + <!-- Quick Buy button is not visible --> |
| 208 | + <actionGroup ref="AssertStorefrontElementInvisibleActionGroup" stepKey="dontSeeQuickBuyButton"> |
| 209 | + <argument name="selector" value="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}"/> |
| 210 | + <argument name="userInput" value="Quick Buy"/> |
| 211 | + </actionGroup> |
| 212 | + |
| 213 | + <!-- Verify changes on the front-end by opening a simple product as a logged in customer with saved card and address in the other store view |
| 214 | + 1. New customer session should be started to verify changes --> |
| 215 | + <actionGroup ref="StorefrontSignOutActionGroup" stepKey="logoutCustomer"/> |
| 216 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLoginToStorefront"> |
| 217 | + <argument name="Customer" value="$$createCustomer$$"/> |
| 218 | + </actionGroup> |
| 219 | + |
| 220 | + <!-- 2. Switch store view --> |
| 221 | + <actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="switchToSecondStoreView"> |
| 222 | + <argument name="storeView" value="storeViewData2"/> |
| 223 | + </actionGroup> |
| 224 | + |
| 225 | + <!-- 3. Assert customer is logged with saved card and address --> |
| 226 | + <actionGroup ref="OpenStorefrontCustomerStoredPaymentMethodsPageActionGroup" stepKey="goToStorefrontCustomerPaymentMethodsPage"/> |
| 227 | + <actionGroup ref="AssertStorefrontCustomerSavedCardActionGroup" stepKey="assertCardPaymentMethod"/> |
| 228 | + <actionGroup ref="StorefrontCustomerGoToSidebarMenu" stepKey="openAddressBookPage"> |
| 229 | + <argument name="menu" value="Address Book"/> |
| 230 | + </actionGroup> |
| 231 | + <see selector="{{CheckoutOrderSummarySection.shippingAddress}}" userInput="{{US_Address_TX.street[0]}} {{US_Address_TX.city}}, {{US_Address_TX.state}}, {{US_Address_TX.postcode}}" stepKey="seeCustomerShippingAddress"/> |
| 232 | + |
| 233 | + <!-- Open product page --> |
| 234 | + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="goToProductPage"> |
| 235 | + <argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/> |
| 236 | + </actionGroup> |
| 237 | + |
| 238 | + <!-- Instant Purchase button is still visible --> |
| 239 | + <actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeInstantPurchaseBtn"> |
| 240 | + <argument name="selector" value="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}"/> |
| 241 | + <argument name="userInput" value="Instant Purchase"/> |
| 242 | + </actionGroup> |
| 243 | + |
| 244 | + <!-- Delete store views --> |
| 245 | + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteFirstStoreView"> |
| 246 | + <argument name="customStore" value="storeViewData1"/> |
| 247 | + </actionGroup> |
| 248 | + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteSecondStoreView"> |
| 249 | + <argument name="customStore" value="storeViewData2"/> |
| 250 | + </actionGroup> |
| 251 | + </test> |
| 252 | +</tests> |
0 commit comments