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

Commit

Permalink
Merge pull request #83 from magento-pangolin/MC-4788
Browse files Browse the repository at this point in the history
  • Loading branch information
tomreece authored Apr 5, 2019
2 parents 2fe3f1c + a5ce676 commit ede7bc8
Show file tree
Hide file tree
Showing 16 changed files with 453 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,8 @@
<selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Second Website" stepKey="selectWebsites"/>

</actionGroup>
</actionGroups>

<actionGroup name="AdminInactiveCartPriceRuleActionGroup" extends="AdminCreateCartPriceRuleActionGroup">
<click selector="{{AdminCartPriceRulesFormSection.active}}" stepKey="clickActiveToDisable" after="fillRuleName"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminCreateCartPriceRuleActionsSectionDiscountFieldsActionGroup">
<arguments>
<argument name="ruleName" type="entity"/>
</arguments>
<conditionalClick selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.actionsHeader}}" visible="true" stepKey="clickToExpandActions"/>
<selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="{{ruleName.simple_action}}" stepKey="selectActionType"/>
<fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="{{ruleName.discount_amount}}" stepKey="fillDiscountAmount"/>
<fillField selector="{{AdminCartPriceRulesFormSection.maximumQtyDiscount}}" userInput="{{ruleName.maximumQtyDiscount}}" stepKey="fillMaximumQtyDiscount"/>
<fillField selector="{{AdminCartPriceRulesFormSection.discountStep}}" userInput="{{ruleName.discount_step}}" stepKey="fillDiscountStep"/>
</actionGroup>
<actionGroup name="AdminCreateCartPriceRuleActionsSectionShippingAmountActionGroup">
<click selector="{{AdminCartPriceRulesFormSection.applyToShippingAmount}}" stepKey="clickApplyToShipping"/>
</actionGroup>
<actionGroup name="AdminCreateCartPriceRuleActionsSectionSubsequentRulesActionGroup">
<click selector="{{AdminCartPriceRulesFormSection.discardSubsequentRules}}" stepKey="clickApplyToShipping"/>
</actionGroup>
<actionGroup name="AdminCreateCartPriceRuleActionsSectionFreeShippingActionGroup">
<arguments>
<argument name="ruleName" type="string"/>
</arguments>
<selectOption selector="{{AdminCartPriceRulesFormSection.freeShipping}}" userInput="{{ruleName}}" stepKey="selectForMatchingItemsOnly"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminCreateCartPriceRuleConditionsSectionSubtotalActionGroup">
<arguments>
<argument name="ruleName" type="entity"/>
<argument name="condition1" type="string"/>
</arguments>
<conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditions"/>
<click selector="{{AdminCartPriceRulesFormSection.newCondition}}" stepKey="clickNewCondition"/>
<selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelect}}" userInput="{{condition1}}" stepKey="selectCondition1"/>
<waitForPageLoad stepKey="waitForConditionLoad"/>
<click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" stepKey="clickEllipsis"/>
<fillField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--1')}}" userInput="{{ruleName.subtotal}}" stepKey="fillSubtotalParameter"/>
</actionGroup>
<actionGroup name="AdminCreateCartPriceRuleConditionsSectionShippingCountryActionGroup">
<arguments>
<argument name="ruleName" type="entity"/>
<argument name="condition2" type="string"/>
</arguments>
<conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditions"/>
<click selector="{{AdminCartPriceRulesFormSection.newCondition}}" stepKey="clickNewConditionButton"/>
<selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelect}}" userInput="{{condition2}}" stepKey="selectCondition2"/>
<waitForPageLoad stepKey="waitForSecondConditionLoad"/>
<click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" stepKey="clickTheEllipsis"/>
<selectOption selector="{{AdminCartPriceRulesFormSection.selectCountryDropdown}}" userInput="{{ruleName.shippingCountry}}" stepKey="fillShippingCountryParameter"/>
</actionGroup>
<actionGroup name="AdminCreateCartPriceRuleConditionsSectionShippingPostcodeActionGroup">
<arguments>
<argument name="ruleName" type="entity"/>
<argument name="condition3" type="string"/>
</arguments>
<conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditions"/>
<click selector="{{AdminCartPriceRulesFormSection.newCondition}}" stepKey="clickOnNewCondition"/>
<selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelect}}" userInput="{{condition3}}" stepKey="selectCondition3"/>
<waitForPageLoad stepKey="waitForThirdConditionLoad"/>
<click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" stepKey="clickOnEllipsis"/>
<fillField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--3')}}" userInput="{{ruleName.shippingPostcode}}" stepKey="fillShippingPostcodeParameter"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminCreateCartPriceRuleLabelsSectionActionGroup">
<arguments>
<argument name="ruleName" type="entity"/>
</arguments>
<conditionalClick selector="{{AdminCartPriceRulesFormSection.labelsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.labelsHeader}}" visible="true" stepKey="clickToExpandLabels"/>
<fillField selector="{{AdminCartPriceRulesFormSection.defaultRuleLabelAllStoreViews}}" userInput="{{ruleName.defaultRuleLabelAllStoreViews}}" stepKey="fillDefaultRuleLabelAllStoreViews"/>
<fillField selector="{{AdminCartPriceRulesFormSection.defaultStoreView}}" userInput="{{ruleName.defaultStoreView}}" stepKey="fillDefaultStoreView"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminCreateCartPriceRuleRuleInfoSectionActionGroup">
<arguments>
<argument name="ruleName" type="entity"/>
</arguments>
<amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/>
<waitForPageLoad stepKey="waitForPriceList"/>
<click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/>
<fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{ruleName.name}}" stepKey="fillRuleName"/>
<fillField selector="{{AdminCartPriceRulesFormSection.description}}" userInput="{{ruleName.description}}" stepKey="fillDescription"/>
<selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="{{ruleName.websites}}" stepKey="selectWebsites"/>
<selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" parameterArray="[{{ruleName.customerGroups}}]" stepKey="selectCustomerGroup"/>
<selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="{{ruleName.coupon_type}}" stepKey="selectCouponType"/>
<waitForElementVisible selector="{{AdminCartPriceRulesFormSection.couponCode}}" stepKey="waitForElementVisible"/>
<fillField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{ruleName.coupon_code}}" stepKey="fillCouponCode"/>
<fillField selector="{{AdminCartPriceRulesFormSection.userPerCoupon}}" userInput="{{ruleName.uses_per_coupon}}" stepKey="fillUsesPerCoupon"/>
<fillField selector="{{AdminCartPriceRulesFormSection.userPerCustomer}}" userInput="{{ruleName.uses_per_customer}}" stepKey="fillUsesPerCustomer"/>
<generateDate date="+1 minute" format="m/d/Y" stepKey="startDateTime"/>
<fillField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$startDateTime}" stepKey="fillStartDate"/>
<fillField selector="{{AdminCartPriceRulesFormSection.priority}}" userInput="{{ruleName.sort_order}}" stepKey="fillPriority"/>
<conditionalClick selector="{{AdminCartPriceRulesFormSection.publicInRSSFeed}}" dependentSelector="{{AdminCartPriceRulesFormSection.publicInRSSFeed}}" visible="false" stepKey="clickOnlyIfRSSIsDisabled"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@
<click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="doFilter"/>
<click selector="{{AdminCartPriceRulesSection.rowByIndex('1')}}" stepKey="goToEditRulePage"/>
</actionGroup>
</actionGroups>
<actionGroup name="AdminCartPriceRuleNotInGridActionGroup" extends="AdminFilterCartPriceRuleActionGroup">
<remove keyForRemoval="goToEditRulePage"/>
<waitForPageLoad stepKey="waitForStoreToLoad"/>
<see selector="{{AdminCartPriceRulesSection.emptyText}}" userInput="We couldn't find any records." stepKey="seeAssertCartPriceRuleIsNotPresentedInGrid"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertCartPriceRuleSuccessSaveMessageActionGroup">
<click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/>
<see selector="{{AdminCartPriceRulesFormSection.successMessage}}" userInput="You saved the rule." stepKey="seeAssertSuccessSaveMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertStorefrontMiniCartItemsActionGroup">
<arguments>
<argument name="productName" type="string"/>
<argument name="productPrice" type="string"/>
<argument name="cartSubtotal" type="string"/>
<argument name="qty" type="string"/>
</arguments>
<see selector="{{StorefrontMinicartSection.miniCartItemsText}}" userInput="{{productName}}" stepKey="seeProductNameInMiniCart"/>
<see selector="{{StorefrontMinicartSection.miniCartItemsText}}" userInput="{{productPrice}}" stepKey="seeProductPriceInMiniCart"/>
<seeElement selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="seeCheckOutButtonInMiniCart"/>
<seeElement selector="{{StorefrontMinicartSection.productQuantity(productName, qty)}}" stepKey="seeProductQuantity1"/>
<seeElement selector="{{StorefrontMinicartSection.productImage}}" stepKey="seeProductImage"/>
<see selector="{{StorefrontMinicartSection.productSubTotal}}" userInput="{{cartSubtotal}}" stepKey="seeSubTotal"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontAddToTheCartActionGroup">
<waitForPageLoad stepKey="waitForPageLoad"/>
<scrollTo selector="{{StorefrontProductActionSection.addToCart}}" stepKey="scrollToAddToCartButton"/>
<click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart"/>
<waitForPageLoad stepKey="waitForPageToLoad"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontClickOnMiniCartActionGroup">
<scrollToTopOfPage stepKey="scrollToTheTopOfThePage"/>
<waitForElementVisible selector="{{StorefrontMinicartSection.showCart}}" stepKey="waitForElementToBeVisible"/>
<click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickOnMiniCart"/>
<waitForPageLoad stepKey="waitForPageToLoad"/>
</actionGroup>
</actionGroups>
50 changes: 49 additions & 1 deletion app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,52 @@
<entity name="SalesRuleNoCouponWithFixedDiscount" extends="ApiCartRule">
<data key="simple_action">by_fixed</data>
</entity>
</entities>
<entity name="ActiveSalesRuleWithPercentPriceDiscountCoupon">
<data key="name" unique="suffix">Cart Price Rule with Specific Coupon</data>
<data key="description">Description for Cart Price Rule</data>
<data key="is_active">Yes</data>
<data key="websites">Main Website</data>
<data key="customerGroups">'NOT LOGGED IN'</data>
<data key="coupon_type">Specific Coupon</data>
<data key="coupon_code" unique="suffix">123-abc-ABC-987</data>
<data key="apply">Percent of product price discount</data>
<data key="discountAmount">50</data>
<data key="defaultRuleLabelAllStoreViews">Cart Price Rule with Specific Coupon</data>
<data key="defaultStoreView">Cart Price Rule with Specific Coupon</data>
</entity>
<entity name="ActiveSalesRuleWithComplexConditions">
<data key="name" unique="suffix">Cart Price Rule with complex conditions</data>
<data key="description">Cart Price Rule with complex conditions</data>
<data key="is_active">Yes</data>
<data key="websites">Main Website</data>
<data key="customerGroups">'NOT LOGGED IN', 'General', 'Wholesale', 'Retailer'</data>
<data key="coupon_type">Specific Coupon</data>
<data key="coupon_code" unique="suffix">123-abc-ABC-987</data>
<data key="uses_per_coupon">13</data>
<data key="uses_per_customer">63</data>
<data key="sort_order">1</data>
<data key="is_rss">Yes</data>
<data key="subtotal">300</data>
<data key="shippingCountry">US</data>
<data key="shippingPostcode">123456789a</data>
<data key="simple_action">Percent of product price discount</data>
<data key="discount_amount">50</data>
<data key="maximumQtyDiscount">0</data>
<data key="discount_step">0</data>
<data key="apply_to_shipping">Yes</data>
<data key="stop_rules_processing">Yes</data>
<data key="simple_free_shipping">For matching items only</data>
<data key="defaultRuleLabelAllStoreViews">Cart Price Rule with complex conditions</data>
<data key="defaultStoreView">Cart Price Rule with complex conditions</data>
</entity>
<entity name="InactiveSalesRule">
<data key="name" unique="suffix">Inactive Cart Price Rule</data>
<data key="description">Inactive Cart Price Rule</data>
<data key="is_active">0</data>
<data key="websites">Main Website</data>
<data key="customerGroups">'NOT LOGGED IN'</data>
<data key="coupon_type">No Coupon</data>
<data key="apply">Percent of product price discount</data>
<data key="discountAmount">50</data>
</entity>
</entities>
Loading

0 comments on commit ede7bc8

Please sign in to comment.