Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Commit

Permalink
Merge pull request #170 from magento-pangolin/MC-6436
Browse files Browse the repository at this point in the history
MC-6436
  • Loading branch information
RyanZolper authored Jun 19, 2019
2 parents 68984ab + 2fed193 commit 7e55aca
Show file tree
Hide file tree
Showing 14 changed files with 451 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/code/Magento/Braintree/Test/Mftf/Data/BraintreeData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@
<data key="year">20</data>
<data key="cvv">113</data>
</entity>
<entity name="StoredPaymentMethods">
<data key="cardNumberEnding">5100</data>
<data key="cardExpire">12/2020</data>
</entity>

<entity name="BraintreeConfigurationData" type="data">
<data key="title">Credit Card (Braintree)</data>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertStorefrontElementInvisibleActionGroup">
<arguments>
<argument name="selector" type="string"/>
<argument name="userInput" type="string"/>
</arguments>
<dontSee selector="{{selector}}" userInput="{{userInput}}" stepKey="dontSeeElement"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="ConfiguringInstantPurchaseFunctionalityTest">
<annotations>
<features value="One Page Checkout"/>
<stories value="Configuring instant purchase"/>
<title value="Configuring instant purchase functionality test"/>
<description value="Configuring instant purchase"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-6436"/>
<group value="checkout"/>
</annotations>
<before>
<!-- Configure Braintree Vault-enabled payment method -->
<createData entity="BraintreeConfig" stepKey="braintreeConfigurationData"/>
<createData entity="CustomBraintreeConfigurationData" stepKey="enableBraintree"/>

<!-- Create customer -->
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>

<!-- Create product -->
<createData entity="SimpleProduct2" stepKey="createProduct"/>

<!-- Login as admin -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
</before>
<after>
<!-- Set configs to default -->
<createData entity="DefaultBraintreeConfig" stepKey="defaultBraintreeConfig"/>
<createData entity="RollBackCustomBraintreeConfigurationData" stepKey="rollBackCustomBraintreeConfigurationData"/>

<!-- Delete product -->
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>

<!-- Delete customer -->
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>

<!-- Admin logout -->
<actionGroup ref="logout" stepKey="adminLogout"/>
</after>

<!-- Create store views -->
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createFirstStoreView">
<argument name="customStore" value="storeViewData1"/>
</actionGroup>
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createSecondStoreView">
<argument name="customStore" value="storeViewData2"/>
</actionGroup>

<!-- Login to Frontend -->
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer">
<argument name="Customer" value="$$createCustomer$$"/>
</actionGroup>

<!-- Add product to cart -->
<actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart">
<argument name="product" value="$$createProduct$$"/>
</actionGroup>
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>

<!-- Customer placed order with payment method save -->
<waitForElement selector="{{CheckoutShippingMethodsSection.next}}" stepKey="waitForNextButton"/>
<click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/>
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPaymentSectionLoaded"/>

<!-- Fill Braintree cart data -->
<click selector="{{BraintreeConfigurationPaymentSection.creditCart}}" stepKey="selectBraintreePaymentMethod"/>
<waitForPageLoad stepKey="waitForBraintreeFormLoad"/>
<scrollTo selector="{{BraintreeConfigurationPaymentSection.creditCart}}" stepKey="scrollToCreditCardSection"/>
<actionGroup ref="StorefrontFillCartDataActionGroup" stepKey="fillCartData"/>
<waitForPageLoad stepKey="waitForFillCartData"/>

<!-- Place order -->
<click selector="{{BraintreeConfigurationPaymentSection.paymentMethodContainer}}{{CheckoutPaymentSection.placeOrder}}" stepKey="checkoutPlaceOrder"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="waitForLoadSuccessPage"/>

<!-- Go to Configuration > Sales -->
<actionGroup ref="AdminOpenInstantPurchaseConfigPageActionGroup" stepKey="openInstantPurchaseConfigPage"/>

<!-- Enable Instant Purchase -->
<actionGroup ref="AdminChangeInstantPurchaseStatusActionGroup" stepKey="enableInstantPurchase"/>

<!-- Switch to specific store view -->
<actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="switchToSpecificStoreView">
<argument name="storeView" value="storeViewData1.name"/>
</actionGroup>

<!-- Change button text on a single store view -->
<actionGroup ref="AdminChangeInstantPurchaseButtonTextActionGroup" stepKey="changeInstantPurchaseButtonText">
<argument name="buttonText" value="Quick Buy"/>
</actionGroup>

<!-- 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:
1. Go to Storefront page -->
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStorefrontPage"/>

