Skip to content

Commit a95ef1e

Browse files
committed
MC-62: Admin should be able to create a cart price rule of type Fixed amount discount
1 parent f91db30 commit a95ef1e

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductActionSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
1010
<section name="StorefrontProductActionSection">
11-
<element name="addToCart" type="button" selector="#product-addtocart-button"/>
11+
<element name="addToCart" type="button" selector="#product-addtocart-button" timeout="30"/>
1212
<element name="addToCartButtonTitleIsAdding" type="text" selector="//button/span[text()='Adding...']"/>
1313
<element name="addToCartButtonTitleIsAdded" type="text" selector="//button/span[text()='Added']"/>
1414
<element name="addToCartButtonTitleIsAddToCart" type="text" selector="//button/span[text()='Add to Cart']"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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="AdminCreateFixedAmountDiscountTest">
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 Fixed amount discount"/>
16+
<description value="Admin should be able to create a cart price rule of type Fixed amount discount"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="MC-62"/>
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+
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
29+
<deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/>
30+
</after>
31+
32+
<!-- Create a cart price rule for $10 Fixed amount discount -->
33+
<amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/>
34+
<click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/>
35+
<fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{_defaultCoupon.code}}" stepKey="fillRuleName"/>
36+
<selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/>
37+
<selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/>
38+
<click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/>
39+
<selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount" stepKey="selectActionType"/>
40+
<fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="10" stepKey="fillDiscountAmount"/>
41+
<click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/>
42+
<see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
43+
44+
<!-- Create a product to check the storefront -->
45+
<actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin">
46+
<argument name="category" value="$$createPreReqCategory$$"/>
47+
<argument name="simpleProduct" value="_defaultProduct"/>
48+
</actionGroup>
49+
50+
<!-- Spot check the storefront -->
51+
<amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="goToProductPage"/>
52+
<click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/>
53+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/>
54+
<waitForPageLoad stepKey="waitForCartPage"/>
55+
<waitForElementVisible selector="td[data-th='Discount']" stepKey="waitForDiscountElement"/>
56+
<see selector="td[data-th='Discount']" userInput="-$10.00" stepKey="seeDiscountTotal"/>
57+
</test>
58+
</tests>

0 commit comments

Comments
 (0)