Skip to content

Commit 11e102d

Browse files
committed
MC-11296: Move Product between Categories (Cron is ON, Update by Schedule Mode)
1 parent fa3bee1 commit 11e102d

File tree

2 files changed

+43
-45
lines changed

2 files changed

+43
-45
lines changed

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<element name="productTaxClassDisabled" type="select" selector="select[name='product[tax_class_id]'][disabled=true]"/>
3333
<element name="productTaxClassUseDefault" type="checkbox" selector="input[name='use_default[tax_class_id]']"/>
3434
<element name="advancedPricingLink" type="button" selector="button[data-index='advanced_pricing_button']" timeout="30"/>
35-
<element name="currentCategory" type="text" selector=".admin__action-multiselect-crumb span[data-bind='text: label']"/>
35+
<element name="currentCategory" type="text" selector=".admin__action-multiselect-crumb > span"/>
3636
<element name="categoriesDropdown" type="multiselect" selector="div[data-index='category_ids']"/>
3737
<element name="unselectCategories" type="button" selector="//span[@class='admin__action-multiselect-crumb']/span[contains(.,'{{category}}')]/../button[@data-action='remove-selected-item']" parameterized="true" timeout="30"/>
3838
<element name="productQuantity" type="input" selector=".admin__field[data-index=qty] input"/>

app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717
<testCaseId value="MC-11296"/>
1818
<group value="catalog"/>
1919
</annotations>
20+
2021
<before>
2122
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
23+
<createData entity="defaultSimpleProduct" stepKey="simpleProduct"/>
24+
<createData entity="_defaultCategory" stepKey="createAnchoredCategory1"/>
25+
<createData entity="_defaultCategory" stepKey="createSecondCategory"/>
2226

2327
<!-- Switch "Category Product" and "Product Category" indexers to "Update by Schedule" mode -->
2428
<amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="onIndexManagement"/>
@@ -30,47 +34,8 @@
3034
<actionGroup ref="AdminSwitchIndexerToActionModeActionGroup" stepKey="switchProductCategory">
3135
<argument name="indexerValue" value="catalog_product_category"/>
3236
</actionGroup>
33-
34-
<!-- Create the anchored category <Cat1_anchored> -->
35-
<createData entity="_defaultCategory" stepKey="createAnchoredCategory1"/>
36-
<actionGroup ref="AdminAnchorCategoryActionGroup" stepKey="anchorCategory">
37-
<argument name="categoryName" value="$$createAnchoredCategory1.name$$"/>
38-
</actionGroup>
39-
40-
<!-- Create subcategory <Sub1> of the anchored category -->
41-
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/>
42-
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SimpleSubCategory.name}}" stepKey="addSubCategoryName"/>
43-
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSubCategory1"/>
44-
<waitForPageLoad stepKey="waitForSecondCategoryToSave"/>
45-
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/>
46-
47-
<!-- Assign <product1> to the <Sub1> -->
48-
<createData entity="defaultSimpleProduct" stepKey="simpleProduct"/>
49-
50-
<amOnPage url="{{AdminProductEditPage.url($$simpleProduct.id$$)}}" stepKey="goToProduct"/>
51-
<waitForPageLoad stepKey="waitForProductPage"/>
52-
<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="activateDropDown"/>
53-
<fillField userInput="{{SimpleSubCategory.name}}" selector="{{AdminProductFormSection.searchCategory}}" stepKey="fillSearchField"/>
54-
<waitForPageLoad stepKey="waitForSearchSubCategory"/>
55-
<click selector="{{AdminProductFormSection.selectCategory(SimpleSubCategory.name)}}" stepKey="selectSubCategory"/>
56-
<click selector="{{AdminProductFormSection.done}}" stepKey="clickButtonDone"/>
57-
<waitForPageLoad stepKey="waitForCategoryApply"/>
58-
<click selector="{{AdminProductFormSection.save}}" stepKey="clickButtonSave"/>
59-
<waitForPageLoad stepKey="waitForSave"/>
60-
61-
<!-- Create another non-anchored category <Cat2> -->
62-
<createData entity="_defaultCategory" stepKey="createSecondCategory"/>
63-
64-
<!-- Enable `Use Categories Path for Product URLs` on Stores -> Configuration -> Catalog -> Catalog -> Search Engine Optimization -->
65-
<amOnPage url="{{AdminCatalogSearchConfigurationPage.url}}" stepKey="onConfigPage"/>
66-
<waitForPageLoad stepKey="waitForLoading"/>
67-
<conditionalClick selector="{{AdminCatalogSearchEngineConfigurationSection.searchEngineOptimization}}" dependentSelector="{{AdminCatalogSearchEngineConfigurationSection.openedEngineOptimization}}" visible="false" stepKey="clickEngineOptimization"/>
68-
<uncheckOption selector="{{AdminCatalogSearchEngineConfigurationSection.systemValueUseCategoriesPath}}" stepKey="uncheckDefault"/>
69-
<selectOption userInput="Yes" selector="{{AdminCatalogSearchEngineConfigurationSection.selectUseCategoriesPatForProductUrls}}" stepKey="selectYes"/>
70-
<click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/>
71-
<waitForPageLoad stepKey="waitForSaving"/>
72-
<see selector="{{AdminIndexManagementSection.successMessage}}" userInput="You saved the configuration." stepKey="seeMessage"/>
7337
</before>
38+
7439
<after>
7540
<!-- Switch "Category Product" and "Product Category" indexers to "Update by Save" mode -->
7641
<amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="onIndexManagement"/>
@@ -90,6 +55,39 @@
9055
<deleteData createDataKey="createAnchoredCategory1" stepKey="deleteAnchoredCategory1"/>
9156
<actionGroup ref="logout" stepKey="logout"/>
9257
</after>
58+
<!-- Create the anchored category <Cat1_anchored> -->
59+
<actionGroup ref="AdminAnchorCategoryActionGroup" stepKey="anchorCategory">
60+
<argument name="categoryName" value="$$createAnchoredCategory1.name$$"/>
61+
</actionGroup>
62+
63+
<!-- Create subcategory <Sub1> of the anchored category -->
64+
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/>
65+
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SimpleSubCategory.name}}" stepKey="addSubCategoryName"/>
66+
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSubCategory1"/>
67+
<waitForPageLoad stepKey="waitForSecondCategoryToSave"/>
68+
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSaveSuccessMessage"/>
69+
70+
<!-- Assign <product1> to the <Sub1> -->
71+
<amOnPage url="{{AdminProductEditPage.url($$simpleProduct.id$$)}}" stepKey="goToProduct"/>
72+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
73+
<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="activateDropDownCategory"/>
74+
<fillField userInput="{{SimpleSubCategory.name}}" selector="{{AdminProductFormSection.searchCategory}}" stepKey="fillSearch"/>
75+
<waitForPageLoad stepKey="waitForSubCategory"/>
76+
<click selector="{{AdminProductFormSection.selectCategory(SimpleSubCategory.name)}}" stepKey="selectSub1Category"/>
77+
<click selector="{{AdminProductFormSection.done}}" stepKey="clickDone"/>
78+
<waitForPageLoad stepKey="waitForApplyCategory"/>
79+
<click selector="{{AdminProductFormSection.save}}" stepKey="clickSave"/>
80+
<waitForPageLoad stepKey="waitForSavingChanges"/>
81+
82+
<!-- Enable `Use Categories Path for Product URLs` on Stores -> Configuration -> Catalog -> Catalog -> Search Engine Optimization -->
83+
<amOnPage url="{{AdminCatalogSearchConfigurationPage.url}}" stepKey="onConfigPage"/>
84+
<waitForPageLoad stepKey="waitForLoading"/>
85+
<conditionalClick selector="{{AdminCatalogSearchEngineConfigurationSection.searchEngineOptimization}}" dependentSelector="{{AdminCatalogSearchEngineConfigurationSection.openedEngineOptimization}}" visible="false" stepKey="clickEngineOptimization"/>
86+
<uncheckOption selector="{{AdminCatalogSearchEngineConfigurationSection.systemValueUseCategoriesPath}}" stepKey="uncheckDefault"/>
87+
<selectOption userInput="Yes" selector="{{AdminCatalogSearchEngineConfigurationSection.selectUseCategoriesPatForProductUrls}}" stepKey="selectYes"/>
88+
<click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/>
89+
<waitForPageLoad stepKey="waitForSaving"/>
90+
<see selector="{{AdminIndexManagementSection.successMessage}}" userInput="You saved the configuration." stepKey="seeMessage"/>
9391

