Skip to content

Commit 3a9ac72

Browse files
ENGCOM-8547: [MFTF] Refactoring of AddOutOfStockProductToCompareListTest #31099
- Merge Pull Request #31099 from AnnaAPak/magento2:ref-AddOutOfStockProductToCompareListTest - Merged commits: 1. 6bb8158 2. 3cf82b7 3. 1089f15 4. 7320189 5. 8ba2695 6. d001c99 7. 125b01a
2 parents 05a3e7e + 125b01a commit 3a9ac72

File tree

2 files changed

+101
-63
lines changed

2 files changed

+101
-63
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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="StorefrontHoverProductOnCategoryPageActionGroup">
12+
<annotations>
13+
<description>Hover product on the Category page</description>
14+
</annotations>
15+
16+
<moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverOverProduct"/>
17+
18+
</actionGroup>
19+
</actionGroups>

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

Lines changed: 82 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<group value="Catalog"/>
2121
</annotations>
2222
<before>
23-
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
<comment userInput="Adding the comment for preserving Backward Compatibility" stepKey="loginAsAdmin"/>
2424
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockDisable.path}} {{CatalogInventoryOptionsShowOutOfStockDisable.value}}" stepKey="setConfigShowOutOfStockFalse"/>
2525
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
2626
<argument name="tags" value=""/>
@@ -30,81 +30,100 @@
3030
<requiredEntity createDataKey="category"/>
3131
</createData>
3232
</before>
33+
3334
<after>
3435
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockDisable.path}} {{CatalogInventoryOptionsShowOutOfStockDisable.value}}" stepKey="setConfigShowOutOfStockFalse"/>
3536
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
3637
<argument name="tags" value=""/>
3738
</actionGroup>
3839
<deleteData createDataKey="product" stepKey="deleteProduct"/>
3940
<deleteData createDataKey="category" stepKey="deleteCategory"/>
40-
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
41+
<comment userInput="Adding the comment for preserving Backward Compatibility" stepKey="logout"/>
4142
</after>
42-
<!--Open product page-->
43-
<comment userInput="Open product page" stepKey="openProdPage"/>
44-
<amOnPage url="{{StorefrontProductPage.url($$product.custom_attributes[url_key]$$)}}" stepKey="goToSimpleProductPage"/>
45-
<waitForPageLoad stepKey="waitForSimpleProductPage"/>
46-
<!--'Add to compare' link is not available-->
47-
<comment userInput="'Add to compare' link is not available" stepKey="addToCompareLinkAvailability"/>
43+
<comment userInput="Open product page | Comment is kept to preserve the step key for backward compatibility" stepKey="openProdPage"/>
44+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="goToSimpleProductPage"/>
45+
46+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="waitForSimpleProductPage">
47+
<argument name="productUrl" value="$$product.custom_attributes[url_key]$$"/>
48+
</actionGroup>
49+
50+
<comment userInput="'Add to compare' link is not available | Comment is kept to preserve the step key for backward compatibility" stepKey="addToCompareLinkAvailability"/>
51+
4852
<dontSeeElement selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="dontSeeAddToCompareLink"/>
49-
<!--Turn on 'out on stock' config-->
50-
<comment userInput="Turn on 'out of stock' config" stepKey="onOutOfStockConfig"/>
53+
54+
<comment userInput="Turn on 'out of stock' config | Comment is kept to preserve the step key for backward compatibility" stepKey="onOutOfStockConfig"/>
5155
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockEnable.path}} {{CatalogInventoryOptionsShowOutOfStockEnable.value}}" stepKey="setConfigShowOutOfStockTrue"/>
52-
<!--Clear cache and reindex-->
53-
<comment userInput="Clear cache and reindex" stepKey="cleanCache"/>
56+
57+
<comment userInput="Clear cache and reindex | Comment is kept to preserve the step key for backward compatibility" stepKey="cleanCache"/>
5458
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
55-
<argument name="indices" value=""/>
56-
</actionGroup>
59+
<argument name="indices" value=""/>
60+
</actionGroup>
5761
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
58-
<argument name="tags" value=""/>
59-
</actionGroup>
60-
<!--Open product page-->
61-
<comment userInput="Open product page" stepKey="openProductPage"/>
62-
<amOnPage url="{{StorefrontProductPage.url($$product.custom_attributes[url_key]$$)}}" stepKey="goToSimpleProductPage2"/>
63-
<waitForPageLoad stepKey="waitForSimpleProductPage2"/>
64-
<!--Click on 'Add to Compare' link-->
65-
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="seeAddToCompareLink"/>
66-
<comment userInput="Click on 'Add to Compare' link" stepKey="clickOnAddToCompareLink"/>
67-
<click selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="clickOnAddToCompare"/>
68-
<waitForPageLoad stepKey="waitForProdAddToCmpList"/>
69-
<!--Assert success message-->
70-
<comment userInput="Assert success message" stepKey="assertSuccessMsg"/>
71-
<grabTextFrom selector="{{StorefrontMessagesSection.success}}" stepKey="grabTextFromSuccessMessage"/>
72-
<assertEquals stepKey="assertSuccessMessage">
73-
<actualResult type="const">($grabTextFromSuccessMessage)</actualResult>
74-
<expectedResult type="string">You added product $$product.name$$ to the comparison list.</expectedResult>
75-
</assertEquals>
76-
<!--See product in the comparison list-->
77-
<comment userInput="See product in the comparison list" stepKey="seeProductInComparisonList"/>
78-
<amOnPage url="{{StorefrontProductComparePage.url}}" stepKey="navigateToComparePage"/>
79-
<waitForPageLoad stepKey="waitForStorefrontProductComparePageLoad"/>
80-
<seeElement selector="{{StorefrontProductCompareMainSection.ProductLinkByName($product.name$)}}" stepKey="seeProductInCompareList"/>
81-
<!--Go to Category page and delete product from comparison list-->
82-
<comment userInput="Go to Category page and delete product from comparison list" stepKey="deleteProdFromCmpList"/>
83-
<amOnPage url="{{StorefrontCategoryPage.url($$category.name$$)}}" stepKey="onCategoryPage"/>
84-
<waitForPageLoad time="30" stepKey="waitForPageLoad1"/>
85-
<click selector="{{StorefrontComparisonSidebarSection.ClearAll}}" stepKey="clickClearAll"/>
86-
<waitForPageLoad time="30" stepKey="waitForConfirmPageLoad"/>
87-
<click selector="{{AdminDeleteRoleSection.confirm}}" stepKey="confirmProdDelate"/>
88-
<waitForPageLoad time="30" stepKey="waitForConfirmLoad"/>
89-
<!--Add product to compare list from Category page-->
90-
<comment userInput="Add product to compare list fom Category page" stepKey="addToCmpFromCategPage"/>
91-
<moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverOverProduct"/>
92-
<click selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="clickAddToCompare"/>
93-
<waitForPageLoad stepKey="waitProdAddingToCmpList"/>
94-
<!--Assert success message-->
95-
<comment userInput="Assert success message" stepKey="assertSuccessMsg2"/>
96-
<grabTextFrom selector="{{StorefrontMessagesSection.success}}" stepKey="grabTextFromSuccessMessage2"/>
97-
<assertEquals stepKey="assertSuccessMessage2">
98-
<actualResult type="const">($grabTextFromSuccessMessage)</actualResult>
99-
<expectedResult type="string">You added product $$product.name$$ to the comparison list.</expectedResult>
100-
</assertEquals>
101-
<!--Check that product displays on add to compare widget-->
102-
<comment userInput="Check that product displays on add to compare widget" stepKey="checkProdNameOnWidget"/>
62+
<argument name="tags" value=""/>
63+
</actionGroup>
64+
65+
<comment userInput="Open product page | Comment is kept to preserve the step key for backward compatibility" stepKey="openProductPage"/>
66+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="goToSimpleProductPage2"/>
67+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForSimpleProductPage2"/>
68+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="seeAddToCompareLink">
69+
<argument name="productUrl" value="$$product.custom_attributes[url_key]$$"/>
70+
</actionGroup>
71+
72+
<comment userInput="Click on 'Add to Compare' link | Comment is kept to preserve the step key for backward compatibility" stepKey="clickOnAddToCompareLink"/>
73+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnAddToCompare"/>
74+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProdAddToCmpList"/>
75+
<comment userInput="Assert success message | Comment is kept to preserve the step key for backward compatibility" stepKey="assertSuccessMsg"/>
76+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="grabTextFromSuccessMessage"/>
77+
78+
<actionGroup ref="StorefrontAddProductToCompareActionGroup" stepKey="assertSuccessMessage">
79+
<argument name="productVar" value="$$product$$"/>
80+
</actionGroup>
81+
82+
<comment userInput="See product in the comparison list | Comment is kept to preserve the step key for backward compatibility" stepKey="seeProductInComparisonList"/>
83+
84+
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openCategoryPage">
85+
<argument name="categoryName" value="$$category.name$$"/>
86+
</actionGroup>
87+
88+
<actionGroup ref="StorefrontOpenAndCheckComparisionActionGroup" stepKey="navigateToComparePage"/>
89+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefrontProductComparePageLoad"/>
90+
91+
<actionGroup ref="SeeProductInComparisonListActionGroup" stepKey="seeProductInCompareList">
92+
<argument name="productVar" value="$$product$$"/>
93+
</actionGroup>
94+
95+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="deleteProdFromCmpList"/>
96+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="onCategoryPage"/>
97+
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="waitForPageLoad1">
98+
<argument name="categoryName" value="$$category.name$$"/>
99+
</actionGroup>
100+
101+
<actionGroup ref="StorefrontClearCompareActionGroup" stepKey="clickClearAll"/>
102+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForConfirmPageLoad"/>
103+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="confirmProdDelate"/>
104+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForConfirmLoad"/>
105+
<comment userInput="Add product to compare list fom Category page | Comment is kept to preserve the step key for backward compatibility" stepKey="addToCmpFromCategPage"/>
106+
107+
<actionGroup ref="StorefrontHoverProductOnCategoryPageActionGroup" stepKey="hoverOverProduct"/>
108+
109+
<actionGroup ref="StorefrontAddProductToCompareActionGroup" stepKey="clickAddToCompare">
110+
<argument name="productVar" value="$$product$$"/>
111+
</actionGroup>
112+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitProdAddingToCmpList"/>
113+
<comment userInput="Assert success message | Comment is kept to preserve the step key for backward compatibility" stepKey="assertSuccessMsg2"/>
114+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="grabTextFromSuccessMessage2"/>
115+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="assertSuccessMessage2"/>
116+
117+
<comment userInput="Check that product displays on add to compare widget | Comment is kept to preserve the step key for backward compatibility" stepKey="checkProdNameOnWidget"/>
103118
<seeElement selector="{{StorefrontComparisonSidebarSection.ProductTitleByName($$product.name$$)}}" stepKey="seeProdNameOnCmpWidget"/>
104-
<!--See product in the compare page-->
119+
105120
<comment userInput="See product in the compare page" stepKey="seeProductInComparePage"/>
106-
<amOnPage url="{{StorefrontProductComparePage.url}}" stepKey="navigateToComparePage2"/>
107-
<waitForPageLoad stepKey="waitForStorefrontProductComparePageLoad2"/>
108-
<seeElement selector="{{StorefrontProductCompareMainSection.ProductLinkByName($product.name$)}}" stepKey="seeProductInCompareList2"/>
121+
<actionGroup ref="StorefrontOpenAndCheckComparisionActionGroup" stepKey="navigateToComparePage2"/>
122+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefrontProductComparePageLoad2"/>
123+
124+
<actionGroup ref="SeeProductInComparisonListActionGroup" stepKey="seeProductInCompareList2">
125+
<argument name="productVar" value="$$product$$"/>
126+
</actionGroup>
127+
109128
</test>
110129
</tests>

0 commit comments

Comments
 (0)