Skip to content

Commit 61e17e5

Browse files
author
Alexander Akimov
authored
Merge pull request #3816 from magento-tsg/2.3-develop-mftf-pr13
[TSG] MFTF for 2.3 (pr13) (2.3.1)
2 parents 908ed15 + 7e431c9 commit 61e17e5

File tree

19 files changed

+353
-9
lines changed

19 files changed

+353
-9
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,15 @@
263263
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
264264
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessage"/>
265265
</actionGroup>
266+
267+
<actionGroup name="AdminAssignProductToCategory">
268+
<arguments>
269+
<argument name="productId" type="string"/>
270+
<argument name="categoryName" type="string"/>
271+
</arguments>
272+
<amOnPage url="{{AdminProductEditPage.url(productId)}}" stepKey="amOnPage"/>
273+
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{categoryName}}]" stepKey="selectCategory"/>
274+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton"/>
275+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the product." stepKey="seeSaveProductMessage"/>
276+
</actionGroup>
266277
</actionGroups>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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="RelatedProductLink" type="product_link">
12+
<var key="sku" entityKey="sku" entityType="product2"/>
13+
<var key="linked_product_sku" entityKey="sku" entityType="product"/>
14+
<data key="link_type">related</data>
15+
<data key="linked_product_type">simple</data>
16+
<data key="position">1</data>
17+
<requiredEntity type="product_link_extension_attribute">Qty1000</requiredEntity>
18+
</entity>
19+
</entities>
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="OneRelatedProductLink" type="product_links">
12+
<requiredEntity type="product_link">RelatedProductLink</requiredEntity>
13+
</entity>
14+
</entities>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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="ProductLinkWidget" extends="ProductsListWidget">
12+
<data key="type">Catalog Product Link</data>
13+
<data key="template">Product Link Block Template</data>
14+
</entity>
15+
</entities>
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="AdminNewWidgetPage" url="admin/widget_instance/new/" area="admin" module="Magento_Widget">
12+
<section name="AdminNewWidgetSelectProductPopupSection"/>
13+
</page>
14+
</pages>
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="AdminNewWidgetSection">
12+
<element name="selectProduct" type="button" selector=".btn-chooser" timeout="30"/>
13+
</section>
14+
</sections>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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="AdminNewWidgetSelectProductPopupSection">
12+
<element name="filterBySku" type="input" selector=".data-grid-filters input[name='chooser_sku']"/>
13+
<element name="firstRow" type="select" selector=".even>td" timeout="20"/>
14+
</section>
15+
</sections>

app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateApiConfigurableProductActionGroup.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,17 @@
6262
<requiredEntity createDataKey="createConfigChildProduct2"/>
6363
</createData>
6464
</actionGroup>
65+
66+
<!-- Create the configurable product, children are not visible individually -->
67+
<actionGroup name="AdminCreateApiConfigurableProductWithHiddenChildActionGroup" extends="AdminCreateApiConfigurableProductActionGroup">
68+
<!-- Create the 2 children that will be a part of the configurable product -->
69+
<createData entity="ApiSimpleOneHidden" stepKey="createConfigChildProduct1">
70+
<requiredEntity createDataKey="createConfigProductAttribute"/>
71+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
72+
</createData>
73+
<createData entity="ApiSimpleTwoHidden" stepKey="createConfigChildProduct2">
74+
<requiredEntity createDataKey="createConfigProductAttribute"/>
75+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
76+
</createData>
77+
</actionGroup>
6578
</actionGroups>

