Skip to content

Commit 5c013cd

Browse files
merge magento/2.3-develop into magento-tango/MC-19862
2 parents e2ed021 + de0fc3b commit 5c013cd

16 files changed

+588
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminAssociateBundleProductToWebsitesTest">
12+
<annotations>
13+
<features value="Bundle"/>
14+
<stories value="Create/Edit bundle product in Admin"/>
15+
<title value="Admin should be able to associate bundle product to websites"/>
16+
<description value="Admin should be able to associate bundle product to websites"/>
17+
<testCaseId value="MC-3344"/>
18+
<severity value="CRITICAL"/>
19+
<group value="bundle"/>
20+
<group value="catalog"/>
21+
</annotations>
22+
<before>
23+
<!-- Configure Store URLs -->
24+
<magentoCLI command="config:set {{StorefrontEnableAddStoreCodeToUrls.path}} {{StorefrontEnableAddStoreCodeToUrls.value}}" stepKey="setAddStoreCodeToUrlsToYes"/>
25+
26+
<!-- Create category -->
27+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
28+
29+
<!-- Create Simple product -->
30+
<createData entity="SimpleProduct2" stepKey="createSimpleProduct"/>
31+
32+
<!-- Create Bundle product -->
33+
<createData entity="ApiBundleProductPriceViewRange" stepKey="createBundleProduct">
34+
<requiredEntity createDataKey="createCategory"/>
35+
</createData>
36+
<createData entity="DropDownBundleOption" stepKey="bundleOption">
37+
<requiredEntity createDataKey="createBundleProduct"/>
38+
</createData>
39+
<createData entity="ApiBundleLink" stepKey="createNewBundleLink">
40+
<requiredEntity createDataKey="createBundleProduct"/>
41+
<requiredEntity createDataKey="bundleOption"/>
42+
<requiredEntity createDataKey="createSimpleProduct"/>
43+
</createData>
44+
45+
<!-- Reindex -->
46+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
47+
48+
<!-- Login as admin -->
49+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
50+
51+
<!--Create website-->
52+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createSecondWebsite">
53+
<argument name="newWebsiteName" value="{{secondCustomWebsite.name}}"/>
54+
<argument name="websiteCode" value="{{secondCustomWebsite.code}}"/>
55+
</actionGroup>
56+
<!-- Create second store -->
57+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createSecondStoreGroup">
58+
<argument name="website" value="{{secondCustomWebsite.name}}"/>
59+
<argument name="storeGroupName" value="{{SecondStoreGroupUnique.name}}"/>
60+
<argument name="storeGroupCode" value="{{SecondStoreGroupUnique.code}}"/>
61+
</actionGroup>
62+
<!-- Create second store view -->
63+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createSecondStoreView">
64+
<argument name="StoreGroup" value="SecondStoreGroupUnique"/>
65+
<argument name="customStore" value="SecondStoreUnique"/>
66+
</actionGroup>
67+
</before>
68+
<after>
69+
<!-- Disabled Store URLs -->
70+
<magentoCLI command="config:set {{StorefrontDisableAddStoreCodeToUrls.path}} {{StorefrontDisableAddStoreCodeToUrls.value}}" stepKey="setAddStoreCodeToUrlsToNo"/>
71+
72+
<!-- Delete simple product -->
73+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
74+
<!-- Delete bundle product -->
75+
<deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/>
76+
77+
<!-- Delete second website -->
78+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
79+
<argument name="websiteName" value="{{secondCustomWebsite.name}}"/>
80+
</actionGroup>
81+
82+
<actionGroup ref="NavigateToAndResetProductGridToDefaultView" stepKey="resetProductGridFilter"/>
83+
84+
<!-- Admin logout -->
85+
<actionGroup ref="logout" stepKey="adminLogout"/>
86+
</after>
87+
88+
<!-- Open product page and assign grouped project to second website -->
89+
<actionGroup ref="filterAndSelectProduct" stepKey="openAdminProductPage">
90+
<argument name="productSku" value="$$createBundleProduct.sku$$"/>
91+
</actionGroup>
92+
<actionGroup ref="AdminAssignProductInWebsiteActionGroup" stepKey="assignProductToSecondWebsite">
93+
<argument name="website" value="{{secondCustomWebsite.name}}"/>
94+
</actionGroup>
95+
<actionGroup ref="AdminUnassignProductInWebsiteActionGroup" stepKey="unassignProductFromDefaultWebsite">
96+
<argument name="website" value="{{_defaultWebsite.name}}"/>
97+
</actionGroup>
98+
<actionGroup ref="saveProductForm" stepKey="saveGroupedProduct"/>
99+
100+
<!-- Assert product is assigned to Second website -->
101+
<actionGroup ref="AssertProductIsAssignedToWebsite" stepKey="seeCustomWebsiteIsChecked">
102+
<argument name="website" value="{{secondCustomWebsite.name}}"/>
103+
</actionGroup>
104+
105+
<!-- Assert product is not assigned to Main website -->
106+
<actionGroup ref="AssertProductIsNotAssignedToWebsite" stepKey="seeMainWebsiteIsNotChecked">
107+
<argument name="website" value="{{_defaultWebsite.name}}"/>
108+
</actionGroup>
109+
110+
<!-- Go to frontend and open product on Main website -->
111+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
112+
<argument name="productUrl" value="$$createBundleProduct.custom_attributes[url_key]$$"/>
113+
</actionGroup>
114+
115+
<!-- Assert 404 page -->
116+
<actionGroup ref="StorefrontAssertPageNotFoundErrorOnProductDetailPageActionGroup" stepKey="assertPageNotFoundError">
117+
<argument name="product" value="$$createBundleProduct$$"/>
118+
</actionGroup>
119+
120+
<!-- Assert product is present at Second website -->
121+
<actionGroup ref="StorefrontOpenProductPageUsingStoreCodeInUrlActionGroup" stepKey="openProductPageUsingStoreCodeInUrl">
122+
<argument name="product" value="$$createBundleProduct$$"/>
123+
<argument name="storeView" value="SecondStoreUnique"/>
124+
</actionGroup>
125+
</test>
126+
</tests>

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

