Skip to content

Commit

Permalink
Merge pull request #3885 from magento-pangolin/mtf-eol-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
okolesnyk authored Mar 19, 2019
2 parents a55c94f + 5aef2fb commit 2e863d6
Show file tree
Hide file tree
Showing 86 changed files with 2,351 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<click selector="{{AdminGridActionSection.submitButton}}" stepKey="clickSubmit"/>
<waitForPageLoad stepKey="waitForConfirmWindowToAppear"/>
<see selector="{{AdminConfirmationModalSection.message}}" userInput="Are you sure you want to delete the selected backup(s)?" stepKey="seeConfirmationModal"/>
<waitForPageLoad stepKey="waitForSubmitAction"/>
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="clickOkConfirmDelete"/>
<dontSee selector="{{AdminGridTableSection.backupNameColumn}}" userInput="{{backup.name}}" stepKey="dontSeeBackupInGrid"/>
</actionGroup>

</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,18 @@
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton"/>
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the product." stepKey="seeSaveProductMessage"/>
</actionGroup>
<actionGroup name="FillCategoryNameAndUrlKeyAndSave">
<arguments>
<argument name="categoryName" type="string"/>
<argument name="categoryUrlKey" type="string"/>
</arguments>
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{categoryName}}" stepKey="enterCategoryName"/>
<scrollTo selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="scrollToSearchEngineOptimization"/>
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSEO"/>
<waitForPageLoad stepKey="waitForPageToLoad"/>
<fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{categoryUrlKey}}" stepKey="enterURLKey"/>
<scrollToTopOfPage stepKey="scrollToTheTopOfPage"/>
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
<waitForPageLoad stepKey="waitForPageToLoad1"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeNewProductTitle"/>
</actionGroup>

<!--Fill main fields in create product form-->
<!-- Fill main fields in create product form using a product entity -->
<actionGroup name="fillMainProductForm">
<arguments>
<argument name="product" defaultValue="_defaultProduct"/>
Expand All @@ -34,6 +34,25 @@
<fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{product.weight}}" stepKey="fillProductWeight"/>
</actionGroup>

<!-- Fill main fields in create product form using strings for flexibility -->
<actionGroup name="FillMainProductFormByString">
<arguments>
<argument name="productName" type="string"/>
<argument name="productSku" type="string"/>
<argument name="productPrice" type="string"/>
<argument name="productQuantity" type="string"/>
<argument name="productStatus" type="string"/>
<argument name="productWeight" type="string"/>
</arguments>
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{productName}}" stepKey="fillProductName"/>
<fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{productSku}}" stepKey="fillProductSku"/>
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{productPrice}}" stepKey="fillProductPrice"/>
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{productQuantity}}" stepKey="fillProductQty"/>
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{productStatus}}" stepKey="selectStockStatus"/>
<selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="This item has weight" stepKey="selectWeight"/>
<fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{productWeight}}" stepKey="fillProductWeight"/>
</actionGroup>

<!--Fill main fields in create product form with no weight, useful for virtual and downloadable products -->
<actionGroup name="fillMainProductFormNoWeight">
<arguments>
Expand Down Expand Up @@ -77,6 +96,11 @@
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product." stepKey="seeSaveConfirmation"/>
</actionGroup>

<!-- Save product but do not expect a success message -->
<actionGroup name="SaveProductFormNoSuccessCheck" extends="saveProductForm">
<remove keyForRemoval="seeSaveConfirmation"/>
</actionGroup>

<!--Upload image for product-->
<actionGroup name="addProductImage">
<arguments>
Expand Down Expand Up @@ -389,6 +413,22 @@
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
<fillField userInput="{{product.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/>
</actionGroup>

<actionGroup name="SetProductUrlKeyByString">
<arguments>
<argument name="urlKey" type="string"/>
</arguments>
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
<fillField userInput="{{urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/>
</actionGroup>

<actionGroup name="SetCategoryByName">
<arguments>
<argument name="categoryName" type="string"/>
</arguments>
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{categoryName}}]" stepKey="searchAndSelectCategory"/>
</actionGroup>

