Skip to content

Commit

Permalink
Merge pull request #2299 from magento-plankton/MAGETWO-89382
Browse files Browse the repository at this point in the history
[plankton] MAGETWO-89382: Automate MAGETWO-46344 MFTF
  • Loading branch information
Alexander Akimov authored Mar 29, 2018
2 parents d2a037f + 803dbe4 commit 63e5713
Show file tree
Hide file tree
Showing 12 changed files with 231 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
<actionGroup name="MoveCategoryActionGroup">
<arguments>
<argument name="childCategory"/>
<argument name="parentCategory"/>
</arguments>
<click stepKey="expandAllCategoriesTree" selector="{{AdminCategorySidebarTreeSection.expandAll}}"/>
<waitForAjaxLoad stepKey="waitForCategoriesExpand"/>
<dragAndDrop selector1="{{AdminCategorySidebarTreeSection.categoryInTree('childCategory')}}" selector2="{{AdminCategorySidebarTreeSection.categoryInTree('parentCategory')}}" stepKey="moveCategory"/>
<waitForElementVisible selector="{{AdminCategoryModalSection.message}}" stepKey="waitForWarningMessageVisible"/>
<see selector="{{AdminCategoryModalSection.message}}" userInput="This operation can take a long time" stepKey="seeWarningMessage"/>
<click selector="{{AdminCategoryModalSection.ok}}" stepKey="clickOkButtonOnWarningPopup"/>
<waitForPageLoad stepKey="waitForCategoryPageReload"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<actionGroup name="StorefrontCheckCategoryActionGroup">
<arguments>
<argument name="category"/>
<argument name="productCount"/>
<argument name="productCount" type="string"/>
</arguments>
<seeInCurrentUrl url="/{{category.custom_attributes[url_key]}}.html" stepKey="checkUrl"/>
<seeInTitle userInput="{{category.name}}" stepKey="assertCategoryNameInTitle"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,17 @@
<data key="is_active">true</data>
<data key="include_in_menu">true</data>
</entity>
<entity name="NewRootCategory" type="category">
<data key="name" unique="suffix">NewRootCategory</data>
<data key="name_lwr" unique="suffix">newrootcategory</data>
<data key="is_active">true</data>
<data key="include_in_menu">true</data>
<data key="parent_id">1</data>
</entity>
<entity name="SubCategoryWithParent" type="category">
<data key="name" unique="suffix">subCategory</data>
<data key="name_lwr" unique="suffix">subCategory</data>
<data key="is_active">true</data>
<var key="parent_id" entityType="category" entityKey="id" />
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,19 @@
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
</entity>
<entity name="productWithDescription" type="product">
<data key="sku" unique="suffix">testProductWithDescriptionSku</data>
<data key="type_id">simple</data>
<data key="attribute_set_id">4</data>
<data key="visibility">4</data>
<data key="name" unique="suffix">testProductWithDescriptionName</data>
<data key="price">123.00</data>
<data key="urlKey" unique="suffix">testproductwithdescriptionurlkey</data>
<data key="status">1</data>
<data key="quantity">100</data>
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
<requiredEntity type="custom_attribute_array">ApiProductDescription</requiredEntity>
<requiredEntity type="custom_attribute_array">ApiProductShortDescription</requiredEntity>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
<element name="message" type="text" selector="aside.confirm div.modal-content"/>
<element name="title" type="text" selector="aside.confirm .modal-header .modal-title"/>
<element name="ok" type="button" selector="aside.confirm .modal-footer .action-primary"/>
<element name="cancel" type="button" selector="aside.confirm .modal-footer .action-dismiss"/>
<element name="cancel" type="button" selector="aside.confirm .modal-footer .action-secondary"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
<test name="DeleteCategoriesTest">
<annotations>
<features value="Delete categories"/>
<title value="Delete categories."/>
<description value="Delete Default Root Category and subcategories and vefify after products on storefront."/>
<severity value="CRITICAL"/>
<testCaseId value="MAGETWO-46344"/>
<group value="testNotIsolated"/>
</annotations>
<before>
<createData entity="_defaultCategory" stepKey="createCategoryC"/>
<createData entity="productWithDescription" stepKey="createProduct1">
<requiredEntity createDataKey="createCategoryC"/>
</createData>
<createData entity="SubCategoryWithParent" stepKey="createSubCategory">
<requiredEntity createDataKey="createCategoryC"/>
</createData>
<createData entity="productWithDescription" stepKey="createProduct2">
<requiredEntity createDataKey="createSubCategory"/>
</createData>
<createData entity="_defaultCategory" stepKey="createCategoryB"/>
<createData entity="productWithDescription" stepKey="createProduct3">
<requiredEntity createDataKey="createCategoryB"/>
</createData>
<createData entity="NewRootCategory" stepKey="createNewRootCategoryA"/>
</before>
<after>
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
<deleteData createDataKey="createProduct1" stepKey="deleteProduct1"/>
<deleteData createDataKey="createProduct2" stepKey="deleteProduct2"/>
<deleteData createDataKey="createProduct3" stepKey="deleteProduct3"/>
</after>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/>
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToCategoryPage1"/>
<waitForPageLoad time="30" stepKey="waitForPageCategoryLoadAfterNavigate"/>
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree($$createNewRootCategoryA.name$$)}}" stepKey="openNewRootCategory"/>
<waitForPageLoad stepKey="waitForPageCategoryLoadAfterClickOnNewRootCategory"/>
<seeElement selector="{{AdminCategoryMainActionsSection.DeleteButton}}" stepKey="assertDeleteButtonIsPresent"/>
<!--Move categories from Default Category to NewRootCategory. -->
<actionGroup ref="MoveCategoryActionGroup" stepKey="MoveCategoryBToNewRootCategory">
<argument name="childCategory" value="$$createCategoryC.name$$"/>
<argument name="parentCategory" value="$$createNewRootCategoryA.name$$"/>
</actionGroup>
<actionGroup ref="MoveCategoryActionGroup" stepKey="MoveCategoryCToNewRootCategory">
<argument name="childCategory" value="$$createCategoryB.name$$"/>
<argument name="parentCategory" value="$$createNewRootCategoryA.name$$"/>
</actionGroup>
<!-- Change root category for Main Website Store. -->
<amOnPage stepKey="s1" url="{{AdminSystemStorePage.url}}"/>
<waitForPageLoad stepKey="waitForPageAdminSystemStoreLoad" />
<click stepKey="s2" selector="{{AdminStoresGridSection.resetButton}}"/>
<waitForPageLoad stepKey="waitForPageAdminStoresGridLoadAfterResetButton" time="10"/>
<fillField stepKey="s4" selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" userInput="Main Website Store"/>
<click stepKey="s5" selector="{{AdminStoresGridSection.searchButton}}"/>
<waitForPageLoad stepKey="waitForPageAdminStoresGridLoadAfterSearchButton"/>
<click stepKey="s7" selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" />
<waitForPageLoad stepKey="waitForPageAdminStoresGroupEditLoad" />
<selectOption selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" userInput="{{NewRootCategory.name}}" stepKey="setNewCategoryForStoreGroup"/>
<click selector="{{AdminNewStoreViewActionsSection.saveButton}}" stepKey="clickSaveStoreGroup"/>
<waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForModalSaveStoreGroup"/>
<see selector="{{AdminConfirmationModalSection.title}}" userInput="Warning message" stepKey="seeWarning"/>
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="acceptModal" />
<waitForElementVisible selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="waitForPageAdminStoresGridReload"/>
<see userInput="You saved the store." stepKey="seeSavedMessage"/>

