Skip to content

Commit eb83bb9

Browse files
ACQE-8433: Verify the 'Email sent' message is displaying in the header by generating email for invoice, shipment and credit memo
- Created automation test file
1 parent b1846f1 commit eb83bb9

File tree

4 files changed

+131
-6
lines changed

4 files changed

+131
-6
lines changed

app/code/Magento/Sales/Test/Mftf/Data/OrderData.xml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
6-
*/
3+
/**
4+
* Copyright 2018 Adobe
5+
* All Rights Reserved.
6+
*/
77
-->
88

99
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -45,4 +45,8 @@
4545
<data key="processing">Processing</data>
4646
<data key="ordered">Ordered</data>
4747
</entity>
48+
<entity name="AdminOrderEmailsSendMessage" type="text">
49+
<data key="message">You sent the message.</data>
50+
<data key="shipmentMessage">You sent the shipment.</data>
51+
</entity>
4852
</entities>

app/code/Magento/Sales/Test/Mftf/Data/PaymentConfigData.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2019 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -12,6 +12,10 @@
1212
<data key="label">payment/checkmo/active</data>
1313
<data key="value">1</data>
1414
</entity>
15+
<entity name="disabledCheckMoneyOrder" type="config">
16+
<data key="label">payment/checkmo/active</data>
17+
<data key="value">0</data>
18+
</entity>
1519
<entity name="enabledBankTransferPaymentOrder" type="config">
1620
<data key="label">payment/banktransfer/active</data>
1721
<data key="value">1</data>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,9 @@
3232
<element name="invoiceTabContent1" type="text" selector="#sales_order_view_tabs_order_invoices_content > div > div.admin__data-grid-wrap > table > tbody > tr > td"/>
3333
<element name="creditMemoWarning" type="text" selector="//div[@class='modal-content']//div[text()='This will create an offline refund. To create an online refund, open an invoice and create credit memo for it. Do you want to continue?']"/>
3434
<element name="linkOrder" type="text" selector="//*[@id='sales_order_view_tabs_order_info_content']//table[contains(@class,'order-information-table')]/tbody//tr//th[text()='{{orderInfo}}']/following-sibling::td//a" parameterized="true"/>
35+
<element name="sendShipmentEmail" type="button" selector="//*[@id='save']"/>
36+
<element name="sendCreditMemoEmail" type="button" selector="//*[@id='send_notification']"/>
37+
<element name="openShipmentFromGrid" type="button" selector="table.data-grid tbody > tr:first-child a.action-menu-item[href*='order_shipment/view']"/>
38+
<element name="openCreditMemoFromGrid" type="button" selector="table.data-grid tbody > tr:first-child a.action-menu-item[href*='order_creditmemo/view']"/>
3539
</section>
3640
</sections>
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminOrderEmailsConfirmationMessageTest">
12+
<annotations>
13+
<features value="Sales"/>
14+
<title value="Admin sees confirmation messages for invoice, shipment, and credit memo emails"/>
15+
<description value="Covers storefront order placement and admin sending invoice, shipment, and credit memo emails with confirmation message checks"/>
16+
<stories value="Place order, send invoice, shipment, and credit memo emails and check confirmation messages"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="AC-9122"/>
19+
<group value="Sales"/>
20+
</annotations>
21+
<before>
22+
<!-- Enable payment method one of "check/money order" -->
23+
<magentoCLI command="config:set {{enabledCheckMoneyOrder.label}} {{enabledCheckMoneyOrder.value}}" stepKey="enableCheckMoneyOrder"/>
24+
<!-- Create simple product -->
25+
<createData entity="SimpleProduct2" stepKey="createSimpleProduct"/>
26+
<!-- Create customer -->
27+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
28+
</before>
29+
<!-- Step 1: Go to frontend and log in as customer -->
30+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount">
31+
<argument name="Customer" value="$$createCustomer$$"/>
32+
</actionGroup>
33+
<!-- Step 2: Add product to cart and place order -->
34+
<actionGroup ref="StorefrontAddSimpleProductWithQtyActionGroup" stepKey="addSimpleProductToCart">
35+
<argument name="product" value="$$createSimpleProduct$$"/>
36+
<argument name="quantity" value="1"/>
37+
</actionGroup>
38+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
39+
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRate"/>
40+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="goToReview"/>
41+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyOrder"/>
42+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlacePurchaseOrder"/>
43+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="orderNumber"/>
44+
<!-- Step 3: Log in to admin -->
45+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
46+
<!-- Step 4: Go to sales order and open order -->
47+
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrderInAdmin">
48+
<argument name="orderId" value="{$orderNumber}"/>
49+
</actionGroup>
50+
<!-- Step 5: Create invoice, shipment, and credit memo -->
51+
<actionGroup ref="AdminCreateInvoiceAndShipmentActionGroup" stepKey="createInvoiceAndShipment"/>
52+
<actionGroup ref="AdminCreateCreditMemoWithReturnToStockActionGroup" stepKey="createCreditMemo"/>
53+
<!-- Step 6: In the order page, click on invoice under the information tab -->
54+
<click selector="{{AdminOrderDetailsMainActionsSection.invoiceTab}}" stepKey="goToInvoiceTab"/>
55+
<!-- Steps 7: Click on view button under action. -->
56+
<actionGroup ref="AdminSelectFirstGridRowActionGroup" stepKey="openInvoiceFromGrid"/>
57+
<!-- Step 8: Click on Send Email button -->
58+
<click selector="{{AdminOrderDetailsMainActionsSection.sendEmail}}" stepKey="clickSendInvoiceEmail"/>
59+
<waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForInvoiceConfirmationModal"/>
60+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmSendInvoiceEmail"/>
61+
<waitForElementVisible selector="{{AdminOrderDetailsMessagesSection.successMessage}}" stepKey="waitForInvoiceSuccessMessage"/>
62+
<grabTextFrom selector="{{AdminOrderDetailsMessagesSection.successMessage}}" stepKey="grabInvoiceSuccessMessage"/>
63+
<!-- Assert invoice email confirmation -->
64+
<assertEquals stepKey="assertInvoiceEmailConfirmation">
65+
<actualResult type="const">$grabInvoiceSuccessMessage</actualResult>
66+
<expectedResult type="string">{{AdminOrderEmailsSendMessage.message}}</expectedResult>
67+
</assertEquals>
68+
<!-- Step 9: Send shipment email -->
69+
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrderInAdmin1">
70+
<argument name="orderId" value="{$orderNumber}"/>
71+
</actionGroup>
72+
<click selector="{{AdminOrderDetailsMainActionsSection.shipmentsTab}}" stepKey="goToShipmentTab"/>
73+
<click selector="{{AdminOrderDetailsMainActionsSection.openShipmentFromGrid}}" stepKey="clickShipmentViewLink"/>
74+
<waitForElementVisible selector="{{AdminOrderDetailsMainActionsSection.sendShipmentEmail}}" stepKey="waitForSendShipmentEmailButton"/>
75+
<click selector="{{AdminOrderDetailsMainActionsSection.sendShipmentEmail}}" stepKey="clickSendShipmentEmail"/>
76+
<waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForShipmentConfirmationModal"/>
77+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmSendShipmentEmail"/>
78+
<waitForElementVisible selector="{{AdminOrderDetailsMessagesSection.successMessage}}" stepKey="waitForShipmentSuccessMessage"/>
79+
<grabTextFrom selector="{{AdminOrderDetailsMessagesSection.successMessage}}" stepKey="grabShipmentSuccessMessage"/>
80+
<!-- Assert shipment email confirmation -->
81+
<assertEquals stepKey="assertShipmentEmailConfirmation">
82+
<actualResult type="const">$grabShipmentSuccessMessage</actualResult>
83+
<expectedResult type="string">{{AdminOrderEmailsSendMessage.shipmentMessage}}</expectedResult>
84+
</assertEquals>
85+
<!-- Step 10: Send credit memo email -->
86+
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrderInAdmin2">
87+
<argument name="orderId" value="{$orderNumber}"/>
88+
</actionGroup>
89+
<click selector="{{AdminCreditMemoTotalSection.creditMemoItem}}" stepKey="goToCreditMemoTab"/>
90+
<click selector="{{AdminOrderDetailsMainActionsSection.openCreditMemoFromGrid}}" stepKey="openCreditMemoFromGrid"/>
91+
<click selector="{{AdminOrderDetailsMainActionsSection.sendCreditMemoEmail}}" stepKey="clickSendCreditMemoEmail"/>
92+
<waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForCreditMemoConfirmationModal"/>
93+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmSendCreditMemoEmail"/>
94+
<waitForElementVisible selector="{{AdminOrderDetailsMessagesSection.successMessage}}" stepKey="waitForCreditMemoSuccessMessage"/>
95+
<grabTextFrom selector="{{AdminOrderDetailsMessagesSection.successMessage}}" stepKey="grabCreditMemoSuccessMessage"/>
96+
<!-- Assert credit memo email confirmation -->
97+
<assertEquals stepKey="assertCreditMemoEmailConfirmation">
98+
<actualResult type="const">$grabCreditMemoSuccessMessage</actualResult>
99+
<expectedResult type="string">{{AdminOrderEmailsSendMessage.message}}</expectedResult>
100+
</assertEquals>
101+
<after>
102+
<!-- Delete product and customer -->
103+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
104+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
105+
<!-- Logout from admin -->
106+
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
107+
<!-- Logout from storefront -->
108+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
109+
<!-- Disable payment method "Check/Money Order" -->
110+
<magentoCLI command="config:set {{disabledCheckMoneyOrder.label}} {{disabledCheckMoneyOrder.value}}" stepKey="disableCheckMoneyOrder"/>
111+
</after>
112+
</test>
113+
</tests>

0 commit comments

Comments
 (0)