Skip to content

Commit eb34cdb

Browse files
committed
ACQE-6908 : Verify that Apply gift cards or promo codes widget is shown on order review page
Testcase intends to Verify that Apply gift cards or promo codes widget is shown on order review page for PayFlow Link (Includes Express Checkout)
1 parent edcd0dc commit eb34cdb

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed

app/code/Magento/Paypal/Test/Mftf/Section/CheckoutPaymentSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,7 @@
7474
<element name="productQuantityInCartBlock" type="text" selector="//div[@class='details-qty']/span[@class='value']" />
7575
<element name="productChargedFor" type="text" selector="tr.totals.charge span.price"/>
7676
<element name="productCharged" type="text" selector="//tr[@class='grand totals']//span[@class='price' and contains(text(),'HK$')]"/>
77+
<element name="reviewOrder" type="button" selector="//div//button[text()='Continue to Review Order']"/>
78+
<element name="checkoutWithPaypal" type="button" selector="(//div[@class='cart-container']//input[@data-action='checkout-form-submit'])[1]" timeout="30"/>
7779
</section>
7880
</sections>

app/code/Magento/Paypal/Test/Mftf/Section/StorefrontPayPalOrderReviewSection.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
<section name="StorefrontPayPalOrderReviewSection">
1111
<element name="shippingMethod" type="select" selector="#shipping-method"/>
1212
<element name="placeOrderBtn" type="button" selector="#review-button" timeout="30"/>
13+
<element name="applyDiscountCodeHeader" type="select" selector="//strong[text()='Apply Discount Code']"/>
14+
<element name="discountCodeField" type="input" selector=".control #coupon_code"/>
15+
<element name="applyDiscount" type="button" selector="//button//span[text()='Apply Discount']"/>
16+
<element name="gitCardHeader" type="select" selector="//strong[@id='block-giftcard-heading']"/>
17+
<element name="giftCardField" type="input" selector="//input[@id='giftcard-code']"/>
18+
<element name="addGiftCard" type="button" selector="//span[text()='Add Gift Card']"/>
19+
<element name="giftCardStatus" type="select" selector="//span[text()='Check Gift Card status and balance']"/>
20+
<element name="grandTotal" type="text" selector="//td[@data-th='Grand Total']//strong"/>
1321
</section>
1422
</sections>
1523

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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="StorefrontVerifyGiftCardPromoWidgetForPayFlowLinkTest">
11+
<annotations>
12+
<features value="payFlow link"/>
13+
<stories value="Storefront Gift Card and Promo Codes"/>
14+
<title value="Verify that Apply gift cards or promo codes widget is shown on order review page"/>
15+
<description value="Verify that Apply gift cards or promo codes widget is shown on order review page for PayFlow Link (Includes Express Checkout)"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="AC-4378"/>
18+
</annotations>
19+
<before>
20+
<createData entity="simpleProductWithoutCategory" stepKey="createProduct">
21+
<field key="price">100.00</field>
22+
</createData>
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
24+
<actionGroup ref="AdminEnablePayPalPayFlowLinkActionGroup" stepKey="ConfigPayPalPayFlowLink">
25+
<argument name="credentials" value="SamplePaypalPaymentsFlowLinkConfig"/>
26+
</actionGroup>
27+
<!-- Create cart price rule -->
28+
<actionGroup ref="AdminCreateCartPriceRuleWithCouponCodeActionGroup" stepKey="createCartPriceRule">
29+
<argument name="ruleName" value="CatPriceRule"/>
30+
<argument name="couponCode" value="CatPriceRule.coupon_code"/>
31+
</actionGroup>
32+
<createData entity="GiftCardCodePool" stepKey="createCodePool"/>
33+
<actionGroup ref="AddGiftCardAccountActionGroup" stepKey="addGiftCardAccount">
34+
<argument name="website" value="Main Website" />
35+
<argument name="balanceAmount" value="50" />
36+
</actionGroup>
37+
<grabTextFrom selector="{{AdminGiftCardAccountGridSection.giftCardCode}}" stepKey="giftCardAccountCode"/>
38+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
39+
<argument name="indices" value=""/>
40+
</actionGroup>
41+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
42+
<argument name="tags" value="config full_page"/>
43+
</actionGroup>
44+
</before>
45+
<after>
46+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
47+
<!-- Delete gift card account -->
48+
<actionGroup ref="DeleteGiftCardAccountActionGroup" stepKey="deleteGiftCardAccount">
49+
<argument name="giftCardAccountCode" value="$giftCardAccountCode"/>
50+
</actionGroup>
51+
<actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCartPriceRule">
52+
<argument name="ruleName" value="{{CatPriceRule.name}}"/>
53+
</actionGroup>
54+
<actionGroup ref="AdminDisablePayPalPayFlowLinkActionGroup" stepKey="disablePayPalPayFlow"/>
55+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
56+
</after>
57+
<actionGroup ref="StorefrontAddSimpleProductWithQtyActionGroup" stepKey="addSimpleProductToCart">
58+
<argument name="product" value="$$createProduct$$"/>
59+
<argument name="quantity" value="1"/>
60+
</actionGroup>
61+
<!--Go to shopping cart-->
62+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="openShoppingCartPage"/>
63+
<waitForElementVisible selector="{{CheckoutPaymentSection.checkoutWithPaypal}}" stepKey="waitForPayPalBtn"/>
64+
<click selector="{{CheckoutPaymentSection.checkoutWithPaypal}}" stepKey="clickPayPalBtn"/>
65+
<!--Login to Paypal in-context-->
66+
<actionGroup ref="StorefrontLoginToPayPalPaymentAccountTwoStepActionGroup" stepKey="LoginToPayPal"/>
67+
<waitForElementClickable selector="{{CheckoutPaymentSection.reviewOrder}}" stepKey="waitForReviewOrderButtonToBeClickable"/>
68+
<click selector="{{CheckoutPaymentSection.reviewOrder}}" stepKey="clickReviewOrderButton"/>
69+
<waitForPageLoad stepKey="waitForPageLoad"/>
70+
<!--Click PayPal button and go back to Magento site-->
71+
<actionGroup ref="StorefrontPaypalSwitchBackToMagentoFromCheckoutPageActionGroup" stepKey="goBackToMagentoSite"/>
72+
<actionGroup ref="StorefrontSelectShippingMethodOnOrderReviewPageActionGroup" stepKey="selectShippingMethod"/>
73+
<waitForElementClickable selector="{{StorefrontPayPalOrderReviewSection.applyDiscountCodeHeader}}" stepKey="waitForDiscountHeaderToBeClickable"/>
74+
<click selector="{{StorefrontPayPalOrderReviewSection.applyDiscountCodeHeader}}" stepKey="clickDiscountHeader"/>
75+
<waitForElementVisible selector="{{StorefrontPayPalOrderReviewSection.discountCodeField}}" stepKey="waitForDiscountCodeFieldToBeVisible"/>
76+
<fillField selector="{{StorefrontPayPalOrderReviewSection.discountCodeField}}" userInput="{{CatPriceRule.coupon_code}}" stepKey="fillDiscountCodeField"/>
77+
<waitForElementClickable selector="{{StorefrontPayPalOrderReviewSection.applyDiscount}}" stepKey="waitForApplyDiscountToBeClickable"/>
78+
<click selector="{{StorefrontPayPalOrderReviewSection.applyDiscount}}" stepKey="clickApplyDiscount"/>
79+
<waitForPageLoad stepKey="waitForCouponToBeApplied"/>
80+
<waitForElement selector="{{StorefrontPayPalOrderReviewSection.grandTotal('$95.00')}}" stepKey="assertTotalAfterDiscountApplied"/>
81+
82+
83+
<waitForElementClickable selector="{{StorefrontPayPalOrderReviewSection.gitCardHeader}}" stepKey="waitForGiftCardHeaderToBeClickable"/>
84+
<click selector="{{StorefrontPayPalOrderReviewSection.gitCardHeader}}" stepKey="clickGiftCardHeader"/>
85+
<waitForElementVisible selector="{{StorefrontPayPalOrderReviewSection.giftCardField}}" stepKey="waitForGiftCodeFieldToBeVisible"/>
86+
<fillField selector="{{StorefrontPayPalOrderReviewSection.giftCardField}}" userInput="$giftCardAccountCode" stepKey="fillGiftCodeField"/>
87+
<waitForElementClickable selector="{{StorefrontPayPalOrderReviewSection.addGiftCard}}" stepKey="waitForAddGiftCardToBeClickable"/>
88+
<click selector="{{StorefrontPayPalOrderReviewSection.addGiftCard}}" stepKey="clickAddGiftCard"/>
89+
<waitForPageLoad stepKey="waitForCouponToBeApplied2"/>
90+
<waitForElement selector="{{StorefrontPayPalOrderReviewSection.grandTotal('$55.00')}}" stepKey="assertTotalAfterGiftCardApplied"/>
91+
<!--SubmitOrder-->
92+
<actionGroup ref="StorefrontPlaceOrderOnOrderReviewPageActionGroup" stepKey="clickPlaceOrderBtn"/>
93+
</test>
94+
</tests>

0 commit comments

Comments
 (0)