Skip to content

Commit 1d8fbab

Browse files
committed
MC-13212: Apply Promo Code during Checkout for physical product
1 parent dcab488 commit 1d8fbab

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,7 @@
5757
<element name="noQuotes" type="text" selector=".no-quotes-block"/>
5858
<element name="paymentMethodByName" type="text" selector="//*[@id='checkout-payment-method-load']//*[contains(@class, 'payment-group')]//label[normalize-space(.)='{{var1}}']" parameterized="true"/>
5959
<element name="billingAddressSelectShared" type="select" selector=".checkout-billing-address select[name='billing_address_id']"/>
60+
<element name="discount" type="block" selector="tr.totals.discount"/>
61+
<element name="discountPrice" type="text" selector=".discount .price"/>
6062
</section>
6163
</sections>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,35 +41,45 @@
4141
<actionGroup ref="logout" stepKey="logout"/>
4242
</after>
4343

44-
<!-- Add simple product to cart -->
44+
<!-- Go to Storefront as Guest and add simple product to cart -->
4545
<actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart">
4646
<argument name="product" value="$$createProduct$$"/>
4747
</actionGroup>
4848

49-
<!-- Navigate to checkout -->
49+
<!-- Go to Checkout -->
5050
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
5151

52-
<!-- Fill shipping address -->
52+
<!-- Fill all required fields with valid data and select Flat Rate, price = 5, shipping -->
5353
<actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShipping">
5454
<argument name="shippingMethod" value="Flat Rate"/>
5555
</actionGroup>
5656

57-
<!-- Apply discount to order -->
57+
<!-- Click Apply Discount Code: section is expanded. Input promo code, apply and see success message -->
5858
<actionGroup ref="StorefrontApplyDiscountCodeActionGroup" stepKey="applyCoupon">
5959
<argument name="discountCode" value="$$createCouponForCartPriceRule.code$$"/>
6060
</actionGroup>
6161

62+
<!-- Apply button is disappeared -->
63+
<dontSeeElement selector="{{DiscountSection.ApplyCodeBtn}}" stepKey="dontSeeApplyButton"/>
64+
65+
<!-- Cancel coupon button is appeared -->
66+
<seeElement selector="{{DiscountSection.cancelCouponBtn}}" stepKey="seeCancelCouponButton"/>
67+
68+
<!-- Order summary contains information about applied code -->
69+
<seeElement selector="{{CheckoutPaymentSection.discount}}" stepKey="seeDiscountCouponInSummaryBlock"/>
70+
<see selector="{{CheckoutPaymentSection.discountPrice}}" userInput="-$5.00" stepKey="seeDiscountPrice"/>
71+
6272
<!-- Select payment solution -->
6373
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="clickCheckMoneyOrderPayment"/>
6474

65-
<!-- Place Order -->
75+
<!-- Place Order: order is successfully placed -->
6676
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/>
6777
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/>
6878

6979
<!-- Login as admin -->
7080
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
7181

72-
<!-- Check total in created order -->
82+
<!-- Verify total on order page -->
7383
<actionGroup ref="filterOrderGridById" stepKey="filterOrderById">
7484
<argument name="orderId" value="$grabOrderNumber"/>
7585
</actionGroup>

app/code/Magento/SalesRule/Test/Mftf/Section/DiscountSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
<element name="ApplyCodeBtn" type="button" selector="//span[text()='Apply Discount']"/>
1515
<element name="CancelCoupon" type="button" selector="//button[@value='Cancel Coupon']"/>
1616
<element name="DiscountVerificationMsg" type="button" selector="//div[contains(@class, 'discount-code _active')]//div[@data-role='checkout-messages']/div/div"/>
17+
<element name="cancelCouponBtn" type="button" selector="#discount-form .action-cancel"/>
1718
</section>
1819
</sections>

0 commit comments

Comments
 (0)