Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MFTF] Refactoring of AddOutOfStockProductToCompareListTest #31099

Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontHoverProductOnCategoryPageActionGroup">
<annotations>
<description>Hover product on the Category page</description>
</annotations>

<moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverOverProduct"/>

</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<group value="Catalog"/>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockDisable.path}} {{CatalogInventoryOptionsShowOutOfStockDisable.value}}" stepKey="setConfigShowOutOfStockFalse"/>
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
<argument name="tags" value=""/>
Expand All @@ -30,81 +29,99 @@
<requiredEntity createDataKey="category"/>
</createData>
</before>

<after>
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockDisable.path}} {{CatalogInventoryOptionsShowOutOfStockDisable.value}}" stepKey="setConfigShowOutOfStockFalse"/>
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
<argument name="tags" value=""/>
</actionGroup>
<deleteData createDataKey="product" stepKey="deleteProduct"/>
<deleteData createDataKey="category" stepKey="deleteCategory"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
<deleteData createDataKey="product" stepKey="deleteProduct"/>
<deleteData createDataKey="category" stepKey="deleteCategory"/>
</after>
<!--Open product page-->
<comment userInput="Open product page" stepKey="openProdPage"/>
<amOnPage url="{{StorefrontProductPage.url($$product.custom_attributes[url_key]$$)}}" stepKey="goToSimpleProductPage"/>
<waitForPageLoad stepKey="waitForSimpleProductPage"/>
<!--'Add to compare' link is not available-->
<comment userInput="'Add to compare' link is not available" stepKey="addToCompareLinkAvailability"/>
<comment userInput="Open product page | Comment is kept to preserve the step key for backward compatibility" stepKey="openProdPage"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="goToSimpleProductPage"/>

<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="waitForSimpleProductPage">
<argument name="productUrl" value="$$product.custom_attributes[url_key]$$"/>
</actionGroup>

<comment userInput="'Add to compare' link is not available | Comment is kept to preserve the step key for backward compatibility" stepKey="addToCompareLinkAvailability"/>

<dontSeeElement selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="dontSeeAddToCompareLink"/>
<!--Turn on 'out on stock' config-->
<comment userInput="Turn on 'out of stock' config" stepKey="onOutOfStockConfig"/>

<comment userInput="Turn on 'out of stock' config | Comment is kept to preserve the step key for backward compatibility" stepKey="onOutOfStockConfig"/>
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockEnable.path}} {{CatalogInventoryOptionsShowOutOfStockEnable.value}}" stepKey="setConfigShowOutOfStockTrue"/>
<!--Clear cache and reindex-->
<comment userInput="Clear cache and reindex" stepKey="cleanCache"/>

<comment userInput="Clear cache and reindex | Comment is kept to preserve the step key for backward compatibility" stepKey="cleanCache"/>
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
<argument name="indices" value=""/>
</actionGroup>
<argument name="indices" value=""/>
</actionGroup>
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
<argument name="tags" value=""/>
</actionGroup>
<!--Open product page-->
<comment userInput="Open product page" stepKey="openProductPage"/>
<amOnPage url="{{StorefrontProductPage.url($$product.custom_attributes[url_key]$$)}}" stepKey="goToSimpleProductPage2"/>
<waitForPageLoad stepKey="waitForSimpleProductPage2"/>
<!--Click on 'Add to Compare' link-->
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="seeAddToCompareLink"/>
<comment userInput="Click on 'Add to Compare' link" stepKey="clickOnAddToCompareLink"/>
<click selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="clickOnAddToCompare"/>
<waitForPageLoad stepKey="waitForProdAddToCmpList"/>
<!--Assert success message-->
<comment userInput="Assert success message" stepKey="assertSuccessMsg"/>
<grabTextFrom selector="{{StorefrontMessagesSection.success}}" stepKey="grabTextFromSuccessMessage"/>
<assertEquals stepKey="assertSuccessMessage">
<actualResult type="const">($grabTextFromSuccessMessage)</actualResult>
<expectedResult type="string">You added product $$product.name$$ to the comparison list.</expectedResult>
</assertEquals>
<!--See product in the comparison list-->
<comment userInput="See product in the comparison list" stepKey="seeProductInComparisonList"/>
<amOnPage url="{{StorefrontProductComparePage.url}}" stepKey="navigateToComparePage"/>
<waitForPageLoad stepKey="waitForStorefrontProductComparePageLoad"/>
<seeElement selector="{{StorefrontProductCompareMainSection.ProductLinkByName($product.name$)}}" stepKey="seeProductInCompareList"/>
<!--Go to Category page and delete product from comparison list-->
<comment userInput="Go to Category page and delete product from comparison list" stepKey="deleteProdFromCmpList"/>
<amOnPage url="{{StorefrontCategoryPage.url($$category.name$$)}}" stepKey="onCategoryPage"/>
<waitForPageLoad time="30" stepKey="waitForPageLoad1"/>
<click selector="{{StorefrontComparisonSidebarSection.ClearAll}}" stepKey="clickClearAll"/>
<waitForPageLoad time="30" stepKey="waitForConfirmPageLoad"/>
<click selector="{{AdminDeleteRoleSection.confirm}}" stepKey="confirmProdDelate"/>
<waitForPageLoad time="30" stepKey="waitForConfirmLoad"/>
<!--Add product to compare list from Category page-->
<comment userInput="Add product to compare list fom Category page" stepKey="addToCmpFromCategPage"/>
<moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverOverProduct"/>
<click selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="clickAddToCompare"/>
<waitForPageLoad stepKey="waitProdAddingToCmpList"/>
<!--Assert success message-->
<comment userInput="Assert success message" stepKey="assertSuccessMsg2"/>
<grabTextFrom selector="{{StorefrontMessagesSection.success}}" stepKey="grabTextFromSuccessMessage2"/>
<assertEquals stepKey="assertSuccessMessage2">
<actualResult type="const">($grabTextFromSuccessMessage)</actualResult>
<expectedResult type="string">You added product $$product.name$$ to the comparison list.</expectedResult>
</assertEquals>
<!--Check that product displays on add to compare widget-->
<comment userInput="Check that product displays on add to compare widget" stepKey="checkProdNameOnWidget"/>
<argument name="tags" value=""/>
</actionGroup>

