Skip to content

Commit 2e863d6

Browse files
authored
Merge pull request #3885 from magento-pangolin/mtf-eol-pr
[pangolins] Convert MTF tests to MFTF tests - closes magento-commerce/magento-functional-tests-migration#417 - closes magento-commerce/magento-functional-tests-migration#632
2 parents a55c94f + 5aef2fb commit 2e863d6

File tree

86 files changed

+2351
-19
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+2351
-19
lines changed

app/code/Magento/Backup/Test/Mftf/ActionGroup/DeleteBackupActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
<click selector="{{AdminGridActionSection.submitButton}}" stepKey="clickSubmit"/>
2020
<waitForPageLoad stepKey="waitForConfirmWindowToAppear"/>
2121
<see selector="{{AdminConfirmationModalSection.message}}" userInput="Are you sure you want to delete the selected backup(s)?" stepKey="seeConfirmationModal"/>
22+
<waitForPageLoad stepKey="waitForSubmitAction"/>
2223
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="clickOkConfirmDelete"/>
2324
<dontSee selector="{{AdminGridTableSection.backupNameColumn}}" userInput="{{backup.name}}" stepKey="dontSeeBackupInGrid"/>
2425
</actionGroup>
25-
2626
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryActionGroup.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,4 +302,18 @@
302302
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton"/>
303303
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the product." stepKey="seeSaveProductMessage"/>
304304
</actionGroup>
305+
<actionGroup name="FillCategoryNameAndUrlKeyAndSave">
306+
<arguments>
307+
<argument name="categoryName" type="string"/>
308+
<argument name="categoryUrlKey" type="string"/>
309+
</arguments>
310+
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{categoryName}}" stepKey="enterCategoryName"/>
311+
<scrollTo selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="scrollToSearchEngineOptimization"/>
312+
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSEO"/>
313+
<waitForPageLoad stepKey="waitForPageToLoad"/>
314+
<fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{categoryUrlKey}}" stepKey="enterURLKey"/>
315+
<scrollToTopOfPage stepKey="scrollToTheTopOfPage"/>
316+
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
317+
<waitForPageLoad stepKey="waitForPageToLoad1"/>
318+
</actionGroup>
305319
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Product" stepKey="seeNewProductTitle"/>
2121
</actionGroup>
2222

23-
<!--Fill main fields in create product form-->
23+
<!-- Fill main fields in create product form using a product entity -->
2424
<actionGroup name="fillMainProductForm">
2525
<arguments>
2626
<argument name="product" defaultValue="_defaultProduct"/>
@@ -34,6 +34,25 @@
3434
<fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{product.weight}}" stepKey="fillProductWeight"/>
3535
</actionGroup>
3636

37+
<!-- Fill main fields in create product form using strings for flexibility -->
38+
<actionGroup name="FillMainProductFormByString">
39+
<arguments>
40+
<argument name="productName" type="string"/>
41+
<argument name="productSku" type="string"/>
42+
<argument name="productPrice" type="string"/>
43+
<argument name="productQuantity" type="string"/>
44+
<argument name="productStatus" type="string"/>
45+
<argument name="productWeight" type="string"/>
46+
</arguments>
47+
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{productName}}" stepKey="fillProductName"/>
48+
<fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{productSku}}" stepKey="fillProductSku"/>
49+
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{productPrice}}" stepKey="fillProductPrice"/>
50+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{productQuantity}}" stepKey="fillProductQty"/>
51+
<selectOption selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{productStatus}}" stepKey="selectStockStatus"/>
52+
<selectOption selector="{{AdminProductFormSection.productWeightSelect}}" userInput="This item has weight" stepKey="selectWeight"/>
53+
<fillField selector="{{AdminProductFormSection.productWeight}}" userInput="{{productWeight}}" stepKey="fillProductWeight"/>
54+
</actionGroup>
55+
3756
<!--Fill main fields in create product form with no weight, useful for virtual and downloadable products -->
3857
<actionGroup name="fillMainProductFormNoWeight">
3958
<arguments>
@@ -77,6 +96,11 @@
7796
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product." stepKey="seeSaveConfirmation"/>
7897
</actionGroup>
7998

