Skip to content

Commit 9d8d42f

Browse files
committed
Merge branches '2.3-tests-pr' and 'MC-13212' of github.com:magento-pangolin/magento2ce into MC-13212
2 parents 5080acb + d5b8136 commit 9d8d42f

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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+
<!-- Add simple product to cart -->
45+
<actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart">
46+
<argument name="product" value="$$createProduct$$"/>
47+
</actionGroup>
48+
49+
<!-- Navigate to checkout -->
50+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
51+
52+
<!-- Fill shipping address -->
53+
<actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShipping">
54+
<argument name="shippingMethod" value="Flat Rate"/>
55+
</actionGroup>
56+
57+
<!-- Apply discount to order -->
58+
<actionGroup ref="StorefrontApplyDiscountCodeActionGroup" stepKey="applyCoupon">
59+
<argument name="discountCode" value="$$createCouponForCartPriceRule.code$$"/>
60+
</actionGroup>
61+
62+
<!-- Select payment solution -->
63+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="clickCheckMoneyOrderPayment"/>
64+
65+
<!-- Place Order -->
66+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/>
67+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/>
68+
69+
<!-- Login as admin -->
70+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
71+
72+
<!-- Check total in created order -->
73+
<actionGroup ref="filterOrderGridById" stepKey="filterOrderById">
74+
<argument name="orderId" value="$grabOrderNumber"/>
75+
</actionGroup>
76+
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
77+
<waitForPageLoad stepKey="waitForAdminOrderPageLoad"/>
78+
<scrollTo selector="{{AdminOrderTotalSection.grandTotal}}" stepKey="scrollToOrderTotalSection"/>
79+
<see selector="{{AdminOrderTotalSection.grandTotal}}" userInput="$$createProduct.price$$" stepKey="checkTotal"/>
80+
</test>
81+
</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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
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="//div[contains(@class, 'discount-code _active')]//div[@data-role='checkout-messages']/div/div"/>
1617
</section>
1718
</sections>

0 commit comments

Comments
 (0)