Skip to content

Commit 87d870c

Browse files
committed
#30362:Fixed Redirect to the store view when trying to save attribute
Added MFTF Test coverage
1 parent 6ffb8b1 commit 87d870c

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminCreateNewProductAttributeSection">
1212
<element name="saveAttribute" type="button" selector="#save" timeout="30"/>
13+
<element name="closeAttribute" type="button" selector="#cancel" timeout="30"/>
1314
<element name="defaultLabel" type="input" selector="input[name='frontend_label[0]']"/>
1415
<element name="inputType" type="select" selector="select[name='frontend_input']" timeout="30"/>
1516
<element name="addValue" type="button" selector="//button[contains(@data-action,'add_new_row')]" timeout="30"/>
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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="AdminVerifyCreateCloseCreateCustomProductAttributeTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Create product Attribute"/>
15+
<title value="Create Custom Product Attribute Dropdown Field (Not Required) from Product Page"/>
16+
<description
17+
value="login as admin and create simple product attribute Dropdown field after closing the new attribute window"/>
18+
<severity value="MAJOR"/>
19+
<testCaseId value="MC-30362"/>
20+
<group value="catalog"/>
21+
</annotations>
22+
<before>
23+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
24+
<createData entity="SimpleProduct" stepKey="createProduct">
25+
<requiredEntity createDataKey="createCategory"/>
26+
</createData>
27+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdminPanel"/>
28+
</before>
29+
<after>
30+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
31+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
32+
<actionGroup ref="AdminDeleteProductAttributeByLabelActionGroup" stepKey="deleteCreatedAttribute">
33+
<argument name="productAttributeLabel" value="{{ProductAttributeFrontendLabel.label}}"/>
34+
</actionGroup>
35+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdminPanel"/>
36+
</after>
37+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="navigateToProductPage">
38+
<argument name="productId" value="$createProduct.id$"/>
39+
</actionGroup>
40+
<!-- Attribute creation -->
41+
<click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickOnAddAttribute"/>
42+
<waitForElementVisible selector="{{AdminProductFormSection.createNewAttributeBtn}}" stepKey="waitForCreateBtn"/>
43+
<click selector="{{AdminProductFormSection.createNewAttributeBtn}}" stepKey="clickCreateNewAttributeButton"/>
44+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultLabel}}"
45+
stepKey="waitForLabelInput"/>
46+
<!-- Close creation window few times -->
47+
<click selector="{{AdminCreateNewProductAttributeSection.closeAttribute}}"
48+
stepKey="clickCloseNewAttributeWindowButton"/>
49+
<waitForElementVisible selector="{{AdminProductFormSection.createNewAttributeBtn}}"
50+
stepKey="waitForCreateBtn2"/>
51+
<click selector="{{AdminProductFormSection.createNewAttributeBtn}}" stepKey="clickCreateNewAttributeButton2"/>
52+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultLabel}}"
53+
stepKey="waitForLabelInput2"/>
54+
<click selector="{{AdminCreateNewProductAttributeSection.closeAttribute}}"
55+
stepKey="clickCloseNewAttributeWindowButton2"/>
56+
<waitForElementVisible selector="{{AdminProductFormSection.createNewAttributeBtn}}"
57+
stepKey="waitForCreateBtn3"/>
58+
<click selector="{{AdminProductFormSection.createNewAttributeBtn}}" stepKey="clickCreateNewAttributeButton3"/>
59+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultLabel}}"
60+
stepKey="waitForLabelInput3"/>
61+
<!-- Fill attribute data and save -->
62+
<fillField selector="{{AdminCreateNewProductAttributeSection.defaultLabel}}"
63+
userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillAttributeLabel"/>
64+
<selectOption selector="{{AdminCreateNewProductAttributeSection.inputType}}" userInput="Dropdown"
65+
stepKey="setInputType"/>
66+
<click selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}"
67+
stepKey="clickOnAdvancedAttributeProperties"/>
68+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.attributeCode}}"
69+
stepKey="waitForAttributeCodeToVisible"/>
70+
<fillField selector="{{AdminCreateNewProductAttributeSection.attributeCode}}"
71+
userInput="{{newProductAttribute.attribute_code}}" stepKey="fillAttributeCode"/>
72+
<scrollTo selector="{{AdminCreateNewProductAttributeSection.storefrontProperties}}"
73+
stepKey="scrollToStorefrontProperties"/>
74+
<click selector="{{AdminCreateNewProductAttributeSection.storefrontProperties}}"
75+
stepKey="clickOnStorefrontProperties"/>
76+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.inSearch}}"
77+
stepKey="waitForStoreFrontProperties"/>
78+
<checkOption selector="{{AdminCreateNewProductAttributeSection.inSearch}}" stepKey="enableInSearchOption"/>
79+
<checkOption selector="{{AdminCreateNewProductAttributeSection.advancedSearch}}"
80+
stepKey="enableAdvancedSearch"/>
81+
<checkOption selector="{{AdminCreateNewProductAttributeSection.visibleOnStorefront}}"
82+
stepKey="enableVisibleOnStorefront"/>
83+
<checkOption selector="{{AdminCreateNewProductAttributeSection.sortProductListing}}"
84+
stepKey="enableSortProductListing"/>
85+
<actionGroup ref="AdminAddOptionForDropdownAttributeActionGroup" stepKey="createDropdownOption">
86+
<argument name="storefrontViewAttributeValue" value="{{ProductAttributeOption8.label}}"/>
87+
<argument name="adminAttributeLabel" value="{{ProductAttributeOption8.label}}"/>
88+
</actionGroup>
89+
<checkOption selector="{{AdminCreateNewProductAttributeSection.defaultRadioButton('1')}}"
90+
stepKey="selectRadioButton"/>
91+
<click selector="{{AdminCreateNewProductAttributeSection.saveAttribute}}" stepKey="clickOnSaveAttribute"/>
92+
<!-- Check if the product page after attribute save-->
93+
<seeInCurrentUrl url="{{AdminProductEditPage.url($createProduct.id$)}}" stepKey="seeRedirectToProductPage"/>
94+
</test>
95+
</tests>

0 commit comments

Comments
 (0)