Skip to content

Commit 996406f

Browse files
committed
MC-30281: [2.4] Fix and unskip StorefrontSortingByPriceForConfigurableProductWithCatalogRuleAppliedTest
1 parent e6e6725 commit 996406f

File tree

2 files changed

+83
-50
lines changed

2 files changed

+83
-50
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminCatalogPriceRuleAddSkuConditionActionGroup">
11+
<annotations>
12+
<description>Create new product SKU based condition in Catalog Price Rule form.</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="productSku" type="string" defaultValue="{{ApiSimpleTwo.sku}}"/>
16+
</arguments>
17+
18+
<conditionalClick selector="{{AdminNewCatalogPriceRule.conditionsTabTitle}}" dependentSelector="{{AdminNewCatalogPriceRule.conditionsTabBody}}" visible="false" stepKey="openConditionsSectionIfNeeded"/>
19+
<scrollTo selector="{{AdminNewCatalogPriceRule.conditionsTabTitle}}" stepKey="scrollToConditionsFieldset"/>
20+
<waitForElementVisible selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" stepKey="waitForNewConditionButton"/>
21+
<click selector="{{AdminNewCatalogPriceRuleConditions.newCondition}}" stepKey="clickAddNewConditionButton"/>
22+
<selectOption selector="{{AdminNewCatalogPriceRuleConditions.conditionSelect('1')}}" userInput="Magento\CatalogRule\Model\Rule\Condition\Product|sku" stepKey="selectConditionTypeSku"/>
23+
<waitForPageLoad stepKey="waitConditionFormRefresh"/>
24+
<click selector="{{AdminNewCatalogPriceRuleConditions.targetEllipsis('1')}}" stepKey="clickEllipsis"/>
25+
<fillField selector="{{AdminNewCatalogPriceRuleConditions.targetInput('1', '1')}}" userInput="{{productSku}}" stepKey="fillProductSku"/>
26+
<click selector="{{AdminNewCatalogPriceRuleConditions.applyButton('1', '1')}}" stepKey="clickApply"/>
27+
</actionGroup>
28+
</actionGroups>

app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml

