Skip to content

Commit c32cbac

Browse files
authored
Merge pull request #143 from magento-pangolin/MC-13212
MC-13212
2 parents 4a3c2bf + f6078a2 commit c32cbac

File tree

6 files changed

+120
-0
lines changed

6 files changed

+120
-0
lines changed

app/code/Magento/Bundle/Test/Mftf/Test/AdminProductBundleCreationTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
<deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/>
3232
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
3333
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
34+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndexPage"/>
35+
<actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteAllProducts"/>
3436
<actionGroup ref="logout" stepKey="logout"/>
3537
</after>
3638
<!-- go to bundle product creation page-->

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
<deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/>
3333
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
3434
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
35+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndexPage"/>
36+
<actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteAllProducts"/>
3537
<actionGroup ref="logout" stepKey="logout"/>
3638
</after>
3739
<!-- go to bundle product creation page-->

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>
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontApplyPromoCodeDuringCheckoutTest">
12+
<annotations>
13+
<features value="OnePageCheckout"/>
14+
<stories value="OnePageCheckout with Promo Code"/>
15+
<title value="Storefront apply promo code during checkout test"/>
16+
<description value="Apply promo code during checkout for physical product"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-13212"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
<before>
22+
<!-- Create simple product -->
23+
<createData entity="SimpleProduct2" stepKey="createProduct">
24+
<field key="price">10.00</field>
25+
</createData>
26+
27+
<!-- Create cart price rule -->
28+
<createData entity="ActiveSalesRuleForNotLoggedIn" stepKey="createCartPriceRule"/>
29+
<createData entity="SimpleSalesRuleCoupon" stepKey="createCouponForCartPriceRule">
30+
<requiredEntity createDataKey="createCartPriceRule"/>
31+
</createData>
32+
</before>
33+
<after>
34+
<!-- Delete simple product -->
35+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
36+
37+
<!-- Delete sales rule -->
38+
<deleteData createDataKey="createCartPriceRule" stepKey="deleteCartPriceRule"/>
39+
40+
<!-- Admin log out -->
41+
<actionGroup ref="logout" stepKey="logout"/>
42+
</after>
43+
44+
<!-- Go to Storefront as Guest and add simple product to cart -->
45+
<actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart">
46+
<argument name="product" value="$$createProduct$$"/>
47+
</actionGroup>
48+
49+
<!-- Go to Checkout -->
50+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
51+
52+
<!-- Fill all required fields with valid data and select Flat Rate, price = 5, shipping -->
53+
<actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShipping">
54+
<argument name="shippingMethod" value="Flat Rate"/>
55+
</actionGroup>
56+
57+
<!-- Click Apply Discount Code: section is expanded. Input promo code, apply and see success message -->
58+
<actionGroup ref="StorefrontApplyDiscountCodeActionGroup" stepKey="applyCoupon">
59+
<argument name="discountCode" value="$$createCouponForCartPriceRule.code$$"/>
60+
</actionGroup>
61+
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+
72+
<!-- Select payment solution -->
73+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="clickCheckMoneyOrderPayment"/>
74+
75+
<!-- Place Order: order is successfully placed -->
76+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/>
77+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/>
78+
79+
<!-- Login as admin -->
80+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
81+
82+
<!-- Verify total on order page -->
83+
<actionGroup ref="filterOrderGridById" stepKey="filterOrderById">
84+
<argument name="orderId" value="$grabOrderNumber"/>
85+
</actionGroup>
86+
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
87+
<waitForPageLoad stepKey="waitForAdminOrderPageLoad"/>
88+
<scrollTo selector="{{AdminOrderTotalSection.grandTotal}}" stepKey="scrollToOrderTotalSection"/>
89+
<see selector="{{AdminOrderTotalSection.grandTotal}}" userInput="$$createProduct.price$$" stepKey="checkTotal"/>
90+
</test>
91+
</tests>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<!-- Apply discount code during checkout -->
11+
<actionGroup name="StorefrontApplyDiscountCodeActionGroup">
12+
<arguments>
13+
<argument name="discountCode" type="string"/>
14+
</arguments>
15+
<click selector="{{DiscountSection.DiscountTab}}" stepKey="clickToAddDiscount"/>
16+
<fillField selector="{{DiscountSection.DiscountInput}}" userInput="{{discountCode}}" stepKey="fillFieldDiscountCode"/>
17+
<click selector="{{DiscountSection.ApplyCodeBtn}}" stepKey="clickToApplyDiscount"/>
18+
<waitForPageLoad stepKey="waitForDiscountToBeAdded"/>
19+
<see selector="{{DiscountSection.DiscountVerificationMsg}}" userInput="Your coupon was successfully applied" stepKey="assertDiscountApplyMessage"/>
20+
</actionGroup>
21+
</actionGroups>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@
1313
<element name="DiscountInput" type="input" selector="#discount-code"/>
1414
<element name="ApplyCodeBtn" type="button" selector="//span[text()='Apply Discount']"/>
1515
<element name="CancelCoupon" type="button" selector="//button[@value='Cancel Coupon']"/>
16+
<element name="DiscountVerificationMsg" type="button" selector=".message-success div"/>
17+
<element name="CancelCouponBtn" type="button" selector="#discount-form .action-cancel"/>
1618
</section>
1719
</sections>

0 commit comments

Comments
 (0)