Skip to content

Commit 13d54f9

Browse files
author
Joan He
authored
Merge pull request #2128 from magento-pangolin/MAGETWO-87709
[pangolin] MAGETWO-87704: [MFTF] Automate MAGETWO-87504
2 parents b050660 + af9e488 commit 13d54f9

27 files changed

+556
-87
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductActionGroup.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,40 @@
6060
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="{{image.file}}" stepKey="uploadFile"/>
6161
<waitForAjaxLoad stepKey="waitForAjaxUpload"/>
6262
</actionGroup>
63+
64+
<!--Fill fields for simple product in a category in Admin-->
65+
<actionGroup name="FillAdminSimpleProductForm">
66+
<arguments>
67+
<argument name="category"/>
68+
<argument name="simpleProduct"/>
69+
</arguments>
70+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
71+
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/>
72+
<click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/>
73+
<fillField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/>
74+
<fillField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/>
75+
<fillField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/>
76+
<fillField userInput="{{simpleProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/>
77+
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{category.name}}]" stepKey="searchAndSelectCategory"/>
78+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
79+
<fillField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/>
80+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/>
81+
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveMessageSuccess"/>
82+
<seeInField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="assertFieldName"/>
83+
<seeInField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="assertFieldSku"/>
84+
<seeInField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="assertFieldPrice"/>
85+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSectionAssert"/>
86+
<seeInField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="assertFieldUrlKey"/>
87+
</actionGroup>
88+
89+
<!--Assert text in Related, Up-Sell or Cross-Sell section in Admin Product page-->
90+
<actionGroup name="AssertTextInAdminProductRelatedUpSellCrossSellSection">
91+
<arguments>
92+
<argument name="element" defaultValue="AdminProductFormRelatedUpSellCrossSellSection.relatedProductSectionText"/>
93+
<argument name="expectedText"/>
94+
</arguments>
95+
<conditionalClick selector="{{AdminProductFormSection.productFormTab('Related Products')}}" dependentSelector="{{AdminProductFormSection.productFormTabState('Related Products', 'closed')}}" visible="true" stepKey="openTab"/>
96+
<waitForPageLoad time="30" stepKey="waitForPageLoad"/>
97+
<see selector="{{element}}" userInput="{{expectedText}}" stepKey="AssertText"/>
98+
</actionGroup>
6399
</actionGroups>
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertProductInStorefrontCategoryPage">
12+
<arguments>
13+
<argument name="category"/>
14+
<argument name="product"/>
15+
</arguments>
16+
<!-- Go to storefront category page, assert product visibility -->
17+
<amOnPage url="{{StorefrontCategoryPage.url(category.name)}}" stepKey="navigateToCategoryPage"/>
18+
<waitForPageLoad stepKey="waitForPageLoad1"/>
19+
<see userInput="{{product.name}}" stepKey="assertProductPresent"/>
20+
<see userInput="{{product.price}}" stepKey="assertProductPricePresent"/>
21+
</actionGroup>
22+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertProductInStorefrontProductPage">
12+
<arguments>
13+
<argument name="product"/>
14+
</arguments>
15+
<!-- Go to storefront product page, assert product visibility -->
16+
<amOnPage url="{{product.urlKey}}.html" stepKey="navigateToProductPage"/>
17+
<waitForPageLoad stepKey="waitForPageLoad2"/>
18+
<seeInTitle userInput="{{product.name}}" stepKey="assertProductNameTitle"/>
19+
<see userInput="{{product.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/>
20+
<see userInput="{{product.price}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPrice"/>
21+
<see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/>
22+
</actionGroup>
23+
</actionGroups>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/NewProductActionGroup.xml

