Skip to content

Commit fe50539

Browse files
committed
MC-74: Admin should be able to apply the catalog rule by category
1 parent f952fc1 commit fe50539

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminApplyCatalogRuleByCategoryTest">
11+
<annotations>
12+
<features value="CatalogRule"/>
13+
<stories value="Apply catalog price rule"/>
14+
<title value="Admin should be able to apply the catalog rule by category"/>
15+
<description value="Admin should be able to apply the catalog rule by category"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MC-74"/>
18+
<group value="CatalogRule"/>
19+
</annotations>
20+
<before>
21+
<createData entity="ApiCategory" stepKey="createCategoryOne"/>
22+
<createData entity="ApiSimpleProduct" stepKey="createSimpleProductOne">
23+
<requiredEntity createDataKey="createCategoryOne"/>
24+
</createData>
25+
<createData entity="ApiCategory" stepKey="createCategoryTwo"/>
26+
<createData entity="ApiSimpleProduct" stepKey="createSimpleProductTwo">
27+
<requiredEntity createDataKey="createCategoryTwo"/>
28+
</createData>
29+
30+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
31+
</before>
32+
<after>
33+
<deleteData createDataKey="createCategoryOne" stepKey="deleteCategoryOne"/>
34+
<deleteData createDataKey="createSimpleProductOne" stepKey="deleteSimpleProductOne"/>
35+
<deleteData createDataKey="createCategoryTwo" stepKey="deleteCategoryTwo"/>
36+
<deleteData createDataKey="createSimpleProductTwo" stepKey="deleteSimpleProductTwo"/>
37+
38+
<!-- Delete the catalog price rule -->
39+
<amOnPage stepKey="goToPriceRulePage" url="{{CatalogRulePage.url}}"/>
40+
<actionGroup stepKey="deletePriceRule" ref="deleteEntitySecondaryGrid">
41+
<argument name="name" value="{{_defaultCatalogRule.name}}"/>
42+
<argument name="searchInput" value="{{AdminSecondaryGridSection.catalogRuleIdentifierSearch}}"/>
43+
</actionGroup>
44+
45+
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/>
46+
</after>
47+
48+
<!-- 1. Begin creating a new catalog price rule -->
49+
<amOnPage url="{{CatalogRulePage.url}}" stepKey="goToPriceRulePage"/>
50+
<waitForPageLoad stepKey="waitForPriceRulePage"/>
51+
<click selector="{{AdminGridMainControls.add}}" stepKey="addNewRule"/>
52+
<waitForPageLoad stepKey="waitForIndividualRulePage"/>
53+
<fillField selector="{{AdminNewCatalogPriceRule.ruleName}}" userInput="{{_defaultCatalogRule.name}}" stepKey="fillName"/>
54+
<fillField selector="{{AdminNewCatalogPriceRule.description}}" userInput="{{_defaultCatalogRule.description}}" stepKey="fillDescription"/>
55+
<selectOption selector="{{AdminNewCatalogPriceRule.websites}}" userInput="{{_defaultCatalogRule.website_ids[0]}}" stepKey="selectSite"/>
56+
<click selector="{{AdminNewCatalogPriceRule.fromDateButton}}" stepKey="clickFromCalender"/>
57+
<click selector="{{AdminNewCatalogPriceRule.todayDate}}" stepKey="clickFromToday"/>
58+
<click selector="{{AdminNewCatalogPriceRule.toDateButton}}" stepKey="clickToCalender"/>
59+
<click selector="{{AdminNewCatalogPriceRule.todayDate}}" stepKey="clickToToday"/>
60+
<click selector="{{AdminNewCatalogPriceRule.conditionsTab}}" stepKey="openConditions"/>
61+
<click selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" stepKey="clickNewRule"/>
62+
<selectOption selector="{{AdminNewCatalogPriceRuleConditions.conditionSelect('1')}}" userInput="Category" stepKey="selectCategory"/>
63+
<waitForPageLoad stepKey="waitForEllipsis"/>
64+
<click selector="{{AdminNewCatalogPriceRuleConditions.targetEllipsis('1')}}" stepKey="clickEllipsis"/>
65+
<waitForPageLoad stepKey="waitForInput"/>
66+
67+
<!-- 2. Fill condition of category = createCategoryOne -->
68+
<fillField selector="{{AdminNewCatalogPriceRuleConditions.targetInput('1', '1')}}" userInput="$$createCategoryOne.id$$" stepKey="fillCategory"/>
69+
<click selector="{{AdminNewCatalogPriceRuleConditions.applyButton('1', '1')}}" stepKey="clickApply"/>
70+
<click selector="{{AdminNewCatalogPriceRule.actionsTab}}" stepKey="openActionDropdown"/>
71+
<selectOption selector="{{AdminNewCatalogPriceRuleActions.apply}}" userInput="{{_defaultCatalogRule.simple_action}}" stepKey="discountType"/>
72+
<fillField selector="{{AdminNewCatalogPriceRuleActions.discountAmount}}" userInput="50" stepKey="fillDiscountValue"/>
73+
<selectOption selector="{{AdminNewCatalogPriceRuleActions.disregardRules}}" userInput="Yes" stepKey="discardSubsequentRules"/>
74+
<scrollToTopOfPage stepKey="scrollToTop"/>
75+
<waitForPageLoad stepKey="waitForApplied"/>
76+
<actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/>
77+
78+
<!-- 3. Save and apply the new catalog price rule -->
79+
<click selector="{{AdminNewCatalogPriceRule.saveAndApply}}" stepKey="saveAndApply"/>
80+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
81+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
82+
83+
<!-- 4. Verify the storefront -->
84+
<amOnPage url="$$createCategoryOne.name$$.html" stepKey="goToCategoryOne"/>
85+
<see selector="{{StorefrontCategoryProductSection.ProductInfoByNumber('1')}}" userInput="$$createSimpleProductOne.name$$" stepKey="seeProductOne"/>
86+
<see selector="{{StorefrontCategoryProductSection.ProductInfoByNumber('1')}}" userInput="$61.50" stepKey="seeProductOnePrice"/>
87+
<see selector="{{StorefrontCategoryProductSection.ProductInfoByNumber('1')}}" userInput="Regular Price $123.00" stepKey="seeProductOneRegularPrice"/>
88+
<amOnPage url="$$createCategoryTwo.name$$.html" stepKey="goToCategoryTwo"/>
89+
<see selector="{{StorefrontCategoryProductSection.ProductInfoByNumber('1')}}" userInput="$$createSimpleProductTwo.name$$" stepKey="seeProductTwo"/>
90+
<see selector="{{StorefrontCategoryProductSection.ProductInfoByNumber('1')}}" userInput="$123.00" stepKey="seeProductTwoPrice"/>
91+
<dontSee selector="{{StorefrontCategoryProductSection.ProductInfoByNumber('1')}}" userInput="$61.50" stepKey="dontSeeDiscount"/>
92+
</test>
93+
</tests>

0 commit comments

Comments
 (0)