Skip to content

Commit

Permalink
ENGCOM-8533: [MFTF] Refactoring of AdminUpdateSimpleProductWithRegula…
Browse files Browse the repository at this point in the history
…rPriceInStockEnabledFlatTest #31221
  • Loading branch information
gabrieldagama committed Dec 15, 2020
2 parents 051cc6c + 736554e commit ed5d72a
Show file tree
Hide file tree
Showing 7 changed files with 251 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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="AdminAssignTwoCategoriesToProductActionGroup" extends="AdminAssignCategoryToProductAndSaveActionGroup">
<annotations>
<description>Extends AdminAssignCategoryToProductAndSaveActionGroup + assigns the second category and prevents product saving (the Product Edit page should be opened in Admin prior this check).</description>
</annotations>
<arguments>
<argument name="categoryTwoName" type="string"/>
</arguments>
<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="openDropDown2" after="waitForApplyCategory"/>
<checkOption selector="{{AdminProductFormSection.selectCategory(categoryTwoName)}}" stepKey="selectCategoryTwo"/>
<click selector="{{AdminProductFormSection.done}}" stepKey="clickDone2"/>
<waitForPageLoad stepKey="waitForApplyCategoryTwo"/>
<remove keyForRemoval="clickSave"/>
<remove keyForRemoval="waitForSavingProduct"/>
<remove keyForRemoval="seeSuccessMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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="AdminFillMainProductFormActionGroup" extends="FillMainProductFormActionGroup">
<annotations>
<description>Extends FillMainProductFormActionGroup with filling the next fields: Tax Class, Visibility, SEO->URL </description>
</annotations>

<selectOption selector="{{AdminProductFormSection.productTaxClass}}" userInput="{{product.productTaxClass}}" stepKey="selectProductTaxClass"/>
<selectOption selector="{{AdminProductFormSection.visibility}}" userInput="{{product.visibility}}" stepKey="selectVisibility"/>
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="clickAdminProductSEOSection"/>
<fillField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="{{product.urlKey}}" stepKey="fillUrlKey"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?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="AssertAdminManageStockOnEditPageActionGroup">
<annotations>
<description>Check if manageStock value is correct
(the Product Edit page->Advanced Inventory section should be opened in Admin prior this check).</description>
</annotations>
<arguments>
<argument name="manageStock" type="string"/>
</arguments>

<see selector="{{AdminProductFormAdvancedInventorySection.manageStock}}" userInput="{{manageStock}}" stepKey="seeManageStock"/>

</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?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="AssertAdminProductInfoOnEditPageActionGroup">
<annotations>
<description>Validates next fields on the Product Edit Page:
name, sku, price, quantity, stock status, tax class, weight, weigh select, visibility, url key</description>
</annotations>
<arguments>
<argument name="product" type="entity"/>
</arguments>
<waitForPageLoad stepKey="waitForProductToLoad"/>
<seeInField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="seeProductName"/>
<seeInField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="seeProductSku"/>
<seeInField selector="{{AdminProductFormSection.productPrice}}" userInput="{{product.price}}" stepKey="seeProductPrice"/>
<seeInField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{product.quantity}}" stepKey="seeProductQuantity"/>
<seeInField selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{product.status}}" stepKey="seeProductStockStatus"/>
<seeInField selector="{{AdminProductFormSection.productTaxClass}}" userInput="{{product.productTaxClass}}" stepKey="seeProductTaxClass"/>
<seeInField selector="{{AdminProductFormSection.productWeight}}" userInput="{{product.weight}}" stepKey="seeSimpleProductWeight"/>
<seeInField selector="{{AdminProductFormSection.productWeightSelect}}" userInput="{{product.weightSelect}}" stepKey="seeSimpleProductWeightSelect"/>
<seeInField selector="{{AdminProductFormSection.visibility}}" userInput="{{product.visibility}}" stepKey="seeVisibility"/>
<scrollTo selector="{{AdminProductSEOSection.sectionHeader}}" x="0" y="-80" stepKey="scrollToAdminProductSEOSection1"/>
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="clickAdminProductSEOSection1"/>
<seeInField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="{{product.urlKey}}" stepKey="seeUrlKey"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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="AssertStorefrontProductStockStatusOnProductPageActionGroup">
<annotations>
<description>Validates that the provided Product Stock Status is present and correct
(the Product Detail page should be opened on Storefront prior this check)</description>
</annotations>
<arguments>
<argument name="productStockStatus" type="string"/>
</arguments>

<see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="{{productStockStatus}}" stepKey="seeProductStockStatus"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatCatalogTest">
<annotations>
<stories value="Update Simple Product"/>
<title value="Update Simple Product with Regular Price (In Stock) Enabled Flat"/>
<description value="Test log in to Update Simple Product and Update Simple Product with Regular Price (In Stock) Enabled Flat"/>
<testCaseId value="MC-10818"/>
<severity value="CRITICAL"/>
<group value="catalog"/>
<group value="mtf_migrated"/>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<magentoCLI stepKey="setFlatCatalogProduct" command="config:set catalog/frontend/flat_catalog_product 1"/>
<createData entity="SimpleSubCategory" stepKey="initialCategoryEntity"/>
<createData entity="defaultSimpleProduct" stepKey="initialSimpleProduct">
<requiredEntity createDataKey="initialCategoryEntity"/>
</createData>
<createData entity="SimpleSubCategory" stepKey="categoryEntity"/>
</before>
<after>
<deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/>
<deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/>
<actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct">
<argument name="sku" value="{{simpleProductEnabledFlat.sku}}"/>
</actionGroup>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
<magentoCLI stepKey="unsetFlatCatalogProduct" command="config:set catalog/frontend/flat_catalog_product 0"/>
</after>

