Skip to content

Commit 976b696

Browse files
ENGCOM-8431: [MFTF] Add AssertStorefrontCartDiscountActionGroup #30776
2 parents 6602482 + a76d695 commit 976b696

16 files changed

+77
-26
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertStorefrontCartDiscountActionGroup">
12+
<annotations>
13+
<description>Assert that the provided Discount is present in the Storefront Shopping Cart.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="discount" type="string" defaultValue="0"/>
17+
</arguments>
18+
<waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscount"/>
19+
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-${{discount}}" stepKey="assertDiscount"/>
20+
</actionGroup>
21+
</actionGroups>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@
4747
<actionGroup ref="CheckoutFillEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxFields"/>
4848

4949
<!-- Assert Discount and proceed to checkout -->
50-
<waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/>
51-
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$50.00" stepKey="seeDiscountTotal"/>
50+
<comment userInput="Adding the comment to replace action for preserving Backward Compatibility" stepKey="waitForDiscountElement"/>
51+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeDiscountTotal">
52+
<argument name="discount" value="50.00"/>
53+
</actionGroup>
5254
<actionGroup ref="StorefrontClickProceedToCheckoutActionGroup" stepKey="goToCheckout"/>
5355
<comment userInput="Adding the comment to replace waitForPageToLoad action for preserving Backward Compatibility" stepKey="waitForPageToLoad"/>
5456

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@
7575
</actionGroup>
7676

7777
<!-- Assert Discount and proceed to checkout -->
78-
<waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/>
79-
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$15.00" stepKey="seeDiscountTotal"/>
78+
<comment userInput="Adding the comment to replace action for preserving Backward Compatibility" stepKey="waitForDiscountElement"/>
79+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeDiscountTotal">
80+
<argument name="discount" value="15.00"/>
81+
</actionGroup>
8082
<actionGroup ref="StorefrontClickProceedToCheckoutActionGroup" stepKey="goToCheckout"/>
8183
<comment userInput="Adding the comment to replace waitForPageToLoad1 action for preserving Backward Compatibility" stepKey="waitForPageToLoad1"/>
8284

app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@
107107
<argument name="total" value="$280.00"/>
108108
</actionGroup>
109109
<see selector="{{CheckoutCartSummarySection.shipping}}" userInput="$0.00" stepKey="seeAssertFreeShippingConditionApplied"/>
110-
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$280.00" stepKey="seeAssertDiscountAmountAppliedForMatchingItemsConditionIsTrue"/>
110+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeAssertDiscountAmountAppliedForMatchingItemsConditionIsTrue">
111+
<argument name="discount" value="280.00"/>
112+
</actionGroup>
111113
</test>
112114
</tests>

app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@
8787
<argument name="coupon" value="_defaultCoupon"/>
8888
</actionGroup>
8989
<waitForPageLoad stepKey="waitForProductPageLoad2"/>
90-
<waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/>
91-
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$5.00" stepKey="seeDiscountTotal"/>
90+
<comment userInput="Adding the comment to replace action for preserving Backward Compatibility" stepKey="waitForDiscountElement"/>
91+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeDiscountTotal">
92+
<argument name="discount" value="5.00"/>
93+
</actionGroup>
9294

9395
<!--Reset timezone-->
9496
<actionGroup ref="AdminOpenGeneralConfigurationPageActionGroup" stepKey="goToGeneralConfigReset"/>

app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@
8080
<argument name="coupon" value="_defaultCoupon"/>
8181
</actionGroup>
8282
<waitForPageLoad stepKey="waitForProductPageLoad2"/>
83-
<waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/>
84-
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$5.00" stepKey="seeDiscountTotal"/>
83+
<comment userInput="Adding the comment to replace action for preserving Backward Compatibility" stepKey="waitForDiscountElement"/>
84+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeDiscountTotal">
85+
<argument name="discount" value="5.00"/>
86+
</actionGroup>
8587
</test>
8688
</tests>

app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@
8484
<waitForElementVisible selector="{{StorefrontSalesRuleCartCouponSection.couponField}}" stepKey="waitForCouponField" />
8585
<fillField selector="{{StorefrontSalesRuleCartCouponSection.couponField}}" userInput="{$grabCouponCode}" stepKey="fillCouponField"/>
8686
<click selector="{{StorefrontSalesRuleCartCouponSection.applyButton}}" stepKey="clickApplyButton"/>
87-
<waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/>
88-
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$0.99" stepKey="seeDiscountTotal"/>
87+
<comment userInput="Adding the comment to replace action for preserving Backward Compatibility" stepKey="waitForDiscountElement"/>
88+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeDiscountTotal">
89+
<argument name="discount" value="0.99"/>
90+
</actionGroup>
8991
</test>
9092
</tests>

app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@
116116
<argument name="shippingMethod" value="Flat Rate - Fixed"/>
117117
<argument name="total" value="$285.00"/>
118118
</actionGroup>
119-
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$280.00" stepKey="seeAssertDiscountAmountAppliedForSubtotalConditionIsTrue"/>
119+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeAssertDiscountAmountAppliedForSubtotalConditionIsTrue">
120+
<argument name="discount" value="280.00"/>
121+
</actionGroup>
120122
</test>
121123
</tests>

