Skip to content

Commit da7e4ad

Browse files
ManikyalaraoManjusha.S
authored andcommitted
MC-26654 : create new product attribute from product page with Text Field
1 parent f60ec3b commit da7e4ad

File tree

2 files changed

+156
-0
lines changed

2 files changed

+156
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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="AddProductAttributeActionGroup">
12+
<annotations>
13+
<description>Adds the create Attribute to the Product on the Admin Product creation/edit page.</description>
14+
</annotations>
15+
16+
<click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickOnAddAttribute"/>
17+
<waitForPageLoad stepKey="waitForAttributePageToLoad"/>
18+
<click selector="{{AdminProductFormSection.createNewAttributeBtn}}" stepKey="clickCreateNewAttributeButton"/>
19+
<waitForPageLoad stepKey="waitForNewAttributePageToLoad"/>
20+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultLabel}}" stepKey="waitForDefaultLabelToBeVisible"/>
21+
<fillField selector="{{AdminCreateNewProductAttributeSection.defaultLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillAttributeLabel"/>
22+
<selectOption selector="{{AdminCreateNewProductAttributeSection.inputType}}" userInput="Text Field" stepKey="selectTextField"/>
23+
<click selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="clickOnAdvancedAttributeProperties"/>
24+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="waitForAttributeCodeToVisible"/>
25+
<scrollTo selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="scrollToAttributeCode"/>
26+
<fillField selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="fillAttributeCode"/>
27+
<fillField selector="{{AdminCreateNewProductAttributeSection.defaultValue}}" userInput="{{ProductAttributeOption8.value}}" stepKey="fillDefaultValue"/>
28+
<scrollTo selector="{{AdminCreateNewProductAttributeSection.isUnique}}" stepKey="scrollToIsUniqueOption"/>
29+
<checkOption selector="{{AdminCreateNewProductAttributeSection.isUnique}}" stepKey="enableIsUniqueOption"/>
30+
<scrollTo selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="scrollToAdvancedAttributeProperties"/>
31+
<click selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="clickOnAdvancedAttributeProperties1"/>
32+
<scrollTo selector="{{AdminCreateNewProductAttributeSection.storefrontProperties}}" stepKey="scrollToStorefrontProperties"/>
33+
<click selector="{{AdminCreateNewProductAttributeSection.storefrontProperties}}" stepKey="clickOnStorefrontProperties"/>
34+
<waitForPageLoad stepKey="waitForStoreFrontToLoad"/>
35+
<scrollTo stepKey="scroll1" selector="{{AdminCreateNewProductAttributeSection.sortProductListing}}" x="0" y="-80"/>
36+
<checkOption selector="{{AdminCreateNewProductAttributeSection.inSearch}}" stepKey="enableInSearchOption"/>
37+
<checkOption selector="{{AdminCreateNewProductAttributeSection.advancedSearch}}" stepKey="enableAdvancedSearch"/>
38+
<checkOption selector="{{AdminCreateNewProductAttributeSection.isComparable}}" stepKey="enableIsUComparableption"/>
39+
<checkOption selector="{{AdminCreateNewProductAttributeSection.allowHtmlTags}}" stepKey="enableAllowHtmlTags"/>
40+
<checkOption selector="{{AdminCreateNewProductAttributeSection.visibleOnStorefront}}" stepKey="enableVisibleOnStorefront"/>
41+
<checkOption selector="{{AdminCreateNewProductAttributeSection.sortProductListing}}" stepKey="enableSortProductListing"/>
42+
<scrollToTopOfPage stepKey="scrollToTopOfPage"/>
43+
<click selector="{{AdminCreateNewProductAttributeSection.saveAttribute}}" stepKey="clickOnSaveAttribute"/>
44+
<waitForPageLoad stepKey="waitForAttributeToSave"/>
45+
</actionGroup>
46+
</actionGroups>
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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="AddNewProductAttributeInProductPageTest">
12+
<annotations>
13+
<stories value="Create product Attribute"/>
14+
<title value="Create Product Attribute from Product Page"/>
15+
<description value="Login as admin and create new product attribute from product page with Text Field"/>
16+
<severity value="BLOCKER"/>
17+
<testCaseId value="MC-26654"/>
18+
<group value="mtf_migrated"/>
19+
</annotations>
20+
21+
<before>
22+
<!-- Login as admin -->
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
24+
25+
<!--Create Category-->
26+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
27+
28+
<!--Create Simple Product-->
29+
<createData entity="SimpleProduct" stepKey="createSimpleProduct">
30+
<requiredEntity createDataKey="createCategory"/>
31+
</createData>
32+
</before>
33+
<after>
34+
<!--Delete created entity -->
35+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
36+
37+
<!--<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>-->
38+
<actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteCreatedAttribute">
39+
<argument name="ProductAttribute" value="newProductAttribute"/>
40+
</actionGroup>
41+
42+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
43+
</after>
44+
45+
<!-- Open Product Index Page-->
46+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
47+
48+
<!-- Select Created Product-->
49+
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGridBySku">
50+
<argument name="product" value="$$createSimpleProduct$$"/>
51+
</actionGroup>
52+
<click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/>
53+
<waitForPageLoad stepKey="waitForProductToLoad"/>
54+
55+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="100" stepKey="fillProductQty"/>
56+
<actionGroup ref="AdminSetStockStatusActionGroup" stepKey="selectStockStatus">
57+
<argument name="stockStatus" value="In Stock"/>
58+
</actionGroup>
59+
60+
<!-- Create New Product Attribute -->
61+
<actionGroup ref="AddProductAttributeActionGroup" stepKey="createattribute"/>
62+
63+
<actionGroup ref="AdminProductFormSaveButtonClickActionGroup" stepKey="saveTheProduct"/>
64+
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
65+
66+
<!--Verify product attribute added in product form -->
67+
<scrollTo selector="{{AdminProductFormSection.contentTab}}" stepKey="scrollToContentTab"/>
68+
<waitForElementVisible selector="{{AdminProductFormSection.attributeTab}}" stepKey="waitForAttributeToVisible"/>
69+
<click selector="{{AdminProductFormSection.attributeTab}}" stepKey="clickOnAttribute"/>
70+
<seeElement selector="{{AdminProductFormSection.attributeLabelByText(ProductAttributeFrontendLabel.label)}}" stepKey="seeAttributeLabelInProductForm"/>
71+
72+
<!--Verify Product Attribute in Attribute Form -->
73+
<actionGroup ref="AdminOpenProductAttributePageActionGroup" stepKey="navigateToProductAttributeGrid"/>
74+
<fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="setAttributeCode"/>
75+
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/>
76+
<waitForPageLoad stepKey="waitForPageLoad" />
77+
<see selector="{{AdminProductAttributeGridSection.attributeCodeColumn}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="seeAttributeCode"/>
78+
<see selector="{{AdminProductAttributeGridSection.defaultLabelColumn}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeDefaultLabel"/>
79+
<see selector="{{AdminProductAttributeGridSection.isVisibleColumn}}" userInput="Yes" stepKey="seeIsVisibleColumn"/>
80+
<see selector="{{AdminProductAttributeGridSection.isSearchableColumn}}" userInput="Yes" stepKey="seeSearchableColumn"/>
81+
<see selector="{{AdminProductAttributeGridSection.isComparableColumn}}" userInput="Yes" stepKey="seeComparableColumn"/>
82+
83+
<!--Verify Product Attribute is present in Category Store Front Page -->
84+
<amOnPage url="$$createCategory.custom_attributes[url_key]$$.html" stepKey="goToStorefrontPage"/>
85+
<waitForPageLoad stepKey="waitForProductFrontPageToLoad"/>
86+
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="clickOnCategory"/>
87+
<waitForPageLoad stepKey="waitForCategoryPageToLoad"/>
88+
<click selector="{{StorefrontCategoryMainSection.productLink}}" stepKey="openSearchedProduct"/>
89+
<waitForPageLoad stepKey="waitForProductToLoad1"/>
90+
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{SimpleProduct.name}}" stepKey="seeProductNameInStoreFront"/>
91+
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="{{SimpleProduct.price}}" stepKey="seeProductPriceInStoreFront"/>
92+
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSkuInStoreFront">
93+
<argument name="productSku" value="{{SimpleProduct.sku}}"/>
94+
</actionGroup>
95+
<scrollTo selector="{{StorefrontProductMoreInformationSection.moreInformation}}" stepKey="scrollToMoreInformation"/>
96+
<see selector="{{StorefrontProductMoreInformationSection.attributeLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeAttributeLabel"/>
97+
<see selector="{{StorefrontProductMoreInformationSection.attributeValue}}" userInput="{{ProductAttributeOption8.value}}" stepKey="seeAttributeValue"/>
98+
99+
<!--Verify Product Attribute present in search page -->
100+
<amOnPage url="$$createCategory.custom_attributes[url_key]$$.html" stepKey="goToStorefrontPage1"/>
101+
<waitForPageLoad stepKey="waitForProductFrontPageToLoad1"/>
102+
<actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="fillAttribute">
103+
<argument name="phrase" value="{{ProductAttributeOption8.value}}"/>
104+
</actionGroup>
105+
<actionGroup ref="StorefrontAssertProductNameOnProductMainPageActionGroup" stepKey="seeProductNameInCategoryPage">
106+
<argument name="productName" value="{{SimpleProduct.name}}"/>
107+
</actionGroup>
108+
</test>
109+
</tests>
110+

0 commit comments

Comments
 (0)