Skip to content

Commit 2b39e6c

Browse files
committed
MC-41853: Related Products are not showing the Correct MAP Price
1 parent 53a0e8a commit 2b39e6c

5 files changed

+236
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontAssertRelatedProductMapOnProductPageActionGroup" extends="StorefrontAssertRelatedProductOnProductPageActionGroup">
12+
<annotations>
13+
<description>Validates provided Product Name and Minimum Advertised Price on Product details page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="relatedProductMap" type="string"/>
17+
</arguments>
18+
19+
<seeElement selector="{{StorefrontCategoryProductSection.relatedProductMapPrice}}" stepKey="seeFirstRelatedProductMapPrice"/>
20+
<grabTextFrom selector="{{StorefrontCategoryProductSection.relatedProductMapPrice}}" stepKey="grabFirstRelatedProductMapPrice"/>
21+
<assertEquals stepKey="assertFirstRelatedProductMapPrice">
22+
<actualResult type="const">($grabFirstRelatedProductMapPrice)</actualResult>
23+
<expectedResult type="string">${{relatedProductMap}}</expectedResult>
24+
</assertEquals>
25+
</actionGroup>
26+
</actionGroups>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontConfigurableProductCheckMapActionGroup">
12+
<annotations>
13+
<description>Check MAP of configurable product options on store-front.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="configProductUrlKey" type="string"/>
17+
<argument name="productMap1" type="string"/>
18+
<argument name="productMap2" type="string"/>
19+
<argument name="productAttributeOptionValue2" type="string"/>
20+
<argument name="productAttributeOptionValue1" type="string"/>
21+
</arguments>
22+
23+
<!--Go to store front and check map for products-->
24+
<amOnPage url="{{StorefrontProductPage.url(configProductUrlKey)}}" stepKey="navigateToConfigProductPage"/>
25+
<waitForPageLoad stepKey="waitForLoadConfigProductPage"/>
26+
27+
<!--Check msrp for second child product-->
28+
<selectOption selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" userInput="{{productAttributeOptionValue2}}" stepKey="selectSecondOption"/>
29+
<waitForElement selector="{{StorefrontProductInfoMainSection.mapPrice}}" stepKey="waitForLoad"/>
30+
<grabTextFrom selector="{{StorefrontProductInfoMainSection.mapPrice}}" stepKey="grabSecondProductMapPrice"/>
31+
<assertEquals stepKey="assertSecondProductMapPrice">
32+
<actualResult type="const">($grabSecondProductMapPrice)</actualResult>
33+
<expectedResult type="string">${{productMap2}}</expectedResult>
34+
</assertEquals>
35+
<seeElement selector="{{StorefrontProductInfoMainSection.clickForPriceLink}}" stepKey="checkClickForPriceLinkForSecondProduct"/>
36+
37+
<!--Check msrp for first child product-->
38+
<selectOption selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" userInput="{{productAttributeOptionValue1}}" stepKey="selectFirstOption"/>
39+
<waitForElement selector="{{StorefrontProductInfoMainSection.mapPrice}}" stepKey="waitForLoad1"/>
40+
<grabTextFrom selector="{{StorefrontProductInfoMainSection.mapPrice}}" stepKey="grabFirstProductMapPrice"/>
41+
<assertEquals stepKey="assertFirstProductMapPrice">
42+
<actualResult type="const">($grabFirstProductMapPrice)</actualResult>
43+
<expectedResult type="string">${{productMap1}}</expectedResult>
44+
</assertEquals>
45+
<seeElement selector="{{StorefrontProductInfoMainSection.clickForPriceLink}}" stepKey="checkClickForPriceLinkForFirstProduct"/>
46+
</actionGroup>
47+
</actionGroups>

app/code/Magento/Msrp/Test/Mftf/Data/ProductData.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,13 @@
1717
<data key="price">100.00</data>
1818
<requiredEntity type="custom_attribute_array">ApiProductMsrp</requiredEntity>
1919
</entity>
20+
<entity name="SimpleProductMap1">
21+
<data key="price">55.00</data>
22+
</entity>
23+
<entity name="SimpleProductMap2">
24+
<data key="price">65.00</data>
25+
</entity>
26+
<entity name="SimpleProductMap3">
27+
<data key="price">155.00</data>
28+
</entity>
2029
</entities>

