Skip to content

Commit 701a96a

Browse files
committed
refactored asserting product details on storefont
1 parent 5e225d6 commit 701a96a

8 files changed

+165
-97
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="AssertAdminManageStockOnEditPageActionGroup">
12+
<annotations>
13+
<description>Check if manageStock value is correct
14+
(the Product Edit page->Advanced Inventory section should be opened in Admin prior this check).</description>
15+
</annotations>
16+
<arguments>
17+
<argument name="manageStock" type="string"/>
18+
</arguments>
19+
20+
<see selector="{{AdminProductFormAdvancedInventorySection.manageStock}}" userInput="{{manageStock}}" stepKey="seeManageStock"/>
21+
22+
</actionGroup>
23+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertStorefrontProductStockStatusOnProductPageActionGroup">
11+
<annotations>
12+
<description>Validates that the provided Product Stock Status is present and correct
13+
(the Product Detail page should be opened on Storefront prior this check)</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="productStockStatus" type="string"/>
17+
</arguments>
18+
19+
<see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="{{productStockStatus}}" stepKey="seeProductStockStatus"/>
20+
</actionGroup>
21+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml

+21-17
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88

9-
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
1111
<test name="AdminUpdateSimpleProductTieredPriceTest">
1212
<annotations>
@@ -71,10 +71,10 @@
7171
<fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{simpleProductTierPrice300InStock.weight}}" stepKey="fillSimpleProductWeight"/>
7272
<selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="{{simpleProductTierPrice300InStock.weightSelect}}" stepKey="selectProductWeight"/>
7373
<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDown"/>
74-
<fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$initialCategoryEntity.name$$" stepKey="fillSearchForInitialCategory" />
74+
<fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$initialCategoryEntity.name$$" stepKey="fillSearchForInitialCategory"/>
7575
<waitForPageLoad stepKey="waitForCategory1"/>
7676
<click selector="{{AdminProductFormSection.selectCategory($$initialCategoryEntity.name$$)}}" stepKey="unselectInitialCategory"/>
77-
<fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$categoryEntity.name$$" stepKey="fillSearchCategory" />
77+
<fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$categoryEntity.name$$" stepKey="fillSearchCategory"/>
7878
<waitForPageLoad stepKey="waitForCategory2"/>
7979
<click selector="{{AdminProductFormSection.selectCategory($$categoryEntity.name$$)}}" stepKey="clickOnCategory"/>
8080
<actionGroup ref="AdminSubmitCategoriesPopupActionGroup" stepKey="clickOnDoneAdvancedCategorySelect"/>
@@ -122,23 +122,27 @@
122122
<see selector="{{StorefrontCategoryMainSection.productLink}}" userInput="{{simpleProductTierPrice300InStock.name}}" stepKey="seeSimpleProductNameOnCategoryPage"/>
123123

