Skip to content

Commit 5a74bfe

Browse files
committed
MC-3241: Admin should be able to set/edit other product information when creating/editing a simple product
1 parent c5322f7 commit 5a74bfe

11 files changed

+294
-0
lines changed
Lines changed: 22 additions & 0 deletions
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="AdminChangeProductSEOSettingsActionGroup">
12+
<arguments>
13+
<argument name="productName" defaultValue="_defaultProduct.name"/>
14+
</arguments>
15+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="clickSearchEngineOptimizationTab"/>
16+
<waitForPageLoad stepKey="waitForTabOpen"/>
17+
<fillField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="{{productName}}" stepKey="setUrlKeyInput"/>
18+
<fillField selector="{{AdminProductSEOSection.metaTitleInput}}" userInput="{{productName}}" stepKey="setMetaTitleInput"/>
19+
<fillField selector="{{AdminProductSEOSection.metaKeywordsInput}}" userInput="{{productName}}" stepKey="setMetaKeywordsInput"/>
20+
<fillField selector="{{AdminProductSEOSection.metaDescriptionInput}}" userInput="{{productName}}" stepKey="setMetaDescriptionInput"/>
21+
</actionGroup>
22+
</actionGroups>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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="AdminSetProductDesignSettingsActionGroup">
12+
<arguments>
13+
<argument name="designSettings" defaultValue="simpleBlankDesign"/>
14+
</arguments>
15+
<click selector="{{ProductDesignSection.DesignTab}}" stepKey="clickDesignTab"/>
16+
<waitForPageLoad stepKey="waitForTabOpen"/>
17+
<selectOption selector="{{ProductDesignSection.LayoutDropdown}}" userInput="{{designSettings.page_layout}}" stepKey="setLayout"/>
18+
<selectOption selector="{{ProductDesignSection.productOptionsContainer}}" userInput="{{designSettings.options_container}}" stepKey="setDisplayProductOptions"/>
19+
</actionGroup>
20+
</actionGroups>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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="AdminSwitchProductGiftMessageStatusActionGroup">
12+
<arguments>
13+
<argument name="status" defaultValue="0"/>
14+
</arguments>
15+
<click selector="{{AdminProductGiftOptionsSection.giftOptions}}" stepKey="clickToExpandGiftOptionsTab"/>
16+
<waitForPageLoad stepKey="waitForGiftOptionsOpen"/>
17+
<uncheckOption selector="{{AdminProductGiftOptionsSection.useConfigSettingsMessage}}" stepKey="uncheckConfigSettingsMessage"/>
18+
<click selector="{{AdminProductGiftOptionsSection.toggleProductGiftMessage}}" stepKey="clickToGiftMessageSwitcher"/>
19+
<seeElement selector="{{AdminProductGiftOptionsSection.giftMessageStatus('status')}}" stepKey="assertGiftMessageStatus"/>
20+
</actionGroup>
21+
</actionGroups>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontAssertGiftMessageFieldsActionGroup">
11+
<waitForElementVisible selector="{{StorefrontProductCartGiftOptionSection.giftOptions}}" stepKey="waitForCartGiftOptionVisible"/>
12+
<click selector="{{StorefrontProductCartGiftOptionSection.giftOptions}}" stepKey="clickGiftOptionBtn"/>
13+
<seeElement selector="{{StorefrontProductCartGiftOptionSection.fieldTo}}" stepKey="seeFieldTo"/>
14+
<seeElement selector="{{StorefrontProductCartGiftOptionSection.fieldFrom}}" stepKey="seeFieldFrom"/>
15+
<seeElement selector="{{StorefrontProductCartGiftOptionSection.message}}" stepKey="seeMessageArea"/>
16+
<seeElement selector="{{StorefrontProductCartGiftOptionSection.update}}" stepKey="seeUpdateButton"/>
17+
<seeElement selector="{{StorefrontProductCartGiftOptionSection.cancel}}" stepKey="seeCancelButton"/>
18+
</actionGroup>
19+
</actionGroups>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="simpleBlankDesign" type="product">
12+
<data key="custom_design">Magento Blank</data>
13+
<data key="page_layout">2 columns with left bar</data>
14+
<data key="options_container">Product Info Column</data>
15+
</entity>
16+
<entity name="simpleLumaDesign" type="product">
17+
<data key="custom_design">Magento Luma</data>
18+
<data key="page_layout">Empty</data>
19+
<data key="options_container">Block after Info Column</data>
20+
</entity>
21+
</entities>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
<section name="ProductDesignSection">
8585
<element name="DesignTab" type="button" selector="//strong[@class='admin__collapsible-title']//span[text()='Design']"/>
8686
<element name="LayoutDropdown" type="select" selector="select[name='product[page_layout]']"/>
87+
<element name="productOptionsContainer" type="select" selector="select[name='product[options_container]']"/>
8788
</section>
8889
<section name="AdminProductFormRelatedUpSellCrossSellSection">
8990
<element name="relatedProductsHeader" type="button" selector=".admin__collapsible-block-wrapper[data-index='related']" timeout="30"/>
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="AdminProductGiftOptionsSection">
12+
<element name="giftOptions" type="text" selector="div[data-index='gift-options']"/>
13+
<element name="useConfigSettingsMessage" type="checkbox" selector="[name='product[use_config_gift_message_available]']"/>
14+
<element name="toggleProductGiftMessage" type="button" selector="input[name='product[gift_message_available]']+label"/>
15+
<element name="giftMessageStatus" type="checkbox" selector="input[name='product[gift_message_available]'][value='{{status}}']" parameterized="true"/>
16+
</section>
17+
</sections>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@
1212
<element name="sectionHeader" type="button" selector="div[data-index='search-engine-optimization']" timeout="30"/>
1313
<element name="urlKeyInput" type="input" selector="input[name='product[url_key]']"/>
1414
<element name="useDefaultUrl" type="checkbox" selector="input[name='use_default[url_key]']"/>
15+
<element name="metaTitleInput" type="input" selector="input[name='product[meta_title]']"/>
16+
<element name="metaKeywordsInput" type="textarea" selector="textarea[name='product[meta_keyword]']"/>
17+
<element name="metaDescriptionInput" type="textarea" selector="textarea[name='product[meta_description]']"/>
1518
</section>
1619
</sections>
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="StorefrontProductPageDesignSection">
12+
<element name="layoutTwoColumnsLeft" type="block" selector=".page-layout-2columns-left"/>
13+
<element name="layoutEmpty" type="block" selector=".page-layout-empty"/>
14+
</section>
15+
</sections>
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
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="AdminCreateAndEditSimpleProductSettingsTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Create/Edit simple product in Admin"/>
15+
<title value="Admin should be able to set/edit other product information when creating/editing a simple product"/>
16+
<description value="Admin should be able to set/edit product information when creating/editing a simple product"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-3241"/>
19+
<group value="Catalog"/>
20+
</annotations>
21+
<before>
22+
<!-- Login as admin -->
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
24+
25+
<!-- Create related products -->
26+
<createData entity="SimpleProduct2" stepKey="createFirstRelatedProduct"/>
27+
<createData entity="SimpleProduct2" stepKey="createSecondRelatedProduct"/>
28+
<createData entity="SimpleProduct2" stepKey="createThirdRelatedProduct"/>
29+
</before>
30+
<after>
31+
<!-- Delete related products -->
32+
<deleteData createDataKey="createFirstRelatedProduct" stepKey="deleteFirstRelatedProduct"/>
33+
<deleteData createDataKey="createSecondRelatedProduct" stepKey="deleteSecondRelatedProduct"/>
34+
<deleteData createDataKey="createThirdRelatedProduct" stepKey="deleteThirdRelatedProduct"/>
35+
36+
<!-- Log out -->
37+
<actionGroup ref="logout" stepKey="logout"/>
38+
</after>
39+
40+
<!-- Create new simple product -->
41+
<actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="createSimpleProduct"/>
42+
43+
<!-- Fill all main fields -->
44+
<actionGroup ref="fillMainProductForm" stepKey="fillAllNecessaryFields"/>
45+
46+
<!-- Add two related products -->
47+
<actionGroup ref="addRelatedProductBySku" stepKey="addFirstRelatedProduct">
48+
<argument name="sku" value="$$createFirstRelatedProduct.sku$$"/>
49+
</actionGroup>
50+
<actionGroup ref="addRelatedProductBySku" stepKey="addSecondRelatedProduct">
51+
<argument name="sku" value="$$createSecondRelatedProduct.sku$$"/>
52+
</actionGroup>
53+
54+
<!-- Set Design settings for the product -->
55+
<actionGroup ref="AdminSetProductDesignSettingsActionGroup" stepKey="setProductDesignSettings"/>
56+
57+
<!-- Set Gift Options settings for the product -->
58+
<actionGroup ref="AdminSwitchProductGiftMessageStatusActionGroup" stepKey="enableGiftMessageSettings">
59+
<argument name="status" value="1"/>
60+
</actionGroup>
61+
62+
<!-- Save product form -->
63+
<actionGroup ref="saveProductForm" stepKey="clickSaveButton"/>
64+
65+
<!-- Open product page -->
66+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openStorefrontProductPage">
67+
<argument name="productUrl" value="{{_defaultProduct.name}}"/>
68+
</actionGroup>
69+
70+
<!-- Assert related products at the storefront -->
71+
<seeElement selector="{{StorefrontProductRelatedProductsSection.relatedProductName($$createFirstRelatedProduct.name$$)}}" stepKey="seeFirstRelatedProductInStorefront"/>
72+
<seeElement selector="{{StorefrontProductRelatedProductsSection.relatedProductName($$createSecondRelatedProduct.name$$)}}" stepKey="seeSecondRelatedProductInStorefront"/>
73+
74+
<!-- Assert product design settings "left bar is present at product page with 2 columns" -->
75+
<seeElement selector="{{StorefrontProductPageDesignSection.layoutTwoColumnsLeft}}" stepKey="seeDesignChanges"/>
76+
77+
<!-- Assert Gift Option product settings is present -->
78+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
79+
<argument name="product" value="_defaultProduct"/>
80+
<argument name="productCount" value="1"/>
81+
</actionGroup>
82+
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openShoppingCart"/>
83+
<actionGroup ref="StorefrontAssertGiftMessageFieldsActionGroup" stepKey="assertGiftMessageFieldsArePresent"/>
84+
85+
<!-- Open created product -->
86+
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct">
87+
<argument name="product" value="_defaultProduct"/>
88+
</actionGroup>
89+
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct">
90+
<argument name="product" value="_defaultProduct"/>
91+
</actionGroup>
92+
93+
<!-- Edit product Search Engine Optimization settings -->
94+
<actionGroup ref="AdminChangeProductSEOSettingsActionGroup" stepKey="editProductSEOSettings">
95+
<argument name="productName" value="SimpleProduct.name"/>
96+
</actionGroup>
97+
98+
<!-- Edit related products -->
99+
<actionGroup ref="addRelatedProductBySku" stepKey="addThirdRelatedProduct">
100+
<argument name="sku" value="$$createThirdRelatedProduct.sku$$"/>
101+
</actionGroup>
102+
<click selector="{{AdminProductFormRelatedUpSellCrossSellSection.removeRelatedProduct($$createFirstRelatedProduct.sku$$)}}" stepKey="removeFirstRelatedProduct"/>
103+
104+
<!-- Edit Design settings for the product -->
105+
<actionGroup ref="AdminSetProductDesignSettingsActionGroup" stepKey="editProductDesignSettings">
106+
<argument name="designSettings" value="simpleLumaDesign"/>
107+
</actionGroup>
108+
109+
<!-- Edit Gift Option product settings -->
110+
<actionGroup ref="AdminSwitchProductGiftMessageStatusActionGroup" stepKey="disableGiftMessageSettings"/>
111+
112+
<!-- Save product form -->
113+
<actionGroup ref="saveProductForm" stepKey="clickSaveProduct"/>
114+
115+
<!-- Verify Url Key after changing -->
116+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
117+
<argument name="productUrl" value="{{SimpleProduct.name}}"/>
118+
</actionGroup>
119+
120+
<!-- Assert related products at the storefront -->
121+
<seeElement selector="{{StorefrontProductRelatedProductsSection.relatedProductName($$createSecondRelatedProduct.name$$)}}" stepKey="seeSecondRelatedProduct"/>
122+
<seeElement selector="{{StorefrontProductRelatedProductsSection.relatedProductName($$createThirdRelatedProduct.name$$)}}" stepKey="seeThirdRelatedProduct"/>
123+
124+
<!-- Assert product design settings "Layout empty" -->
125+
<seeElement selector="{{StorefrontProductPageDesignSection.layoutEmpty}}" stepKey="seeNewDesignChanges"/>
126+
127+
<!-- Assert Gift Option product settings -->
128+
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/>
129+
<dontSeeElement selector="{{StorefrontProductCartGiftOptionSection.giftOptions}}" stepKey="dontSeeGiftOptionBtn"/>
130+
131+
<!-- Delete created simple product -->
132+
<actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct">
133+
<argument name="product" value="_defaultProduct"/>
134+
</actionGroup>
135+
</test>
136+
</tests>

0 commit comments

Comments
 (0)