Skip to content

Commit 1a8f941

Browse files
committed
Merge remote-tracking branch 'origin/ACP2E-4001' into PR_2025_07_08_muntianu
2 parents 6ee558e + f6bf717 commit 1a8f941

File tree

5 files changed

+126
-5
lines changed

5 files changed

+126
-5
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminPayPalExpressCheckoutCancelInvoiceNotCaptureTest">
11+
<annotations>
12+
<features value="PayPal"/>
13+
<stories value="Invoice for Online Payment"/>
14+
<title value="Cancel No Capture Invoice for Online Payment"/>
15+
<description value="Cancel invoice when online payment has not capture invoice"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="AC-15016"/>
18+
<useCaseId value="ACP2E-4001"/>
19+
<group value="3rd_party_integration"/>
20+
<group value="paypalExpress"/>
21+
<group value="pr_exclude"/>
22+
</annotations>
23+
<before>
24+
<!-- Simple product is created -->
25+
<createData entity="SimpleProduct" stepKey="createProduct">
26+
<field key="price">10.00</field>
27+
</createData>
28+
<!-- US Customer is created -->
29+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
30+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
31+
</before>
32+
<after>
33+
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="onOrderPage"/>
34+
<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearFilters"/>
35+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
36+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
37+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
38+
</after>
39+
<!-- Go to StoreFront -->
40+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToStoreFront"/>
41+
<!-- Add product to cart -->
42+
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart">
43+
<argument name="product" value="$$createProduct$$"/>
44+
</actionGroup>
45+
<!-- Goto Checkout Page -->
46+
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="goToCheckout"/>
47+
<!--Fill Shipping Address-->
48+
<actionGroup ref="GuestCheckoutFillNewShippingAddressActionGroup" stepKey="fillShippingAddress">
49+
<argument name="customer" value="$$createCustomer$$" />
50+
<argument name="address" value="US_Address_TX"/>
51+
</actionGroup>
52+
<!-- Select shipping -->
53+
<actionGroup ref="StorefrontSetShippingMethodActionGroup" stepKey="selectShippingMethodAsFlatRate">
54+
<argument name="shippingMethodName" value="Flat Rate"/>
55+
</actionGroup>
56+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="goToCheckoutPaymentPage"/>
57+
<!-- Click on PayPal payment radio button -->
58+
<waitForElementClickable selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="waitForPayPalRadioButton"/>
59+
<click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="selectPaypalPayment"/>
60+
<actionGroup ref="SwitchToPayPalGroupBtnActionGroup" stepKey="clickPayPalBtn"/>
61+
<!-- Login to Paypal in-context and verify order total on paypal page-->
62+
<actionGroup ref="StorefrontLoginToPayPalPaymentAccountTwoStepActionGroup" stepKey="loginToPayPal"/>
63+
<actionGroup ref="StorefrontPaypalSwitchBackToMagentoFromCheckoutPageActionGroup" stepKey="confirmPaymentAndGoBackToMagento"/>
64+
<!-- I see order successful Page -->
65+
<waitForElementVisible selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="waitForOrderNumberToBeGrabbed"/>
66+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/>
67+
<waitForText selector="{{CheckoutSuccessMainSection.success}}" userInput="We'll email you an order confirmation with details and tracking info." stepKey="seeSuccessMessage"/>
68+
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrder">
69+
<argument name="orderId" value="{$grabOrderNumber}"/>
70+
</actionGroup>
71+
<waitForElementVisible selector="{{AdminOrderPaymentInformationSection.paymentInformationField('Last Transaction ID')}}" stepKey="waitForTransactionIDFieldToBeAppeared"/>
72+
<grabTextFrom selector="{{AdminOrderPaymentInformationSection.paymentInformationField('Last Transaction ID')}}" stepKey="grabTransactionID"/>
73+
<waitForText selector="{{AdminOrderTotalSection.grandTotal}}" userInput="$15.00" stepKey="checkGrandTotal"/>
74+
<!-- Create invoice with not capture amount -->
75+
<actionGroup ref="AdminCreateInvoiceNotCaptureActionGroup" stepKey="createInvoiceNotCapture"/>
76+
<!-- Open invoice and cancel it -->
77+
<actionGroup ref="AdminOpenInvoiceFromOrderPageActionGroup" stepKey="openInvoiceFromOrderPage"/>
78+
<actionGroup ref="AdminClickCancelButtonInInvoiceActionGroup" stepKey="clickCancelInvoiceButton"/>
79+
</test>
80+
</tests>

app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Cancel.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?php
22
/**
3-
*
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
65
*/
76
namespace Magento\Sales\Controller\Adminhtml\Order\Invoice;
87

98
use Magento\Framework\App\Action\HttpPostActionInterface;
9+
use Magento\Framework\App\Action\HttpGetActionInterface;
1010
use Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoice\View;
1111

12-
class Cancel extends View implements HttpPostActionInterface
12+
class Cancel extends View implements HttpPostActionInterface, HttpGetActionInterface
1313
{
1414
/**
1515
* Authorization level of a basic admin session
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
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="AdminClickCancelButtonInInvoiceActionGroup">
12+
<annotations>
13+
<description>Admin clicks cancel button from top menu on invoice page.</description>
14+
</annotations>
15+
<waitForElementClickable selector="{{AdminInvoiceMainActionsSection.cancel}}" stepKey="waitForHoldButtonToBeClickable"/>
16+
<click selector="{{AdminInvoiceMainActionsSection.cancel}}" stepKey="clickCancelButton"/>
17+
<waitForPageLoad stepKey="waitForLoadPage"/>
18+
<waitForText userInput="You canceled the invoice." stepKey="seeMessageInvoiceCanceled"/>
19+
</actionGroup>
20+
</actionGroups>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
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="AdminCreateInvoiceNotCaptureActionGroup" extends="AdminCreateInvoiceActionGroup">
12+
<annotations>
13+
<description>Admin creates invoice for online payment with No Capture option selected.</description>
14+
</annotations>
15+
<waitForElementVisible selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="waitForInvoiceButton" before="clickInvoice"/>
16+
<scrollTo selector="{{AdminInvoiceMainActionsSection.selectModeOfAmount}}" x="0" y="-80" stepKey="scrollToAmount" after="waitForInvoicePage"/>
17+
<selectOption userInput="Not Capture" selector="{{AdminInvoiceMainActionsSection.selectModeOfAmount}}" stepKey="selectNotCaptureUnderAmount" after="scrollToAmount"/>
18+
<waitForElementVisible selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="waitForSubmitInvoicebtn" after="selectNotCaptureUnderAmount"/>
19+
</actionGroup>
20+
</actionGroups>

app/code/Magento/Sales/Test/Mftf/Section/AdminInvoiceMainActionsSection.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright 2024 Adobe
4+
* Copyright 2017 Adobe
55
* All Rights Reserved.
66
*/
77
-->
@@ -12,6 +12,7 @@
1212
<element name="submitInvoice" type="button" selector=".action-default.scalable.save.submit-button.primary" timeout="60"/>
1313
<element name="openNewCreditMemoFromInvoice" type="button" selector=".action-default.scalable.credit-memo"/>
1414
<element name="submitNewRefundFromInvoice" type="button" selector=".action-default.scalable.save.submit-button.refund.primary"/>
15+
<element name="cancel" type="button" selector=".action-default.scalable.delete"/>
1516
<element name="selectModeOfAmount" type="select" selector=".admin__control-select"/>
1617
</section>
1718
</sections>

0 commit comments

Comments
 (0)