app/code/Magento/Msrp/Test/Mftf/Section/StorefrontCategoryProductSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
<section name="StorefrontCategoryProductSection">
1111
<element name="clickForPrice" type="button" selector="//a[normalize-space() = '{{productName}}']/following::div[@data-role='priceBox']/a[@class='action map-show-info']" parameterized="true" timeout="30"/>
1212
<element name="mapPrice" type="button" selector="//a[normalize-space() = '{{productName}}']/following::div[@data-role='priceBox']//span[contains(@class, 'price-msrp_price')]" parameterized="true" timeout="30"/>
13+
<element name="relatedProductMapPrice" type="text" selector="//*[@class='block related']//span[contains(@class, 'price-msrp_price')]"/>
1314
</section>
1415
</sections>
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontConfigurableProductWithMapAndRelatedProductTest">
12+
<annotations>
13+
<features value="Msrp"/>
14+
<stories value="Minimum advertised price"/>
15+
<title value="Check related and simple products with MAP assigned to configurable product displayed correctly"/>
16+
<description value="Check related and simple products with MAP assigned to configurable product displayed correctly"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-41948"/>
19+
<useCaseId value="MC-41853"/>
20+
<group value="Msrp"/>
21+
</annotations>
22+
<before>
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24+
25+
<!--Create category-->
26+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
27+
28+
<!-- Create the configurable product -->
29+
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
30+
<requiredEntity createDataKey="createCategory"/>
31+
</createData>
32+
33+
<!-- Make the configurable product have two options, that are children of the default attribute set -->
34+
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
35+
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
36+
<requiredEntity createDataKey="createConfigProductAttribute"/>
37+
</createData>
38+
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2">
39+
<requiredEntity createDataKey="createConfigProductAttribute"/>
40+
</createData>
41+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
42+
<requiredEntity createDataKey="createConfigProductAttribute"/>
43+
</createData>
44+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1">
45+
<requiredEntity createDataKey="createConfigProductAttribute"/>
46+
</getData>
47+
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2">
48+
<requiredEntity createDataKey="createConfigProductAttribute"/>
49+
</getData>
50+
51+
<!-- Create the 2 children that will be a part of the configurable product -->
52+
<createData entity="ApiSimpleProductWithPrice50" stepKey="createConfigChildProduct1">
53+
<requiredEntity createDataKey="createConfigProductAttribute"/>
54+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
55+
</createData>
56+
<createData entity="ApiSimpleProductWithPrice60" stepKey="createConfigChildProduct2">
57+
<requiredEntity createDataKey="createConfigProductAttribute"/>
58+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
59+
</createData>
60+
61+
<!-- Assign the two products to the configurable product -->
62+
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
63+
<requiredEntity createDataKey="createConfigProduct"/>
64+
<requiredEntity createDataKey="createConfigProductAttribute"/>
65+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
66+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
67+
</createData>
68+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1">
69+
<requiredEntity createDataKey="createConfigProduct"/>
70+
<requiredEntity createDataKey="createConfigChildProduct1"/>
71+
</createData>
72+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2">
73+
<requiredEntity createDataKey="createConfigProduct"/>
74+
<requiredEntity createDataKey="createConfigChildProduct2"/>
75+
</createData>
76+
77+
<!-- Create simple product which will be related to configurable product -->
78+
<createData entity="SimpleProduct2" stepKey="createRelatedProduct"/>
79+
80+
<!--Enable Minimum advertised Price-->
81+
<createData entity="MsrpEnableMAP" stepKey="enableMAP"/>
82+
</before>
83+
<after>
84+
<!--Delete created data-->
85+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
86+
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
87+
<deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/>
88+
<deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/>
89+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
90+
91+
<!-- Delete related products -->
92+
<deleteData createDataKey="createRelatedProduct" stepKey="deleteRelatedProduct"/>
93+
94+
<!--Disable Minimum advertised Price-->
95+
<createData entity="MsrpDisableMAP" stepKey="disableMAP"/>
96+
97+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
98+
99+
<!-- Reindex invalidated indices after product attribute has been created/deleted -->
100+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
101+
</after>
102+
103+
<!-- Set Minimum Advertised Price to configurable products -->
104+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToFirstChildProductEditPage">
105+
<argument name="productId" value="$$createConfigChildProduct1.id$$"/>
106+
</actionGroup>
107+
<actionGroup ref="AdminSetAdvancedPricingActionGroup" stepKey="setMsrpForFirstChildProduct">
108+
<argument name="advancedPrice" value="{{SimpleProductMap1.price}}"/>
109+
</actionGroup>
110+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToSecondChildProductEditPage">
111+
<argument name="productId" value="$$createConfigChildProduct2.id$$"/>
112+
</actionGroup>
113+
<actionGroup ref="AdminSetAdvancedPricingActionGroup" stepKey="setMsrpForSecondChildProduct">
114+
<argument name="advancedPrice" value="{{SimpleProductMap2.price}}"/>
115+
</actionGroup>
116+
117+
<!-- Add related product to configurable product -->
118+
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForConfigProduct">
119+
<argument name="product" value="$$createConfigProduct$$"/>
120+
</actionGroup>
121+
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct">
122+
<argument name="product" value="$$createConfigProduct$$"/>
123+
</actionGroup>
124+
<actionGroup ref="AddRelatedProductBySkuActionGroup" stepKey="addRelatedProduct">
125+
<argument name="sku" value="$$createRelatedProduct.sku$$"/>
126+
</actionGroup>
127+
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButtonConfigurableProduct"/>
128+
129+
<!-- Set Minimum Advertised Price to related product -->
130+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToRelatedProductEditPage">
131+
<argument name="productId" value="$$createRelatedProduct.id$$"/>
132+
</actionGroup>
133+
<actionGroup ref="AdminSetAdvancedPricingActionGroup" stepKey="setMsrpForRelatedProduct">
134+
<argument name="advancedPrice" value="{{SimpleProductMap3.price}}"/>
135+
</actionGroup>
136+
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButtonRelatedProduct"/>
137+
138+
<!--Go to store front and check msrp for products-->
139+
<actionGroup ref="StorefrontConfigurableProductCheckMapActionGroup" stepKey="checkMapForConfigurableProduct">
140+
<argument name="configProductUrlKey" value="$$createConfigProduct.custom_attributes[url_key]$$"/>
141+
<argument name="productMap1" value="{{SimpleProductMap1.price}}"/>
142+
<argument name="productAttributeOptionValue1" value="$$getConfigAttributeOption1.value$$"/>
143+
<argument name="productMap2" value="{{SimpleProductMap2.price}}"/>
144+
<argument name="productAttributeOptionValue2" value="$$getConfigAttributeOption2.value$$"/>
145+
</actionGroup>
146+
147+
<!--Check related product map price -->
148+
<actionGroup ref="StorefrontAssertRelatedProductMapOnProductPageActionGroup" stepKey="checkMapForRelatedProduct">
149+
<argument name="relatedProductMap" value="{{SimpleProductMap3.price}}"/>
150+
<argument name="productName" value="$createRelatedProduct.name$"/>
151+
</actionGroup>
152+
</test>
153+
</tests>

0 commit comments

Comments
 (0)