Skip to content

Commit 8df804d

Browse files
ENGCOM-7606: Refactoring create product with several websites and check url rewrites test #28391
- Merge Pull Request #28391 from kate-kyzyma/magento2:Refactoring-CreateProductWithSeveralWebsitesAndCheckURLRewritesTest - Merged commits: 1. cb1557e 2. ed9a79e 3. 2ff8b5e 4. 8f5aaec
2 parents dc6d0b0 + 8f5aaec commit 8df804d

File tree

3 files changed

+69
-20
lines changed

3 files changed

+69
-20
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminSubmitCategoriesPopupActionGroup">
12+
<annotations>
13+
<description>Clicks the "Done" button on the Search Categories popup.</description>
14+
</annotations>
15+
16+
<click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneButton" />
17+
</actionGroup>
18+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertAdminStoreValueIsSetForUrlRewriteActionGroup">
12+
<annotations>
13+
<description>Verifies that the proper Store Value is used for URL Rewrite.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="storeValue" type="string"/>
17+
</arguments>
18+
19+
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Store View')}}"
20+
userInput="{{storeValue}}" stepKey="seeStoreValueForCategoryId"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,25 @@
6363
</actionGroup>
6464

6565
<!-- Create simple product with categories created in create data -->
66-
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="openProductCatalogPage"/>
67-
<waitForPageLoad stepKey="waitForProductCatalogPage"/>
66+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductsGrid"/>
6867
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct">
6968
<argument name="product" value="$$createProduct$$"/>
7069
</actionGroup>
71-
<click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="clickFirstRowOfCreatedSimpleProduct"/>
72-
<waitForPageLoad stepKey="waitUntilProductIsOpened"/>
73-
<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDown"/>
74-
<fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$rootCategory.name$$" stepKey="fillSearchForInitialCategory"/>
75-
<waitForPageLoad stepKey="waitForCategory1"/>
76-
<click selector="{{AdminProductFormSection.selectCategory($$rootCategory.name$$)}}" stepKey="unselectInitialCategory"/>
77-
<fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="$$category.name$$" stepKey="fillSearchCategory"/>
78-
<waitForPageLoad stepKey="waitForCategory2"/>
79-
<click selector="{{AdminProductFormSection.selectCategory($$category.name$$)}}" stepKey="clickOnCategory"/>
80-
<click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneAdvancedCategorySelect"/>
81-
<scrollToTopOfPage stepKey="scrollToTopOfAdminProductFormSection"/>
82-
<click selector="{{AdminProductFormSection.save}}" stepKey="clickSaveButton"/>
83-
<waitForPageLoad stepKey="waitForSimpleProductSaved"/>
70+
<actionGroup ref="OpenProductForEditByClickingRowXColumnYInProductGridActionGroup" stepKey="openProduct"/>
71+
<actionGroup ref="SetCategoryByNameActionGroup" stepKey="unselectInitialCategory">
72+
<argument name="categoryName" value="$$rootCategory.name$$"/>
73+
</actionGroup>
74+
<actionGroup ref="AdminSubmitCategoriesPopupActionGroup" stepKey="pressDoneButton"/>
75+
<actionGroup ref="SetCategoryByNameActionGroup" stepKey="setNewCategory">
76+
<argument name="categoryName" value="$$category.name$$"/>
77+
</actionGroup>
78+
<actionGroup ref="AdminSubmitCategoriesPopupActionGroup" stepKey="clickOnDoneButton"/>
79+
<actionGroup ref="SaveProductFormNoSuccessCheckActionGroup" stepKey="saveProduct"/>
80+
8481
<!-- Verify customer see success message -->
85-
<see selector="{{AdminProductFormSection.successMessage}}" userInput="You saved the product." stepKey="seeAssertSimpleProductSaveSuccessMessage"/>
82+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="seeAssertSimpleProductSaveSuccessMessage">
83+
<argument name="message" value="You saved the product."/>
84+
</actionGroup>
8685

8786
<!-- Grab category Id -->
8887
<actionGroup ref="OpenCategoryFromCategoryTreeActionGroup" stepKey="grabCategoryId">
@@ -95,8 +94,13 @@
9594
<argument name="redirectType" value="No"/>
9695
<argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/>
9796
</actionGroup>
98-
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Store View')}}" userInput="{{customStoreGroup.name}}" stepKey="seeStoreValueForCategoryId"/>
99-
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Store View')}}" userInput="{{customStoreEN.name}}" stepKey="seeStoreViewValueForCategoryId"/>
97+
98+
<actionGroup ref="AssertAdminStoreValueIsSetForUrlRewriteActionGroup" stepKey="seeStoreValueForCategoryId">
99+
<argument name="storeValue" value="{{customStoreGroup.name}}"/>
100+
</actionGroup>
101+
<actionGroup ref="AssertAdminStoreValueIsSetForUrlRewriteActionGroup" stepKey="seeStoreViewValueForCategoryId">
102+
<argument name="storeValue" value="{{customStoreEN.name}}"/>
103+
</actionGroup>
100104

101105
<!-- Grab product Id -->
102106
<actionGroup ref="FilterAndSelectProductActionGroup" stepKey="grabProductId">
@@ -109,7 +113,12 @@
109113
<argument name="redirectType" value="No"/>
110114
<argument name="targetPath" value="catalog/product/view/id/{$productId}"/>
111115
</actionGroup>
112-
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Store View')}}" userInput="{{customStore.name}}" stepKey="seeStoreValueForProductId"/>
113-
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Store View')}}" userInput="{{storeViewData.name}}" stepKey="seeStoreViewValueForProductId"/>
116+
117+
<actionGroup ref="AssertAdminStoreValueIsSetForUrlRewriteActionGroup" stepKey="seeStoreValueForProductId">
118+
<argument name="storeValue" value="{{customStore.name}}"/>
119+
</actionGroup>
120+
<actionGroup ref="AssertAdminStoreValueIsSetForUrlRewriteActionGroup" stepKey="seeStoreViewValueForProductId">
121+
<argument name="storeValue" value="{{storeViewData.name}}"/>
122+
</actionGroup>
114123
</test>
115124
</tests>

0 commit comments

Comments
 (0)