Skip to content

Commit 4c38cb8

Browse files
committed
MC-73: Admin should be able to create a cart price rule of type Buy X get Y free
1 parent bcd6828 commit 4c38cb8

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/AdminCartPriceRulesFormSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
<element name="actionsHeader" type="button" selector="div[data-index='actions']" timeout="30"/>
2525
<element name="apply" type="select" selector="select[name='simple_action']"/>
2626
<element name="discountAmount" type="input" selector="input[name='discount_amount']"/>
27+
<element name="discountStep" type="input" selector="input[name='discount_step']"/>
2728
</section>
2829
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="AdminCreateBuyXGetYFreeTest">
12+
<annotations>
13+
<features value="SalesRule"/>
14+
<stories value="Create cart price rule"/>
15+
<title value="Admin should be able to create a cart price rule of type Buy X get Y free"/>
16+
<description value="Admin should be able to create a cart price rule of type Buy X get Y free"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="MC-73"/>
19+
<group value="SalesRule"/>
20+
</annotations>
21+
22+
<before>
23+
<createData entity="_defaultCategory" stepKey="createPreReqCategory"/>
24+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
25+
</before>
26+
27+
<after>
28+
<!-- Delete the cart price rule we made during the test -->
29+
<actionGroup ref="DeleteCartPriceRuleByName" stepKey="cleanUpRule">
30+
<argument name="ruleName" value="{{_defaultCoupon.code}}"/>
31+
</actionGroup>
32+
<deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/>
33+
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
34+
</after>
35+
36+
<!-- Create a cart price rule of type Buy X get Y free -->
37+
<amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/>
38+
<waitForPageLoad stepKey="waitForRulesPage"/>
39+
<click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/>
40+
<fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{_defaultCoupon.code}}" stepKey="fillRuleName"/>
41+
<selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/>
42+
<selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/>
43+
<click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/>
44+
<selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Buy X get Y free (discount amount is Y)" stepKey="selectActionType"/>
45+
<fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="1" stepKey="fillDiscountAmount"/>
46+
<fillField selector="{{AdminCartPriceRulesFormSection.discountStep}}" userInput="1" stepKey="fillDiscountStep"/>
47+
<click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/>
48+
<see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
49+
50+
<!-- Create a product to check the storefront -->
51+
<actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin">
52+
<argument name="category" value="$$createPreReqCategory$$"/>
53+
<argument name="simpleProduct" value="_defaultProduct"/>
54+
</actionGroup>
55+
56+
<!-- Spot check the storefront -->
57+
<amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="goToProductPage"/>
58+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
59+
<fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="2" stepKey="fillQuantity"/>
60+
<click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/>
61+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/>
62+
<waitForPageLoad stepKey="waitForCartPage"/>
63+
<waitForElementVisible selector="td[data-th='Discount']" stepKey="waitForDiscountElement"/>
64+
<see selector="td[data-th='Discount']" userInput="-$123.00" stepKey="seeDiscountTotal"/>
65+
</test>
66+
</tests>

0 commit comments

Comments
 (0)