+15
Original file line numberDiff line numberDiff line change
@@ -396,4 +396,19 @@
396396
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
397397
<waitForPageLoad stepKey="waitForPageToLoad1"/>
398398
</actionGroup>
399+
400+
<actionGroup name="AdminCategoryAssignProduct">
401+
<annotations>
402+
<description>Requires navigation to category creation/edit page. Assign products to category - using "Products in Category" tab.</description>
403+
</annotations>
404+
<arguments>
405+
<argument name="productSku" type="string"/>
406+
</arguments>
407+
408+
<conditionalClick selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="false" stepKey="clickOnProductInCategory"/>
409+
<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickOnResetFilter"/>
410+
<fillField selector="{{AdminCategoryContentSection.productTableColumnSku}}" userInput="{{productSku}}" stepKey="fillSkuFilter"/>
411+
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton"/>
412+
<click selector="{{AdminCategoryContentSection.productTableRow}}" stepKey="selectProductFromTableRow"/>
413+
</actionGroup>
399414
</actionGroups>

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

+1
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
<element name="productTableColumnName" type="input" selector="#catalog_category_products_filter_name"/>
2525
<element name="productTableRow" type="button" selector="#catalog_category_products_table tbody tr"/>
2626
<element name="productSearch" type="button" selector="//button[@data-action='grid-filter-apply']" timeout="30"/>
27+
<element name="productTableColumnSku" type="input" selector="#catalog_category_products_filter_sku"/>
2728
</section>
2829
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminProductCustomURLKeyPreservedWhenAssignedToCategoryWithoutCustomURLKey">
12+
<annotations>
13+
<stories value="Product"/>
14+
<features value="Catalog"/>
15+
<title value="Product custom URL Key is preserved when assigned to a Category (without custom URL Key) alongside with another Product without custom URL Key"/>
16+
<description value="The test verifies that product custom URL Key is preserved when assigned to a Category (without custom URL Key) alongside with another Product without custom URL Key."/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-6443"/>
19+
<useCaseId value="MAGETWO-90331"/>
20+
<group value="catalog"/>
21+
</annotations>
22+
<before>
23+
<!-- Create category -->
24+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
25+
26+
<!-- Create Simple Products -->
27+
<createData entity="SimpleProduct2" stepKey="createSimpleProductFirst"/>
28+
<createData entity="SimpleProduct2" stepKey="createSimpleProductSecond"/>
29+
30+
<!--Login as admin -->
31+
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/>
32+
33+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView">
34+
<argument name="customStore" value="storeViewData"/>
35+
</actionGroup>
36+
37+
<!--Run full reindex and clear caches -->
38+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
39+
<magentoCLI command="cache:flush" arguments="full_page" stepKey="flushCache"/>
40+
</before>
41+
<after>
42+
<deleteData createDataKey="createSimpleProductFirst" stepKey="deleteFirstSimpleProduct"/>
43+
<deleteData createDataKey="createSimpleProductSecond" stepKey="deleteSecondSimpleProduct"/>
44+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
45+
46+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView">
47+
<argument name="customStore" value="storeViewData"/>
48+
</actionGroup>
49+
50+
<actionGroup ref="logout" stepKey="logout"/>
51+
</after>
52+
53+
<!-- Open product -->
54+
<amOnPage url="{{AdminProductEditPage.url($createSimpleProductSecond.id$)}}" stepKey="openProductSecondEditPage"/>
55+
<!-- switch store view -->
56+
<actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="switchToStoreView">
57+
<argument name="storeView" value="storeViewData.name"/>
58+
</actionGroup>
59+
60+
<!-- set url key -->
61+
<conditionalClick selector="{{AdminProductSEOSection.sectionHeader}}" dependentSelector="{{AdminProductSEOSection.urlKeyInput}}" visible="false" stepKey="openSeoSection"/>
62+
<uncheckOption selector="{{AdminProductSEOSection.useDefaultUrl}}" stepKey="uncheckUseDefaultUrlKey"/>
63+
<fillField userInput="U2" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/>
64+
<actionGroup ref="saveProductForm" stepKey="saveProduct"/>
65+
66+
<actionGroup ref="goToAdminCategoryPageById" stepKey="openCategory">
67+
<argument name="id" value="$createCategory.id$"/>
68+
</actionGroup>
69+
70+
<actionGroup ref="AdminCategoryAssignProduct" stepKey="assignSimpleProductFirst">
71+
<argument name="productSku" value="$createSimpleProductFirst.sku$"/>
72+
</actionGroup>
73+
<actionGroup ref="AdminCategoryAssignProduct" stepKey="assignSimpleProductSecond">
74+
<argument name="productSku" value="$createSimpleProductSecond.sku$"/>
75+
</actionGroup>
76+
77+
<actionGroup ref="saveCategoryForm" stepKey="saveCategory"/>
78+
79+
<executeJS function="return '$createCategory.name$'.toLowerCase();" stepKey="categoryNameLower" />
80+
<executeJS function="return '$createSimpleProductFirst.name$'.toLowerCase();" stepKey="simpleProductFirstNameLower" />
81+
<executeJS function="return '$createSimpleProductSecond.name$'.toLowerCase();" stepKey="simpleProductSecondNameLower" />
82+
83+
<!-- Make assertions on frontend -->
84+
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToStorefrontPage"/>
85+
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName($createCategory.name$)}}" stepKey="onCategoryPage"/>
86+
<seeInCurrentUrl url="{$categoryNameLower}.html" stepKey="checkCategryUrlKey"/>
87+
88+
<!-- Open first product -->
89+
<click selector="{{StorefrontCategoryProductSection.ProductTitleByName($createSimpleProductFirst.name$)}}" stepKey="openFirstProduct"/>
90+
<waitForPageLoad time="30" stepKey="waitForFirstProduct"/>
91+
<seeInCurrentUrl url="{$simpleProductFirstNameLower}.html" stepKey="checkFirstSimpleProductUrlKey"/>
92+
93+
<amOnPage url="{{StorefrontCategoryPage.url($createCategory.custom_attributes[url_key]$)}}" stepKey="onCategoryView"/>
94+
<!-- Open second product -->
95+
<click selector="{{StorefrontCategoryProductSection.ProductTitleByName($createSimpleProductSecond.name$)}}" stepKey="openSecondProduct"/>
96+
<waitForPageLoad time="30" stepKey="waitForSecondProduct"/>
97+
<seeInCurrentUrl url="{$simpleProductSecondNameLower}.html" stepKey="checkSecondSimpleProductUrlKey"/>
98+
99+
<actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="switchToCustomStoreView">
100+
<argument name="storeView" value="storeViewData"/>
101+
</actionGroup>
102+
103+
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName($createCategory.name$)}}" stepKey="openCategoryPage"/>
104+
<seeInCurrentUrl url="{$categoryNameLower}.html" stepKey="seeCategoryUrlKey"/>
105+
106+
<!-- Open product first -->
107+
<click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProductFirst.name$$)}}" stepKey="openFirstSimpleProduct"/>
108+
<waitForPageLoad time="30" stepKey="waitForFirstSimpleProduct"/>
109+
<seeInCurrentUrl url="{$simpleProductFirstNameLower}.html" stepKey="assertFirstSimpleProductUrlKey"/>
110+
111+
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName($createCategory.name$)}}" stepKey="openCategoryView"/>
112+
<!-- Open product2 -->
113+
<click selector="{{StorefrontCategoryProductSection.ProductTitleByName($createSimpleProductSecond.name$)}}" stepKey="openSecondSimpleProduct"/>
114+
<waitForPageLoad time="30" stepKey="waitForSecondSimpleProduct"/>
115+
<seeInCurrentUrl url="u2.html" stepKey="assertSecondSimpleProductUrlKey"/>
116+
</test>
117+
</tests>

0 commit comments

Comments
 (0)