Skip to content

Commit 28b89d0

Browse files
committed
MC-72: Admin should be able to create a cart price rule of type Percent of product price discount
1 parent e5b218d commit 28b89d0

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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="AdminCreatePercentOfProductPriceTest">
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 Percent of product price discount"/>
16+
<description value="Admin should be able to create a cart price rule of type Percent of product price discount"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="MC-72"/>
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 for 50 percent of product price -->
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="Percent of product price discount" stepKey="selectActionType"/>
45+
<fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="50" stepKey="fillDiscountAmount"/>
46+
<click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/>
47+
<see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
48+
49+
<!-- Create a product to check the storefront -->
50+
<actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin">
51+
<argument name="category" value="$$createPreReqCategory$$"/>
52+
<argument name="simpleProduct" value="_defaultProduct"/>
53+
</actionGroup>
54+
55+
<!-- Spot check the storefront -->
56+
<amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="goToProductPage"/>
57+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
58+
<click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/>
59+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/>
60+
<waitForPageLoad stepKey="waitForCartPage"/>
61+
<waitForElementVisible selector="td[data-th='Discount']" stepKey="waitForDiscountElement"/>
62+
<see selector="td[data-th='Discount']" userInput="-$61.50" stepKey="seeDiscountTotal"/>
63+
</test>
64+
</tests>

0 commit comments

Comments
 (0)