Skip to content

Commit c4e20bf

Browse files
committed
Merge branch 'ACP2E-1369' of https://github.com/magento-l3/magento2ce into PR-02142023
2 parents c1f2439 + d3d4b33 commit c4e20bf

File tree

3 files changed

+96
-4
lines changed

3 files changed

+96
-4
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminOrderCheckCommentsHistoryTest">
12+
<annotations>
13+
<features value="Sales"/>
14+
<stories value="Admin order page"/>
15+
<title value="Check Comments History Tab"/>
16+
<description value="Check if order comments history tab is loading"/>
17+
<severity value="MINOR"/>
18+
<testCaseId value="AC-7087"/>
19+
<useCaseId value="ACP2E-1369"/>
20+
<group value="sales"/>
21+
</annotations>
22+
<before>
23+
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
24+
<createData entity="_defaultCategory" stepKey="createCategory"/>
25+
<createData entity="SimpleProduct" stepKey="createProduct">
26+
<requiredEntity createDataKey="createCategory"/>
27+
</createData>
28+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
29+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
30+
</before>
31+
<after>
32+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
33+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
34+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
35+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
36+
</after>
37+
38+
<!-- Create order, invoice, shipment and credit memo -->
39+
<createData entity="CustomerCart" stepKey="createCustomerCart">
40+
<requiredEntity createDataKey="createCustomer"/>
41+
</createData>
42+
<createData entity="CustomerCartItem" stepKey="addCartItem">
43+
<requiredEntity createDataKey="createCustomerCart"/>
44+
<requiredEntity createDataKey="createProduct"/>
45+
</createData>
46+
<createData entity="CustomerAddressInformation" stepKey="addCustomerOrderAddress">
47+
<requiredEntity createDataKey="createCustomerCart"/>
48+
</createData>
49+
<updateData createDataKey="createCustomerCart" entity="CustomerOrderPaymentMethod" stepKey="createFirstOrder">
50+
<requiredEntity createDataKey="createCustomerCart"/>
51+
</updateData>
52+
<createData entity="Invoice" stepKey="invoiceOrder">
53+
<requiredEntity createDataKey="createCustomerCart"/>
54+
</createData>
55+
<createData entity="Shipment" stepKey="createShipment">
56+
<requiredEntity createDataKey="createCustomerCart"/>
57+
</createData>
58+
<createData entity="CreditMemo" stepKey="createCreditMemo">
59+
<requiredEntity createDataKey="createCustomerCart"/>
60+
</createData>
61+
62+
<!-- Open Admin Order page -->
63+
<actionGroup ref="AdminOpenOrderViewPageByOrderIdActionGroup" stepKey="openOrder">
64+
<argument name="orderId" value="$createCustomerCart.return$"/>
65+
</actionGroup>
66+
67+
<!--Go to Comments history and switch to Information -->
68+
<click selector="{{AdminOrderDetailsOrderViewSection.commentsHistory}}" stepKey="goToCommentsHistory1"/>
69+
<click selector="{{AdminOrderDetailsOrderViewSection.information}}" stepKey="goToInformation"/>
70+
<dontSee userInput="A technical problem with the server created an error" stepKey="dontSeeTechnicalErrorMessageOne"/>
71+
72+
<!--Go to Comments history and don't see the error message -->
73+
<click selector="{{AdminOrderDetailsOrderViewSection.commentsHistory}}" stepKey="goToCommentsHistory2"/>
74+
<waitForPageLoad stepKey="waitForCommentsHistoryPage"/>
75+
<see userInput="Notes for this Order" stepKey="seeMessageNotesForThisOrder"/>
76+
<dontSee userInput="A technical problem with the server created an error" stepKey="dontSeeTechnicalErrorMessageTwo"/>
77+
</test>
78+
</tests>

dev/tests/js/jasmine/tests/lib/mage/backend/bootstrap.test.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,20 @@ define([
2222

2323
describe('"sendPostponeRequest" method', function () {
2424
it('should insert "Error" notification if request failed', function () {
25+
var data = {
26+
jqXHR: {
27+
responseText: 'error',
28+
status: '503',
29+
readyState: 4
30+
},
31+
textStatus: 'error'
32+
};
33+
2534
$pageMainActions.appendTo('body');
2635
$('body').notification();
2736

2837
// eslint-disable-next-line jquery-no-event-shorthand
29-
$.ajaxSettings.error();
38+
$.ajaxSettings.error(data.jqXHR, data.textStatus);
3039

3140
expect($('.message-error').length).toBe(1);
3241
expect(

lib/web/mage/backend/bootstrap.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,14 @@ define([
7373

7474
/**
7575
* Error callback.
76+
*
77+
* @param {Object} jqXHR - The jQuery XMLHttpRequest object returned by $.ajax()
78+
* @param {String} textStatus
7679
*/
77-
error: function () {
78-
$('body').notification('clear')
79-
.notification('add', {
80+
error: function (jqXHR, textStatus) {
81+
$('body').notification('clear');
82+
if (jqXHR.readyState !== 0 && textStatus !== 'abort') {
83+
$('body').notification('add', {
8084
error: true,
8185
message: $.mage.__(
8286
'A technical problem with the server created an error. ' +
@@ -92,6 +96,7 @@ define([
9296
$('.page-main-actions').after($wrapper);
9397
}
9498
});
99+
}
95100
}
96101
});
97102

0 commit comments

Comments
 (0)