|
| 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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 10 | + <test name="StorefrontInstantPurchaseFunctionalityTest"> |
| 11 | + <annotations> |
| 12 | + <features value="InstantPurchase"/> |
| 13 | + <stories value="Using Instant Purchase"/> |
| 14 | + <title value="Checks that Instant Purchase functionality works fine"/> |
| 15 | + <description value="Checks that customer with different billing and shipping addresses work with Instant Purchase functionality fine"/> |
| 16 | + <useCaseId value="MAGETWO-90898"/> |
| 17 | + <testCaseId value="MC-25924"/> |
| 18 | + <severity value="CRITICAL"/> |
| 19 | + <group value="instant_purchase"/> |
| 20 | + <group value="vault"/> |
| 21 | + <group value="braintree"/> |
| 22 | + </annotations> |
| 23 | + <before> |
| 24 | + <magentoCLI command="downloadable:domains:add" arguments="example.com static.magento.com" stepKey="addDownloadableDomain"/> |
| 25 | + <!-- Configure Braintree payment method --> |
| 26 | + <createData entity="BraintreeConfig" stepKey="configureBraintreePayment"/> |
| 27 | + <!-- Enable Braintree with Vault --> |
| 28 | + <createData entity="CustomBraintreeConfigurationData" stepKey="enableBraintreeAndVault"/> |
| 29 | + <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="createCustomer"/> |
| 30 | + <!-- Create all product variations --> |
| 31 | + <createData entity="SimpleProduct2" stepKey="createSimpleProduct"/> |
| 32 | + <createData entity="VirtualProduct" stepKey="createVirtualProduct"/> |
| 33 | + <actionGroup ref="AdminCreateApiConfigurableProductActionGroup" stepKey="createConfigurableProduct"/> |
| 34 | + <!-- Create Bundle Product --> |
| 35 | + <createData entity="ApiFixedBundleProduct" stepKey="createBundleProduct"/> |
| 36 | + <createData entity="DropDownBundleOption" stepKey="createBundleOption"> |
| 37 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 38 | + </createData> |
| 39 | + <createData entity="ApiBundleLink" stepKey="createBundleLink"> |
| 40 | + <requiredEntity createDataKey="createBundleProduct"/> |
| 41 | + <requiredEntity createDataKey="createBundleOption"/> |
| 42 | + <requiredEntity createDataKey="createSimpleProduct"/> |
| 43 | + </createData> |
| 44 | + <!-- Create Downloadable Product --> |
| 45 | + <createData entity="ApiDownloadableProduct" stepKey="createDownloadableProduct"/> |
| 46 | + <createData entity="downloadableLink1" stepKey="addDownloadableLink"> |
| 47 | + <requiredEntity createDataKey="createDownloadableProduct"/> |
| 48 | + </createData> |
| 49 | + <!-- Create Grouped Product --> |
| 50 | + <createData entity="ApiGroupedProduct" stepKey="createGroupedProduct"/> |
| 51 | + <createData entity="OneSimpleProductLink" stepKey="createLinkForGroupedProduct"> |
| 52 | + <requiredEntity createDataKey="createGroupedProduct"/> |
| 53 | + <requiredEntity createDataKey="createSimpleProduct"/> |
| 54 | + </createData> |
| 55 | + <!-- Log in as a customer --> |
| 56 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLoginToStorefront"> |
| 57 | + <argument name="Customer" value="$createCustomer$"/> |
| 58 | + </actionGroup> |
| 59 | + <!-- Customer placed order from storefront with payment method --> |
| 60 | + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> |
| 61 | + <argument name="product" value="$createSimpleProduct$"/> |
| 62 | + </actionGroup> |
| 63 | + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/> |
| 64 | + <actionGroup ref="StorefrontSetShippingMethodActionGroup" stepKey="setShippingMethodFlatRate"/> |
| 65 | + <actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="goToCheckoutPaymentStep"/> |
| 66 | + <!-- Fill Braintree card data --> |
| 67 | + <click selector="{{BraintreeConfigurationPaymentSection.creditCart}}" stepKey="selectBraintreePaymentMethod"/> |
| 68 | + <waitForPageLoad stepKey="waitForBraintreeFormLoad"/> |
| 69 | + <scrollTo selector="{{BraintreeConfigurationPaymentSection.creditCart}}" stepKey="scrollToCreditCardSection"/> |
| 70 | + <actionGroup ref="StorefrontFillCartDataActionGroup" stepKey="fillCardData"> |
| 71 | + <argument name="cartData" value="PaymentAndShippingInfo"/> |
| 72 | + </actionGroup> |
| 73 | + <waitForPageLoad stepKey="waitForFillCardData"/> |
| 74 | + <checkOption selector="{{StorefrontOnePageCheckoutPaymentSection.saveForLaterUse}}" stepKey="checkSaveForLaterUse"/> |
| 75 | + <actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="clickOnPlaceOrder"> |
| 76 | + <argument name="orderNumberMessage" value="CONST.successCheckoutOrderNumberMessage"/> |
| 77 | + <argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage"/> |
| 78 | + </actionGroup> |
| 79 | + </before> |
| 80 | + <after> |
| 81 | + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/> |
| 82 | + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> |
| 83 | + <!-- Set configs to default --> |
| 84 | + <createData entity="DefaultBraintreeConfig" stepKey="defaultBraintreeConfig"/> |
| 85 | + <createData entity="RollBackCustomBraintreeConfigurationData" stepKey="rollBackCustomBraintreeConfigurationData"/> |
| 86 | + <!-- Remove created products/attributes --> |
| 87 | + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> |
| 88 | + <deleteData createDataKey="createVirtualProduct" stepKey="deleteVirtualProduct"/> |
| 89 | + <deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/> |
| 90 | + <deleteData createDataKey="createGroupedProduct" stepKey="deleteGroupedProduct"/> |
| 91 | + <!-- Remove Downloadable Product --> |
| 92 | + <magentoCLI command="downloadable:domains:remove static.magento.com" stepKey="removeDownloadableDomain"/> |
| 93 | + <deleteData createDataKey="createDownloadableProduct" stepKey="deleteDownloadableProduct"/> |
| 94 | + <!-- Remove Configurable Product --> |
| 95 | + <deleteData createDataKey="createConfigProductCreateConfigurableProduct" stepKey="deleteConfigProduct"/> |
| 96 | + <deleteData createDataKey="createConfigProductAttributeCreateConfigurableProduct" stepKey="deleteConfigProductAttribute"/> |
| 97 | + <deleteData createDataKey="createConfigChildProduct1CreateConfigurableProduct" stepKey="deleteConfigChildProduct1"/> |
| 98 | + <deleteData createDataKey="createConfigChildProduct2CreateConfigurableProduct" stepKey="deleteConfigChildProduct2"/> |
| 99 | + <!-- Reindex invalidated indices after product attribute has been created/deleted --> |
| 100 | + <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> |
| 101 | + </after> |
| 102 | + <!-- 1. Browse all product page and verify that the "Instant Purchase" button appears --> |
| 103 | + <!-- Virtual product --> |
| 104 | + <amOnPage url="{{StorefrontProductPage.url($createVirtualProduct.custom_attributes[url_key]$)}}" stepKey="openVirtualProductPage"/> |
| 105 | + <waitForElementVisible selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="waitForButtonOnVirtualProductPage"/> |
| 106 | + <!-- Downloadable Product --> |
| 107 | + <amOnPage url="{{StorefrontProductPage.url($createDownloadableProduct.custom_attributes[url_key]$)}}" stepKey="openDownloadableProductPage"/> |
| 108 | + <waitForElementVisible selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="waitForButtonOnDownloadableProductPage"/> |
| 109 | + <!-- Bundle Product --> |
| 110 | + <amOnPage url="{{StorefrontProductPage.url($createBundleProduct.custom_attributes[url_key]$)}}" stepKey="openBundleProductPage"/> |
| 111 | + <waitForElementVisible selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="waitForCustomizeAndAddToCartButton"/> |
| 112 | + <click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/> |
| 113 | + <waitForElementVisible selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="waitForButtonOnBundleProductPage"/> |
| 114 | + <!-- Grouped product --> |
| 115 | + <amOnPage url="{{StorefrontProductPage.url($createGroupedProduct.custom_attributes[url_key]$)}}" stepKey="openGroupedProductPage"/> |
| 116 | + <waitForElementVisible selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="waitForButtonOnGroupedProductPage"/> |
| 117 | + <!-- Configurable Product --> |
| 118 | + <amOnPage url="{{StorefrontProductPage.url($createConfigProductCreateConfigurableProduct.custom_attributes[url_key]$)}}" stepKey="openConfigurableProductPage"/> |
| 119 | + <waitForElementVisible selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="waitForButtonOnConfigurableProductPage"/> |
| 120 | + <!-- 2. Click on "Instant Purchase" and assert information --> |
| 121 | + <amOnPage url="{{StorefrontProductPage.url($createSimpleProduct.custom_attributes[url_key]$)}}" stepKey="openSimpleProductPage"/> |
| 122 | + <waitForElementVisible selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="waitForInstantPurchaseButton"/> |
| 123 | + <actionGroup ref="AssertStorefrontInstantPurchaseConfirmationDataActionGroup" stepKey="assertInstantPurchasePopupData"> |
| 124 | + <argument name="shippingStreet" value="{{US_Address_NY.street[0]}}"/> |
| 125 | + <argument name="billingStreet" value="{{US_Address_NY.street[0]}}"/> |
| 126 | + <argument name="cardEnding" value="{{StoredPaymentMethods.cardNumberEnding}}"/> |
| 127 | + </actionGroup> |
| 128 | + <!-- 3. Confirm Instant Purchase --> |
| 129 | + <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="placeOrderAgain"/> |
| 130 | + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> |
| 131 | + <see userInput="Your order number is:" selector="{{StorefrontMessagesSection.success}}" stepKey="seePlaceOrderSuccessMessage"/> |
| 132 | + <!-- 4. Customer changes his default address --> |
| 133 | + <amOnPage url="{{StorefrontCustomerAddressesPage.url}}" stepKey="goToAddressPage"/> |
| 134 | + <click selector="{{StorefrontCustomerAddressesSection.editAdditionalAddress('1')}}" stepKey="clickOnEditAdditionalAddressButton"/> |
| 135 | + <checkOption selector="{{StorefrontCustomerAddressFormSection.useAsDefaultBillingAddressCheckBox}}" stepKey="checkUseAsDefaultBillingAddressCheckbox"/> |
| 136 | + <actionGroup ref="AdminSaveCustomerAddressActionGroup" stepKey="saveAddress"/> |
| 137 | + <!-- 5.1 Customer places a new order from the storefront with new payment credentials --> |
| 138 | + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCartAgain"> |
| 139 | + <argument name="product" value="$createSimpleProduct$"/> |
| 140 | + </actionGroup> |
| 141 | + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicartAgain"/> |
| 142 | + <actionGroup ref="StorefrontSetShippingMethodActionGroup" stepKey="setShippingMethodFlatRateAgain"/> |
| 143 | + <click selector="{{CheckoutShippingMethodsSection.shipHereButton}}" stepKey="changeShippingAddress"/> |
| 144 | + <actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="goToCheckoutPaymentStepAgain"/> |
| 145 | + <!-- Fill Braintree card data --> |
| 146 | + <click selector="{{BraintreeConfigurationPaymentSection.creditCart}}" stepKey="selectBraintreePaymentMethodAgain"/> |
| 147 | + <waitForPageLoad stepKey="waitForBraintreeFormLoadAgain"/> |
| 148 | + <scrollTo selector="{{BraintreeConfigurationPaymentSection.creditCart}}" stepKey="scrollToCreditCardSectionAgain"/> |
| 149 | + <actionGroup ref="StorefrontFillCartDataActionGroup" stepKey="fillCardDataAgain"> |
| 150 | + <argument name="cartData" value="VisaDefaultCard"/> |
| 151 | + </actionGroup> |
| 152 | + <waitForPageLoad stepKey="waitForFillCardDataAgain"/> |
| 153 | + <!-- 5.2 Customer save this payment method --> |
| 154 | + <checkOption selector="{{StorefrontOnePageCheckoutPaymentSection.saveForLaterUse}}" stepKey="checkSaveForLaterUseAgain"/> |
| 155 | + <actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="clickOnPlaceOrderAgain"> |
| 156 | + <argument name="orderNumberMessage" value="CONST.successCheckoutOrderNumberMessage"/> |
| 157 | + <argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage"/> |
| 158 | + </actionGroup> |
| 159 | + <!-- 6. Customer opens simple product page --> |
| 160 | + <amOnPage url="{{StorefrontProductPage.url($createSimpleProduct.custom_attributes[url_key]$)}}" stepKey="openSimpleProductPageAgain"/> |
| 161 | + <waitForElementVisible selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="waitForInstantPurchaseButtonAgain"/> |
| 162 | + <!-- 7. Click on "Instant Purchase" and verify that information are different from previous --> |
| 163 | + <actionGroup ref="AssertStorefrontInstantPurchaseConfirmationDataActionGroup" stepKey="assertInstantPurchasePopupDataAgain"> |
| 164 | + <argument name="shippingStreet" value="{{US_Address_NY.street[0]}}"/> |
| 165 | + <argument name="billingStreet" value="{{UK_Not_Default_Address.street[0]}}"/> |
| 166 | + <argument name="cardEnding" value="{{VisaDefaultCardInfo.cardNumberEnding}}"/> |
| 167 | + </actionGroup> |
| 168 | + <!-- 8. Confirm Instant Purchase --> |
| 169 | + <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="placeOrderFinalTime"/> |
| 170 | + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessageAgain"/> |
| 171 | + <see userInput="Your order number is:" selector="{{StorefrontMessagesSection.success}}" stepKey="seePlaceOrderSuccessMessageAgain"/> |
| 172 | + </test> |
| 173 | +</tests> |
0 commit comments