Skip to content

Commit 449fe34

Browse files
ivy00johnstomreece
authored andcommitted
MC-4418: Convert CreateProductAttributeEntityFromProductPageTest to MFTF
- Adding actions to fill in the Product Quantity so it appears in the Storefront. - Correcting data references in the Test actions so they refer to the createData vs the Data Entity.
1 parent a1890ee commit 449fe34

File tree

3 files changed

+45
-8
lines changed

3 files changed

+45
-8
lines changed

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@
1717
<testCaseId value="MC-10905"/>
1818
<group value="mtf_migrated"/>
1919
</annotations>
20+
2021
<before>
2122
<!-- Login as admin -->
2223
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
24+
2325
<!--Create Category-->
2426
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
27+
2528
<!--Create Configurable Product-->
2629
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
2730
<requiredEntity createDataKey="createCategory"/>
@@ -31,17 +34,25 @@
3134
<!--Delete created entity -->
3235
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
3336
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
37+
3438
<actionGroup ref="deleteProductAttribute" stepKey="deleteCreatedAttribute">
3539
<argument name="ProductAttribute" value="newProductAttribute"/>
3640
</actionGroup>
41+
3742
<actionGroup ref="logout" stepKey="logout"/>
3843
</after>
44+
3945
<!-- Open Product Index Page-->
4046
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
4147
<waitForPageLoad stepKey="waitForProductIndexPageToLoad"/>
48+
4249
<!-- Select Created Product-->
4350
<click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createConfigProduct.sku$$)}}"/>
4451
<waitForPageLoad stepKey="waitForProductToLoad"/>
52+
53+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="100" stepKey="fillProductQty"/>
54+
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="In Stock" stepKey="selectStockStatus"/>
55+
4556
<!-- Create New Product Attribute -->
4657
<click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickOnAddAttribute"/>
4758
<waitForPageLoad stepKey="waitForAttributePageToLoad"/>
@@ -60,7 +71,6 @@
6071
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="waitForAttributeCodeToVisible"/>
6172
<scrollTo selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="scrollToAttributeCode"/>
6273
<fillField selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="fillAttributeCode"/>
63-
<selectOption selector="{{AdminCreateNewProductAttributeSection.scope}}" userInput="Global" stepKey="selectScope"/>
6474
<scrollTo selector="{{AdminCreateNewProductAttributeSection.isUnique}}" stepKey="scrollToIsUniqueOption"/>
6575
<checkOption selector="{{AdminCreateNewProductAttributeSection.isUnique}}" stepKey="enableIsUniqueOption"/>
6676
<scrollTo selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="scrollToAdvancedAttributeProperties"/>
@@ -81,11 +91,13 @@
8191
<click selector="{{AdminProductFormSection.save}}" stepKey="saveTheProduct"/>
8292
<waitForPageLoad stepKey="waitForProductToSave"/>
8393
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
94+
8495
<!--Verify product attribute added in product form -->
8596
<scrollTo selector="{{AdminProductFormSection.contentTab}}" stepKey="scrollToContentTab"/>
8697
<waitForElementVisible selector="{{AdminProductFormSection.attributeTab}}" stepKey="waitForAttributeToVisible"/>
8798
<click selector="{{AdminProductFormSection.attributeTab}}" stepKey="clickOnAttribute"/>
8899
<seeElement selector="{{AdminProductFormSection.attributeLabelByText(ProductAttributeFrontendLabel.label)}}" stepKey="seeAttributeLabelInProductForm"/>
100+
89101
<!--Verify Product Attribute in Attribute Form -->
90102
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
91103
<fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="setAttributeCode"/>
@@ -94,30 +106,31 @@
94106
<see selector="{{AdminProductAttributeGridSection.attributeCodeColumn}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="seeAttributeCode"/>
95107
<see selector="{{AdminProductAttributeGridSection.defaultLabelColumn}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeDefaultLabel"/>
96108
<see selector="{{AdminProductAttributeGridSection.isVisibleColumn}}" userInput="Yes" stepKey="seeIsVisibleColumn"/>
97-
<see selector="{{AdminProductAttributeGridSection.scopeColumn}}" userInput="Global" stepKey="seeScopeColumn"/>
98109
<see selector="{{AdminProductAttributeGridSection.isSearchableColumn}}" userInput="Yes" stepKey="seeSearchableColumn"/>
99110
<see selector="{{AdminProductAttributeGridSection.isComparableColumn}}" userInput="Yes" stepKey="seeComparableColumn"/>
111+
100112
<!--Verify Product Attribute is present in Category Store Front Page -->
101113
<amOnPage url="$$createCategory.name$$.html" stepKey="goToStorefrontPage"/>
102114
<waitForPageLoad stepKey="waitForProductFrontPageToLoad"/>
103115
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="clickOnCategory"/>
104116
<waitForPageLoad stepKey="waitForPageToLoad"/>
105117
<click selector="{{StorefrontCategoryMainSection.productLink}}" stepKey="openSearchedProduct"/>
106118
<waitForPageLoad stepKey="waitForProductToLoad1"/>
107-
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{ApiConfigurableProduct.name}}" stepKey="seeProductNameInStoreFront"/>
108-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="{{ApiConfigurableProduct.price}}" stepKey="seeProductPriceInStoreFront"/>
109-
<see selector="{{StorefrontProductInfoMainSection.productSku}}" userInput="{{ApiConfigurableProduct.sku}}" stepKey="seeProductSkuInStoreFront"/>
119+
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeProductNameInStoreFront"/>
120+
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigProduct.price$$" stepKey="seeProductPriceInStoreFront"/>
121+
<see selector="{{StorefrontProductInfoMainSection.productSku}}" userInput="$$createConfigProduct.sku$$" stepKey="seeProductSkuInStoreFront"/>
110122
<scrollTo selector="{{StorefrontProductMoreInformationSection.moreInformation}}" stepKey="scrollToMoreInformation"/>
111123
<see selector="{{StorefrontProductMoreInformationSection.attributeLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeAttributeLabel"/>
112124
<see selector="{{StorefrontProductMoreInformationSection.attributeValue}}" userInput="{{ProductAttributeOption8.value}}" stepKey="seeAttributeValue"/>
125+
113126
<!--Verify Product Attribute present in search page -->
114127
<amOnPage url="$$createCategory.name$$.html" stepKey="goToStorefrontPage1"/>
115128
<waitForPageLoad stepKey="waitForProductFrontPageToLoad1"/>
116129
<fillField selector="{{StorefrontQuickSearchResultsSection.searchTextBox}}" userInput="{{ProductAttributeOption8.value}}" stepKey="fillAttribute"/>
117130
<waitForPageLoad stepKey="waitForSearchTextBox"/>
118131
<click selector="{{StorefrontQuickSearchResultsSection.searchTextBoxButton}}" stepKey="clickSearchTextBoxButton"/>
119132
<waitForPageLoad stepKey="waitForSearchResultToLoad"/>
120-
<see selector="{{StorefrontCategoryMainSection.productName}}" userInput="{{ApiConfigurableProduct.name}}" stepKey="seeProductNameInCategoryPage"/>
133+
<see selector="{{StorefrontCategoryMainSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeProductNameInCategoryPage"/>
121134
<see selector="{{StorefrontCategoryMainSection.productOptionList}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeProductAttributeOptionInCategoryPage"/>
122135
</test>
123136
</tests>

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@
1717
<testCaseId value="MC-10899"/>
1818
<group value="mtf_migrated"/>
1919
</annotations>
20+
2021
<before>
2122
<!-- Login as admin -->
2223
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
24+
2325
<!--Create Category-->
2426
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
27+
2528
<!--Create Simple Product-->
2629
<createData entity="SimpleProduct" stepKey="createSimpleProduct">
2730
<requiredEntity createDataKey="createCategory"/>
@@ -30,18 +33,26 @@
3033
<after>
3134
<!--Delete created entity -->
3235
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
36+
3337
<!--<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>-->
3438
<actionGroup ref="deleteProductAttribute" stepKey="deleteCreatedAttribute">
3539
<argument name="ProductAttribute" value="newProductAttribute"/>
3640
</actionGroup>
41+
3742
<actionGroup ref="logout" stepKey="logout"/>
3843
</after>
44+
3945
<!-- Open Product Index Page-->
4046
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
4147
<waitForPageLoad stepKey="waitForProductIndexPageToLoad"/>
48+
4249
<!-- Select Created Product-->
4350
<click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/>
4451
<waitForPageLoad stepKey="waitForProductToLoad"/>
52+
53+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="100" stepKey="fillProductQty"/>
54+
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="In Stock" stepKey="selectStockStatus"/>
55+
4556
<!-- Create New Product Attribute -->
4657
<click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickOnAddAttribute"/>
4758
<waitForPageLoad stepKey="waitForAttributePageToLoad"/>
@@ -54,7 +65,6 @@
5465
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="waitForAttributeCodeToVisible"/>
5566
<scrollTo selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="scrollToAttributeCode"/>
5667
<fillField selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="fillAttributeCode"/>
57-
<selectOption selector="{{AdminCreateNewProductAttributeSection.scope}}" userInput="Global" stepKey="selectScope"/>
5868
<fillField selector="{{AdminCreateNewProductAttributeSection.defaultValue}}" userInput="{{ProductAttributeOption8.value}}" stepKey="fillDefaultValue"/>
5969
<scrollTo selector="{{AdminCreateNewProductAttributeSection.isUnique}}" stepKey="scrollToIsUniqueOption"/>
6070
<checkOption selector="{{AdminCreateNewProductAttributeSection.isUnique}}" stepKey="enableIsUniqueOption"/>
@@ -76,11 +86,13 @@
7686
<click selector="{{AdminProductFormSection.save}}" stepKey="saveTheProduct"/>
7787
<waitForPageLoad stepKey="waitForProductToSave"/>
7888
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
89+
7990
<!--Verify product attribute added in product form -->
8091
<scrollTo selector="{{AdminProductFormSection.contentTab}}" stepKey="scrollToContentTab"/>
8192
<waitForElementVisible selector="{{AdminProductFormSection.attributeTab}}" stepKey="waitForAttributeToVisible"/>
8293
<click selector="{{AdminProductFormSection.attributeTab}}" stepKey="clickOnAttribute"/>
8394
<seeElement selector="{{AdminProductFormSection.attributeLabelByText(ProductAttributeFrontendLabel.label)}}" stepKey="seeAttributeLabelInProductForm"/>
95+
8496
<!--Verify Product Attribute in Attribute Form -->
8597
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
8698
<fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="setAttributeCode"/>
@@ -89,9 +101,9 @@
89101
<see selector="{{AdminProductAttributeGridSection.attributeCodeColumn}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="seeAttributeCode"/>
90102
<see selector="{{AdminProductAttributeGridSection.defaultLabelColumn}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeDefaultLabel"/>
91103
<see selector="{{AdminProductAttributeGridSection.isVisibleColumn}}" userInput="Yes" stepKey="seeIsVisibleColumn"/>
92-
<see selector="{{AdminProductAttributeGridSection.scopeColumn}}" userInput="Global" stepKey="seeScopeColumn"/>
93104
<see selector="{{AdminProductAttributeGridSection.isSearchableColumn}}" userInput="Yes" stepKey="seeSearchableColumn"/>
94105
<see selector="{{AdminProductAttributeGridSection.isComparableColumn}}" userInput="Yes" stepKey="seeComparableColumn"/>
106+
95107
<!--Verify Product Attribute is present in Category Store Front Page -->
96108
<amOnPage url="$$createCategory.name$$.html" stepKey="goToStorefrontPage"/>
97109
<waitForPageLoad stepKey="waitForProductFrontPageToLoad"/>
@@ -105,6 +117,7 @@
105117
<scrollTo selector="{{StorefrontProductMoreInformationSection.moreInformation}}" stepKey="scrollToMoreInformation"/>
106118
<see selector="{{StorefrontProductMoreInformationSection.attributeLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeAttributeLabel"/>
107119
<see selector="{{StorefrontProductMoreInformationSection.attributeValue}}" userInput="{{ProductAttributeOption8.value}}" stepKey="seeAttributeValue"/>
120+
108121
<!--Verify Product Attribute present in search page -->
109122
<amOnPage url="$$createCategory.name$$.html" stepKey="goToStorefrontPage1"/>
110123
<waitForPageLoad stepKey="waitForProductFrontPageToLoad1"/>

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@
1717
<testCaseId value="MC-10906"/>
1818
<group value="mtf_migrated"/>
1919
</annotations>
20+
2021
<before>
2122
<!-- Login as admin -->
2223
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
24+
2325
<!--Create Category-->
2426
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
27+
2528
<!--Create Simple Product-->
2629
<createData entity="SimpleProduct" stepKey="createSimpleProduct">
2730
<requiredEntity createDataKey="createCategory"/>
@@ -36,12 +39,18 @@
3639
</actionGroup>
3740
<actionGroup ref="logout" stepKey="logout"/>
3841
</after>
42+
3943
<!-- Open Product Index Page-->
4044
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
4145
<waitForPageLoad stepKey="waitForProductIndexPageToLoad"/>
46+
4247
<!-- Select Created Product-->
4348
<click stepKey="openFirstProduct" selector="{{AdminProductGridSection.productRowBySku($$createSimpleProduct.sku$$)}}"/>
4449
<waitForPageLoad stepKey="waitForProductToLoad"/>
50+
51+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="100" stepKey="fillProductQty"/>
52+
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="In Stock" stepKey="selectStockStatus"/>
53+
4554
<!-- Create Product Attribute -->
4655
<click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickOnAddAttribute"/>
4756
<waitForPageLoad stepKey="waitForAttributePageToLoad"/>
@@ -64,10 +73,12 @@
6473
<waitForPageLoad stepKey="waitForAttributeToSave"/>
6574
<click selector="{{AdminProductFormSection.save}}" stepKey="saveTheProduct"/>
6675
<waitForPageLoad stepKey="waitForProductToSave"/>
76+
6777
<!--Verify product attribute added in product form and Is Required message displayed-->
6878
<scrollTo selector="{{AdminProductFormSection.contentTab}}" stepKey="scrollToContentTab"/>
6979
<waitForElementVisible selector="{{AdminProductFormSection.attributeTab}}" stepKey="waitForAttributeToVisible"/>
7080
<seeElement selector="{{AdminProductFormSection.attributeFieldError}}" stepKey="seeAttributeInputFiledErrorMessage"/>
81+
7182
<!--Fill the Required field and save the product -->
7283
<fillField selector="{{AdminProductFormSection.attributeRequiredInput(newProductAttribute.attribute_code)}}" userInput="attribute" stepKey="fillTheAttributeRequiredInputField"/>
7384
<scrollToTopOfPage stepKey="scrollToTopOfProductFormPage"/>

0 commit comments

Comments
 (0)