<actionGroup name="expandAdminProductSection">
<arguments>
<argument name="sectionSelector" defaultValue="{{AdminProductContentSection.sectionHeader}}" type="string"/>
Expand Down
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="AssertProductInfoOnEditPageActionGroup" extends="OpenEditProductOnBackendActionGroup">
<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"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?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="AssertProductOnAdminGridActionGroup" extends="viewProductInAdminGrid">
<arguments>
<argument name="product" defaultValue="_defaultProduct"/>
</arguments>
<remove keyForRemoval="clickClearFiltersAfter"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@
<data key="store_id">0</data>
<var key="sku" entityType="product2" entityKey="sku" />
</entity>
<entity name="specialProductPrice2" type="catalogSpecialPrice">
<data key="price">55.55</data>
<data key="store_id">0</data>
<var key="sku" entityType="product" entityKey="sku" />
</entity>
</entities>
58 changes: 58 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,48 @@
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
</entity>
<entity name="SimpleProductAfterImport1" type="product">
<data key="sku">SimpleProductForTest1</data>
<data key="type_id">simple</data>
<data key="attribute_set_id">4</data>
<data key="name">SimpleProductAfterImport1</data>
<data key="price">250.00</data>
<data key="visibility">4</data>
<data key="status">1</data>
<data key="quantity">100</data>
<data key="urlKey">simple-product-for-test-1</data>
<data key="weight">1</data>
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
</entity>
<entity name="SimpleProductAfterImport2" type="product">
<data key="sku">SimpleProductForTest2</data>
<data key="type_id">simple</data>
<data key="attribute_set_id">4</data>
<data key="name">SimpleProductAfterImport2</data>
<data key="price">300.00</data>
<data key="visibility">4</data>
<data key="status">1</data>
<data key="quantity">100</data>
<data key="urlKey">simple-product-for-test-2</data>
<data key="weight">1</data>
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
</entity>
<entity name="SimpleProductAfterImport3" type="product">
<data key="sku">SimpleProductForTest3</data>
<data key="type_id">simple</data>
<data key="attribute_set_id">4</data>
<data key="name">SimpleProductAfterImport3</data>
<data key="price">350.00</data>
<data key="visibility">4</data>
<data key="status">1</data>
<data key="quantity">100</data>
<data key="urlKey">simple-product-for-test-3</data>
<data key="weight">1</data>
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
</entity>
<entity name="SimpleProduct2" type="product">
<data key="sku" unique="suffix">SimpleProduct</data>
<data key="type_id">simple</data>
Expand Down Expand Up @@ -906,4 +948,20 @@
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
</entity>
<entity name="simpleProductWithoutCategory" type="product">
<data key="sku" unique="suffix">sku_simple_product_</data>
<data key="type_id">simple</data>
<data key="attribute_set_id">4</data>
<data key="visibility">4</data>
<data key="name" unique="suffix">SimpleProduct</data>
<data key="price">560</data>
<data key="urlKey" unique="suffix">simple-product-</data>
<data key="status">1</data>
<data key="quantity">25</data>
<data key="weight">1</data>
<data key="product_has_weight">1</data>
<data key="is_in_stock">1</data>
<data key="tax_class_id">2</data>
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminCategoryMessagesSection">
<element name="SuccessMessage" type="text" selector=".message-success"/>
<element name="errorMessage" type="text" selector="//div[@class='message message-error error']"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<element name="addValue" type="button" selector="//button[contains(@data-action,'add_new_row')]" timeout="30"/>
<element name="defaultStoreView" type="input" selector="//input[contains(@name,'option[value][option_{{row}}][1]')]" parameterized="true"/>
<element name="adminOption" type="input" selector="//input[contains(@name,'option[value][option_{{row}}][0]')]" parameterized="true"/>
<element name="defaultRadioButton" type="radio" selector="//tr[{{row}}]//input[contains(@name,'default[]')]/..//label" parameterized="true"/>
<element name="defaultRadioButton" type="radio" selector="//tr[{{row}}]//input[contains(@name,'default[]')]" parameterized="true"/>
<element name="isRequired" type="checkbox" selector="//input[contains(@name,'is_required')]/..//label"/>
<element name="advancedAttributeProperties" type="text" selector="//div[contains(@data-index,'advanced_fieldset')]"/>
<element name="attributeCode" type="input" selector="//*[@class='admin__fieldset-wrapper-content admin__collapsible-content _show']//input[@name='attribute_code']"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<section name="StorefrontMessagesSection">
<element name="success" type="text" selector="div.message-success.success.message"/>
<element name="error" type="text" selector="div.message-error.error.message"/>
<element name="noticeMessage" type="text" selector="div.message-notice"/>
<element name="noticeMessage" type="text" selector="div.message.notice div"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?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="AdminCreateDuplicateCategoryTest">
<annotations>
<stories value="Create category"/>
<title value="Create Duplicate Category With Already Existed UrlKey"/>
<description value="Login as admin and create duplicate category"/>
<testCaseId value="MC-14702"/>
<severity value="CRITICAL"/>
<group value="mtf_migrated"/>
</annotations>

