Skip to content

Commit 0f9088a

Browse files
committed
Merge branch 'MC-74' into RE-develop
2 parents 5f9a032 + fe50539 commit 0f9088a

File tree

6 files changed

+282
-1
lines changed

6 files changed

+282
-1
lines changed

app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<section name="StorefrontPropertiesSection">
2626
<element name="StoreFrontPropertiesTab" selector="#product_attribute_tabs_front" type="button"/>
2727
<element name="EnableWYSIWYG" type="select" selector="#enabled"/>
28+
<element name="useForPromoRuleConditions" type="select" selector="#is_used_for_promo_rules"/>
2829
</section>
2930
<section name="WYSIWYGProductAttributeSection">
3031
<element name="ShowHideBtn" type="button" selector="#toggledefault_value_texteditor"/>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeGridSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<element name="GridFilterFrontEndLabel" type="input" selector="#attributeGrid_filter_frontend_label"/>
1515
<element name="Search" type="button" selector="button[data-action=grid-filter-apply]" timeout="30"/>
1616
<element name="ResetFilter" type="button" selector="button[data-action='grid-filter-reset']" timeout="30"/>
17-
<element name="FirstRow" type="button" selector="//*[@id='attributeGrid_table']/tbody/tr[1]"/>
17+
<element name="FirstRow" type="button" selector="//*[@id='attributeGrid_table']/tbody/tr[1]" timeout="30"/>
1818
<element name="FilterByAttributeCode" type="input" selector="#attributeGrid_filter_attribute_code"/>
1919
</section>
2020
</sections>

app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryTopToolbarSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@
1212
<element name="gridMode" type="button" selector=".//*[@class='toolbar toolbar-products'][1]//*[@id='mode-grid']" timeout="30"/>
1313
<element name="listMode" type="button" selector=".//*[@class='toolbar toolbar-products'][1]//*[@id='mode-list']" timeout="30"/>
1414
<element name="sortByDropdown" type="select" selector=".//*[@class='toolbar toolbar-products'][1]//*[@id='sorter']" timeout="30"/>
15+
<element name="sortDirectionAsc" type="button" selector=".//*[@class='toolbar toolbar-products'][1]//a[contains(@class, 'sort-asc')]" timeout="30"/>
16+
<element name="sortDirectionDesc" type="button" selector=".//*[@class='toolbar toolbar-products'][1]//a[contains(@class, 'sort-desc')]" timeout="30"/>
1517
</section>
1618
</sections>

app/code/Magento/CatalogRule/Test/Mftf/Section/AdminNewCatalogPriceRuleSection.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@
3737
<element name="disregardRules" type="select" selector="[name='stop_rules_processing']"/>
3838
</section>
3939

40+
<section name="AdminNewCatalogPriceRuleConditions">
41+
<element name="newCondition" type="button" selector="span.rule-param-new-child"/>
42+
<element name="conditionSelect" type="select" selector="select#conditions__{{var}}__new_child" parameterized="true"/>
43+
<element name="targetEllipsis" type="button" selector="//li[{{var}}]//a[@class='label'][text() = '...']" parameterized="true"/>
44+
<element name="targetInput" type="input" selector="input#conditions__{{var1}}--{{var2}}__value" parameterized="true"/>
45+
<element name="applyButton" type="button" selector="#conditions__{{var1}}__children li:nth-of-type({{var2}}) a.rule-param-apply" parameterized="true"/>
46+
</section>
47+
4048
<section name="AdminCatalogPriceRuleGrid">
4149
<element name="applyRules" type="button" selector="#apply_rules" timeout="30"/>
4250
</section>
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)