Skip to content

Commit f91db30

Browse files
committed
Merge branch 'MC-90' into RE-develop
2 parents edfa353 + bc7da05 commit f91db30

File tree

5 files changed

+121
-0
lines changed

5 files changed

+121
-0
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Data/SalesCouponData.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@
1515
<data key="type">0</data>
1616
<var key="rule_id" entityType="SalesRule" entityKey="rule_id"/>
1717
</entity>
18+
<entity name="_defaultCoupon" type="SalesRuleCoupon">
19+
<data key="code" unique="suffix">defaultCoupon</data>
20+
</entity>
1821
</entities>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
10+
<page name="AdminCartPriceRulesPage" url="sales_rule/promo_quote/" area="admin" module="SalesRule">
11+
<section name="AdminCartPriceRulesSection"/>
12+
<section name="AdminCartPriceRulesFormSection"/>
13+
</page>
14+
</pages>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
10+
<section name="AdminCartPriceRulesFormSection">
11+
<element name="save" type="button" selector="#save" timeout="30"/>
12+
13+
<!-- Rule Information (the main form on the page) -->
14+
<element name="ruleInformationHeader" type="button" selector="div[data-index='rule_information']" timeout="30"/>
15+
<element name="ruleName" type="input" selector="input[name='name']"/>
16+
<element name="websites" type="multiselect" selector="select[name='website_ids']"/>
17+
<element name="customerGroups" type="multiselect" selector="select[name='customer_group_ids']"/>
18+
<element name="coupon" type="select" selector="select[name='coupon_type']"/>
19+
<element name="couponCode" type="input" selector="input[name='coupon_code']"/>
20+
21+
<!-- Actions sub-form -->
22+
<element name="actionsHeader" type="button" selector="div[data-index='actions']" timeout="30"/>
23+
<element name="apply" type="select" selector="select[name='simple_action']"/>
24+
<element name="discountAmount" type="input" selector="input[name='discount_amount']"/>
25+
</section>
26+
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
10+
<section name="AdminCartPriceRulesSection">
11+
<element name="addNewRuleButton" type="button" selector="#add" timeout="30"/>
12+
<element name="messages" type="text" selector=".messages"/>
13+
<element name="filterByNameInput" type="input" selector="input[name='name']"/>
14+
<element name="searchButton" type="button" selector="#promo_quote_grid button[title='Search']" timeout="30"/>
15+
<element name="nameColumns" type="text" selector="td[data-column='name']"/>
16+
<element name="rowContainingText" type="text" selector="//*[@id='promo_quote_grid_table']/tbody/tr[td//text()[contains(., '{{var1}}')]]" parameterized="true" timeout="30"/>
17+
</section>
18+
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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="AdminCreateCartPriceRuleForCouponCodeTest">
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 for a specific coupon code"/>
16+
<description value="Admin should be able to create a cart price rule for a specific coupon code"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="MC-90"/>
19+
<group value="SalesRule"/>
20+
</annotations>
21+
22+
<before>
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
24+
</before>
25+
26+
<after>
27+
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
28+
</after>
29+
30+
<!-- Create a cart price rule based on a coupon code -->
31+
<amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/>
32+
<click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/>
33+
<fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{_defaultCoupon.code}}" stepKey="fillRuleName"/>
34+
<selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/>
35+
<selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/>
36+
<selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="selectCouponType"/>
37+
<fillField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{_defaultCoupon.code}}" stepKey="fillCouponCode"/>
38+
<click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/>
39+
<selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="selectActionType"/>
40+
<fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="5" stepKey="fillDiscountAmount"/>
41+
<click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/>
42+
43+
<!-- Verify initial successful save -->
44+
<see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
45+
<fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="{{_defaultCoupon.code}}" stepKey="filterByName"/>
46+
<click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="doFilter"/>
47+
<see selector="{{AdminCartPriceRulesSection.nameColumns}}" userInput="{{_defaultCoupon.code}}" stepKey="seeRuleInResults"/>
48+
49+
<!-- Verify further on the Rule's edit page -->
50+
<click selector="{{AdminCartPriceRulesSection.rowContainingText(_defaultCoupon.code)}}" stepKey="goToEditRule"/>
51+
<seeInField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{_defaultCoupon.code}}" stepKey="seeRuleName"/>
52+
<seeOptionIsSelected selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="seeWebsites"/>
53+
<seeOptionIsSelected selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="seeCustomerGroup"/>
54+
<seeOptionIsSelected selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="seeCouponType"/>
55+
<seeInField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{_defaultCoupon.code}}" stepKey="seeCouponCode"/>
56+
<click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions2"/>
57+
<seeOptionIsSelected selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="seeActionType"/>
58+
<seeInField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="5" stepKey="seeDiscountAmount"/>
59+
</test>
60+
</tests>

0 commit comments

Comments
 (0)