Skip to content

Commit 1739b23

Browse files
committed
ACP2E-690: Discount code Times Used is being counted twice
1 parent abdb8fe commit 1739b23

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

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

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@
2828
<after>
2929
<!--Delete simple product created during the test-->
3030
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
31-
<!--Delete the cart price rule we made during the test-->
32-
<actionGroup ref="DeleteCartPriceRuleByName" stepKey="cleanUpRule">
33-
<argument name="ruleName" value="{{CatPriceRule.name}}"/>
34-
</actionGroup>
3531
<!--Delete customer created during the test-->
3632
<actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteCustomer">
3733
<argument name="email" value="{{CustomerEntityOne.email}}"/>
3834
</actionGroup>
35+
<!--Delete the cart price rule we made during the test-->
36+
<actionGroup ref="DeleteCartPriceRuleByName" stepKey="cleanUpRule">
37+
<argument name="ruleName" value="{{CatPriceRule.name}}"/>
38+
</actionGroup>
3939
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
4040
</after>
4141

4242
<!--Go to admin Marketing > Cart Price Rule Page-->
4343
<actionGroup ref="AdminOpenCartPriceRulesPageActionGroup" stepKey="amOnCartPriceList"/>
4444

4545
<!--Create a new rule with specified details below-->
46-
<click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule" after="amOnCartPriceList"/>
47-
<fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{CatPriceRule.name}}" stepKey="fillRuleName" after="clickAddNewRule"/>
46+
<click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/>
47+
<fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{CatPriceRule.name}}" stepKey="fillRuleName"/>
4848
<selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="{{CartPriceRuleConditionAndFreeShippingApplied.websites}}" stepKey="selectWebsites"/>
4949
<selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" parameterArray="[{{CatPriceRule.customerGroups}}]" stepKey="selectCustomerGroup"/>
5050

@@ -54,41 +54,40 @@
5454
<fillField selector="{{AdminCartPriceRulesFormSection.userPerCustomer}}" userInput="1" stepKey="fillUsesPerCustomer"/>
5555

5656
<!--Navigate to Actions tab and set the specified details-->
57-
<click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions" after="fillUsesPerCustomer"/>
57+
<click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/>
5858
<selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="{{CatPriceRule.apply}}" stepKey="selectActionType"/>
5959
<fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="{{CatPriceRule.discountAmount}}" stepKey="fillDiscountAmount"/>
6060
<click selector="{{AdminCartPriceRulesFormSection.saveAndContinue}}" stepKey="clickSaveAndContinueButton"/>
6161
<waitForPageLoad stepKey="waitForPageToLoad"/>
6262

6363
<!-- Navigate to Manage Coupon Codes section to generate 5 coupon code -->
64-
<click selector="{{AdminCartPriceRulesFormSection.manageCouponCodesHeader}}" stepKey="expandCouponSection" after="clickSaveAndContinueButton"/>
65-
<fillField selector="{{AdminCartPriceRulesFormSection.couponQty}}" userInput="5" stepKey="fillCouponQty"/>
64+
<click selector="{{AdminCartPriceRulesFormSection.manageCouponCodesHeader}}" stepKey="expandCouponSection"/>
65+
<fillField selector="{{AdminCartPriceRulesFormSection.couponQty}}" userInput="1" stepKey="fillCouponQty"/>
6666
<click selector="{{AdminCartPriceRulesFormSection.generateCouponsButton}}" stepKey="clickGenerate"/>
6767
<see selector="{{AdminCartPriceRulesFormSection.successMessage}}" userInput="Message is added to queue, wait to get your coupons soon" stepKey="seeGenerationSuccess"/>
6868

6969
<!--Start coupon code generator queue-->
7070
<actionGroup ref="CliConsumerStartActionGroup" stepKey="startMessageQueue">
7171
<argument name="consumerName" value="{{AdminCodeGeneratorMessageConsumerData.consumerName}}"/>
72-
<argument name="maxMessages" value="5"/>
72+
<argument name="maxMessages" value="1"/>
7373
</actionGroup>
7474

7575
<!--Reload cart price rule page-->
76-
<actionGroup ref="ReloadPageActionGroup" stepKey="refreshPage" after="startMessageQueue"/>
76+
<actionGroup ref="ReloadPageActionGroup" stepKey="refreshPage"/>
7777

