Skip to content

Commit e726f8f

Browse files
Sahil.kumarManjusha.S
authored andcommitted
MQE-3312: Automation to Add New Product Attribute from Product Page
1 parent 0d5e6a5 commit e726f8f

File tree

1 file changed

+67
-64
lines changed

1 file changed

+67
-64
lines changed

app/code/Magento/Catalog/Test/Mftf/Test/AddNewProductAttributeInProductPageTest.xml

Lines changed: 67 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -25,86 +25,89 @@
2525
<!--Create Category-->
2626
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
2727

28-
<!--Create Simple Product-->
29-
<createData entity="SimpleProduct" stepKey="createSimpleProduct">
30-
<requiredEntity createDataKey="createCategory"/>
31-
</createData>
3228
</before>
3329
<after>
34-
<!--Delete created entity -->
35-
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
30+
<!--Delete created entity
31+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/> -->
3632

37-
<!--<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>-->
38-
<actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteCreatedAttribute">
39-
<argument name="ProductAttribute" value="newProductAttribute"/>
40-
</actionGroup>
33+
<!-- <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteCreatedAttribute">
34+
<argument name="ProductAttribute" value="newProductAttribute"/>
35+
</actionGroup> -->
4136

4237
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
4338
</after>
4439

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$$"/>
40+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPage"/>
41+
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="navigateToCreateProductPage">
42+
<argument name="product" value="SimpleProduct"/>
5143
</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"/>
44+
<actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm">
45+
<argument name="product" value="SimpleProduct"/>
46+
</actionGroup>
47+
<actionGroup ref="SetCategoryByNameActionGroup" stepKey="addCategoryToProduct">
48+
<argument name="categoryName" value="$createCategory.name$"/>
5849
</actionGroup>
5950

60-
<!-- Create New Product Attribute -->
61-
<actionGroup ref="AddProductAttributeActionGroup" stepKey="createattribute"/>
51+
<!-- Step 6 -->
52+
<click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickOnAddAttribute"/>
53+
<waitForPageLoad stepKey="waitForAttributePageToLoad"/>
54+
<click selector="{{AdminProductFormSection.createNewAttributeBtn}}" stepKey="clickCreateNewAttributeButton"/>
55+
<waitForPageLoad stepKey="waitForNewAttributePageToLoad"/>
56+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultLabel}}" stepKey="waitForDefaultLabelToBeVisible"/>
57+
<fillField selector="{{AdminCreateNewProductAttributeSection.defaultLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillAttributeLabel"/>
58+
<selectOption selector="{{AdminCreateNewProductAttributeSection.inputType}}" userInput="Dropdown" stepKey="selectInputType"/>
59+
<checkOption selector="{{AdminCreateNewProductAttributeSection.isRequired}}" stepKey="enableIsRequiredOption"/>
6260

63-
<actionGroup ref="AdminProductFormSaveButtonClickActionGroup" stepKey="saveTheProduct"/>
64-
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
61+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="waitForAddValueButtonToVisible"/>
62+
<click selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="clickOnAddValueButton"/>
63+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('0')}}" stepKey="waitForDefaultStoreViewToVisible"/>
64+
<fillField selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('0')}}" userInput="value 1" stepKey="fillDefaultStoreView"/>
65+
<fillField selector="{{AdminCreateNewProductAttributeSection.adminOption('0')}}" userInput="value 1 admin" stepKey="fillAdminField"/>
66+
<checkOption selector="{{AdminCreateNewProductAttributeSection.defaultRadioButton('1')}}" stepKey="selectRadioButton"/>
67+
68+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="waitForAddValueButtonToVisible2"/>
69+
<click selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="clickOnAddValueButton2"/>
70+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('1')}}" stepKey="waitForDefaultStoreViewToVisible2"/>
71+
<fillField selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('1')}}" userInput="value 2" stepKey="fillDefaultStoreView2"/>
72+
<fillField selector="{{AdminCreateNewProductAttributeSection.adminOption('1')}}" userInput="value 2 admin" stepKey="fillAdminField2"/>
73+
74+
75+
76+
<click selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="clickOnAdvancedAttributeProperties"/>
77+
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="waitForAttributeCodeToVisible"/>
78+
<scrollTo selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="scrollToAttributeCode"/>
79+
<fillField selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="fillAttributeCode"/>
80+
81+
<scrollTo selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="scrollToAdvancedAttributeProperties"/>
82+
<click selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="clickOnAdvancedAttributeProperties1"/>
83+
<scrollTo selector="{{AdminCreateNewProductAttributeSection.storefrontProperties}}" stepKey="scrollToStorefrontProperties"/>
84+
<click selector="{{AdminCreateNewProductAttributeSection.storefrontProperties}}" stepKey="clickOnStorefrontProperties"/>
85+
<waitForPageLoad stepKey="waitForStoreFrontToLoad"/>
86+
87+
88+
<scrollTo stepKey="scroll1" selector="{{AdminCreateNewProductAttributeSection.sortProductListing}}" x="0" y="-80"/>
89+
<checkOption selector="{{AdminCreateNewProductAttributeSection.inSearch}}" stepKey="enableInSearchOption"/>
90+
<checkOption selector="{{AdminCreateNewProductAttributeSection.advancedSearch}}" stepKey="enableAdvancedSearch"/>
91+
<checkOption selector="{{AdminCreateNewProductAttributeSection.isComparable}}" stepKey="enableIsUComparableption"/>
92+
93+
<!-- Step 7 -->
94+
<click selector="{{AdminCreateNewProductAttributeSection.saveAttribute}}" stepKey="clickOnSaveAttribute"/>
95+
<waitForPageLoad stepKey="waitForAttributeToSave"/>
6596

66-
<!--Verify product attribute added in product form -->
97+
98+
<!--Step 8: Verify product attribute added in product form -->
6799
<scrollTo selector="{{AdminProductFormSection.contentTab}}" stepKey="scrollToContentTab"/>
68100
<waitForElementVisible selector="{{AdminProductFormSection.attributeTab}}" stepKey="waitForAttributeToVisible"/>
69101
<click selector="{{AdminProductFormSection.attributeTab}}" stepKey="clickOnAttribute"/>
70102
<seeElement selector="{{AdminProductFormSection.attributeLabelByText(ProductAttributeFrontendLabel.label)}}" stepKey="seeAttributeLabelInProductForm"/>
103+
<seeElement selector="{{AdminProductFormSection.newAddedAttribute(newProductAttribute.attribute_code)}}" stepKey="seeAttributeCodeInProductForm"/>
104+
105+
<actionGroup ref="AdminProductFormSaveButtonClickActionGroup" stepKey="saveTheProduct"/>
106+
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
107+
108+
109+
110+
71111

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>
108112
</test>
109113
</tests>
110-

0 commit comments

Comments
 (0)