<actionGroup ref="AdminClearFiltersActionGroup" stepKey="openProductCatalogPage"/>
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openProductPage">
<argument name="product" value="$$initialSimpleProduct$$"/>
</actionGroup>

<actionGroup ref="AdminClickOnAdvancedInventoryLinkActionGroup" stepKey="clickAdvancedInventoryLink"/>
<actionGroup ref="AdminSetManageStockConfigActionGroup" stepKey="setManageStockConfig">
<argument name="value" value="No"/>
</actionGroup>
<actionGroup ref="AdminSubmitAdvancedInventoryFormActionGroup" stepKey="clickDoneButtonOnAdvancedInventorySection"/>

<actionGroup ref="AdminAssignTwoCategoriesToProductActionGroup" stepKey="assignCategories">
<argument name="categoryName" value="$$initialCategoryEntity.name$$"/>
<argument name="categoryTwoName" value="$$categoryEntity.name$$"/>
</actionGroup>

<actionGroup ref="AdminFillMainProductFormActionGroup" stepKey="fillSimpleProductInfo">
<argument name="product" value="simpleProductEnabledFlat"/>
</actionGroup>

<actionGroup ref="AdminProductFormSaveButtonClickActionGroup" stepKey="clickSaveButton"/>

<see selector="{{AdminProductFormSection.successMessage}}" userInput="You saved the product." stepKey="seeSimpleProductSavedSuccessMessage"/>

<actionGroup ref="AdminClearFiltersActionGroup" stepKey="openProductCatalogPage1"/>
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openProductPage1">
<argument name="product" value="simpleProductEnabledFlat"/>
</actionGroup>

<actionGroup ref="AdminClickOnAdvancedInventoryLinkActionGroup" stepKey="clickTheAdvancedInventoryLink1"/>
<actionGroup ref="AssertAdminManageStockOnEditPageActionGroup" stepKey="assertManageStock1">
<argument name="manageStock" value="No"/>
</actionGroup>
<actionGroup ref="AdminSubmitAdvancedInventoryFormActionGroup" stepKey="clickDoneButtonOnAdvancedInventorySection1"/>

<actionGroup ref="AssertAdminProductIsAssignedToCategoryActionGroup" stepKey="checkifProductIsAssignedToInitialCategory">
<argument name="categoryName" value="$$initialCategoryEntity.name$$"/>
</actionGroup>

<actionGroup ref="AssertAdminProductIsAssignedToCategoryActionGroup" stepKey="checkifProductIsAssignedToCategoryTwo">
<argument name="categoryName" value="$$categoryEntity.name$$"/>
</actionGroup>

<actionGroup ref="AssertAdminProductInfoOnEditPageActionGroup" stepKey="assertProductInfo">
<argument name="product" value="simpleProductEnabledFlat"/>
</actionGroup>

<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="openCategoryPage">
<argument name="category" value="$categoryEntity$"/>
</actionGroup>

<actionGroup ref="AssertStorefrontProductIsPresentOnCategoryPageActionGroup" stepKey="seeSimpleProductNameOnCategoryPage">
<argument name="productName" value="{{simpleProductEnabledFlat.name}}"/>
</actionGroup>

<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToProductPage">
<argument name="productUrlKey" value="{{simpleProductEnabledFlat.urlKey}}"/>
</actionGroup>

<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeSimpleProductNameOnStoreFrontPage">
<argument name="productName" value="{{simpleProductEnabledFlat.name}}"/>
</actionGroup>
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeSimpleProductPriceOnStoreFrontPage">
<argument name="productPrice" value="{{simpleProductEnabledFlat.price}}"/>
</actionGroup>
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeSimpleProductSKUOnStoreFrontPage">
<argument name="productSku" value="{{simpleProductEnabledFlat.sku}}"/>
</actionGroup>
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="seeSimpleProductStockStatusOnStoreFrontPage">
<argument name="productStockStatus" value="{{simpleProductEnabledFlat.storefrontStatus}}"/>
</actionGroup>

<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToHomepage"/>
<actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchForSku">
<argument name="phrase" value="{{simpleProductEnabledFlat.sku}}"/>
</actionGroup>
<actionGroup ref="StorefrontOpenProductFromQuickSearchActionGroup" stepKey="openAndCheckProduct">
<argument name="productName" value="{{simpleProductEnabledFlat.name}}"/>
<argument name="productUrlKey" value="{{simpleProductEnabledFlat.urlKey}}"/>
</actionGroup>

</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest">
<test name="AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest" deprecated="Use AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatCatalogTest instead">
<annotations>
<stories value="Update Simple Product"/>
<title value="Update Simple Product with Regular Price (In Stock) Enabled Flat"/>
<title value="DEPRECACTED. Update Simple Product with Regular Price (In Stock) Enabled Flat"/>
<description value="Test log in to Update Simple Product and Update Simple Product with Regular Price (In Stock) Enabled Flat"/>
<testCaseId value="MC-10818"/>
<severity value="CRITICAL"/>
<group value="catalog"/>
<group value="mtf_migrated"/>
<skip>
<issueId value="DEPRECATED">Use AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatCatalogTest instead</issueId>
</skip>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
Expand Down

0 comments on commit ed5d72a

Please sign in to comment.