Lines changed: 55 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11-
<test name="StorefrontSortingByPriceForConfigurableProductWithCatalogRuleAppliedTest">
11+
<test name="StorefrontCheckSortingByPriceForConfigurableWithCatalogRuleAppliedTest">
1212
<annotations>
1313
<features value="ConfigurableProduct"/>
14-
<stories value="View soting by price in storefront"/>
15-
<title value="Sorting by price for Configurable with Catalog Rule applied"/>
14+
<stories value="Check sorting by price on storefront"/>
15+
<title value="Check sorting by price for Configurable product with Catalog Rule applied"/>
1616
<description value="Sort by price should be correct if the apply Catalog Rule to child product of configurable product"/>
1717
<severity value="CRITICAL"/>
18-
<testCaseId value="MAGETWO-69988"/>
19-
<group value="configurable_product"/>
18+
<testCaseId value="MC-11926"/>
19+
<useCaseId value="MAGETWO-66688"/>
20+
<group value="catalog"/>
21+
<group value="catalogRule"/>
22+
<group value="configurableProduct"/>
2023
</annotations>
2124
<before>
2225
<createData entity="ApiCategory" stepKey="createCategory"/>
@@ -28,63 +31,63 @@
2831
<requiredEntity createDataKey="createCategory"/>
2932
<field key="price">10.00</field>
3033
</createData>
31-
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
34+
<createData entity="ApiConfigurableProduct" stepKey="createConfigurableProduct">
3235
<requiredEntity createDataKey="createCategory"/>
3336
</createData>
34-
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
35-
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
36-
<requiredEntity createDataKey="createConfigProductAttribute"/>
37+
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigurableProductAttribute"/>
38+
<createData entity="productAttributeOption1" stepKey="createConfigurableProductAttributeOption1">
39+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
3740
</createData>
38-
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2">
39-
<requiredEntity createDataKey="createConfigProductAttribute"/>
41+
<createData entity="productAttributeOption2" stepKey="createConfigurableProductAttributeOption2">
42+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
4043
</createData>
41-
<createData entity="productAttributeOption3" stepKey="createConfigProductAttributeOption3">
42-
<requiredEntity createDataKey="createConfigProductAttribute"/>
44+
<createData entity="productAttributeOption3" stepKey="createConfigurableProductAttributeOption3">
45+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
4346
</createData>
4447
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
45-
<requiredEntity createDataKey="createConfigProductAttribute"/>
48+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
4649
</createData>
4750
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1">
48-
<requiredEntity createDataKey="createConfigProductAttribute"/>
51+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
4952
</getData>
5053
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2">
51-
<requiredEntity createDataKey="createConfigProductAttribute"/>
54+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
5255
</getData>
5356
<getData entity="ProductAttributeOptionGetter" index="3" stepKey="getConfigAttributeOption3">
54-
<requiredEntity createDataKey="createConfigProductAttribute"/>
57+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
5558
</getData>
5659
<createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1">
57-
<requiredEntity createDataKey="createConfigProductAttribute"/>
60+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
5861
<requiredEntity createDataKey="getConfigAttributeOption1"/>
5962
<field key="price">15.00</field>
6063
</createData>
6164
<createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2">
62-
<requiredEntity createDataKey="createConfigProductAttribute"/>
65+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
6366
<requiredEntity createDataKey="getConfigAttributeOption2"/>
6467
<field key="price">20.00</field>
6568
</createData>
6669
<createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct3">
67-
<requiredEntity createDataKey="createConfigProductAttribute"/>
70+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
6871
<requiredEntity createDataKey="getConfigAttributeOption3"/>
6972
<field key="price">25.00</field>
7073
</createData>
71-
<createData entity="ConfigurableProductThreeOptions" stepKey="createConfigProductOption">
72-
<requiredEntity createDataKey="createConfigProduct"/>
73-
<requiredEntity createDataKey="createConfigProductAttribute"/>
74+
<createData entity="ConfigurableProductThreeOptions" stepKey="createConfigurableProductOption">
75+
<requiredEntity createDataKey="createConfigurableProduct"/>
76+
<requiredEntity createDataKey="createConfigurableProductAttribute"/>
7477
<requiredEntity createDataKey="getConfigAttributeOption1"/>
7578
<requiredEntity createDataKey="getConfigAttributeOption2"/>
7679
<requiredEntity createDataKey="getConfigAttributeOption3"/>
7780
</createData>
78-
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1">
79-
<requiredEntity createDataKey="createConfigProduct"/>
81+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigurableProductAddChild1">
82+
<requiredEntity createDataKey="createConfigurableProduct"/>
8083
<requiredEntity createDataKey="createConfigChildProduct1"/>
8184
</createData>
82-
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2">
83-
<requiredEntity createDataKey="createConfigProduct"/>
85+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigurableProductAddChild2">
86+
<requiredEntity createDataKey="createConfigurableProduct"/>
8487
<requiredEntity createDataKey="createConfigChildProduct2"/>
8588
</createData>
86-
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild3">
87-
<requiredEntity createDataKey="createConfigProduct"/>
89+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigurableProductAddChild3">
90+
<requiredEntity createDataKey="createConfigurableProduct"/>
8891
<requiredEntity createDataKey="createConfigChildProduct3"/>
8992
</createData>
9093
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
@@ -95,8 +98,8 @@
9598
<actionGroup ref="ChangeUseForPromoRuleConditionsProductAttributeActionGroup" stepKey="changeUseForPromoRuleConditionsProductAttributeToYes">
9699
<argument name="option" value="Yes"/>
97100
</actionGroup>
98-
<magentoCLI command="indexer:reindex" stepKey="reindex1"/>
99-
<magentoCLI command="cache:flush" stepKey="flushCache1"/>
101+
<actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllRules"/>
102+
<magentoCLI command="indexer:reindex" stepKey="reindexIndices"/>
100103
</before>
101104

102105
<after>
@@ -106,8 +109,8 @@
106109
<deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/>
107110
<deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/>
108111
<deleteData createDataKey="createConfigChildProduct3" stepKey="deleteConfigChildProduct3"/>
109-
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
110-
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
112+
<deleteData createDataKey="createConfigurableProduct" stepKey="deleteConfigProduct"/>
113+
<deleteData createDataKey="createConfigurableProductAttribute" stepKey="deleteConfigProductAttribute"/>
111114

112115
<!--SKU Product Attribute is disable for Promo Rule Conditions-->
113116
<actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="navigateToSkuProductAttribute">
@@ -116,7 +119,12 @@
116119
<actionGroup ref="ChangeUseForPromoRuleConditionsProductAttributeActionGroup" stepKey="changeUseForPromoRuleConditionsProductAttributeToNo">
117120
<argument name="option" value="No"/>
118121
</actionGroup>
122+
<actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllRules"/>
119123
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
124+
125+
<!-- TODO: Remove this and change to CliRunReindexUsingCronJobsActionGroup after MC-29943 delivered-->
126+
<!-- Need reindex because creating new product attributes break some indices and this may affect other tests in testsuite -->
127+
<magentoCLI command="indexer:reindex" stepKey="reindexIndices"/>
120128
</after>
121129