<!-- 2. Switch store view -->
<actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="SwitchStoreView">
<argument name="storeView" value="storeViewData1"/>
</actionGroup>

<!-- 3. Assert customer is logged with saved card with address -->
<actionGroup ref="OpenStorefrontCustomerStoredPaymentMethodsPageActionGroup" stepKey="openStorefrontCustomerStoredPaymentMethodsPage"/>
<actionGroup ref="AssertStorefrontCustomerSavedCardActionGroup" stepKey="assertCustomerPaymentMethod"/>
<actionGroup ref="StorefrontCustomerGoToSidebarMenu" stepKey="goToAddressBook">
<argument name="menu" value="Address Book"/>
</actionGroup>
<see selector="{{CheckoutOrderSummarySection.shippingAddress}}" userInput="{{US_Address_TX.street[0]}} {{US_Address_TX.city}}, {{US_Address_TX.state}}, {{US_Address_TX.postcode}}" stepKey="checkShippingAddress"/>

<!-- Open product page -->
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
<argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/>
</actionGroup>

<!-- Quick Buy button shows up. Clicking it opens review popup -->
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeQuickBuyButton">
<argument name="selector" value="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}"/>
<argument name="userInput" value="Quick Buy"/>
</actionGroup>
<click selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="clickQuickBuyButton"/>
<waitForElementVisible selector="{{StorefrontInstantPurchasePopupSection.modalTitle}}" stepKey="waitForPopUpTitleVisible"/>
<see selector="{{StorefrontInstantPurchasePopupSection.modalTitle}}" userInput="Instant Purchase Confirmation" stepKey="seeReviewPopUp"/>
<click selector="{{StorefrontInstantPurchasePopupSection.cancel}}" stepKey="closeModalPopup"/>
<waitForPageLoad stepKey="waitForClosing"/>

<!-- 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
1. New customer session should be started to verify changes -->
<actionGroup ref="StorefrontSignOutActionGroup" stepKey="customerLogout"/>
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginCustomer">
<argument name="Customer" value="$$createCustomer$$"/>
</actionGroup>

<!-- 2. Switch store view which description was not changed -->
<actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="SwitchToSecondStoreView">
<argument name="storeView" value="storeViewData2"/>
</actionGroup>

<!-- 3. Assert customer is logged with saved card and address -->
<actionGroup ref="OpenStorefrontCustomerStoredPaymentMethodsPageActionGroup" stepKey="openStorefrontCustomerPaymentMethodsPage"/>
<actionGroup ref="AssertStorefrontCustomerSavedCardActionGroup" stepKey="assertPaymentMethod"/>
<actionGroup ref="StorefrontCustomerGoToSidebarMenu" stepKey="openAddressBook">
<argument name="menu" value="Address Book"/>
</actionGroup>
<see selector="{{CheckoutOrderSummarySection.shippingAddress}}" userInput="{{US_Address_TX.street[0]}} {{US_Address_TX.city}}, {{US_Address_TX.state}}, {{US_Address_TX.postcode}}" stepKey="seeShippingAddress"/>

<!-- Open product page -->
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openCreatedProductPage">
<argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/>
</actionGroup>

<!-- Instant Purchase button shows up. Clicking it opens review popup. -->
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeInstantPurchaseButton">
<argument name="selector" value="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}"/>
<argument name="userInput" value="Instant Purchase"/>
</actionGroup>
<click selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="clickInstantPurchaseButton"/>
<waitForElementVisible selector="{{StorefrontInstantPurchasePopupSection.modalTitle}}" stepKey="waitForPopUpVisible"/>
<see selector="{{StorefrontInstantPurchasePopupSection.modalTitle}}" userInput="Instant Purchase Confirmation" stepKey="seeReviewPopUpTitle"/>
<click selector="{{StorefrontInstantPurchasePopupSection.cancel}}" stepKey="closeModalPopUp"/>
<waitForPageLoad stepKey="waitForModalClosing"/>

<actionGroup ref="StorefrontSignOutActionGroup" stepKey="createdCustomerLogout"/>

<!-- Return to configuration and disable Instant Purchase in a specific store view -->
<actionGroup ref="AdminOpenInstantPurchaseConfigPageActionGroup" stepKey="openInstantPurchasePage"/>
<scrollToTopOfPage stepKey="scrollToTop"/>
<actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="switchToFirstSpecificStoreView">
<argument name="storeView" value="storeViewData1.name"/>
</actionGroup>
<actionGroup ref="AdminChangeInstantPurchaseStatusActionGroup" stepKey="disableInstantPurchase">
<argument name="status" value="0"/>
</actionGroup>