app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCartPriceRuleActionGroup.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,27 @@
3838
<click selector="{{AdminMainActionsSection.saveAndContinue}}" stepKey="clickSaveButton"/>
3939
<see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
4040
</actionGroup>
41+
42+
<actionGroup name="SetConditionForActionsInCartPriceRuleActionGroup">
43+
<arguments>
44+
<argument name="actionsAggregator" type="string" defaultValue="ANY"/>
45+
<argument name="actionsValue" type="string" defaultValue="FALSE"/>
46+
<argument name="childAttribute" type="string" defaultValue="Category"/>
47+
<argument name="actionValue" type="string"/>
48+
</arguments>
49+
<click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickOnActionTab"/>
50+
<click selector="{{AdminCartPriceRulesFormSection.condition('ALL')}}" stepKey="clickToChooseOption"/>
51+
<selectOption selector="{{AdminCartPriceRulesFormSection.actionsAggregator}}" userInput="{{actionsAggregator}}" stepKey="selectCondition"/>
52+
<click selector="{{AdminCartPriceRulesFormSection.condition('TRUE')}}" stepKey="clickToChooseOption2"/>
53+
<selectOption selector="{{AdminCartPriceRulesFormSection.actionsValue}}" userInput="{{actionsValue}}" stepKey="selectCondition2"/>
54+
<click selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="selectActionConditions"/>
55+
<waitForPageLoad stepKey="waitForDropDownOpened"/>
56+
<selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="{{childAttribute}}" stepKey="selectAttribute"/>
57+
<waitForPageLoad stepKey="waitForOperatorOpened"/>
58+
<click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" stepKey="clickToChooseOption3"/>
59+
<fillField selector="{{AdminCartPriceRulesFormSection.actionValue}}" userInput="{{actionValue}}" stepKey="fillActionValue"/>
60+
<click selector="{{AdminCartPriceRulesFormSection.applyAction}}" stepKey="applyAction"/>
61+
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveButton"/>
62+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
63+
</actionGroup>
4164
</actionGroups>

app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,8 @@
189189
<data key="uses_per_coupon">10</data>
190190
<data key="simple_free_shipping">1</data>
191191
</entity>
192+
193+
<entity name="SalesRuleNoCouponWithFixedDiscount" extends="ApiCartRule">
194+
<data key="simple_action">by_fixed</data>
195+
</entity>
192196
</entities>