Lines changed: 0 additions & 30 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10+
<!--Click Add to Cart button in storefront product page-->
11+
<actionGroup name="addToCartFromStorefrontProductPage">
12+
<arguments>
13+
<argument name="productName"/>
14+
</arguments>
15+
<click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart"/>
16+
<waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAdding"/>
17+
<waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdding"/>
18+
<waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAdded"/>
19+
<waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdded"/>
20+
<waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAddToCart}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAddToCart"/>
21+
<waitForPageLoad stepKey="waitForPageLoad"/>
22+
<see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
23+
</actionGroup>
24+
</actionGroups>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductAttributeData.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,25 @@
5252
<data key="used_for_sort_by">true</data>
5353
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
5454
</entity>
55+
<entity name="productDropDownAttribute" type="ProductAttribute">
56+
<data key="attribute_code" unique="suffix">attribute</data>
57+
<data key="frontend_input">select</data>
58+
<data key="scope">global</data>
59+
<data key="is_required">false</data>
60+
<data key="is_unique">false</data>
61+
<data key="is_searchable">true</data>
62+
<data key="is_visible">true</data>
63+
<data key="is_visible_in_advanced_search">true</data>
64+
<data key="is_visible_on_front">true</data>
65+
<data key="is_filterable">true</data>
66+
<data key="is_filterable_in_search">true</data>
67+
<data key="used_in_product_listing">true</data>
68+
<data key="is_used_for_promo_rules">true</data>
69+
<data key="is_comparable">true</data>
70+
<data key="is_used_in_grid">true</data>
71+
<data key="is_visible_in_grid">true</data>
72+
<data key="is_filterable_in_grid">true</data>
73+
<data key="used_for_sort_by">true</data>
74+
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
75+
</entity>
5576
</entities>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,35 @@
102102
<data key="status">1</data>
103103
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
104104
</entity>
105+
<entity name="SimpleTwo" type="product2">
106+
<data key="sku" unique="suffix">SimpleTwo</data>
107+
<data key="type_id">simple</data>
108+
<data key="attribute_set_id">4</data>
109+
<data key="name" unique="suffix">SimpleProduct</data>
110+
<data key="price">1.23</data>
111+
<data key="visibility">4</data>
112+
<data key="status">1</data>
113+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
114+
<requiredEntity type="custom_attribute">CustomAttributeProductUrlKey</requiredEntity>
115+
</entity>
105116
<entity name="ImageUpload" type="uploadImage">
106117
<data key="title" unique="suffix">Image1</data>
107118
<data key="price">1.00</data>
108119
<data key="file_type">Upload File</data>
109120
<data key="shareable">Yes</data>
110121
<data key="file">magento-logo.png</data>
111122
</entity>
123+
<entity name="ProductWithUnicode" type="product">
124+
<data key="sku" unique="suffix">&#38657;&#20135;&#21697;</data>
125+
<data key="type_id">simple</data>
126+
<data key="attribute_set_id">4</data>
127+
<data key="visibility">4</data>
128+
<data key="name" unique="suffix">&#38657;&#20135;&#21697;</data>
129+
<data key="price">123.00</data>
130+
<data key="urlKey" unique="suffix">testurlkey</data>
131+
<data key="status">1</data>
132+
<data key="quantity">100</data>
133+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
134+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
135+
</entity>
112136
</entities>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Page/AdminProductCreatePage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
<section name="AdminProductImagesSection"/>
1616
<section name="AdminAddProductsToOptionPanel"/>
1717
<section name="AdminProductMessagesSection"/>
18+
<section name="AdminProductFormRelatedUpSellCrossSellSection"/>
1819
</page>
1920
</pages>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Page/AdminProductPage.xml

Lines changed: 0 additions & 17 deletions
This file was deleted.

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Page/StorefrontCategoryPage.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
11-
<page name="StorefrontCategoryPage" url="/{{var1}}.html" area="storefront" module="Category" parameterized="true">
11+
<page name="StorefrontCategoryPage" url="/{{var1}}.html" area="storefront" module="Catalog" parameterized="true">
1212
<section name="StorefrontCategoryMainSection"/>
1313
<section name="WYSIWYGToolbarSection"/>
1414
</page>

0 commit comments

Comments
 (0)