99+
<!-- Save product but do not expect a success message -->
100+
<actionGroup name="SaveProductFormNoSuccessCheck" extends="saveProductForm">
101+
<remove keyForRemoval="seeSaveConfirmation"/>
102+
</actionGroup>
103+
80104
<!--Upload image for product-->
81105
<actionGroup name="addProductImage">
82106
<arguments>
@@ -389,6 +413,22 @@
389413
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
390414
<fillField userInput="{{product.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/>
391415
</actionGroup>
416+
417+
<actionGroup name="SetProductUrlKeyByString">
418+
<arguments>
419+
<argument name="urlKey" type="string"/>
420+
</arguments>
421+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
422+
<fillField userInput="{{urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/>
423+
</actionGroup>
424+
425+
<actionGroup name="SetCategoryByName">
426+
<arguments>
427+
<argument name="categoryName" type="string"/>
428+
</arguments>
429+
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{categoryName}}]" stepKey="searchAndSelectCategory"/>
430+
</actionGroup>
431+
392432
<actionGroup name="expandAdminProductSection">
393433
<arguments>
394434
<argument name="sectionSelector" defaultValue="{{AdminProductContentSection.sectionHeader}}" type="string"/>
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="AssertProductInfoOnEditPageActionGroup" extends="OpenEditProductOnBackendActionGroup">
12+
<arguments>
13+
<argument name="product" type="entity"/>
14+
</arguments>
15+
<waitForPageLoad stepKey="waitForProductToLoad"/>
16+
<seeInField selector="{{AdminProductFormSection.productName}}" userInput="{{product.name}}" stepKey="seeProductName"/>
17+
<seeInField selector="{{AdminProductFormSection.productSku}}" userInput="{{product.sku}}" stepKey="seeProductSku"/>
18+
<seeInField selector="{{AdminProductFormSection.productPrice}}" userInput="{{product.price}}" stepKey="seeProductPrice"/>
19+
<seeInField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{product.quantity}}" stepKey="seeProductQuantity"/>
20+
<seeInField selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{product.status}}" stepKey="seeProductStockStatus"/>
21+
</actionGroup>
22+
</actionGroups>
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertProductOnAdminGridActionGroup" extends="viewProductInAdminGrid">
12+
<arguments>
13+
<argument name="product" defaultValue="_defaultProduct"/>
14+
</arguments>
15+
<remove keyForRemoval="clickClearFiltersAfter"/>
16+
</actionGroup>
17+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Data/CatalogSpecialPriceData.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,9 @@
1212
<data key="store_id">0</data>
1313
<var key="sku" entityType="product2" entityKey="sku" />
1414
</entity>
15+
<entity name="specialProductPrice2" type="catalogSpecialPrice">
16+
<data key="price">55.55</data>
17+
<data key="store_id">0</data>
18+
<var key="sku" entityType="product" entityKey="sku" />
19+
</entity>
1520
</entities>

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,48 @@
6060
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
6161
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
6262
</entity>
63+
<entity name="SimpleProductAfterImport1" type="product">
64+
<data key="sku">SimpleProductForTest1</data>
65+
<data key="type_id">simple</data>
66+
<data key="attribute_set_id">4</data>
67+
<data key="name">SimpleProductAfterImport1</data>
68+
<data key="price">250.00</data>
69+
<data key="visibility">4</data>
70+
<data key="status">1</data>
71+
<data key="quantity">100</data>
72+
<data key="urlKey">simple-product-for-test-1</data>
73+
<data key="weight">1</data>
74+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
75+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
76+
</entity>
77+
<entity name="SimpleProductAfterImport2" type="product">
78+
<data key="sku">SimpleProductForTest2</data>
79+
<data key="type_id">simple</data>
80+
<data key="attribute_set_id">4</data>
81+
<data key="name">SimpleProductAfterImport2</data>
82+
<data key="price">300.00</data>
83+
<data key="visibility">4</data>
84+
<data key="status">1</data>
85+
<data key="quantity">100</data>
86+
<data key="urlKey">simple-product-for-test-2</data>
87+
<data key="weight">1</data>
88+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
89+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
90+
</entity>
91+
<entity name="SimpleProductAfterImport3" type="product">
92+
<data key="sku">SimpleProductForTest3</data>
93+
<data key="type_id">simple</data>
94+
<data key="attribute_set_id">4</data>
95+
<data key="name">SimpleProductAfterImport3</data>
96+
<data key="price">350.00</data>
97+
<data key="visibility">4</data>
98+
<data key="status">1</data>
99+
<data key="quantity">100</data>
100+
<data key="urlKey">simple-product-for-test-3</data>
101+
<data key="weight">1</data>
102+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
103+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
104+
</entity>
63105
<entity name="SimpleProduct2" type="product">
64106
<data key="sku" unique="suffix">SimpleProduct</data>
65107
<data key="type_id">simple</data>
@@ -906,4 +948,20 @@
906948
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
907949
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
908950
</entity>
951+
<entity name="simpleProductWithoutCategory" type="product">
952+
<data key="sku" unique="suffix">sku_simple_product_</data>
953+
<data key="type_id">simple</data>
954+
<data key="attribute_set_id">4</data>
955+
<data key="visibility">4</data>
956+
<data key="name" unique="suffix">SimpleProduct</data>
957+
<data key="price">560</data>
958+
<data key="urlKey" unique="suffix">simple-product-</data>
959+
<data key="status">1</data>
960+
<data key="quantity">25</data>
961+
<data key="weight">1</data>
962+
<data key="product_has_weight">1</data>
963+
<data key="is_in_stock">1</data>
964+
<data key="tax_class_id">2</data>
965+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
966+
</entity>
909967
</entities>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminCategoryMessagesSection">
1212
<element name="SuccessMessage" type="text" selector=".message-success"/>
13+
<element name="errorMessage" type="text" selector="//div[@class='message message-error error']"/>
1314
</section>
1415
</sections>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<element name="addValue" type="button" selector="//button[contains(@data-action,'add_new_row')]" timeout="30"/>
1616
<element name="defaultStoreView" type="input" selector="//input[contains(@name,'option[value][option_{{row}}][1]')]" parameterized="true"/>
1717
<element name="adminOption" type="input" selector="//input[contains(@name,'option[value][option_{{row}}][0]')]" parameterized="true"/>
18-
<element name="defaultRadioButton" type="radio" selector="//tr[{{row}}]//input[contains(@name,'default[]')]/..//label" parameterized="true"/>
18+
<element name="defaultRadioButton" type="radio" selector="//tr[{{row}}]//input[contains(@name,'default[]')]" parameterized="true"/>
1919
<element name="isRequired" type="checkbox" selector="//input[contains(@name,'is_required')]/..//label"/>
2020
<element name="advancedAttributeProperties" type="text" selector="//div[contains(@data-index,'advanced_fieldset')]"/>
2121
<element name="attributeCode" type="input" selector="//*[@class='admin__fieldset-wrapper-content admin__collapsible-content _show']//input[@name='attribute_code']"/>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
<section name="StorefrontMessagesSection">
1212
<element name="success" type="text" selector="div.message-success.success.message"/>
1313
<element name="error" type="text" selector="div.message-error.error.message"/>
14-
<element name="noticeMessage" type="text" selector="div.message-notice"/>
14+
<element name="noticeMessage" type="text" selector="div.message.notice div"/>
1515
</section>
1616
</sections>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateDuplicateCategoryTest">
11+
<annotations>
12+
<stories value="Create category"/>
13+
<title value="Create Duplicate Category With Already Existed UrlKey"/>
14+
<description value="Login as admin and create duplicate category"/>
15+
<testCaseId value="MC-14702"/>
16+
<severity value="CRITICAL"/>
17+
<group value="mtf_migrated"/>
18+
</annotations>
19+
20+
<before>
21+
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/>
22+
<createData entity="SimpleSubCategory" stepKey="category"/>
23+
</before>
24+
<after>
25+
<deleteData createDataKey="category" stepKey="deleteCategory"/>
26+
<actionGroup ref="logout" stepKey="logout"/>
27+
</after>
28+
29+
<!-- Open Category Page and select Add category -->
30+
<actionGroup ref="goToCreateCategoryPage" stepKey="goToCategoryPage"/>
31+
32+
<!-- Fill the Category form with same name and urlKey as initially created category(SimpleSubCategory) -->
33+
<actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillCategoryForm">
34+
<argument name="categoryName" value="$$category.name$$"/>
35+
<argument name="categoryUrlKey" value="$$category.custom_attributes[url_key]$$"/>
36+
</actionGroup>
37+
38+
<!-- Assert error message -->
39+
<see selector="{{AdminCategoryMessagesSection.errorMessage}}" userInput="The value specified in the URL Key field would generate a URL that already exists." stepKey="seeErrorMessage"/>
40+
</test>
41+
</tests>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateDuplicateProductTest">
11+
<annotations>
12+
<stories value="Create Product"/>
13+
<title value="Create Duplicate Product With Existed Subcategory Name And UrlKey"/>
14+
<description value="Login as admin and create duplicate Product"/>
15+
<testCaseId value="MC-14714"/>
16+
<severity value="CRITICAL"/>
17+
<group value="mtf_migrated"/>
18+
</annotations>
19+
20+
<before>
21+
<createData entity="SubCategory" stepKey="category"/>
22+
<createData entity="Two_nested_categories" stepKey="subCategory">
23+
<requiredEntity createDataKey="category"/>
24+
</createData>
25+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
26+
</before>
27+
28+
<after>
29+
<deleteData createDataKey="subCategory" stepKey="deleteSubCategory"/>
30+
<deleteData createDataKey="category" stepKey="deleteCategory"/>
31+
<actionGroup ref="logout" stepKey="logout"/>
32+
</after>
33+
34+
<!-- Go to new simple product page -->
35+
<actionGroup ref="GoToSpecifiedCreateProductPage" stepKey="goToCreateProductPage"/>
36+
37+
<!-- Fill the main fields in the form -->
38+
<actionGroup ref="FillMainProductFormByString" stepKey="fillMainProductForm">
39+
<argument name="productName" value="$$subCategory.name$$"/>
40+
<argument name="productSku" value="{{defaultSimpleProduct.sku}}"/>
41+
<argument name="productPrice" value="{{defaultSimpleProduct.price}}"/>
42+
<argument name="productQuantity" value="{{defaultSimpleProduct.quantity}}"/>
43+
<argument name="productStatus" value="{{defaultSimpleProduct.status}}"/>
44+
<argument name="productWeight" value="{{defaultSimpleProduct.weight}}"/>
45+
</actionGroup>
46+
47+
<!-- Select the category that we created in the before block -->
48+
<actionGroup ref="SetCategoryByName" stepKey="setCategory">
49+
<argument name="categoryName" value="$$category.name$$"/>
50+
</actionGroup>
51+
52+
<!-- Set the url key to match the subcategory created in the before block -->
53+
<actionGroup ref="SetProductUrlKeyByString" stepKey="fillUrlKey">
54+
<argument name="urlKey" value="$$subCategory.custom_attributes[url_key]$$"/>
55+
</actionGroup>
56+
57+
<!-- Save the product and expect to see an error message -->
58+
<actionGroup ref="SaveProductFormNoSuccessCheck" stepKey="tryToSaveProduct"/>
59+
<see selector="{{AdminProductFormSection.successMessage}}" userInput="The value specified in the URL Key field would generate a URL that already exists." stepKey="seeErrorMessage"/>
60+
</test>
61+
</tests>

0 commit comments

Comments
 (0)