Skip to content

Commit 2cc1dab

Browse files
committed
MC-35065: Catalog pricerules are not working with custom options as expected in Magento 2.3.0 product details page
1 parent d3f2b75 commit 2cc1dab

File tree

2 files changed

+167
-5
lines changed

2 files changed

+167
-5
lines changed

app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@
77
-->
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10-
<test name="ApplyCatalogRuleForSimpleProductWithCustomOptionsTest">
10+
<test name="ApplyCatalogRuleForSimpleProductWithCustomOptionsTest" deprecated="Use ApplyCatalogRuleForSimpleProductsWithCustomOptionsTest instead">
1111
<annotations>
1212
<features value="CatalogRule"/>
1313
<stories value="Apply catalog price rule"/>
14-
<title value="Admin should be able to apply the catalog price rule for simple product with 3 custom options"/>
14+
<title value="Deprecated. Admin should be able to apply the catalog price rule for simple product with 3 custom options"/>
1515
<description value="Admin should be able to apply the catalog price rule for simple product with 3 custom options"/>
1616
<severity value="CRITICAL"/>
1717
<testCaseId value="MC-14769"/>
1818
<group value="CatalogRule"/>
1919
<group value="mtf_migrated"/>
20+
<skip>
21+
<issueId value="DEPRECATED">Use ApplyCatalogRuleForSimpleProductsWithCustomOptionsTest instead</issueId>
22+
</skip>
2023
</annotations>
2124
<before>
2225
<!-- Login as Admin -->
@@ -67,9 +70,7 @@
6770
<actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/>
6871

