Skip to content

Commit a78bb39

Browse files
committed
Merge remote-tracking branch 'origin/MC-35640' into 2.4-develop-pr120
2 parents d73c173 + b590648 commit a78bb39

File tree

9 files changed

+125
-7
lines changed

9 files changed

+125
-7
lines changed

app/code/Magento/Catalog/Test/Mftf/Page/StorefrontCategoryPage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<page name="StorefrontCategoryPage" url="/{{var1}}.html" area="storefront" module="Magento_Catalog" parameterized="true">
1212
<section name="StorefrontCategoryMainSection"/>
1313
<section name="WYSIWYGToolbarSection"/>
14+
<section name="StorefrontCategoryProductSection"/>
1415
</page>
1516
</pages>

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,11 @@
2121
<entity name="DisableMAP" type="msrp_settings_config">
2222
<data key="value">0</data>
2323
</entity>
24+
25+
<entity name="MsrpDisplayPriceOnGesture" type="msrp_settings_config">
26+
<requiredEntity type="display_price_type">DisplayPriceOnGesture</requiredEntity>
27+
</entity>
28+
<entity name="DisplayPriceOnGesture" type="msrp_settings_config">
29+
<data key="value">1</data>
30+
</entity>
2431
</entities>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@
1313
<requiredEntity type="custom_attribute_array">ApiProductCost</requiredEntity>
1414
<requiredEntity type="custom_attribute_array">ApiProductMsrp</requiredEntity>
1515
</entity>
16+
<entity name="SimpleProductWithMsrp" type="product" extends="SimpleProduct">
17+
<data key="price">100.00</data>
18+
<requiredEntity type="custom_attribute_array">ApiProductMsrp</requiredEntity>
19+
</entity>
1620
</entities>

app/code/Magento/Msrp/Test/Mftf/Metadata/MsrpSettingsMeta.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
<object key="enabled" dataType="enabled">
1515
<field key="value">string</field>
1616
</object>
17+
<object key="display_price_type" dataType="display_price_type">
18+
<field key="value">string</field>
19+
</object>
1720
</object>
1821
</object>
1922
</object>
2023
</operation>
21-
</operations>
24+
</operations>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="StorefrontCategoryPage" url="/{{var1}}.html" area="storefront" module="Magento_Catalog" parameterized="true">
12+
<section name="StorefrontMsrpPopupSection"/>
13+
</page>
14+
</pages>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
10+
<section name="StorefrontCategoryProductSection">
11+
<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"/>
12+
<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+
</section>
14+
</sections>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
10+
<section name="StorefrontMsrpPopupSection">
11+
<element name="addToCartButton" type="button" selector="#map-popup-click-for-price .action.tocart" timeout="30"/>
12+
</section>
13+
</sections>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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="StorefrontAddMapProductToCartFromPopupOnCategoryPageTest">
12+
<annotations>
13+
<features value="Msrp"/>
14+
<stories value="Minimum advertised price"/>
15+
<title value="Add simple product with minimum advertised price to cart from popup on category page"/>
16+
<description value="Check that simple product with minimum advertised price is successfully added to cart from popup on category page"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-40419"/>
19+
<useCaseId value="MC-35640"/>
20+
<group value="msrp"/>
21+
</annotations>
22+
<before>
23+
<!-- Enable Minimum advertised Price -->
24+
<createData entity="MsrpEnableMAP" stepKey="enableMAP"/>
25+
26+
<!-- Display Price in Popup -->
27+
<createData entity="MsrpDisplayPriceOnGesture" stepKey="displayPriceOnGesture"/>
28+
29+
<!-- Create category -->
30+
<createData entity="_defaultCategory" stepKey="createCategory"/>
31+
32+
<!-- Create product with MAP -->
33+
<createData entity="SimpleProductWithMsrp" stepKey="createProduct">
34+
<requiredEntity createDataKey="createCategory"/>
35+
</createData>
36+
</before>
37+
<after>
38+
<!-- Delete product and category -->
39+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
40+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
41+
42+
<!-- Disable Minimum advertised Price -->
43+
<createData entity="MsrpDisableMAP" stepKey="disableMAP"/>
44+
</after>
45+
46+
<!-- Open created category on Storefront -->
47+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="navigateToCategoryPage">
48+
<argument name="category" value="$createCategory$"/>
49+
</actionGroup>
50+
51+
<!-- Grab and verify MAP price -->
52+
<grabTextFrom selector="{{StorefrontCategoryProductSection.mapPrice($createProduct.name$)}}" stepKey="grabMapPrice"/>
53+
<assertEquals stepKey="assertMapPrice">
54+
<actualResult type="variable">grabMapPrice</actualResult>
55+
<expectedResult type="string">${{ApiProductMsrp.value}}</expectedResult>
56+
</assertEquals>
57+
58+
<!-- Open 'Click for price' popup and click 'Add to Cart' button -->
59+
<click selector="{{StorefrontCategoryProductSection.clickForPrice($createProduct.name$)}}" stepKey="clickForPrice"/>
60+
<waitForElementVisible selector="{{StorefrontMsrpPopupSection.addToCartButton}}" stepKey="waitForAddToCartButton"/>
61+
<click selector="{{StorefrontMsrpPopupSection.addToCartButton}}" stepKey="clickAddToCartButton"/>
62+
<waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/>
63+
<see selector="{{StorefrontMessagesSection.success}}" userInput="You added $createProduct.name$ to your shopping cart." stepKey="assertSuccessMessage"/>
64+
</test>
65+
</tests>

app/code/Magento/Msrp/view/base/templates/product/price/msrp.phtml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,9 @@ $priceElementIdPrefix = $block->getPriceElementIdPrefix() ? $block->getPriceElem
8080
$data['addToCartButton'] = '#product_addtocart_form [type=submit]';
8181
} else {
8282
$data['addToCartButton'] = sprintf(
83-
'form:has(input[type="hidden"][name="product"][value="%s"]) button[type="submit"]',
84-
(int) $productId . ',' .
85-
sprintf(
86-
'.block.widget .price-box[data-product-id=%s]+.product-item-actions button.tocart',
87-
(int)$productId
88-
)
83+
'form:has(input[type="hidden"][name="product"][value="%1$s"]) button[type="submit"],' .
84+
'.block.widget .price-box[data-product-id="%1$s"]+.product-item-actions button.tocart',
85+
$productId
8986
);
9087
}
9188
?>

0 commit comments

Comments
 (0)