<!-- @TODO: Uncomment commented below code after MQE-903 is fixed -->
<!-- Perform cli reindex. -->
<!--<magentoCLI command="indexer:reindex" stepKey="magentoCli"/>-->

<!-- Delete Default Root Category. -->
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToCategoryPageAfterCLIReindexCommand"/>
<waitForPageLoad time="30" stepKey="waitForPageCategoryLoadAfterCLIReindexCommand"/>
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree('Default Category')}}" stepKey="clickOnDefaultRootCategory"/>
<waitForPageLoad stepKey="waitForPageDefaultCategoryEditLoad" />
<seeElement selector="{{AdminCategoryMainActionsSection.DeleteButton}}" stepKey="assertDeleteButtonIsPresent1"/>
<click selector="{{AdminCategoryMainActionsSection.DeleteButton}}" stepKey="DeleteDefaultRootCategory"/>
<waitForElementVisible selector="{{AdminCategoryModalSection.ok}}" stepKey="waitForModalDeleteDefaultRootCategory" />
<click selector="{{AdminCategoryModalSection.ok}}" stepKey="acceptModal1"/>
<waitForElementVisible selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="waitForPageReloadAfterDeleteDefaultCategory"/>
<!-- Verify categories 1 and 3 their products. -->
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnHomePage"/>
<waitForPageLoad stepKey="homeWaitForPageLoad"/>

