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 AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest #31221

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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="AdminAssertManageStockOnEditPageActionGroup">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, make sure you are following the guidelines for naming. See 11.3.5.1 item of https://devdocs.magento.com/guides/v2.4/coding-standards/technical-guidelines.html#113-functional-testing

<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="AdminAssertProductInfoOnEditPageActionGroup">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, correct the naming by using the "Assert" prefix before specifying the area. Thank you

<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,22 @@
<?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="AdminAssertProductIsAssignedToCategoryActionGroup">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, correct the naming by using the "Assert" prefix before specifying the area. Thank you

<annotations>
<description>Checks if product is assigned to category (the Product Edit page should be opened in Admin prior this check).</description>
</annotations>
<arguments>
<argument name="categoryName" type="string"/>
</arguments>

<seeElement selector="{{AdminProductFormSection.categories(categoryName)}}" stepKey="seeCategoryName"/>

</actionGroup>
</actionGroups>
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,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="StorefrontAssertProductStockStatusOnProductPageActionGroup">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, correct the naming by using the "Assert" prefix before specifying the area. Thank you

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rogyar I have fixed naming for all Action Groups. Can you please take a look one more time? Thanks.

<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
Expand Up @@ -77,5 +77,6 @@
<element name="newAddedAttribute" type="text" selector="//fieldset[@class='admin__fieldset']//div[contains(@data-index,'{{attributeCode}}')]" parameterized="true"/>
<element name="newCategoryButton" type="button" selector="button[data-index='create_category_button']" timeout="30"/>
<element name="footerBlock" type="block" selector="//footer"/>
<element name="categories" type="text" selector="//*[@class='admin__action-multiselect-crumb']/span[contains(text(), '{{categoryName}}')]" parameterized="true"/>
</section>
</sections>
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="AdminAssertManageStockOnEditPageActionGroup" stepKey="assertManageStock1">
<argument name="manageStock" value="No"/>
</actionGroup>
<actionGroup ref="AdminSubmitAdvancedInventoryFormActionGroup" stepKey="clickDoneButtonOnAdvancedInventorySection1"/>

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

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

<actionGroup ref="AdminAssertProductInfoOnEditPageActionGroup" 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="StorefrontAssertProductStockStatusOnProductPageActionGroup" 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