Skip to content

Commit 55920a8

Browse files
ACQE-6375 : "Registered Checkout Using PayPal Smart Button and Flat Rate (Payment Action = Sale)" is automated.
1 parent 17690da commit 55920a8

File tree

3 files changed

+163
-1
lines changed

3 files changed

+163
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontFillGiftCardPhysicalProductFormActionGroup">
12+
<arguments>
13+
<argument name="sender" type="entity" defaultValue="Simple_US_Customer"/>
14+
<argument name="recipient" type="entity" defaultValue="John_Smith_Customer"/>
15+
<argument name="message" type="string" defaultValue=""/>
16+
</arguments>
17+
<waitForElementClickable selector="{{StorefrontProductInfoMainSection.giftCardSenderName}}" stepKey="waitForSenderNameField"/>
18+
<fillField selector="{{StorefrontProductInfoMainSection.giftCardSenderName}}" userInput="{{sender.fullname}}" stepKey="fillSenderNameField"/>
19+
<waitForElementClickable selector="{{StorefrontProductInfoMainSection.giftCardRecipientName}}" stepKey="waitForRecipientNameField"/>
20+
<fillField selector="{{StorefrontProductInfoMainSection.giftCardRecipientName}}" userInput="{{recipient.fullname}}" stepKey="fillRecipientNameField"/>
21+
<waitForElementClickable selector="{{StorefrontProductInfoMainSection.giftCardMessage}}" stepKey="waitForMessageField"/>
22+
<fillField selector="{{StorefrontProductInfoMainSection.giftCardMessage}}" userInput="{{message}}" stepKey="fillMessageField"/>
23+
</actionGroup>
24+
</actionGroups>

