Skip to content

Commit 0f825a7

Browse files
committed
MAGETWO-97026: Check Url Rewrites Correctly Generated for Multiple Storeviews During Product Import
1 parent 2b27bc0 commit 0f825a7

File tree

10 files changed

+190
-1
lines changed

10 files changed

+190
-1
lines changed

app/code/Magento/Backend/Test/Mftf/Section/AdminMessagesSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
<element name="success" type="text" selector="#messages div.message-success"/>
1313
<element name="nthSuccess" type="text" selector=".message.message-success.success:nth-of-type({{n}})>div" parameterized="true"/>
1414
<element name="error" type="text" selector="#messages div.message-error"/>
15+
<element name="notice" type="text" selector=".message.message-notice.notice"/>
1516
</section>
1617
</sections>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchForProductOnBackendActionGroup.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
<click selector="{{AdminProductFiltersSection.apply}}" stepKey="clickApplyFiltersButton"/>
2020
</actionGroup>
2121

22+
<actionGroup name="SearchForProductOnBackendByNameActionGroup" extends="SearchForProductOnBackendActionGroup">
23+
<arguments>
24+
<argument name="productName" type="string"/>
25+
</arguments>
26+
<remove keyForRemoval="fillSkuFieldOnFiltersSection"/>
27+
<fillField userInput="{{productName}}" selector="{{AdminProductFiltersSection.nameInput}}" after="cleanFiltersIfTheySet" stepKey="fillNameFieldOnFiltersSection"/>
28+
</actionGroup>
29+
2230
<actionGroup name="ClearProductsFilterActionGroup">
2331
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
2432
<waitForPageLoad time="30" stepKey="waitForProductsPageToLoad"/>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="AdminImportIndexPage" url="admin/import/" area="admin" module="Magento_ImportExport">
12+
<section name="AdminImportHeaderSection"/>
13+
<section name="AdminImportMainSection"/>
14+
</page>
15+
</pages>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminImportHeaderSection">
12+
<element name="checkDataButton" type="button" selector="#upload_button" timeout="30"/>
13+
</section>
14+
</sections>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminImportMainSection">
12+
<element name="entityType" type="select" selector="#entity"/>
13+
<element name="importBehavior" type="select" selector="#basic_behavior"/>
14+
<element name="selectFileToImport" type="input" selector="#import_file"/>
15+
<element name="importButton" type="button" selector="#import_validation_container button" timeout="30"/>
16+
</section>
17+
</sections>

app/code/Magento/Store/Test/Mftf/Data/StoreData.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,24 @@
3939
<data key="store_type">group</data>
4040
<requiredEntity type="storeGroup">customStoreGroup</requiredEntity>
4141
</entity>
42+
<entity name="customStoreENNotUnique" type="store">
43+
<data key="name">EN</data>
44+
<data key="code">en</data>
45+
<data key="is_active">1</data>
46+
<data key="store_id">null</data>
47+
<data key="store_action">add</data>
48+
<data key="store_type">store</data>
49+
<requiredEntity type="storeGroup">customStoreGroup</requiredEntity>
50+
</entity>
51+
<entity name="customStoreNLNotUnique" type="store">
52+
<data key="name">NL</data>
53+
<data key="code">nl</data>
54+
<data key="is_active">1</data>
55+
<data key="store_id">null</data>
56+
<data key="store_action">add</data>
57+
<data key="store_type">store</data>
58+
<requiredEntity type="storeGroup">customStoreGroup</requiredEntity>
59+
</entity>
4260
<entity name="staticStore" type="store">
4361
<!--data key="group_id">customStoreGroup.id</data-->
4462
<data key="name">Second Store View</data>

app/code/Magento/Store/Test/Mftf/Section/AdminNewStoreViewActionsSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
<element name="delete" type="button" selector="#delete" timeout="30"/>
1212
<element name="resetButton" type="button" selector="#reset" timeout="30"/>
1313
<element name="saveButton" type="button" selector="#save" timeout="60"/>
14-
<element name="loadingMask" type="text" selector=".loading-mask"/>
14+
<element name="loadingMask" type="text" selector=".loading-mask" timeout="60"/>
1515
</section>
1616
</sections>