7878
<!--Open Manage Coupon Codes tab again to see generated coupon codes-->
79-
<click selector="{{AdminCartPriceRulesFormSection.manageCouponCodesHeader}}" stepKey="expandCouponSectionSecondTime" after="refreshPage"/>
80-
<scrollTo selector="{{AdminCartPriceRulesFormSection.couponGridUsedHeader}}" stepKey="scrollToCouponGridUsedHeader" after="expandCouponSectionSecondTime"/>
81-
<waitForElementVisible selector="{{AdminCartPriceRulesFormSection.couponGridUsedHeader}}" stepKey="waitForNewRule" after="scrollToCouponGridUsedHeader"/>
79+
<click selector="{{AdminCartPriceRulesFormSection.manageCouponCodesHeader}}" stepKey="expandCouponSectionSecondTime"/>
80+
<scrollTo selector="{{AdminCartPriceRulesFormSection.couponGridUsedHeader}}" stepKey="scrollToCouponGridUsedHeader"/>
81+
<waitForElementVisible selector="{{AdminCartPriceRulesFormSection.couponGridUsedHeader}}" stepKey="waitForNewRule"/>
8282

8383
<!--Assert coupon codes grid header is correct -->
84-
<see selector="{{AdminCartPriceRulesFormSection.couponGridUsedHeader}}" userInput="Used" stepKey="seeCorrectUsedHeader" after="waitForNewRule"/>
84+
<see selector="{{AdminCartPriceRulesFormSection.couponGridUsedHeader}}" userInput="Used" stepKey="seeCorrectUsedHeader"/>
8585

8686
<!--Grab a coupon code and hold on to it for later -->
8787
<grabTextFrom selector="{{AdminCartPriceRulesFormSection.generatedCouponByIndex('1')}}" stepKey="couponCode"/>
8888

89-
9089
<!--Open the Product Page, add the product to Cart, go to Shopping Cart and Apply the same coupon code -->
91-
<amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="openProductPage" after="couponCode"/>
90+
<amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="openProductPage"/>
9291
<actionGroup ref="ApplyCartRuleOnStorefrontActionGroup" stepKey="applyCartPriceRule">
9392
<argument name="product" value="$$createSimpleProduct$$"/>
9493
<argument name="couponCode" value="{$couponCode}"/>
@@ -112,27 +111,26 @@
112111
</actionGroup>
113112

114113
<!-- Create Customer using guest details while placing an order -->
115-
<actionGroup ref="StorefrontRegisterCustomerFromOrderSuccessPage" stepKey="createCustomerAfterPlaceOrder" after="guestPlaceOrder">
114+
<actionGroup ref="StorefrontRegisterCustomerFromOrderSuccessPage" stepKey="createCustomerAfterPlaceOrder">
116115
<argument name="customer" value="CustomerEntityOne"/>
117116
</actionGroup>
118117

119-
<!-- Run cron three times to force update and wait 2 minutes -->
120118
<!-- Run cron -->
121119
<magentoCron stepKey="runAllCronJobs"/>
122120
<reloadPage stepKey="refreshPageAfterCronRun"/>
123121

124122
<!-- Search and go to cart price rule page again -->
125-
<amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceListSecondTime" after="refreshPageAfterCronRun"/>
123+
<amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceListSecondTime"/>
126124
<waitForPageLoad stepKey="waitForPriceList"/>
127125
<fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="{{CatPriceRule.name}}" stepKey="filterByName"/>
128126
<click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="doFilter"/>
129127
<click selector="{{AdminCartPriceRulesSection.rowByIndex('1')}}" stepKey="goToEditRulePage"/>
130-
<click selector="{{AdminCartPriceRulesFormSection.manageCouponCodesHeader}}" stepKey="expandCouponSectionThirdTime" after="goToEditRulePage"/>
131-
<scrollTo selector="{{AdminCartPriceRulesFormSection.couponGridUsedHeader}}" stepKey="scrollToCouponGridUsedHeaderSecondTime" after="expandCouponSectionThirdTime"/>
132-
<waitForElementVisible selector="{{AdminCartPriceRulesFormSection.couponGridUsedHeader}}" stepKey="waitForCouponGridToLoad" after="scrollToCouponGridUsedHeaderSecondTime"/>
128+
<click selector="{{AdminCartPriceRulesFormSection.manageCouponCodesHeader}}" stepKey="expandCouponSectionThirdTime"/>
129+
<scrollTo selector="{{AdminCartPriceRulesFormSection.couponGridUsedHeader}}" stepKey="scrollToCouponGridUsedHeaderSecondTime"/>
130+
<waitForElementVisible selector="{{AdminCartPriceRulesFormSection.couponGridUsedHeader}}" stepKey="waitForCouponGridToLoad"/>
133131

134132
<!--Verify coupon does not used twice-->
135133
<see userInput="1" selector="{{AdminCartPriceRulesFormSection.generatedCouponTimesUsed('1')}}" stepKey="seeTimesUsed"/>
136-
<wait time="5" stepKey="waitToSeeTimesUsed" after="seeTimesUsed"/>
134+
<wait time="5" stepKey="waitToSeeTimesUsed"/>
137135
</test>
138136
</tests>

0 commit comments

Comments
 (0)