<!-- @TODO: Uncomment commented below code after MQE-903 is fixed -->
<!--<click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategoryC.name$$)}}" stepKey="browseClickCategoryC"/>-->
<!--<actionGroup ref="StorefrontCheckCategoryActionGroup" stepKey="browseAssertCategoryC">-->
<!--<argument name="category" value="$$createCategoryC$$"/>-->
<!--<argument name="productCount" value="2"/>-->
<!--</actionGroup>-->
<!--<actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct1">-->
<!--<argument name="product" value="$$createProduct1$$"/>-->
<!--</actionGroup>-->

<moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategoryC.name$$)}}" stepKey="hoverCategory"/>
<waitForElementVisible selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createSubCategory.name$$)}}" stepKey="waitForSubcategory"/>
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createSubCategory.name$$)}}" stepKey="browseClickSubCategory"/>
<actionGroup ref="StorefrontCheckCategoryActionGroup" stepKey="browseAssertSubcategory">
<argument name="category" value="$$createSubCategory$$"/>
<argument name="productCount" value="1"/>
</actionGroup>
<actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct2">
<argument name="product" value="$$createProduct2$$"/>
</actionGroup>

<!-- @TODO: Uncomment commented below code after MQE-903 is fixed -->
<!--<actionGroup ref="StorefrontCheckCategoryActionGroup" stepKey="browseAssertCategoryB">-->
<!--<argument name="category" value="$$createCategoryB$$"/>-->
<!--<argument name="productCount" value="1"/>-->
<!--</actionGroup>-->
<!--<actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="browseAssertCategoryProduct3">-->
<!--<argument name="product" value="$$createProduct3$$"/>-->
<!--</actionGroup>-->

