Skip to content

Commit ecc4ef5

Browse files
add mftf test
1 parent 00317ef commit ecc4ef5

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed

app/code/Magento/Catalog/Test/Mftf/Data/TierPriceData.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,12 @@
6464
<data key="quantity">30</data>
6565
<var key="sku" entityType="product" entityKey="sku" />
6666
</entity>
67-
</entities>
67+
<entity name="tierProductPriceDiscount" type="catalogTierPrice">
68+
<data key="price">36.00</data>
69+
<data key="price_type">discount</data>
70+
<data key="website_id">0</data>
71+
<data key="customer_group">ALL GROUPS</data>
72+
<data key="quantity">3</data>
73+
<var key="sku" entityType="product" entityKey="sku" />
74+
</entity>
75+
</entities>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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="StoreFrontSimpleProductWithSpecialAndTierDiscountPriceTest">
11+
<annotations>
12+
<features value="Catalog"/>
13+
<title value="Apply discount tier price and custom price values for simple product"/>
14+
<description value="Apply discount tier price and custom price values for simple product"/>
15+
<severity value="MAJOR"/>
16+
<group value="Catalog"/>
17+
</annotations>
18+
<before>
19+
<!-- Create category -->
20+
<createData entity="_defaultCategory" stepKey="createCategory"/>
21+
22+
<!-- Create product -->
23+
<createData entity="ApiSimpleProduct" stepKey="createProduct">
24+
<requiredEntity createDataKey="createCategory"/>
25+
<field key="price">100.00</field>
26+
</createData>
27+
28+
<!-- Add tier price to product -->
29+
<createData entity="tierProductPriceDiscount" stepKey="addTierPrice">
30+
<requiredEntity createDataKey="createProduct"/>
31+
</createData>
32+
33+
<!-- Add special price to product -->
34+
<createData entity="specialProductPrice2" stepKey="addSpecialToSimpleProduct">
35+
<requiredEntity createDataKey="createProduct"/>
36+
<field key="price">65.00</field>
37+
</createData>
38+
</before>
39+
<after>
40+
<deleteData createDataKey="createProduct" stepKey="deleteSimpleProduct"/>
41+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
42+
</after>
43+
<!-- Open product page -->
44+
<amOnPage url="{{StorefrontProductPage.url($createProduct.sku$)}}" stepKey="openProductPage"/>
45+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
46+
47+
<!-- Assert product name on product page -->
48+
<grabTextFrom selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="productNameText"/>
49+
<assertEquals stepKey="assertProductNameOnProductPage">
50+
<expectedResult type="string">$createProduct.name$</expectedResult>
51+
<actualResult type="variable">productNameText</actualResult>
52+
</assertEquals>
53+
54+
<!-- Assert product tier price on product page -->
55+
<grabTextFrom selector="{{StorefrontProductInfoMainSection.tierPriceText}}" stepKey="tierPriceText"/>
56+
<assertEquals stepKey="assertTierPriceTextOnProductPage">
57+
<expectedResult type="string">Buy {{tierProductPriceDiscount.quantity}} for $64.00 each and save 2%</expectedResult>
58+
<actualResult type="variable">tierPriceText</actualResult>
59+
</assertEquals>
60+
61+
<!-- Assert final product price on product page -->
62+
<grabTextFrom selector="{{StorefrontProductInfoMainSection.price}}" stepKey="productPriceText"/>
63+
<assertEquals stepKey="assertProductPriceOnProductPage">
64+
<expectedResult type="string">$65.00</expectedResult>
65+
<actualResult type="variable">productPriceText</actualResult>
66+
</assertEquals>
67+
</test>
68+
</tests>

0 commit comments

Comments
 (0)