6972
<!-- Save and apply the new catalog price rule -->
70-
<conditionalClick selector="{{AdminNewCatalogPriceRule.active}}" dependentSelector="{{AdminNewCatalogPriceRule.activeIsEnabled}}" visible="false" stepKey="enableActiveBtn"/>
71-
<click selector="{{AdminNewCatalogPriceRule.save}}" stepKey="clickSave"/>
72-
<waitForPageLoad stepKey="waitForSave"/>
73+
<actionGroup ref="SaveAndApplyCatalogPriceRuleActionGroup" stepKey="saveAndApplyCatalogPriceRule"/>
7374
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
7475
<argument name="indices" value=""/>
7576
</actionGroup>
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
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="ApplyCatalogRuleForSimpleProductsWithCustomOptionsTest">
11+
<annotations>
12+
<features value="CatalogRule"/>
13+
<stories value="Apply catalog price rule"/>
14+
<title value="Admin should be able to apply the catalog price rule for simple product with 3 custom options"/>
15+
<description value="Admin should be able to apply the catalog price rule for simple product with 3 custom options"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="MC-14769"/>
18+
<group value="catalogRule"/>
19+
<group value="mtf_migrated"/>
20+
</annotations>
21+
<before>
22+
<!-- Login as Admin -->
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24+
<createData entity="_defaultCategory" stepKey="createCategory"/>
25+
<createData entity="_defaultProduct" stepKey="createProduct1">
26+
<requiredEntity createDataKey="createCategory"/>
27+
<field key="price">56.78</field>
28+
</createData>
29+
<createData entity="_defaultProduct" stepKey="createProduct2">
30+
<requiredEntity createDataKey="createCategory"/>
31+
<field key="price">56.78</field>
32+
</createData>
33+
<createData entity="_defaultProduct" stepKey="createProduct3">
34+
<requiredEntity createDataKey="createCategory"/>
35+
<field key="price">56.78</field>
36+
</createData>
37+
38+
<!-- Update all products to have custom options -->
39+
<updateData createDataKey="createProduct1" entity="productWithCustomOptions" stepKey="updateProductWithOptions1"/>
40+
<updateData createDataKey="createProduct2" entity="productWithCustomOptions" stepKey="updateProductWithOptions2"/>
41+
<updateData createDataKey="createProduct3" entity="productWithCustomOptions" stepKey="updateProductWithOptions3"/>
42+
<magentoCron stepKey="runCronIndex" groups="index"/>
43+
</before>
44+
<after>
45+
<!-- Delete products and category -->
46+
<deleteData createDataKey="createProduct1" stepKey="deleteProduct1"/>
47+
<deleteData createDataKey="createProduct2" stepKey="deleteProduct2"/>
48+
<deleteData createDataKey="createProduct3" stepKey="deleteProduct3"/>
49+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
50+
51+
<!-- Delete the catalog price rule -->
52+
<actionGroup ref="AdminOpenCatalogPriceRulePageActionGroup" stepKey="goToPriceRulePage"/>
53+
<actionGroup stepKey="deletePriceRule" ref="deleteEntitySecondaryGrid">
54+
<argument name="name" value="{{_defaultCatalogRule.name}}"/>
55+
<argument name="searchInput" value="{{AdminSecondaryGridSection.catalogRuleIdentifierSearch}}"/>
56+
</actionGroup>
57+
58+
<!-- Logout -->
59+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
60+
</after>
61+
<!-- 1. Begin creating a new catalog price rule -->
62+
<actionGroup ref="NewCatalogPriceRuleByUIWithConditionIsCategoryActionGroup" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory">
63+
<argument name ="categoryId" value="$createCategory.id$"/>
64+
</actionGroup>
65+
66+
<!-- Select not logged in customer group -->
67+
<actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/>
68+
69+
<!-- Save and apply the new catalog price rule -->
70+
<conditionalClick selector="{{AdminNewCatalogPriceRule.active}}" dependentSelector="{{AdminNewCatalogPriceRule.activeIsEnabled}}" visible="false" stepKey="enableActiveBtn"/>
71+
<click selector="{{AdminNewCatalogPriceRule.save}}" stepKey="clickSave"/>
72+
<waitForPageLoad stepKey="waitForSave"/>
73+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
74+
<argument name="indices" value=""/>
75+
</actionGroup>
76+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
77+
<argument name="tags" value=""/>
78+
</actionGroup>
79+
80+
<!-- Navigate to category on store front -->
81+
<amOnPage url="{{StorefrontProductPage.url($createCategory.name$)}}" stepKey="goToCategoryPage"/>
82+
83+
<!-- Check product 1 price on store front category page -->
84+
<see selector="{{StorefrontCategoryProductSection.ProductInfoByName($createProduct1.name$)}}" userInput="$51.10" stepKey="storefrontProduct1Price"/>
85+
86+
<!-- Check product 1 regular price on store front category page -->
87+
<see selector="{{StorefrontCategoryProductSection.ProductInfoByName($createProduct1.name$)}}" userInput="$56.78" stepKey="storefrontProduct1RegularPrice"/>
88+
89+
<!-- Check product 2 price on store front category page -->
90+
<see selector="{{StorefrontCategoryProductSection.ProductInfoByName($createProduct2.name$)}}" userInput="$51.10" stepKey="storefrontProduct2Price"/>
91+
92+
<!-- Check product 2 regular price on store front category page -->
93+
<see selector="{{StorefrontCategoryProductSection.ProductInfoByName($createProduct2.name$)}}" userInput="$56.78" stepKey="storefrontProduct2RegularPrice"/>
94+
95+
<!-- Check product 3 price on store front category page -->
96+
<see selector="{{StorefrontCategoryProductSection.ProductInfoByName($createProduct3.name$)}}" userInput="$51.10" stepKey="storefrontProduct3Price"/>
97+
98+
<!-- Check product 3 regular price on store front category page -->
99+
<see selector="{{StorefrontCategoryProductSection.ProductInfoByName($createProduct3.name$)}}" userInput="$56.78" stepKey="storefrontProduct3RegularPrice"/>
100+
101+
<!-- Navigate to product 1 on store front -->
102+
<amOnPage url="{{StorefrontProductPage.url($createProduct1.name$)}}" stepKey="goToProductPage1"/>
103+
104+
<!-- Assert regular and special price after selecting ProductOptionValueDropdown1 -->
105+
<actionGroup ref="StorefrontSelectCustomOptionDropDownAndAssertPricesActionGroup" stepKey="storefrontSelectCustomOptionAndAssertPrices1">
106+
<argument name="customOption" value="{{ProductOptionValueDropdown1.title}} +$0.01"/>
107+
<argument name="productPrice" value="$56.79"/>
108+
<argument name="productFinalPrice" value="$51.11"/>
109+
</actionGroup>
110+
111+
<!-- Add product 1 to cart -->
112+
<actionGroup ref="StorefrontAddProductToCartWithQtyActionGroup" stepKey="cartAddSimpleProduct1ToCart">
113+
<argument name="productQty" value="1"/>
114+
</actionGroup>
115+
116+
<!-- Navigate to product 2 on store front -->
117+
<amOnPage url="{{StorefrontProductPage.url($createProduct1.name$)}}" stepKey="goToProductPage2"/>
118+
119+
<!-- Assert regular and special price after selecting ProductOptionValueDropdown3 -->
120+
<actionGroup ref="StorefrontSelectCustomOptionDropDownAndAssertPricesActionGroup" stepKey="storefrontSelectCustomOptionAndAssertPrices2">
121+
<argument name="customOption" value="{{ProductOptionValueDropdown3.title}} +$5.11"/>
122+
<argument name="productPrice" value="$62.46"/>
123+
<argument name="productFinalPrice" value="$56.21"/>
124+
</actionGroup>
125+
126+
<!-- Add product 2 to cart -->
127+
<actionGroup ref="StorefrontAddProductToCartWithQtyActionGroup" stepKey="cartAddSimpleProduct2ToCart">
128+
<argument name="productQty" value="1"/>
129+
</actionGroup>
130+
131+
<!-- Navigate to product 3 on store front -->
132+
<amOnPage url="{{StorefrontProductPage.url($createProduct3.name$)}}" stepKey="goToProductPage3"/>
133+
134+
<!-- Add product 3 to cart with no custom option -->
135+
<actionGroup ref="StorefrontAddProductToCartWithQtyActionGroup" stepKey="cartAddSimpleProduct3ToCart">
136+
<argument name="productQty" value="1"/>
137+
</actionGroup>
138+
139+
<!-- Assert sub total on mini shopping cart -->
140+
<actionGroup ref="AssertSubTotalOnStorefrontMiniCartActionGroup" stepKey="assertSubTotalOnStorefrontMiniCart">
141+
<argument name="subTotal" value="$158.42"/>
142+
</actionGroup>
143+
144+
<!-- Navigate to checkout shipping page -->
145+
<amOnPage stepKey="navigateToShippingPage" url="{{CheckoutShippingPage.url}}"/>
146+
<waitForPageLoad stepKey="waitFoCheckoutShippingPageLoad"/>
147+
148+
<!-- Fill Shipping information -->
149+
<actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="fillOrderShippingInfo">
150+
<argument name="customerVar" value="Simple_US_Customer"/>
151+
<argument name="customerAddressVar" value="US_Address_TX"/>
152+
</actionGroup>
153+
154+
<!-- Verify order summary on payment page -->
155+
<actionGroup ref="VerifyCheckoutPaymentOrderSummaryActionGroup" stepKey="verifyCheckoutPaymentOrderSummaryActionGroup">
156+
<argument name="orderSummarySubTotal" value="$158.42"/>
157+
<argument name="orderSummaryShippingTotal" value="$15.00"/>
158+
<argument name="orderSummaryTotal" value="$173.42"/>
159+
</actionGroup>
160+
</test>
161+
</tests>

0 commit comments

Comments
 (0)