124124
<!-- Verify customer see updated simple product (from the above step) on the storefront page -->
125-
<amOnPage url="{{StorefrontProductPage.url(simpleProductTierPrice300InStock.urlKey)}}" stepKey="goToProductPage"/>
126-
<waitForPageLoad stepKey="waitForStorefrontProductPageLoad"/>
127-
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{simpleProductTierPrice300InStock.name}}" stepKey="seeSimpleProductNameOnStoreFrontPage"/>
128-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="{{simpleProductTierPrice300InStock.price}}" stepKey="seeSimpleProductPriceOnStoreFrontPage"/>
125+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToProductPage">
126+
<argument name="productUrlKey" value="{{simpleProductTierPrice300InStock.urlKey}}"/>
127+
</actionGroup>
128+
<comment userInput="Comment is added to preserve the step key for backward compatibilityr" stepKey="waitForStorefrontProductPageLoad"/>
129+
130+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeSimpleProductNameOnStoreFrontPage">
131+
<argument name="productName" value="{{simpleProductTierPrice300InStock.name}}"/>
132+
</actionGroup>
133+
134+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeSimpleProductPriceOnStoreFrontPage">
135+
<argument name="productPrice" value="{{simpleProductTierPrice300InStock.price}}"/>
136+
</actionGroup>
137+
129138
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSku">
130139
<argument name="productSku" value="{{simpleProductTierPrice300InStock.sku}}"/>
131140
</actionGroup>
132-
<grabTextFrom selector="{{StorefrontProductInfoMainSection.productStockStatus}}" stepKey="productStockAvailableStatus"/>
133-
<assertEquals stepKey="assertStockAvailableOnProductPage">
134-
<expectedResult type="string">{{simpleProductTierPrice300InStock.storefrontStatus}}</expectedResult>
135-
<actualResult type="variable">productStockAvailableStatus</actualResult>
136-
</assertEquals>
137-
<grabTextFrom selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="productPriceAmount"/>
138-
<assertEquals stepKey="assertOldPriceTextOnProductPage">
139-
<expectedResult type="string">${{simpleProductTierPrice300InStock.price}}</expectedResult>
140-
<actualResult type="variable">productPriceAmount</actualResult>
141-
</assertEquals>
141+
142+
<comment userInput="Comment is added to preserve the step key for backward compatibilityr" stepKey="productStockAvailableStatus"/>
143+
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="assertStockAvailableOnProductPage">
144+
<argument name="productStockStatus" value="{{simpleProductTierPrice300InStock.storefrontStatus}}"/>
145+
</actionGroup>
142146

143147
<!--Verify customer see updated simple product link on magento storefront page and is searchable by sku -->
144148
<amOnPage url="{{StorefrontProductPage.url(simpleProductTierPrice300InStock.urlKey)}}" stepKey="goToMagentoStorefrontPage"/>

app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml

+21-17
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@
5151
<selectOption selector="{{AdminProductFormSection.stockStatus}}" userInput="{{simpleProductRegularPrice245InStock.status}}" stepKey="selectStockStatusInStock"/>
5252
<fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{simpleProductRegularPrice245InStock.weight}}" stepKey="fillSimpleProductWeight"/>
5353
<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDown"/>
54-
<fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$initialCategoryEntity.name$$" stepKey="fillSearchForInitialCategory" />
54+
<fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$initialCategoryEntity.name$$" stepKey="fillSearchForInitialCategory"/>
5555
<waitForPageLoad stepKey="waitForCategory1"/>
5656
<click selector="{{AdminProductFormSection.selectCategory($$initialCategoryEntity.name$$)}}" stepKey="unselectInitialCategory"/>
57-
<fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$categoryEntity.name$$" stepKey="fillSearchCategory" />
57+
<fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$categoryEntity.name$$" stepKey="fillSearchCategory"/>
5858
<waitForPageLoad stepKey="waitForCategory2"/>
5959
<click selector="{{AdminProductFormSection.selectCategory($$categoryEntity.name$$)}}" stepKey="clickOnCategory"/>
6060
<actionGroup ref="AdminSubmitCategoriesPopupActionGroup" stepKey="clickOnDoneAdvancedCategorySelect"/>
@@ -85,7 +85,7 @@
8585
<seeInField selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{simpleProductRegularPrice245InStock.status}}" stepKey="seeSimpleProductStockStatus"/>
8686
<seeInField selector="{{AdminProductFormSection.productWeight}}" userInput="{{simpleProductRegularPrice245InStock.weight}}" stepKey="seeSimpleProductWeight"/>
8787
<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDownToVerify"/>
88-
<see selector="{{AdminProductFormSection.selectMultipleCategories}}" userInput="$$categoryEntity.name$$" stepKey="selectedCategories" />
88+
<see selector="{{AdminProductFormSection.selectMultipleCategories}}" userInput="$$categoryEntity.name$$" stepKey="selectedCategories"/>
8989
<seeInField selector="{{AdminProductFormSection.visibility}}" userInput="{{simpleProductRegularPrice245InStock.visibility}}" stepKey="seeVisibility"/>
9090
<scrollTo selector="{{AdminProductSEOSection.sectionHeader}}" x="0" y="-80" stepKey="scrollToAdminProductSEOSection1"/>
9191
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="clickAdminProductSEOSection1"/>
@@ -102,23 +102,27 @@
102102
<see selector="{{StorefrontCategoryMainSection.productLink}}" userInput="{{simpleProductRegularPrice245InStock.name}}" stepKey="seeSimpleProductNameOnCategoryPage"/>
103103

