Skip to content

Commit 7ae4f5d

Browse files
authored
Merge pull request #3548 from magento-tsg/2.2-develop-mftf-pr11
[TSG] MFTF for 2.2 (pr11) (2.2.8)
2 parents d8267c2 + e476999 commit 7ae4f5d

20 files changed

+243
-12
lines changed
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminSlideOutDialogSection">
12+
<element name="closeButton" type="button" selector=".modal-slide._show [data-role='closeBtn']" timeout="30"/>
13+
<element name="cancelButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Cancel']" timeout="30"/>
14+
<element name="doneButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Done']" timeout="30"/>
15+
<element name="saveButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Save']" timeout="30"/>
16+
</section>
17+
</sections>

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,11 @@
115115
</arguments>
116116
<uncheckOption selector="{{AdminCategorySEOSection.urlKeyDefaultValueCheckbox}}" before="enterURLKey" stepKey="uncheckDefaultValue"/>
117117
</actionGroup>
118+
119+
<!-- Save category form -->
120+
<actionGroup name="saveCategoryForm">
121+
<seeInCurrentUrl url="{{AdminCategoryPage.url}}" stepKey="seeOnCategoryPage"/>
122+
<click selector="{{AdminMainActionsSection.save}}" stepKey="saveCategory"/>
123+
<seeElement selector="{{AdminMessagesSection.success}}" stepKey="assertSuccess"/>
124+
</actionGroup>
118125
</actionGroups>

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

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<!--Navigate to create product page from product grid page-->
1212
<actionGroup name="goToCreateProductPage">
1313
<arguments>
@@ -97,11 +97,10 @@
9797
<argument name="website"/>
9898
</arguments>
9999
<scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToWebsites"/>
100-
<click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="clickToOpenProductInWebsite"/>
100+
<conditionalClick selector="{{ProductInWebsitesSection.sectionHeader}}" dependentSelector="{{ProductInWebsitesSection.website(website.name)}}" visible="false" stepKey="clickToOpenProductInWebsite"/>
101101
<waitForPageLoad stepKey="waitForPageOpened"/>
102102
<click selector="{{ProductInWebsitesSection.website(website.name)}}" stepKey="selectWebsite"/>
103103
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
104-
<waitForPageLoad time='60' stepKey="waitForPageOpened1"/>
105104
</actionGroup>
106105

107106
<actionGroup name="ProductSetAdvancedPricing">
@@ -149,7 +148,6 @@
149148
</arguments>
150149
<scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToWebsites"/>
151150
<click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="clickToOpenProductInWebsite"/>
152-
<waitForPageLoad stepKey="waitForPageOpened"/>
153151
<checkOption selector="{{ProductInWebsitesSection.website(website)}}" stepKey="selectWebsite"/>
154152
</actionGroup>
155153

@@ -169,6 +167,21 @@
169167
<waitForPageLoad stepKey="waitForPageLoad"/>
170168
<dontSeeElement selector="{{AdminProductImagesSection.imageFile(image.filename)}}" stepKey="seeImage"/>
171169
</actionGroup>
170+
171+
<!--Check tier price with a discount percentage on product-->
172+
<actionGroup name="AssertDiscountsPercentageOfProduct">
173+
<arguments>
174+
<argument name="amount" type="string" defaultValue="45"/>
175+
</arguments>
176+
<click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickOnAdvancedPricingButton"/>
177+
<waitForElementVisible selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="waitForCustomerGroupPriceAddButton"/>
178+
<grabValueFrom selector="{{AdminProductFormAdvancedPricingSection.productTierPricePercentageValuePriceInput('0')}}" stepKey="grabProductTierPriceInput"/>
179+
<assertEquals stepKey="assertProductTierPriceInput">
180+
<expectedResult type="string">{{amount}}</expectedResult>
181+
<actualResult type="string">$grabProductTierPriceInput</actualResult>
182+
</assertEquals>
183+
</actionGroup>
184+
172185
<actionGroup name="CreatedProductConnectToWebsite">
173186
<arguments>
174187
<argument name="website"/>
@@ -188,4 +201,29 @@
188201
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
189202
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the product." stepKey="seeSaveConfirmation"/>
190203
</actionGroup>
204+
205+
<!--Create simple product and assign to category in Admin-->
206+
<actionGroup name="AdminCreateSimpleProductAndAssignToCategory">
207+
<arguments>
208+
<argument name="category"/>
209+
<argument name="simpleProduct"/>
210+
</arguments>
211+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
212+
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/>
213+
<click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/>
214+
<fillField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/>
215+
<fillField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/>
216+
<fillField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/>
217+
<fillField userInput="{{simpleProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/>
218+
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{category.name}}]" stepKey="searchAndSelectCategory"/>
219+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
220+
<fillField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/>
221+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/>
222+
<seeElement selector="{{AdminMessagesSection.success}}" stepKey="assertSaveMessageSuccess"/>
223+
<seeInField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="assertFieldName"/>
224+
<seeInField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="assertFieldSku"/>
225+
<seeInField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="assertFieldPrice"/>
226+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSectionAssert"/>
227+
<seeInField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="assertFieldUrlKey"/>
228+
</actionGroup>
191229
</actionGroups>

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,10 @@
7474
<see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) have been updated." stepKey="seeSuccessMessage"/>
7575
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/>
7676
</actionGroup>
77+
78+
<!-- Sort products by ID descending -->
79+
<actionGroup name="sortProductsByIdDescending">
80+
<conditionalClick selector="{{AdminProductGridTableHeaderSection.id('ascend')}}" dependentSelector="{{AdminProductGridTableHeaderSection.id('descend')}}" visible="false" stepKey="sortById"/>
81+
<waitForPageLoad stepKey="waitForPageLoad"/>
82+
</actionGroup>
7783
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Page/AdminCategoryPage.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
-->
88