app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@
4848
<element name="conditions" type="button" selector=".rule-param.rule-param-new-child > a"/>
4949
<element name="childAttribute" type="select" selector="//select[contains(@name, 'new_child')]"/>
5050
<element name="condition" type="text" selector="//span[@class='rule-param']/a[text()='{{arg}}']" parameterized="true"/>
51+
<element name="actionsAggregator" type="select" selector="#actions__1__aggregator"/>
52+
<element name="actionsValue" type="select" selector="#actions__1__value"/>
5153
<element name="operator" type="select" selector="//select[contains(@name, '[operator]')]"/>
5254
<element name="option" type="select" selector="//ul[@class='rule-param-children']//select[contains(@name, '[value]')]"/>
5355
<element name="actionValue" type="input" selector=".rule-param-edit input"/>
56+
<element name="applyAction" type="text" selector=".rule-param-apply" timeout="30"/>
5457
<element name="actionOperator" type="select" selector=".rule-param-edit select"/>
5558
<element name="applyDiscountToShipping" type="checkbox" selector="input[name='apply_to_shipping']"/>
5659
<element name="applyDiscountToShippingLabel" type="checkbox" selector="input[name='apply_to_shipping']+label"/>
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontCategoryRulesShouldApplyToComplexProductsTest">
12+
<annotations>
13+
<features value="CatalogRule"/>
14+
<stories value="Create cart price rule"/>
15+
<title value="Category rules should apply to complex products"/>
16+
<description value="Sales rules filtering on category should apply to all products, including complex products."/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MAGETWO-70192"/>
19+
<group value="catalogRule"/>
20+
</annotations>
21+
<before>
22+
<!-- Create two Categories: CAT1 and CAT2 -->
23+
<createData entity="_defaultCategory" stepKey="createCategory"/>
24+
<createData entity="SimpleSubCategory" stepKey="createCategory2"/>
25+
<!--Create config1 and config2-->
26+
<actionGroup ref="AdminCreateApiConfigurableProductWithHiddenChildActionGroup" stepKey="createConfigurableProduct1">
27+
<argument name="productName" value="config1"/>
28+
</actionGroup>
29+
<actionGroup ref="AdminCreateApiConfigurableProductWithHiddenChildActionGroup" stepKey="createConfigurableProduct2">
30+
<argument name="productName" value="config2"/>
31+
</actionGroup>
32+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
33+
<!-- Assign config1 and the associated child products to CAT1 -->
34+
<actionGroup ref="AdminAssignProductToCategory" stepKey="assignConfigurableProduct1ToCategory">
35+
<argument name="productId" value="$$createConfigProductCreateConfigurableProduct1.id$$"/>
36+
<argument name="categoryName" value="$$createCategory.name$$"/>
37+
</actionGroup>
38+
<actionGroup ref="AdminAssignProductToCategory" stepKey="assignConfig1ChildProduct1ToCategory">
39+
<argument name="productId" value="$$createConfigChildProduct1CreateConfigurableProduct1.id$$"/>
40+
<argument name="categoryName" value="$$createCategory.name$$"/>
41+
</actionGroup>
42+
<actionGroup ref="AdminAssignProductToCategory" stepKey="assignConfig1ChildProduct2ToCategory">
43+
<argument name="productId" value="$$createConfigChildProduct2CreateConfigurableProduct1.id$$"/>
44+
<argument name="categoryName" value="$$createCategory.name$$"/>
45+
</actionGroup>
46+
<!-- Assign config12 and the associated child products to CAT2 -->
47+
<actionGroup ref="AdminAssignProductToCategory" stepKey="assignConfigurableProduct2ToCategory2">
48+
<argument name="productId" value="$$createConfigProductCreateConfigurableProduct2.id$$"/>
49+
<argument name="categoryName" value="$$createCategory2.name$$"/>
50+
</actionGroup>
51+
<actionGroup ref="AdminAssignProductToCategory" stepKey="assignConfig2ChildProduct1ToCategory2">
52+
<argument name="productId" value="$$createConfigChildProduct1CreateConfigurableProduct2.id$$"/>
53+
<argument name="categoryName" value="$$createCategory2.name$$"/>
54+
</actionGroup>
55+
<actionGroup ref="AdminAssignProductToCategory" stepKey="assignConfig2ChildProduct2ToCategory2">
56+
<argument name="productId" value="$$createConfigChildProduct2CreateConfigurableProduct2.id$$"/>
57+
<argument name="categoryName" value="$$createCategory2.name$$"/>
58+
</actionGroup>
59+
</before>
60+
<after>
61+
<!--Delete configurable product 1-->
62+
<deleteData createDataKey="createConfigProductCreateConfigurableProduct1" stepKey="deleteConfigProduct1"/>
63+
<deleteData createDataKey="createCategory" stepKey="deleteCategory1"/>
64+
<deleteData createDataKey="createConfigChildProduct1CreateConfigurableProduct1" stepKey="deleteConfigChildProduct1"/>
65+
<deleteData createDataKey="createConfigChildProduct2CreateConfigurableProduct1" stepKey="deleteConfigChildProduct2"/>
66+
<deleteData createDataKey="createConfigProductAttributeCreateConfigurableProduct1" stepKey="deleteConfigProductAttribute1"/>
67+
<!--Delete configurable product 2-->
68+
<deleteData createDataKey="createConfigProductCreateConfigurableProduct2" stepKey="deleteConfigProduct2"/>
69+
<deleteData createDataKey="createCategory2" stepKey="deleteCategory2"/>
70+
<deleteData createDataKey="createConfigChildProduct1CreateConfigurableProduct2" stepKey="deleteConfigChildProduct3"/>
71+
<deleteData createDataKey="createConfigChildProduct2CreateConfigurableProduct2" stepKey="deleteConfigChildProduct4"/>
72+
<deleteData createDataKey="createConfigProductAttributeCreateConfigurableProduct2" stepKey="deleteConfigProductAttribute2"/>
73+
<!--Delete Cart Price Rule -->
74+
<deleteData createDataKey="createCartPriceRule" stepKey="deleteCartPriceRule"/>
75+
<actionGroup ref="logout" stepKey="logout"/>
76+
</after>
77+
<!-- 1: Create a cart price rule applying to CAT1 with discount -->
78+
<createData entity="SalesRuleNoCouponWithFixedDiscount" stepKey="createCartPriceRule"/>
79+
<amOnPage url="{{AdminCartPriceRuleEditPage.url($$createCartPriceRule.rule_id$$)}}" stepKey="goToCartPriceRuleEditPage"/>
80+
<actionGroup ref="SetConditionForActionsInCartPriceRuleActionGroup" stepKey="setConditionForActionsInCartPriceRuleActionGroup">
81+
<argument name="actionValue" value="$$createCategory.id$$"/>
82+
</actionGroup>
83+
<!-- 2: Go to frontend and add an item from both CAT1 and CAT2 to your cart -->
84+
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToFrontend"/>
85+
<!-- 3: Open configurable product 1 and add all his child products to cart -->
86+
<amOnPage url="{{StorefrontProductPage.url($$createConfigProductCreateConfigurableProduct1.custom_attributes[url_key]$$)}}" stepKey="amOnConfigurableProductPage"/>
87+
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect('$$createConfigProductAttributeCreateConfigurableProduct1.attribute[frontend_labels][0][label]$$')}}" userInput="$$createConfigProductAttributeOption1CreateConfigurableProduct1.option[store_labels][0][label]$$" stepKey="selectOption"/>
88+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="cartAddConfigurableProductToCart">
89+
<argument name="product" value="$$createConfigProductCreateConfigurableProduct1$$"/>
90+
<argument name="productCount" value="1"/>
91+
</actionGroup>
92+
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect('$$createConfigProductAttributeCreateConfigurableProduct1.attribute[frontend_labels][0][label]$$')}}" userInput="$$createConfigProductAttributeOption2CreateConfigurableProduct1.option[store_labels][0][label]$$" stepKey="selectOption2"/>
93+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="cartAddConfigurableProductToCart2">
94+
<argument name="product" value="$$createConfigProductCreateConfigurableProduct1$$"/>
95+
<argument name="productCount" value="2"/>
96+
</actionGroup>
97+
<actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToCart"/>
98+
<!-- Discount amount is not applied -->
99+
<dontSee selector="{{CheckoutCartSummarySection.discountLabel}}" stepKey="discountIsNotApply"/>
100+
<!-- 3: Open configurable product 2 and add all his child products to cart -->
101+
<amOnPage url="{{StorefrontProductPage.url($$createConfigProductCreateConfigurableProduct2.custom_attributes[url_key]$$)}}" stepKey="amOnConfigurableProductPage2"/>
102+
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect('$$createConfigProductAttributeCreateConfigurableProduct2.attribute[frontend_labels][0][label]$$')}}" userInput="$$createConfigProductAttributeOption1CreateConfigurableProduct2.option[store_labels][0][label]$$" stepKey="selectOption3"/>
103+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="cartAddConfigurableProductToCart3">
104+
<argument name="product" value="$$createConfigProductCreateConfigurableProduct2$$"/>
105+
<argument name="productCount" value="3"/>
106+
</actionGroup>
107+
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect('$$createConfigProductAttributeCreateConfigurableProduct2.attribute[frontend_labels][0][label]$$')}}" userInput="$$createConfigProductAttributeOption2CreateConfigurableProduct2.option[store_labels][0][label]$$" stepKey="selectOption4"/>
108+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="cartAddConfigurableProductToCart4">
109+
<argument name="product" value="$$createConfigProductCreateConfigurableProduct2$$"/>
110+
<argument name="productCount" value="4"/>
111+
</actionGroup>
112+
<!-- Discount amount is applied -->
113+
<actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToCart2"/>
114+
<see selector="{{CheckoutCartSummarySection.discountTotal}}" userInput="-$100.00" stepKey="discountIsApply"/>
115+
</test>
116+
</tests>
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="AdminUrlRewriteEditPage" url="admin/url_rewrite/edit/id/{{url_rewrite_id}}/" area="admin" module="Magento_UrlRewrite">
12+
<section name="AdminUrlRewriteEditSection"/>
13+
</page>
14+
</pages>
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="AdminUrlRewriteEditSection">
12+
<element name="requestPathField" type="input" selector="#request_path"/>
13+
</section>
14+
</sections>

0 commit comments

Comments
 (0)