Skip to content

Commit 0769c29

Browse files
author
Anna Bukatar
committed
ACP2E-1206: Catalog rule should not apply for custom option
- Added MFTF
1 parent a1aa4af commit 0769c29

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed

app/code/Magento/Catalog/Pricing/Price/CalculateCustomOptionCatalogRule.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
/**
1515
* Calculates prices of custom options of the product with catalog rules applied.
16+
*
17+
* @deprecated
18+
* @see ACP2E-1206
1619
*/
1720
class CalculateCustomOptionCatalogRule
1821
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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="StorefrontApplyCatalogRuleAsPercentageToSimpleProductNotCustomOptionsTest">
11+
<annotations>
12+
<features value="CatalogRule"/>
13+
<stories value="Apply catalog price rule"/>
14+
<title value="Catalog rule should not apply for custom option"/>
15+
<description value="Admin should be able to apply the catalog price rule to simple product. Custom options should not be affected"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="AC-6859"/>
18+
<useCaseId value="ACP2E-1206"/>
19+
<group value="catalogRule"/>
20+
<group value="catalog"/>
21+
</annotations>
22+
<before>
23+
<!-- Create category -->
24+
<createData entity="_defaultCategory" stepKey="createCategory"/>
25+
26+
<!-- Create Simple Product -->
27+
<createData entity="_defaultProduct" stepKey="createProduct">
28+
<requiredEntity createDataKey="createCategory"/>
29+
<field key="price">56.78</field>
30+
</createData>
31+
32+
<!-- Update all products to have custom options -->
33+
<updateData createDataKey="createProduct" entity="productWithFixedOptions" stepKey="updateProductWithOptions"/>
34+
35+
<!-- Login as Admin -->
36+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
37+
38+
<!-- Clear all catalog price rules and reindex before test -->
39+
<actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllCatalogRulesBeforeTest"/>
40+
<magentoCron groups="index" stepKey="fixInvalidatedIndicesBeforeTest"/>
41+
</before>
42+
<after>
43+
<!-- Delete products and category -->
44+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
45+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
46+
47+
<!-- Delete the catalog price rule -->
48+
<actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllCatalogRulesAfterTest"/>
49+
<magentoCron groups="index" stepKey="fixInvalidatedIndicesAfter"/>
50+
<!-- Logout -->
51+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
52+
</after>
53+
<!-- Begin creating a new catalog price rule -->
54+
<actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="openNewCatalogPriceRulePage"/>
55+
<actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForCatalogPriceRule">
56+
<argument name="groups" value="'NOT LOGGED IN'"/>
57+
</actionGroup>
58+
<actionGroup ref="AdminFillCatalogRuleConditionActionGroup" stepKey="fillConditionsForCatalogPriceRule">
59+
<argument name="conditionValue" value="$createCategory.id$"/>
60+
</actionGroup>
61+
<actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForCatalogPriceRule">
62+
<argument name="apply" value="by_percent"/>
63+
<argument name="discountAmount" value="12.3"/>
64+
</actionGroup>
65+
<actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyCatalogPriceRule"/>
66+
67+
<!-- Navigate to category on store front -->
68+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="goToStorefrontCategoryPage">
69+
<argument name="category" value="$createCategory$"/>
70+
</actionGroup>
71+
72+
<!-- Check product name on store front category page -->
73+
<actionGroup ref="AssertProductDetailsOnStorefrontActionGroup" stepKey="assertStorefrontProductName">
74+
<argument name="productInfo" value="$createProduct.name$"/>
75+
<argument name="productNumber" value="1"/>
76+
</actionGroup>
77+
78+
<!-- Check product price on store front category page -->
79+
<actionGroup ref="AssertProductDetailsOnStorefrontActionGroup" stepKey="assertStorefrontProductPrice">
80+
<argument name="productInfo" value="$49.80"/>
81+
<argument name="productNumber" value="1"/>
82+
</actionGroup>
83+
84+
<!-- Check product regular price on store front category page -->
85+
<actionGroup ref="AssertProductDetailsOnStorefrontActionGroup" stepKey="assertStorefrontProductRegularPrice">
86+
<argument name="productInfo" value="$56.78"/>
87+
<argument name="productNumber" value="1"/>
88+
</actionGroup>
89+
90+
<!-- Navigate to product on store front -->
91+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToProductPage">
92+
<argument name="productUrlKey" value="$createProduct.custom_attributes[url_key]$"/>
93+
</actionGroup>
94+
95+
<!-- Assert regular and special price after selecting ProductOptionValueDropdown1 -->
96+
<actionGroup ref="StorefrontSelectCustomOptionRadioAndAssertPricesActionGroup" stepKey="storefrontSelectCustomOptionAndAssertPrices">
97+
<argument name="customOption" value="ProductOptionRadioButton2"/>
98+
<argument name="customOptionValue" value="ProductOptionValueRadioButtons1"/>
99+
<argument name="productPrice" value="$156.77"/>
100+
<argument name="productFinalPrice" value="$149.79"/>
101+
</actionGroup>
102+
103+
<!-- Add product 1 to cart -->
104+
<actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage">
105+
<argument name="productName" value="$createProduct.name$"/>
106+
</actionGroup>
107+
108+
<!-- Assert sub total on mini shopping cart -->
109+
<actionGroup ref="AssertSubTotalOnStorefrontMiniCartActionGroup" stepKey="assertSubTotalOnStorefrontMiniCart">
110+
<argument name="subTotal" value="$149.79"/>
111+
</actionGroup>
112+
</test>
113+
</tests>

0 commit comments

Comments
 (0)