99
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
11-
<page name="AdminCategoryPage" url="catalog/category/" area="admin" module="Catalog">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="AdminCategoryPage" url="catalog/category/" area="admin" module="Magento_Catalog">
1212
<section name="AdminCategorySidebarActionSection"/>
1313
<section name="AdminCategorySidebarTreeSection"/>
1414
<section name="AdminCategoryBasicFieldSection"/>

app/code/Magento/Catalog/Test/Mftf/Page/AdminProductIndexPage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<section name="AdminProductGridActionSection" />
1313
<section name="AdminProductGridFilterSection" />
1414
<section name="AdminProductGridSection" />
15+
<section name="AdminProductGridTableHeaderSection" />
1516
<section name="AdminMessagesSection" />
1617
<section name="AdminProductFiltersSection" />
1718
</page>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminProductGridTableHeaderSection">
12+
<element name="id" type="button" selector=".//*[@class='sticky-header']/following-sibling::*//th[@class='data-grid-th _sortable _draggable _{{order}}']/span[text()='ID']" parameterized="true"/>
13+
</section>
14+
</sections>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
-->
88

99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="StorefrontProductInfoMainSection">
1212
<element name="stock" type="input" selector=".stock.available"/>
1313
<element name="productName" type="text" selector=".base"/>
1414
<element name="productSku" type="text" selector=".product.attribute.sku>.value"/>
1515
<element name="productPrice" type="text" selector=".price"/>
16+
<element name="specialPrice" type="text" selector=".special-price"/>
1617
<element name="qty" type="input" selector="#qty"/>
1718
<element name="productStockStatus" type="text" selector=".stock[title=Availability]>span"/>
1819
<element name="productDescription" type="text" selector="#description .value"/>
Lines changed: 24 additions & 0 deletions
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+
9+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="DefaultWebUrlOptionsConfig" type="web_url_use_store">
12+
<requiredEntity type="url_use_store_value">DefaultConfigWebUrlOptions</requiredEntity>
13+
</entity>
14+
<entity name="DefaultConfigWebUrlOptions" type="url_use_store_value">
15+
<data key="value">0</data>
16+
</entity>
17+
18+
<entity name="EnableWebUrlOptionsConfig" type="web_url_use_store">
19+
<requiredEntity type="url_use_store_value">WebUrlOptionsYes</requiredEntity>
20+
</entity>
21+
<entity name="WebUrlOptionsYes" type="url_use_store_value">
22+
<data key="value">1</data>
23+
</entity>
24+
</entities>
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+
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd">
10+
<operation name="WebUrlOptionsConfig" dataType="web_url_use_store" type="create" auth="adminFormKey" url="/admin/system_config/save/section/web/"
11+
method="POST" successRegex="/messages-message-success/" returnRegex="">
12+
<object key="groups" dataType="web_url_use_store">
13+
<object key="url" dataType="web_url_use_store">
14+
<object key="fields" dataType="web_url_use_store">
15+
<object key="use_store" dataType="url_use_store_value">
16+
<field key="value">string</field>
17+
</object>
18+
</object>
19+
</object>
20+
</object>
21+
</operation>
22+
</operations>

0 commit comments

Comments
 (0)