app/code/Magento/UrlRewrite/Test/Mftf/Section/AdminUrlRewriteIndexSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<section name="AdminUrlRewriteIndexSection">
1212
<element name="requestPathFilter" type="input" selector="#urlrewriteGrid_filter_request_path"/>
1313
<element name="requestPathColumnValue" type="text" selector="//*[@id='urlrewriteGrid']//tbody//td[@data-column='request_path' and normalize-space(.)='{{columnValue}}']" parameterized="true"/>
14+
<element name="targetPathColumnValue" type="text" selector="//*[@id='urlrewriteGrid']//tbody//td[@data-column='target_path' and normalize-space(.)='{{columnValue}}']" parameterized="true"/>
1415
</section>
1516
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCheckUrlRewritesCorrectlyGeneratedForMultipleStoreviewsDuringProductImportTest">
11+
<annotations>
12+
<features value="Url Rewrite"/>
13+
<stories value="Url Rewrites Correctly Generated for Multiple Storeviews During Product Import"/>
14+
<title value="Url Rewrites Correctly Generated for Multiple Storeviews During Product Import"/>
15+
<description value="Check Url Rewrites Correctly Generated for Multiple Storeviews During Product Import."/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="MAGETWO-68980"/>
18+
<group value="urlRewrite123"/>
19+
</annotations>
20+
<before>
21+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
22+
<!-- Create Store View EN -->
23+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreViewEn">
24+
<argument name="customStore" value="customStoreENNotUnique"/>
25+
</actionGroup>
26+
<!-- Create Store View NL -->
27+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreViewFr">
28+
<argument name="customStore" value="customStoreNLNotUnique"/>
29+
</actionGroup>
30+
<createData entity="ApiCategory" stepKey="createCategory">
31+
<field key="name">category-admin</field>
32+
</createData>
33+
</before>
34+
<after>
35+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
36+
<actionGroup ref="deleteProductByName" stepKey="deleteImportedProduct">
37+
<argument name="sku" value="productformagetwo68980"/>
38+
<argument name="name" value="productformagetwo68980"/>
39+
</actionGroup>
40+
<actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFiltersIfSet"/>
41+
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/>
42+
</after>
43+
<actionGroup ref="switchCategoryStoreView" stepKey="switchToStoreViewEn">
44+
<argument name="Store" value="customStoreENNotUnique.name"/>
45+
<argument name="CatName" value="$$createCategory.name$$"/>
46+
</actionGroup>
47+
<uncheckOption selector="{{AdminCategoryBasicFieldSection.categoryNameUseDefault}}" stepKey="uncheckUseDefaultValueENStoreView"/>
48+
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="category-english" stepKey="changeNameField"/>
49+
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="clickOnSectionHeader"/>
50+
<actionGroup ref="ChangeSeoUrlKeyForSubCategory" stepKey="changeSeoUrlKeyENStoreView">
51+
<argument name="value" value="category-english"/>
52+
</actionGroup>
53+
<actionGroup ref="switchCategoryStoreView" stepKey="switchToStoreViewNl">
54+
<argument name="Store" value="customStoreNLNotUnique.name"/>
55+
<argument name="CatName" value="$$createCategory.name$$"/>
56+
</actionGroup>
57+
<uncheckOption selector="{{AdminCategoryBasicFieldSection.categoryNameUseDefault}}" stepKey="uncheckUseDefaultValue1"/>
58+
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="category-dutch" stepKey="changeNameFieldNLStoreView"/>
59+
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="clickOnSectionHeader2"/>
60+
<actionGroup ref="ChangeSeoUrlKeyForSubCategory" stepKey="changeSeoUrlKeyNLStoreView">
61+
<argument name="value" value="category-dutch"/>
62+
</actionGroup>
63+
<amOnPage url="{{AdminImportIndexPage.url}}" stepKey="navigateToSystemImport"/>
64+
<selectOption selector="{{AdminImportMainSection.entityType}}" userInput="Products" stepKey="selectProductsOption"/>
65+
<waitForElementVisible selector="{{AdminImportMainSection.importBehavior}}" stepKey="waitForImportBehaviorElementVisible"/>
66+
<selectOption selector="{{AdminImportMainSection.importBehavior}}" userInput="Add/Update" stepKey="selectAddUpdateOption"/>
67+
<attachFile selector="{{AdminImportMainSection.selectFileToImport}}" userInput="import_updated.csv" stepKey="attachFileForImport"/>
68+
<click selector="{{AdminImportHeaderSection.checkDataButton}}" stepKey="clickCheckDataButton"/>
69+
<see selector="{{AdminMessagesSection.notice}}" userInput="Checked rows: 3, checked entities: 1, invalid rows: 0, total errors: 0" stepKey="assertNotice"/>
70+
<see selector="{{AdminMessagesSection.successMessage}}" userInput="File is valid! To start import process press &quot;Import&quot; button" stepKey="assertSuccessMessage"/>
71+
<click selector="{{AdminImportMainSection.importButton}}" stepKey="clickImportButton"/>
72+
<see selector="{{AdminMessagesSection.successMessage}}" userInput="Import successfully done" stepKey="assertSuccessMessage1"/>
73+
<see selector="{{AdminMessagesSection.notice}}" userInput="Created: 1, Updated: 0, Deleted: 0" stepKey="assertNotice1"/>
74+
<actionGroup ref="SearchForProductOnBackendByNameActionGroup" stepKey="searchForProductOnBackend">
75+
<argument name="productName" value="productformagetwo68980"/>
76+
</actionGroup>
77+
<click selector="{{AdminProductGridSection.productRowBySku('productformagetwo68980')}}" stepKey="clickOnProductRow"/>
78+
<grabFromCurrentUrl regex="~/id/(\d+)/~" stepKey="grabProductIdFromUrl"/>
79+
<amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="goToUrlRewritesIndexPage"/>
80+
81+
<fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="category-english.html" stepKey="inputCategoryUrlForENStoreView"/>
82+
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton"/>
83+
<seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue('category-english.html')}}" stepKey="seeUrlInRequestPathColumn"/>
84+
<seeElement selector="{{AdminUrlRewriteIndexSection.targetPathColumnValue(catalog/category/view/id/$$createCategory.id$$)}}" stepKey="seeUrlInTargetPathColumn"/>
85+
86+
<fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="category-dutch.html" stepKey="inputCategoryUrlForNLStoreView"/>
87+
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton1"/>
88+
<seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue('category-dutch.html')}}" stepKey="seeUrlInRequestPathColumn1"/>
89+
<seeElement selector="{{AdminUrlRewriteIndexSection.targetPathColumnValue(catalog/category/view/id/$$createCategory.id$$)}}" stepKey="seeUrlInTargetPathColumn1"/>
90+
91+
<fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="productformagetwo68980-english.html" stepKey="inputProductUrlForENStoreView"/>
92+
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton2"/>
93+
<seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue('productformagetwo68980-english.html')}}" stepKey="seeUrlInRequestPathColumn2"/>
94+
<seeElement selector="{{AdminUrlRewriteIndexSection.targetPathColumnValue('catalog/product/view/id/$grabProductIdFromUrl')}}" stepKey="seeUrlInTargetPathColumn2"/>
95+
96+
<fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="productformagetwo68980-dutch.html" stepKey="inputProductUrlForENStoreViewdfdf"/>
97+
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton3"/>
98+
<seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue('productformagetwo68980-dutch.html')}}" stepKey="seeUrlInRequestPathColumn3"/>
99+
<seeElement selector="{{AdminUrlRewriteIndexSection.targetPathColumnValue('catalog/product/view/id/$grabProductIdFromUrl')}}" stepKey="seeUrlInTargetPathColumn3"/>
100+
101+
<fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="category-english/productformagetwo68980-english.html" stepKey="inputProductUrlForENStoreViewdfdefef"/>
102+
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton4"/>
103+
<seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue('category-english/productformagetwo68980-english.html')}}" stepKey="seeUrlInRequestPathColumn4"/>
104+
<seeElement selector="{{AdminUrlRewriteIndexSection.targetPathColumnValue(catalog/product/view/id/$grabProductIdFromUrl/category/$$createCategory.id$$)}}" stepKey="seeUrlInTargetPathColumn4"/>
105+
106+
<fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="category-dutch/productformagetwo68980-dutch.html" stepKey="inputProductUrlForENStoreViewdfefdefef"/>
107+
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton5"/>
108+
<seeElement selector="{{AdminUrlRewriteIndexSection.requestPathColumnValue('category-dutch/productformagetwo68980-dutch.html')}}" stepKey="seeUrlInRequestPathColumn5"/>
109+
<seeElement selector="{{AdminUrlRewriteIndexSection.targetPathColumnValue(catalog/product/view/id/$grabProductIdFromUrl/category/$$createCategory.id$$)}}" stepKey="seeUrlInTargetPathColumn5"/>
110+
</test>
111+
</tests>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
product_websites,store_view_code,attribute_set_code,product_type,categories,sku,price,name,url_key
2+
base,,Default,simple,Default Category/category-admin,productformagetwo68980,123,productformagetwo68980,productformagetwo68980
3+
,en,Default,simple,,productformagetwo68980,,productformagetwo68980-english,productformagetwo68980-english
4+
,nl,Default,simple,,productformagetwo68980,,productformagetwo68980-dutch,productformagetwo68980-dutch

0 commit comments

Comments
 (0)