<!-- Delete Categories 1(with subcategory) and 3. -->
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToCategoryPageAfterStoreFrontCategoryAssertions"/>
<waitForPageLoad time="30" stepKey="waitForCategoryPageLoadAfterStoreFrontCategoryAssertions"/>
<actionGroup ref="DeleteCategory" stepKey="deleteCategoryC">
<argument name="categoryEntity" value="$$createCategoryC$$"/>
</actionGroup>
<actionGroup ref="DeleteCategory" stepKey="deleteCategoryB">
<argument name="categoryEntity" value="$$createCategoryB$$"/>
</actionGroup>
<!-- Verify categories 1 and 3 are absent -->
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnHomePage1"/>
<waitForPageLoad stepKey="waitHomePageLoadAfterDeletingCategories"/>
<dontSee selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategoryB.name$$)}}" stepKey="browseClickCategoryB"/>
<dontSee selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategoryC.name$$)}}" stepKey="browseClickCategoryC"/>
<!-- Verify products 1-3 are available on storefront -->
<amOnPage url="{{StorefrontHomePage.url}}$$createProduct1.custom_attributes[url_key]$$.html" stepKey="amOnProduct1Page"/>
<waitForPageLoad stepKey="product1WaitForPageLoad"/>
<actionGroup ref="StorefrontCheckSimpleProduct" stepKey="browseAssertProduct1Page">
<argument name="product" value="$$createProduct1$$"/>
</actionGroup>
<amOnPage url="{{StorefrontHomePage.url}}$$createProduct2.custom_attributes[url_key]$$.html" stepKey="amOnProduct2Page"/>
<waitForPageLoad stepKey="product2WaitForPageLoad"/>
<actionGroup ref="StorefrontCheckSimpleProduct" stepKey="browseAssertProduct2Page">
<argument name="product" value="$$createProduct2$$"/>
</actionGroup>
<amOnPage url="{{StorefrontHomePage.url}}$$createProduct3.custom_attributes[url_key]$$.html" stepKey="amOnProduct3Page"/>
<waitForPageLoad stepKey="product3WaitForPageLoad"/>
<actionGroup ref="StorefrontCheckSimpleProduct" stepKey="browseAssertProduct3Page">
<argument name="product" value="$$createProduct3$$"/>
</actionGroup>
<!-- Rename New Root Category to Default category -->
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToCategoryPageAfterStoreFrontProductsAssertions"/>
<waitForPageLoad time="30" stepKey="waitForCategoryPageLoadAfterStoreFrontProductsAssertions"/>
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree('$$createNewRootCategoryA.name$$')}}" stepKey="clickOnNewRootCategoryA"/>
<waitForPageLoad stepKey="waitForPageNewRootCategoryALoad" />
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="Default Category" stepKey="enterCategoryNameAsDefaultCategory"/>
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategoryDefaultCategory"/>
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessageAfterSaveDefaultCategory"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="browseClickCategory"/>
<actionGroup ref="StorefrontCheckCategoryActionGroup" stepKey="browseAssertCategory">
<argument name="category" value="$$createCategory$$"/>
<!-- @TODO: Change to scalar value after MQE-498 is implemented -->
<argument name="productCount" value="CONST.three"/>
<argument name="productCount" value="3"/>
</actionGroup>
<!-- Check simple product 1 in category -->
<comment userInput="Check simple product 1 in category" stepKey="commentCheckSimpleProductInCategory" />
Expand Down Expand Up @@ -120,8 +119,7 @@
<waitForLoadingMaskToDisappear stepKey="waitForCategoryloaded" />
<actionGroup ref="StorefrontCheckCategoryActionGroup" stepKey="compareAssertCategory">
<argument name="category" value="$$createCategory$$"/>
<!-- @TODO: Change to scalar value after MQE-498 is implemented -->
<argument name="productCount" value="CONST.three"/>
<argument name="productCount" value="3"/>
</actionGroup>
<actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="compareAssertSimpleProduct1">
<argument name="product" value="$$createSimpleProduct1$$"/>
Expand All @@ -147,8 +145,7 @@
<waitForLoadingMaskToDisappear stepKey="waitForCompareCategory1loaded" />
<actionGroup ref="StorefrontCheckCategoryActionGroup" stepKey="compareAssertCategory1">
<argument name="category" value="$$createCategory$$"/>
<!-- @TODO: Change to scalar value after MQE-498 is implemented -->
<argument name="productCount" value="CONST.three"/>
<argument name="productCount" value="3"/>
</actionGroup>
<actionGroup ref="StorefrontCheckCategorySimpleProduct" stepKey="compareAssertSimpleProduct2">
<argument name="product" value="$$createSimpleProduct2$$"/>
Expand Down Expand Up @@ -196,8 +193,7 @@
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="compareClickCategoryBeforeClear" after="commentClearComparisonSidebar"/>
<actionGroup ref="StorefrontCheckCategoryActionGroup" stepKey="compareAssertCategory2">
<argument name="category" value="$$createCategory$$"/>
<!-- @TODO: Change to scalar value after MQE-498 is implemented -->
<argument name="productCount" value="CONST.three"/>
<argument name="productCount" value="3"/>
</actionGroup>
<actionGroup ref="StorefrontClearCompareActionGroup" stepKey="compareClearCompare"/>
<comment userInput="End of Comparing Products" stepKey="endOfComparingProducts" />
Expand Down
Loading

0 comments on commit 63e5713

Please sign in to comment.