app/code/Magento/Paypal/Test/Mftf/ActionGroup/StorefrontLoginToPayPalPaymentAccountTwoStepActionGroup.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
<conditionalClick selector="{{PayPalPaymentSection.notYouLink}}" dependentSelector="{{PayPalPaymentSection.notYouLink}}" visible="true" stepKey="selectNotYouSection"/>
1919
<conditionalClick selector="{{PayPalPaymentSection.existingAccountLoginBtn}}" dependentSelector="{{PayPalPaymentSection.existingAccountLoginBtn}}" visible="true" stepKey="skipAccountCreationAndLogin"/>
2020
<waitForPageLoad stepKey="waitForLoginPageLoad"/>
21-
<waitForElement selector="{{PayPalPaymentSection.email}}" stepKey="waitForLoginForm" />
21+
<waitForElementClickable selector="{{PayPalPaymentSection.email}}" stepKey="waitToFocusOnEmailField"/>
22+
<click selector="{{PayPalPaymentSection.email}}" stepKey="focusOnEmailField"/>
23+
<clearField selector="{{PayPalPaymentSection.email}}" stepKey="clearEmailField"/>
24+
<waitForElementVisible selector="{{PayPalPaymentSection.email}}" stepKey="waitForLoginField"/>
2225
<fillField selector="{{PayPalPaymentSection.email}}" userInput="{{credentials.magento/PAYPAL_LOGIN}}" stepKey="fillEmail"/>
2326
<click selector="{{PayPalPaymentSection.nextButton}}" stepKey="clickNext"/>
2427
<waitForElementVisible selector="{{PayPalPaymentSection.password}}" stepKey="waitForPasswordField"/>
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
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="RegisteredPaypalCheckoutWithFlatRatePaymentActionSaleTest">
11+
<annotations>
12+
<features value="PayPal"/>
13+
<stories value="Registered Checkout Using PayPal Smart Button and Flat Rate (Payment Action = Sale)"/>
14+
<title value="Registered Checkout Using PayPal Smart Button and Flat Rate (Payment Action = Sale)"/>
15+
<description value="Customer buy Gift Card Product and checkout using paypal express with flat rates and payment action is sale"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="AC-5037"/>
18+
<group value="3rd_party_integration"/>
19+
<!-- <group value="pr_exclude"/>-->
20+
</annotations>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
23+
<!-- Enable Flat rate -->
24+
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
25+
<!-- Create Category -->
26+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
27+
<!-- Enabling PayPal Express Checkout -->
28+
<magentoCLI command="config:set {{StorefrontPaypalExpressSalePaymentActionOptionConfigData.path}} {{StorefrontPaypalExpressSalePaymentActionOptionConfigData.value}}" stepKey="setPaymentActionSale"/>
29+
<actionGroup ref="AdminPayPalExpressCheckoutEnableActionGroup" stepKey="configPayPalExpress">
30+
<argument name="credentials" value="SamplePaypalExpressConfig2"/>
31+
</actionGroup>
32+
<!-- New Customer -->
33+
<createData entity="Simple_US_Customer" stepKey="createCustomer">
34+
<field key="firstname">John1</field>
35+
<field key="lastname">Doe1</field>
36+
</createData>
37+
</before>
38+
<after>
39+
<actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProduct">
40+
<argument name="sku" value="{{GiftCard.sku}}"/>
41+
</actionGroup>
42+
<magentoCLI command="config:set paypal/general/merchant_country US" stepKey="setMerchantCountry"/>
43+
<magentoCLI command="config:set payment/paypal_express/active 0" stepKey="disablePayPalExpress"/>
44+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer" />
45+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
46+
<!-- Delete Product -->
47+
<deleteData stepKey="deleteCategory" createDataKey="createCategory"/>
48+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
49+
</after>
50+
<!-- Create gift card product -->
51+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToCatalogProductGrid"/>
52+
<waitForPageLoad stepKey="waitForCatalogProductGrid"/>
53+
<actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="openProductFillForm">
54+
<argument name="productType" value="giftcard"/>
55+
</actionGroup>
56+
<!-- Fill gift card product values -->
57+
<actionGroup ref="AdminFillGiftCardProductFieldsActionGroup" stepKey="fillGiftCardProductFields">
58+
<argument name="product" value="GiftCard"/>
59+
</actionGroup>
60+
<!-- Add amount to gift card product -->
61+
<actionGroup ref="addGiftCardAmount" stepKey="addAmountToGiftCard">
62+
<argument name="giftCardAmount" value="GiftCard.amounts[0]"/>
63+
</actionGroup>
64+
<!-- Add gift card product to category -->
65+
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory" after="addAmountToGiftCard"/>
66+
<!-- Save gift card product -->
67+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
68+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="signUpNewUser">
69+
<argument name="Customer" value="$$createCustomer$$"/>
70+
</actionGroup>
71+
<!-- Quick search gift card product -->
72+
<actionGroup ref="StorefrontCheckQuickSearchActionGroup" stepKey="quickSearchForGiftCardProduct">
73+
<argument name="phrase" value="GiftCard.sku"/>
74+
</actionGroup>
75+
<!-- Go to gift card product page on storefront -->
76+
<seeElement selector="{{StorefrontCategoryMainSection.productLink}}" stepKey="seeProductsInCategory"/>
77+
<waitForElementClickable selector="{{StorefrontCategoryMainSection.productLink}}" stepKey="waitForProductClickable"/>
78+
<click selector="{{StorefrontCategoryMainSection.productLink}}" stepKey="openProduct"/>
79+
<!-- Enter Sender's and recipient name -->
80+
<actionGroup ref="StorefrontFillGiftCardPhysicalProductFormActionGroup" stepKey="addDetailsOfGiftCard"/>
81+
<!-- Add product to cart-->
82+
<actionGroup ref="StorefrontClickAddToCartOnProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"/>
83+
<!-- Open mini cart from product page and proceed to checkout -->
84+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
85+
<!-- Verify Shipping address-->
86+
<grabTextFrom selector="{{CheckoutShippingSection.savedAddress}}" stepKey="grabAddress"/>
87+
<!-- Assert the value of created customer attribute in shipping address block of checkout page-->
88+
<assertStringContainsString stepKey="assertCustomerAddresAttribute">
89+
<actualResult type="variable">$grabAddress</actualResult>
90+
<expectedResult type="string">{{US_Address_TX.street[0]}}</expectedResult>
91+
</assertStringContainsString>
92+
<!-- Select Flat rate and click Next-->
93+
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRate"/>
94+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNextOnShippingStep"/>
95+
<!--Assert grand total-->
96+
<actionGroup ref="VerifyCheckoutPaymentOrderSummaryActionGroup" stepKey="verifyCheckoutPaymentOrderSummary">
97+
<argument name="orderSummarySubTotal" value="$10.00"/>
98+
<argument name="orderSummaryShippingTotal" value="$5.00"/>
99+
<argument name="orderSummaryTotal" value="$15.00"/>
100+
</actionGroup>
101+
<!-- Click on PayPal payment radio button -->
102+
<waitForElementClickable selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="waitForPayPalRadioButton"/>
103+
<click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="selectPaypalPayment"/>
104+
<actionGroup ref="SwitchToPayPalGroupBtnActionGroup" stepKey="clickPayPalBtn"/>
105+
<!-- Login to Paypal in-context and verify order total on paypal page-->
106+
<actionGroup ref="StorefrontLoginToPayPalPaymentAccountTwoStepActionGroup" stepKey="loginToPayPal"/>
107+
<actionGroup ref="StorefrontPaypalSwitchBackToMagentoFromCheckoutPageActionGroup" stepKey="confirmPaymentAndGoBackToMagento"/>
108+
<waitForPageLoad stepKey="waitForPagePlacingOrderSuccessfully" />
109+
<!--See success messages-->
110+
<waitForElementVisible selector="{{CheckoutSuccessMainSection.successTitle}}" stepKey="waitForSuccessTitle"/>
111+
<see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle"/>
112+
<see selector="{{CheckoutSuccessMainSection.orderNumberText}}" userInput="Your order number is: " stepKey="seeOrderNumber"/>
113+
<waitForElementVisible selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="waitForOrderNumberToBeGrabbed"/>
114+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
115+
<!-- Go to order page -->
116+
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="openFirstOrderPage">
117+
<argument name="orderId" value="{$grabOrderNumber}"/>
118+
</actionGroup>
119+
<!-- Check order status -->
120+
<actionGroup ref="AdminOrderViewCheckStatusActionGroup" stepKey="seeAdminOrderStatus">
121+
<argument name="status" value="Processing"/>
122+
</actionGroup>
123+
<waitForElementVisible selector="{{AdminOrderDetailsInformationSection.paymentInformationField('Last Transaction ID')}}" stepKey="waitForLastTransactionIDFieldToBeAppearedAfterSubmittingInvoice"/>
124+
<grabTextFrom selector="{{AdminOrderDetailsInformationSection.paymentInformationField('Last Transaction ID')}}" stepKey="grabLastTransactionIDForCaptured"/>
125+
<!-- Check grand total -->
126+
<waitForText selector="{{AdminOrderTotalSection.grandTotal}}" userInput="$15.00" stepKey="checkGrandTotal"/>
127+
<!-- Check comment history -->
128+
<actionGroup ref="AdminOpenOrderCommentsHistoryActionGroup" stepKey="clickOnCommentsHistory"/>
129+
<waitForText selector="{{AdminOrderCommentsTabSection.orderCommentsWithType('Captured amount')}}" userInput="Captured amount of $15.00 online. Transaction ID: &quot;{$grabLastTransactionIDForCaptured}&quot;" stepKey="seeOrderHistoryNotes"/>
130+
<!-- Go to invoice tab and verify invoice is present-->
131+
<actionGroup ref="AdminOpenInvoiceTabFromOrderPageActionGroup" stepKey="clickInvoicesTabOrdersPage"/>
132+
<waitForElementVisible selector="{{AdminOrderInvoicesTabSection.viewInvoice}}" stepKey="waitForInvoicesTabOpenedOne"/>
133+
<seeElement selector="{{AdminOrderInvoicesTabSection.viewInvoice}}" stepKey="seeForInvoicesTabOpenedOne"/>
134+
</test>
135+
</tests>

0 commit comments

Comments
 (0)