Skip to content

Commit 5f875f5

Browse files
committed
Merge remote-tracking branch 'l3/ACP2E-362' into PR_L3_18_04_2022
2 parents 0d7f240 + 0216135 commit 5f875f5

File tree

2 files changed

+97
-2
lines changed

2 files changed

+97
-2
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCheckingDateAfterChangeFrenchCanadaInterfaceLocaleTest">
11+
<annotations>
12+
<features value="Ui"/>
13+
<stories value="Invalid date-time format in the admin order grid for French local"/>
14+
<title value="Checking date format in orders grid column after changing admin interface locale to French(Canada)"/>
15+
<description value="Checking date format in orders grid column after changing admin interface locale to French(Canada)"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="AC-2623"/>
18+
<useCaseId value="ACP2E-362"/>
19+
<group value="backend"/>
20+
<group value="ui"/>
21+
<group value="sales"/>
22+
</annotations>
23+
<before>
24+
<!--Deploy static content with French(Canada) locale-->
25+
<magentoCLI command="setup:static-content:deploy fr_CA" stepKey="deployStaticContentWithFrenchLocale"/>
26+
<!--Create entities-->
27+
<createData entity="SimpleProduct2" stepKey="createProduct"/>
28+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
29+
<!--Login to Admin page-->
30+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
31+
</before>
32+
<after>
33+
<!--Delete entities-->
34+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
35+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
36+
<!--Set Admin "Interface Locale" to default value-->
37+
<actionGroup ref="SetAdminAccountActionGroup" stepKey="setAdminInterfaceLocaleToDefaultValue">
38+
<argument name="InterfaceLocaleByValue" value="en_US"/>
39+
</actionGroup>
40+
<!--Clear filters-->
41+
<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderFilters"/>
42+
<!--Logout from Admin page-->
43+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
44+
</after>
45+
46+
<!--Create order-->
47+
<actionGroup ref="CreateOrderActionGroup" stepKey="createOrder">
48+
<argument name="product" value="$$createProduct$$"/>
49+
<argument name="customer" value="$$createCustomer$$"/>
50+
</actionGroup>
51+
<grabTextFrom selector="{{AdminOrderDetailsInformationSection.orderId}}" stepKey="grabOrderId"/>
52+
53+
<!--Filter orders grid by ID on Admin page-->
54+
<actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById">
55+
<argument name="orderId" value="{$grabOrderId}"/>
56+
</actionGroup>
57+
58+
<!--Get date from "Purchase Date" column-->
59+
<grabTextFrom selector="{{AdminOrdersGridSection.gridCell('1','Purchase Date')}}" stepKey="grabPurchaseDateInDefaultLocale"/>
60+
61+
<!--Get month name in default locale (US)-->
62+
<executeJS function="return (new Date('{$grabPurchaseDateInDefaultLocale}').toLocaleDateString('en-US', {month: 'short'}))" stepKey="getMonthNameInUS"/>
63+
64+
<!--Checking Date with default "Interface Locale"-->
65+
<assertStringContainsString stepKey="checkingDateWithDefaultInterfaceLocale">
66+
<expectedResult type="variable">getMonthNameInUS</expectedResult>
67+
<actualResult type="variable">grabPurchaseDateInDefaultLocale</actualResult>
68+
</assertStringContainsString>
69+
70+
<!--Set Admin "Interface Locale" to "Français (Canada) / français (Canada)"-->
71+
<actionGroup ref="SetAdminAccountActionGroup" stepKey="setAdminInterfaceLocaleToFrance">
72+
<argument name="InterfaceLocaleByValue" value="fr_CA"/>
73+
</actionGroup>
74+
75+
<!--Filter orders grid by ID on Admin page after changing "Interface Locale"-->
76+
<actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridByIdAfterSetFrenchLocale">
77+
<argument name="orderId" value="{$grabOrderId}"/>
78+
</actionGroup>
79+
80+
<!--Get date from "Purchase Date" column after changing "Interface Locale"-->
81+
<grabTextFrom selector="{{AdminOrdersGridSection.gridCell('1','Purchase Date')}}" stepKey="grabPurchaseDateInFrenchLocale"/>
82+
83+
<!--Get month name in French-->
84+
<executeJS function="return (new Date('{$grabPurchaseDateInDefaultLocale}').toLocaleDateString('fr-CA', {month: 'short'}))" stepKey="getMonthNameInFrench"/>
85+
86+
<!--Checking Date after changing "Interface Locale"-->
87+
<assertStringContainsString stepKey="checkingDateAfterChangeInterfaceLocale">
88+
<expectedResult type="variable">getMonthNameInFrench</expectedResult>
89+
<actualResult type="variable">grabPurchaseDateInFrenchLocale</actualResult>
90+
</assertStringContainsString>
91+
</test>
92+
</tests>

lib/web/mage/utils/misc.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,12 @@ define([
9393
var result = mageFormat;
9494

9595
_.each(map, function (moment, mage) {
96-
result = result.replace(mage, moment);
96+
result = result.replace(
97+
new RegExp(mage + '(?=([^\u0027]*\u0027[^\u0027]*\u0027)*[^\u0027]*$)'),
98+
moment
99+
);
97100
});
98-
101+
result = result.replace(/'(.*?)'/g, '[$1]');
99102
return result;
100103
},
101104

0 commit comments

Comments
 (0)