<before>
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/>
<createData entity="SimpleSubCategory" stepKey="category"/>
</before>
<after>
<deleteData createDataKey="category" stepKey="deleteCategory"/>
<actionGroup ref="logout" stepKey="logout"/>
</after>

<!-- Open Category Page and select Add category -->
<actionGroup ref="goToCreateCategoryPage" stepKey="goToCategoryPage"/>

<!-- Fill the Category form with same name and urlKey as initially created category(SimpleSubCategory) -->
<actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillCategoryForm">
<argument name="categoryName" value="$$category.name$$"/>
<argument name="categoryUrlKey" value="$$category.custom_attributes[url_key]$$"/>
</actionGroup>

<!-- Assert error message -->
<see selector="{{AdminCategoryMessagesSection.errorMessage}}" userInput="The value specified in the URL Key field would generate a URL that already exists." stepKey="seeErrorMessage"/>
</test>
</tests>
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?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="AdminCreateDuplicateProductTest">
<annotations>
<stories value="Create Product"/>
<title value="Create Duplicate Product With Existed Subcategory Name And UrlKey"/>
<description value="Login as admin and create duplicate Product"/>
<testCaseId value="MC-14714"/>
<severity value="CRITICAL"/>
<group value="mtf_migrated"/>
</annotations>

<before>
<createData entity="SubCategory" stepKey="category"/>
<createData entity="Two_nested_categories" stepKey="subCategory">
<requiredEntity createDataKey="category"/>
</createData>
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
</before>

<after>
<deleteData createDataKey="subCategory" stepKey="deleteSubCategory"/>
<deleteData createDataKey="category" stepKey="deleteCategory"/>
<actionGroup ref="logout" stepKey="logout"/>
</after>

<!-- Go to new simple product page -->
<actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="goToCreateProductPage"/>

<!-- Fill the main fields in the form -->
<actionGroup ref="FillMainProductFormByString" stepKey="fillMainProductForm">
<argument name="productName" value="$$subCategory.name$$"/>
<argument name="productSku" value="{{defaultSimpleProduct.sku}}"/>
<argument name="productPrice" value="{{defaultSimpleProduct.price}}"/>
<argument name="productQuantity" value="{{defaultSimpleProduct.quantity}}"/>
<argument name="productStatus" value="{{defaultSimpleProduct.status}}"/>
<argument name="productWeight" value="{{defaultSimpleProduct.weight}}"/>
</actionGroup>

<!-- Select the category that we created in the before block -->
<actionGroup ref="SetCategoryByName" stepKey="setCategory">
<argument name="categoryName" value="$$category.name$$"/>
</actionGroup>

<!-- Set the url key to match the subcategory created in the before block -->
<actionGroup ref="SetProductUrlKeyByString" stepKey="fillUrlKey">
<argument name="urlKey" value="$$subCategory.custom_attributes[url_key]$$"/>
</actionGroup>

<!-- Save the product and expect to see an error message -->
<actionGroup ref="SaveProductFormNoSuccessCheck" stepKey="tryToSaveProduct"/>
<see selector="{{AdminProductFormSection.successMessage}}" userInput="The value specified in the URL Key field would generate a URL that already exists." stepKey="seeErrorMessage"/>
</test>
</tests>
Loading

0 comments on commit 2e863d6

Please sign in to comment.