Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Commit ede7bc8

Browse files
authored
Merge pull request #83 from magento-pangolin/MC-4788
2 parents 2fe3f1c + a5ce676 commit ede7bc8

16 files changed

+453
-4
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,8 @@
9191
<selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Second Website" stepKey="selectWebsites"/>
9292

9393
</actionGroup>
94-
</actionGroups>
94+
95+
<actionGroup name="AdminInactiveCartPriceRuleActionGroup" extends="AdminCreateCartPriceRuleActionGroup">
96+
<click selector="{{AdminCartPriceRulesFormSection.active}}" stepKey="clickActiveToDisable" after="fillRuleName"/>
97+
</actionGroup>
98+
</actionGroups>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminCreateCartPriceRuleActionsSectionDiscountFieldsActionGroup">
11+
<arguments>
12+
<argument name="ruleName" type="entity"/>
13+
</arguments>
14+
<conditionalClick selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.actionsHeader}}" visible="true" stepKey="clickToExpandActions"/>
15+
<selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="{{ruleName.simple_action}}" stepKey="selectActionType"/>
16+
<fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="{{ruleName.discount_amount}}" stepKey="fillDiscountAmount"/>
17+
<fillField selector="{{AdminCartPriceRulesFormSection.maximumQtyDiscount}}" userInput="{{ruleName.maximumQtyDiscount}}" stepKey="fillMaximumQtyDiscount"/>
18+
<fillField selector="{{AdminCartPriceRulesFormSection.discountStep}}" userInput="{{ruleName.discount_step}}" stepKey="fillDiscountStep"/>
19+
</actionGroup>
20+
<actionGroup name="AdminCreateCartPriceRuleActionsSectionShippingAmountActionGroup">
21+
<click selector="{{AdminCartPriceRulesFormSection.applyToShippingAmount}}" stepKey="clickApplyToShipping"/>
22+
</actionGroup>
23+
<actionGroup name="AdminCreateCartPriceRuleActionsSectionSubsequentRulesActionGroup">
24+
<click selector="{{AdminCartPriceRulesFormSection.discardSubsequentRules}}" stepKey="clickApplyToShipping"/>
25+
</actionGroup>
26+
<actionGroup name="AdminCreateCartPriceRuleActionsSectionFreeShippingActionGroup">
27+
<arguments>
28+
<argument name="ruleName" type="string"/>
29+
</arguments>
30+
<selectOption selector="{{AdminCartPriceRulesFormSection.freeShipping}}" userInput="{{ruleName}}" stepKey="selectForMatchingItemsOnly"/>
31+
</actionGroup>
32+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminCreateCartPriceRuleConditionsSectionSubtotalActionGroup">
11+
<arguments>
12+
<argument name="ruleName" type="entity"/>
13+
<argument name="condition1" type="string"/>
14+
</arguments>
15+
<conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditions"/>
16+
<click selector="{{AdminCartPriceRulesFormSection.newCondition}}" stepKey="clickNewCondition"/>
17+
<selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelect}}" userInput="{{condition1}}" stepKey="selectCondition1"/>
18+
<waitForPageLoad stepKey="waitForConditionLoad"/>
19+
<click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" stepKey="clickEllipsis"/>
20+
<fillField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--1')}}" userInput="{{ruleName.subtotal}}" stepKey="fillSubtotalParameter"/>
21+
</actionGroup>
22+
<actionGroup name="AdminCreateCartPriceRuleConditionsSectionShippingCountryActionGroup">
23+
<arguments>
24+
<argument name="ruleName" type="entity"/>
25+
<argument name="condition2" type="string"/>
26+
</arguments>
27+
<conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditions"/>
28+
<click selector="{{AdminCartPriceRulesFormSection.newCondition}}" stepKey="clickNewConditionButton"/>
29+
<selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelect}}" userInput="{{condition2}}" stepKey="selectCondition2"/>
30+
<waitForPageLoad stepKey="waitForSecondConditionLoad"/>
31+
<click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" stepKey="clickTheEllipsis"/>
32+
<selectOption selector="{{AdminCartPriceRulesFormSection.selectCountryDropdown}}" userInput="{{ruleName.shippingCountry}}" stepKey="fillShippingCountryParameter"/>
33+
</actionGroup>
34+
<actionGroup name="AdminCreateCartPriceRuleConditionsSectionShippingPostcodeActionGroup">
35+
<arguments>
36+
<argument name="ruleName" type="entity"/>
37+
<argument name="condition3" type="string"/>
38+
</arguments>
39+
<conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditions"/>
40+
<click selector="{{AdminCartPriceRulesFormSection.newCondition}}" stepKey="clickOnNewCondition"/>
41+
<selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelect}}" userInput="{{condition3}}" stepKey="selectCondition3"/>
42+
<waitForPageLoad stepKey="waitForThirdConditionLoad"/>
43+
<click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" stepKey="clickOnEllipsis"/>
44+
<fillField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--3')}}" userInput="{{ruleName.shippingPostcode}}" stepKey="fillShippingPostcodeParameter"/>
45+
</actionGroup>
46+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminCreateCartPriceRuleLabelsSectionActionGroup">
11+
<arguments>
12+
<argument name="ruleName" type="entity"/>
13+
</arguments>
14+
<conditionalClick selector="{{AdminCartPriceRulesFormSection.labelsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.labelsHeader}}" visible="true" stepKey="clickToExpandLabels"/>
15+
<fillField selector="{{AdminCartPriceRulesFormSection.defaultRuleLabelAllStoreViews}}" userInput="{{ruleName.defaultRuleLabelAllStoreViews}}" stepKey="fillDefaultRuleLabelAllStoreViews"/>
16+
<fillField selector="{{AdminCartPriceRulesFormSection.defaultStoreView}}" userInput="{{ruleName.defaultStoreView}}" stepKey="fillDefaultStoreView"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminCreateCartPriceRuleRuleInfoSectionActionGroup">
11+
<arguments>
12+
<argument name="ruleName" type="entity"/>
13+
</arguments>
14+
<amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/>
15+
<waitForPageLoad stepKey="waitForPriceList"/>
16+
<click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/>
17+
<fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{ruleName.name}}" stepKey="fillRuleName"/>
18+
<fillField selector="{{AdminCartPriceRulesFormSection.description}}" userInput="{{ruleName.description}}" stepKey="fillDescription"/>
19+
<selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="{{ruleName.websites}}" stepKey="selectWebsites"/>
20+
<selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" parameterArray="[{{ruleName.customerGroups}}]" stepKey="selectCustomerGroup"/>
21+
<selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="{{ruleName.coupon_type}}" stepKey="selectCouponType"/>
22+
<waitForElementVisible selector="{{AdminCartPriceRulesFormSection.couponCode}}" stepKey="waitForElementVisible"/>
23+
<fillField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{ruleName.coupon_code}}" stepKey="fillCouponCode"/>
24+
<fillField selector="{{AdminCartPriceRulesFormSection.userPerCoupon}}" userInput="{{ruleName.uses_per_coupon}}" stepKey="fillUsesPerCoupon"/>
25+
<fillField selector="{{AdminCartPriceRulesFormSection.userPerCustomer}}" userInput="{{ruleName.uses_per_customer}}" stepKey="fillUsesPerCustomer"/>
26+
<generateDate date="+1 minute" format="m/d/Y" stepKey="startDateTime"/>
27+
<fillField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$startDateTime}" stepKey="fillStartDate"/>
28+
<fillField selector="{{AdminCartPriceRulesFormSection.priority}}" userInput="{{ruleName.sort_order}}" stepKey="fillPriority"/>
29+
<conditionalClick selector="{{AdminCartPriceRulesFormSection.publicInRSSFeed}}" dependentSelector="{{AdminCartPriceRulesFormSection.publicInRSSFeed}}" visible="false" stepKey="clickOnlyIfRSSIsDisabled"/>
30+
</actionGroup>
31+
</actionGroups>

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@
1818
<click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="doFilter"/>
1919
<click selector="{{AdminCartPriceRulesSection.rowByIndex('1')}}" stepKey="goToEditRulePage"/>
2020
</actionGroup>
21-
</actionGroups>
21+
<actionGroup name="AdminCartPriceRuleNotInGridActionGroup" extends="AdminFilterCartPriceRuleActionGroup">
22+
<remove keyForRemoval="goToEditRulePage"/>
23+
<waitForPageLoad stepKey="waitForStoreToLoad"/>
24+
<see selector="{{AdminCartPriceRulesSection.emptyText}}" userInput="We couldn't find any records." stepKey="seeAssertCartPriceRuleIsNotPresentedInGrid"/>
25+
</actionGroup>
26+
</actionGroups>
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertCartPriceRuleSuccessSaveMessageActionGroup">
11+
<click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/>
12+
<see selector="{{AdminCartPriceRulesFormSection.successMessage}}" userInput="You saved the rule." stepKey="seeAssertSuccessSaveMessage"/>
13+
</actionGroup>
14+
</actionGroups>
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertStorefrontMiniCartItemsActionGroup">
11+
<arguments>
12+
<argument name="productName" type="string"/>
13+
<argument name="productPrice" type="string"/>
14+
<argument name="cartSubtotal" type="string"/>
15+
<argument name="qty" type="string"/>
16+
</arguments>
17+
<see selector="{{StorefrontMinicartSection.miniCartItemsText}}" userInput="{{productName}}" stepKey="seeProductNameInMiniCart"/>
18+
<see selector="{{StorefrontMinicartSection.miniCartItemsText}}" userInput="{{productPrice}}" stepKey="seeProductPriceInMiniCart"/>
19+
<seeElement selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="seeCheckOutButtonInMiniCart"/>
20+
<seeElement selector="{{StorefrontMinicartSection.productQuantity(productName, qty)}}" stepKey="seeProductQuantity1"/>
21+
<seeElement selector="{{StorefrontMinicartSection.productImage}}" stepKey="seeProductImage"/>
22+
<see selector="{{StorefrontMinicartSection.productSubTotal}}" userInput="{{cartSubtotal}}" stepKey="seeSubTotal"/>
23+
</actionGroup>
24+
</actionGroups>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontAddToTheCartActionGroup">
11+
<waitForPageLoad stepKey="waitForPageLoad"/>
12+
<scrollTo selector="{{StorefrontProductActionSection.addToCart}}" stepKey="scrollToAddToCartButton"/>
13+
<click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart"/>
14+
<waitForPageLoad stepKey="waitForPageToLoad"/>
15+
</actionGroup>
16+
</actionGroups>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontClickOnMiniCartActionGroup">
11+
<scrollToTopOfPage stepKey="scrollToTheTopOfThePage"/>
12+
<waitForElementVisible selector="{{StorefrontMinicartSection.showCart}}" stepKey="waitForElementToBeVisible"/>
13+
<click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickOnMiniCart"/>
14+
<waitForPageLoad stepKey="waitForPageToLoad"/>
15+
</actionGroup>
16+
</actionGroups>

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

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,52 @@
193193
<entity name="SalesRuleNoCouponWithFixedDiscount" extends="ApiCartRule">
194194
<data key="simple_action">by_fixed</data>
195195
</entity>
196-
</entities>
196+
<entity name="ActiveSalesRuleWithPercentPriceDiscountCoupon">
197+
<data key="name" unique="suffix">Cart Price Rule with Specific Coupon</data>
198+
<data key="description">Description for Cart Price Rule</data>
199+
<data key="is_active">Yes</data>
200+
<data key="websites">Main Website</data>
201+
<data key="customerGroups">'NOT LOGGED IN'</data>
202+
<data key="coupon_type">Specific Coupon</data>
203+
<data key="coupon_code" unique="suffix">123-abc-ABC-987</data>
204+
<data key="apply">Percent of product price discount</data>
205+
<data key="discountAmount">50</data>
206+
<data key="defaultRuleLabelAllStoreViews">Cart Price Rule with Specific Coupon</data>
207+
<data key="defaultStoreView">Cart Price Rule with Specific Coupon</data>
208+
</entity>
209+
<entity name="ActiveSalesRuleWithComplexConditions">
210+
<data key="name" unique="suffix">Cart Price Rule with complex conditions</data>
211+
<data key="description">Cart Price Rule with complex conditions</data>
212+
<data key="is_active">Yes</data>
213+
<data key="websites">Main Website</data>
214+
<data key="customerGroups">'NOT LOGGED IN', 'General', 'Wholesale', 'Retailer'</data>
215+
<data key="coupon_type">Specific Coupon</data>
216+
<data key="coupon_code" unique="suffix">123-abc-ABC-987</data>
217+
<data key="uses_per_coupon">13</data>
218+
<data key="uses_per_customer">63</data>
219+
<data key="sort_order">1</data>
220+
<data key="is_rss">Yes</data>
221+
<data key="subtotal">300</data>
222+
<data key="shippingCountry">US</data>
223+
<data key="shippingPostcode">123456789a</data>
224+
<data key="simple_action">Percent of product price discount</data>
225+
<data key="discount_amount">50</data>
226+
<data key="maximumQtyDiscount">0</data>
227+
<data key="discount_step">0</data>
228+
<data key="apply_to_shipping">Yes</data>
229+
<data key="stop_rules_processing">Yes</data>
230+
<data key="simple_free_shipping">For matching items only</data>
231+
<data key="defaultRuleLabelAllStoreViews">Cart Price Rule with complex conditions</data>
232+
<data key="defaultStoreView">Cart Price Rule with complex conditions</data>
233+
</entity>
234+
<entity name="InactiveSalesRule">
235+
<data key="name" unique="suffix">Inactive Cart Price Rule</data>
236+
<data key="description">Inactive Cart Price Rule</data>
237+
<data key="is_active">0</data>
238+
<data key="websites">Main Website</data>
239+
<data key="customerGroups">'NOT LOGGED IN'</data>
240+
<data key="coupon_type">No Coupon</data>
241+
<data key="apply">Percent of product price discount</data>
242+
<data key="discountAmount">50</data>
243+
</entity>
244+
</entities>

0 commit comments

Comments
 (0)