9492
<!-- Navigate to the Catalog > Products -->
9593
<amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="onCatalogProductPage"/>
@@ -107,9 +105,9 @@
107105
<click selector="{{AdminProductFormSection.unselectCategories(SimpleSubCategory.name)}}" stepKey="removeCategory"/>
108106
<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="openDropDown"/>
109107
<checkOption selector="{{AdminProductFormSection.selectCategory($$createSecondCategory.name$$)}}" stepKey="selectCategory"/>
110-
<click selector="{{AdminProductFormSection.done}}" stepKey="clickDone"/>
111-
<waitForPageLoad stepKey="waitForApplyCategory"/>
112-
<click selector="{{AdminProductFormSection.save}}" stepKey="clickSave"/>
108+
<click selector="{{AdminProductFormSection.done}}" stepKey="pressButtonDone"/>
109+
<waitForPageLoad stepKey="waitForApplyCategory2"/>
110+
<click selector="{{AdminProductFormSection.save}}" stepKey="pushButtonSave"/>
113111
<waitForPageLoad stepKey="waitForSavingProduct"/>
114112

115113
<!--Product is saved -->
@@ -183,7 +181,7 @@
183181
<click selector="{{AdminProductFormSection.done}}" stepKey="clickButtonDone"/>
184182
<waitForPageLoad stepKey="waitForCategoryApply"/>
185183
<click selector="{{AdminProductFormSection.save}}" stepKey="clickButtonSave"/>
186-
<waitForPageLoad stepKey="waitForSaving"/>
184+
<waitForPageLoad stepKey="waitForSaveChanges"/>
187185

188186
<!-- Product is saved successfully -->
189187
<see userInput="You saved the product." selector="{{CatalogProductsSection.messageSuccessSavedProduct}}" stepKey="seeSaveMessage"/>

0 commit comments

Comments
 (0)