<comment userInput="Open product page | Comment is kept to preserve the step key for backward compatibility" stepKey="openProductPage"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="goToSimpleProductPage2"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForSimpleProductPage2"/>
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="seeAddToCompareLink">
<argument name="productUrl" value="$$product.custom_attributes[url_key]$$"/>
</actionGroup>

<comment userInput="Click on 'Add to Compare' link | Comment is kept to preserve the step key for backward compatibility" stepKey="clickOnAddToCompareLink"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnAddToCompare"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProdAddToCmpList"/>
<comment userInput="Assert success message | Comment is kept to preserve the step key for backward compatibility" stepKey="assertSuccessMsg"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="grabTextFromSuccessMessage"/>

<actionGroup ref="StorefrontAddProductToCompareActionGroup" stepKey="assertSuccessMessage">
<argument name="productVar" value="$$product$$"/>
</actionGroup>

<comment userInput="See product in the comparison list | Comment is kept to preserve the step key for backward compatibility" stepKey="seeProductInComparisonList"/>

<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openCategoryPage">
<argument name="categoryName" value="$$category.name$$"/>
</actionGroup>

<actionGroup ref="StorefrontOpenAndCheckComparisionActionGroup" stepKey="navigateToComparePage"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefrontProductComparePageLoad"/>

<actionGroup ref="SeeProductInComparisonListActionGroup" stepKey="seeProductInCompareList">
<argument name="productVar" value="$$product$$"/>
</actionGroup>

<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="deleteProdFromCmpList"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="onCategoryPage"/>
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="waitForPageLoad1">
<argument name="categoryName" value="$$category.name$$"/>
</actionGroup>

<actionGroup ref="StorefrontClearCompareActionGroup" stepKey="clickClearAll"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForConfirmPageLoad"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="confirmProdDelate"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForConfirmLoad"/>
<comment userInput="Add product to compare list fom Category page | Comment is kept to preserve the step key for backward compatibility" stepKey="addToCmpFromCategPage"/>

<actionGroup ref="StorefrontHoverProductOnCategoryPageActionGroup" stepKey="hoverOverProduct"/>

<actionGroup ref="StorefrontAddProductToCompareActionGroup" stepKey="clickAddToCompare">
<argument name="productVar" value="$$product$$"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitProdAddingToCmpList"/>
<comment userInput="Assert success message | Comment is kept to preserve the step key for backward compatibility" stepKey="assertSuccessMsg2"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="grabTextFromSuccessMessage2"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="assertSuccessMessage2"/>

<comment userInput="Check that product displays on add to compare widget | Comment is kept to preserve the step key for backward compatibility" stepKey="checkProdNameOnWidget"/>
<seeElement selector="{{StorefrontComparisonSidebarSection.ProductTitleByName($$product.name$$)}}" stepKey="seeProdNameOnCmpWidget"/>
<!--See product in the compare page-->

<comment userInput="See product in the compare page" stepKey="seeProductInComparePage"/>
<amOnPage url="{{StorefrontProductComparePage.url}}" stepKey="navigateToComparePage2"/>
<waitForPageLoad stepKey="waitForStorefrontProductComparePageLoad2"/>
<seeElement selector="{{StorefrontProductCompareMainSection.ProductLinkByName($product.name$)}}" stepKey="seeProductInCompareList2"/>
<actionGroup ref="StorefrontOpenAndCheckComparisionActionGroup" stepKey="navigateToComparePage2"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefrontProductComparePageLoad2"/>

<actionGroup ref="SeeProductInComparisonListActionGroup" stepKey="seeProductInCompareList2">
<argument name="productVar" value="$$product$$"/>
</actionGroup>

</test>
</tests>