122130
<!--Open category with products and Sort by price desc-->
@@ -127,20 +135,24 @@
127135
<argument name="sortBy" value="price"/>
128136
<argument name="sort" value="desc"/>
129137
</actionGroup>
130-
<see selector="{{StorefrontCategoryMainSection.lineProductName('1')}}" userInput="$$createConfigProduct.name$$" stepKey="seeConfigurableProduct"/>
138+
<see selector="{{StorefrontCategoryMainSection.lineProductName('1')}}" userInput="$$createConfigurableProduct.name$$" stepKey="seeConfigurableProduct"/>
131139
<see selector="{{StorefrontCategoryMainSection.lineProductName('2')}}" userInput="$$createSimpleProduct2.name$$" stepKey="seeSimpleProductTwo"/>
132140
<see selector="{{StorefrontCategoryMainSection.lineProductName('3')}}" userInput="$$createSimpleProduct.name$$" stepKey="seeSimpleProduct"/>
133141

134142
<!--Create and apply catalog price rule-->
135-
<actionGroup ref="NewCatalogPriceRuleByUIWithConditionIsSKUActionGroup" stepKey="createCatalogPriceRule">
136-
<argument name="catalogRule" value="CatalogRuleByPercentWith96Amount" />
137-
<argument name="productSku" value="$$createConfigChildProduct3.sku$$" />
143+
<actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="startCreatingCatalogPriceRule"/>
144+
<actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForCatalogPriceRule">
145+
<argument name="groups" value="'NOT LOGGED IN'"/>
138146
</actionGroup>
139-
<actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/>
140-
<click selector="{{AdminNewCatalogPriceRule.saveAndApply}}" stepKey="clickSaveAndApplyRules"/>
141-
142-
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
143-
<magentoCLI command="cache:flush" stepKey="flushCache"/>
147+
<actionGroup ref="AdminCatalogPriceRuleAddSkuConditionActionGroup" stepKey="addProductSkuBasedCondition">
148+
<argument name="productSku" value="$createConfigChildProduct3.sku$"/>
149+
</actionGroup>
150+
<actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForCatalogPriceRule">
151+
<argument name="apply" value="{{CatalogRuleByPercentWith96Amount.simple_action}}"/>
152+
<argument name="discountAmount" value="{{CatalogRuleByPercentWith96Amount.discount_amount}}"/>
153+
</actionGroup>
154+
<actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyCatalogPriceRule"/>
155+
<actionGroup ref="AdminReindexAndFlushCache" stepKey="reindexAndFlushCache"/>
144156

145157
<!--Reopen category with products and Sort by price desc-->
146158
<actionGroup ref="GoToStorefrontCategoryPageByParametersActionGroup" stepKey="goToStorefrontCategoryPage2">
@@ -152,13 +164,6 @@
152164
</actionGroup>
153165
<see selector="{{StorefrontCategoryMainSection.lineProductName('1')}}" userInput="$$createSimpleProduct2.name$$" stepKey="seeSimpleProductTwo2"/>
154166
<see selector="{{StorefrontCategoryMainSection.lineProductName('2')}}" userInput="$$createSimpleProduct.name$$" stepKey="seeSimpleProduct2"/>
155-
<see selector="{{StorefrontCategoryMainSection.lineProductName('3')}}" userInput="$$createConfigProduct.name$$" stepKey="seeConfigurableProduct2"/>
156-
157-
<!-- Delete the rule -->
158-
<amOnPage url="{{CatalogRulePage.url}}" stepKey="goToPriceRulePage"/>
159-
<actionGroup ref="deleteEntitySecondaryGrid" stepKey="deletePriceRule">
160-
<argument name="name" value="{{CatalogRuleByPercentWith96Amount.name}}"/>
161-
<argument name="searchInput" value="{{AdminSecondaryGridSection.catalogRuleIdentifierSearch}}"/>
162-
</actionGroup>
167+
<see selector="{{StorefrontCategoryMainSection.lineProductName('3')}}" userInput="$$createConfigurableProduct.name$$" stepKey="seeConfigurableProduct2"/>
163168
</test>
164169
</tests>

0 commit comments

Comments
 (0)