104104
<!-- Verify customer see updated simple product (from the above step) on the storefront page -->
105-
<amOnPage url="{{StorefrontProductPage.url(simpleProductRegularPrice245InStock.urlKey)}}" stepKey="goToProductPage"/>
106-
<waitForPageLoad stepKey="waitForStorefrontProductPageLoad"/>
107-
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{simpleProductRegularPrice245InStock.name}}" stepKey="seeSimpleProductNameOnStoreFrontPage"/>
108-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="{{simpleProductRegularPrice245InStock.price}}" stepKey="seeSimpleProductPriceOnStoreFrontPage"/>
105+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToProductPage">
106+
<argument name="productUrlKey" value="{{simpleProductRegularPrice245InStock.urlKey}}"/>
107+
</actionGroup>
108+
<comment userInput="Comment is added to preserve the step key for backward compatibilityr" stepKey="waitForStorefrontProductPageLoad"/>
109+
110+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeSimpleProductNameOnStoreFrontPage">
111+
<argument name="productName" value="{{simpleProductRegularPrice245InStock.name}}"/>
112+
</actionGroup>
113+
114+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeSimpleProductPriceOnStoreFrontPage">
115+
<argument name="productPrice" value="{{simpleProductRegularPrice245InStock.price}}"/>
116+
</actionGroup>
117+
109118
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeSimpleProductSkuOnStoreFrontPage">
110119
<argument name="productSku" value="{{simpleProductRegularPrice245InStock.sku}}"/>
111120
</actionGroup>
112-
<grabTextFrom selector="{{StorefrontProductInfoMainSection.productStockStatus}}" stepKey="productStockAvailableStatus"/>
113-
<assertEquals stepKey="assertStockAvailableOnProductPage">
114-
<expectedResult type="string">{{simpleProductRegularPrice245InStock.storefrontStatus}}</expectedResult>
115-
<actualResult type="variable">productStockAvailableStatus</actualResult>
116-
</assertEquals>
117-
<grabTextFrom selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="productPriceAmount"/>
118-
<assertEquals stepKey="assertOldPriceTextOnProductPage">
119-
<expectedResult type="string">${{simpleProductRegularPrice245InStock.price}}</expectedResult>
120-
<actualResult type="variable">productPriceAmount</actualResult>
121-
</assertEquals>
121+
122+
<comment userInput="Comment is added to preserve the step key for backward compatibilityr" stepKey="productStockAvailableStatus"/>
123+
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="assertStockAvailableOnProductPage">
124+
<argument name="productStockStatus" value="{{simpleProductRegularPrice245InStock.storefrontStatus}}"/>
125+
</actionGroup>
122126

123127
<!--Verify customer see updated simple product link on magento storefront page and is searchable by sku -->
124128
<amOnPage url="{{StorefrontProductPage.url(simpleProductRegularPrice245InStock.urlKey)}}" stepKey="goToMagentoStorefrontPage"/>

app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml

+19-15
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<seeInField selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{simpleProductRegularPrice32501InStock.status}}" stepKey="seeSimpleProductStockStatus"/>
8686
<seeInField selector="{{AdminProductFormSection.productWeight}}" userInput="{{simpleProductRegularPrice32501InStock.weight}}" stepKey="seeSimpleProductWeight"/>
8787
<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDownToVerify"/>
88-
<see selector="{{AdminProductFormSection.selectMultipleCategories}}" userInput="$$categoryEntity.name$$" stepKey="selectedCategories" />
88+
<see selector="{{AdminProductFormSection.selectMultipleCategories}}" userInput="$$categoryEntity.name$$" stepKey="selectedCategories"/>
8989
<seeInField selector="{{AdminProductFormSection.visibility}}" userInput="{{simpleProductRegularPrice32501InStock.visibility}}" stepKey="seeVisibility"/>
9090
<scrollTo selector="{{AdminProductSEOSection.sectionHeader}}" x="0" y="-80" stepKey="scrollToAdminProductSEOSection1"/>
9191
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="clickAdminProductSEOSection1"/>
@@ -102,23 +102,27 @@
102102
<see selector="{{StorefrontCategoryMainSection.productLink}}" userInput="{{simpleProductRegularPrice32501InStock.name}}" stepKey="seeSimpleProductNameOnCategoryPage"/>
103103

104104
<!-- Verify customer see updated simple product (from the above step) on the storefront page -->
105-
<amOnPage url="{{StorefrontProductPage.url(simpleProductRegularPrice32501InStock.urlKey)}}" stepKey="goToProductPage"/>
106-
<waitForPageLoad stepKey="waitForStorefrontProductPageLoad"/>
107-
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{simpleProductRegularPrice32501InStock.name}}" stepKey="seeSimpleProductNameOnStoreFrontPage"/>
108-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="{{simpleProductRegularPrice32501InStock.price}}" stepKey="seeSimpleProductPriceOnStoreFrontPage"/>
105+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToProductPage">
106+
<argument name="productUrlKey" value="{{simpleProductRegularPrice32501InStock.urlKey}}"/>
107+
</actionGroup>
108+
<comment userInput="Comment is added to preserve the step key for backward compatibilityr" stepKey="waitForStorefrontProductPageLoad"/>
109+
110+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeSimpleProductNameOnStoreFrontPage">
111+
<argument name="productName" value="{{simpleProductRegularPrice32501InStock.name}}"/>
112+
</actionGroup>
113+
114+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeSimpleProductPriceOnStoreFrontPage">
115+
<argument name="productPrice" value="{{simpleProductRegularPrice32501InStock.price}}"/>
116+
</actionGroup>
117+
109118
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSku">
110119
<argument name="productSku" value="{{simpleProductRegularPrice32501InStock.sku}}"/>
111120
</actionGroup>
112-
<grabTextFrom selector="{{StorefrontProductInfoMainSection.productStockStatus}}" stepKey="productStockAvailableStatus"/>
113-
<assertEquals stepKey="assertStockAvailableOnProductPage">
114-
<expectedResult type="string">{{simpleProductRegularPrice32501InStock.storefrontStatus}}</expectedResult>
115-
<actualResult type="variable">productStockAvailableStatus</actualResult>
116-
</assertEquals>
117-
<grabTextFrom selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="productPriceAmount"/>
118-
<assertEquals stepKey="assertOldPriceTextOnProductPage">
119-
<expectedResult type="string">${{simpleProductRegularPrice32501InStock.price}}</expectedResult>
120-
<actualResult type="variable">productPriceAmount</actualResult>
121-
</assertEquals>
121+
122+
<comment userInput="Comment is added to preserve the step key for backward compatibilityr" stepKey="productStockAvailableStatus"/>
123+
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="assertStockAvailableOnProductPage">
124+
<argument name="productStockStatus" value="{{simpleProductRegularPrice32501InStock.storefrontStatus}}"/>
125+
</actionGroup>
122126

123127
<!--Verify customer don't see updated simple product link on magento storefront page and is searchable by sku -->
124128
<amOnPage url="{{StorefrontProductPage.url(simpleProductRegularPrice32501InStock.urlKey)}}" stepKey="goToMagentoStorefrontPage"/>

0 commit comments

Comments
 (0)