app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@
118118
<argument name="shippingMethod" value="Flat Rate - Fixed"/>
119119
<argument name="total" value="$66.50"/>
120120
</actionGroup>
121-
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$61.50" stepKey="seeAssertDiscountAmountAppliedForMatchingCategory"/>
121+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeAssertDiscountAmountAppliedForMatchingCategory">
122+
<argument name="discount" value="61.50"/>
123+
</actionGroup>
122124
</test>
123125
</tests>

app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@
106106
<argument name="shippingMethod" value="Flat Rate - Fixed"/>
107107
<argument name="total" value="$285.00"/>
108108
</actionGroup>
109-
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$280.00" stepKey="seeAssertDiscountAmountAppliedForWeightConditionIsTrue"/>
109+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeAssertDiscountAmountAppliedForWeightConditionIsTrue">
110+
<argument name="discount" value="280.00"/>
111+
</actionGroup>
110112
</test>
111113
</tests>

app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleCountryTest.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@
7777
<!-- See discount if we use valid country -->
7878
<selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="Brazil" stepKey="fillCountry"/>
7979
<waitForPageLoad stepKey="waitForCountry1"/>
80-
<waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/>
81-
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$9.99" stepKey="seeDiscountTotal"/>
80+
<comment userInput="Adding the comment to replace action for preserving Backward Compatibility" stepKey="waitForDiscountElement"/>
81+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeDiscountTotal">
82+
<argument name="discount" value="9.99"/>
83+
</actionGroup>
8284

8385
<!-- Do not see discount with other country -->
8486
<selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="United States" stepKey="fillCountry2"/>

app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRulePostcodeTest.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@
8181
<!-- See discount if we use valid postcode -->
8282
<fillField selector="{{CheckoutCartSummarySection.postcode}}" userInput="78613" stepKey="fillPostcode"/>
8383
<waitForPageLoad stepKey="waitForPostcode1"/>
84-
<waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/>
85-
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$9.99" stepKey="seeDiscountTotal"/>
84+
<comment userInput="Adding the comment to replace action for preserving Backward Compatibility" stepKey="waitForDiscountElement"/>
85+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeDiscountTotal">
86+
<argument name="discount" value="9.99"/>
87+
</actionGroup>
8688

8789
<!-- Do not see discount with other postcode -->
8890
<fillField selector="{{CheckoutCartSummarySection.postcode}}" userInput="90210" stepKey="fillPostcode2"/>

app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleQuantityTest.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@
8383
<!-- Now we should see the discount because we have more than 1 item -->
8484
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goToCartPage2"/>
8585
<see selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$246.00" stepKey="seeSubtotal2"/>
86-
<waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/>
87-
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$1.00" stepKey="seeDiscountTotal"/>
86+
<comment userInput="Adding the comment to replace action for preserving Backward Compatibility" stepKey="waitForDiscountElement"/>
87+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeDiscountTotal">
88+
<argument name="discount" value="1.00"/>
89+
</actionGroup>
8890
</test>
8991
</tests>

app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleStateTest.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@
7777
<!-- See discount if we use valid postcode -->
7878
<selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="Indiana" stepKey="fillState"/>
7979
<waitForPageLoad stepKey="waitForPostcode1"/>
80-
<waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/>
81-
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$9.99" stepKey="seeDiscountTotal"/>
80+
<comment userInput="Adding the comment to replace action for preserving Backward Compatibility" stepKey="waitForDiscountElement"/>
81+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeDiscountTotal">
82+
<argument name="discount" value="9.99"/>
83+
</actionGroup>
8284

8385
<!-- Do not see discount with other postcode -->
8486
<selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="Texas" stepKey="fillState2"/>

app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartPriceRuleSubtotalTest.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@
8181
<!-- Now we should see the discount because we exceeded $200 -->
8282
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goToCartPage2"/>
8383
<see selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$246.00" stepKey="seeSubtotal2"/>
84-
<waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/>
85-
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$0.01" stepKey="seeDiscountTotal"/>
84+
<comment userInput="Adding the comment to replace action for preserving Backward Compatibility" stepKey="waitForDiscountElement"/>
85+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeDiscountTotal">
86+
<argument name="discount" value="0.01"/>
87+
</actionGroup>
8688
</test>
8789
</tests>

app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,10 @@
117117
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="amOnPageShoppingCart"/>
118118
<waitForElementVisible selector="{{CheckoutCartSummarySection.orderTotal}}" stepKey="waitForOrderTotalVisible"/>
119119
<selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="United States" stepKey="selectCountry"/>
120-
<waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForOrderTotalUpdate"/>
121-
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$29.00" stepKey="seeDiscountAmount"/>
120+
<comment userInput="Adding the comment to replace action for preserving Backward Compatibility" stepKey="waitForOrderTotalUpdate"/>
121+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeDiscountAmount">
122+
<argument name="discount" value="29.00"/>
123+
</actionGroup>
122124
<see selector="{{CheckoutCartSummarySection.subTotal}}" userInput="$29.00" stepKey="seeSubTotal"/>
123125
<see selector="{{CheckoutCartSummarySection.orderTotal}}" userInput="0.00" stepKey="seeOrderTotal"/>
124126
</test>

0 commit comments

Comments
 (0)