<!-- 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
1. New customer session should be started to verify changes -->
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCreatedCustomer">
<argument name="Customer" value="$$createCustomer$$"/>
</actionGroup>

<!-- 2. Switch store view -->
<actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="switchStoreView">
<argument name="storeView" value="storeViewData1"/>
</actionGroup>

<!-- 3. Assert customer is logged with saved card and address -->
<actionGroup ref="OpenStorefrontCustomerStoredPaymentMethodsPageActionGroup" stepKey="openCustomerPaymentMethodsPage"/>
<actionGroup ref="AssertStorefrontCustomerSavedCardActionGroup" stepKey="assertCartPaymentMethod"/>
<actionGroup ref="StorefrontCustomerGoToSidebarMenu" stepKey="goToAddressBookPage">
<argument name="menu" value="Address Book"/>
</actionGroup>
<see selector="{{CheckoutOrderSummarySection.shippingAddress}}" userInput="{{US_Address_TX.street[0]}} {{US_Address_TX.city}}, {{US_Address_TX.state}}, {{US_Address_TX.postcode}}" stepKey="assertCustomerShippingAddress"/>

<!-- Open product page -->
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductIndexPage">
<argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/>
</actionGroup>

<!-- Quick Buy button is not visible -->
<actionGroup ref="AssertStorefrontElementInvisibleActionGroup" stepKey="dontSeeQuickBuyButton">
<argument name="selector" value="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}"/>
<argument name="userInput" value="Quick Buy"/>
</actionGroup>

<!-- 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
1. New customer session should be started to verify changes -->
<actionGroup ref="StorefrontSignOutActionGroup" stepKey="logoutCustomer"/>
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLoginToStorefront">
<argument name="Customer" value="$$createCustomer$$"/>
</actionGroup>

<!-- 2. Switch store view -->
<actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="switchToSecondStoreView">
<argument name="storeView" value="storeViewData2"/>
</actionGroup>

<!-- 3. Assert customer is logged with saved card and address -->
<actionGroup ref="OpenStorefrontCustomerStoredPaymentMethodsPageActionGroup" stepKey="goToStorefrontCustomerPaymentMethodsPage"/>
<actionGroup ref="AssertStorefrontCustomerSavedCardActionGroup" stepKey="assertCardPaymentMethod"/>
<actionGroup ref="StorefrontCustomerGoToSidebarMenu" stepKey="openAddressBookPage">
<argument name="menu" value="Address Book"/>
</actionGroup>
<see selector="{{CheckoutOrderSummarySection.shippingAddress}}" userInput="{{US_Address_TX.street[0]}} {{US_Address_TX.city}}, {{US_Address_TX.state}}, {{US_Address_TX.postcode}}" stepKey="seeCustomerShippingAddress"/>

<!-- Open product page -->
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="goToProductPage">
<argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/>
</actionGroup>

<!-- Instant Purchase button is still visible -->
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeInstantPurchaseBtn">
<argument name="selector" value="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}"/>
<argument name="userInput" value="Instant Purchase"/>
</actionGroup>

<!-- Delete store views -->
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteFirstStoreView">
<argument name="customStore" value="storeViewData1"/>
</actionGroup>
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteSecondStoreView">
<argument name="customStore" value="storeViewData2"/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertStorefrontCustomerSavedCardActionGroup">
<arguments>
<argument name="card" type="entity" defaultValue="StoredPaymentMethods"/>
</arguments>
<see selector="{{StorefrontCustomerStoredPaymentMethodsSection.cardNumber}}" userInput="{{card.cardNumberEnding}}" stepKey="verifyCardNumber"/>
<see selector="{{StorefrontCustomerStoredPaymentMethodsSection.expirationDate}}" userInput="{{card.cardExpire}}" stepKey="verifyCardExpire"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="OpenStorefrontCustomerStoredPaymentMethodsPageActionGroup">
<amOnPage url="{{StorefrontCustomerStoredPaymentMethodsPage.url}}" stepKey="goToCustomerStoredPaymentMethodsPage"/>
<waitForPageLoad stepKey="waitForCustomerStoredPaymentMethodsPageLoad"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="StorefrontCustomerStoredPaymentMethodsPage" url="/vault/cards/listaction/" area="storefront" module="Magento_Customer">
<section name="StorefrontCustomerStoredPaymentMethodsSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="StorefrontCustomerStoredPaymentMethodsSection">
<element name="cardNumber" type="text" selector="td.card-number"/>
<element name="expirationDate" type="text" selector="td.card-expire"/>
</section>
</sections>
Loading

0 comments on commit 7e55aca

Please sign in to comment.