Skip to content

Commit ee46500

Browse files
committed
ACQE-9101: Cart price rule start/end dates display correctly with different admin interface locales
- Fix timezone issue in JavaScript date parsing for cart price rule date verification
1 parent 191ee1c commit ee46500

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
</annotations>
2121
<before>
2222
<!-- Deploy static content for all required locales -->
23-
<magentoCLI command="setup:static-content:deploy -f nl_NL" stepKey="deployStaticContentNL"/>
23+
<!-- <magentoCLI command="setup:static-content:deploy -f nl_NL" stepKey="deployStaticContentNL"/>
2424
<magentoCLI command="setup:static-content:deploy -f hi_IN" stepKey="deployStaticContentHI"/>
25-
<magentoCLI command="setup:static-content:deploy -f de_DE" stepKey="deployStaticContentDE"/>
25+
<magentoCLI command="setup:static-content:deploy -f de_DE" stepKey="deployStaticContentDE"/> -->
2626
<!-- Step1: Log in to admin -->
2727
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
2828
</before>
@@ -59,8 +59,8 @@
5959
<waitForPageLoad stepKey="waitForFilterUS"/>
6060
<generateDate date="+1 day" format="Y-m-d" stepKey="startDateUSRaw"/>
6161
<generateDate date="+2 day" format="Y-m-d" stepKey="endDateUSRaw"/>
62-
<executeJS function="return (new Date('{$startDateUSRaw}').toLocaleDateString('en-US', {day: 'numeric', month: 'short', year: 'numeric'}))" stepKey="expectedStartDateUSGrid"/>
63-
<executeJS function="return (new Date('{$endDateUSRaw}').toLocaleDateString('en-US', {day: 'numeric', month: 'short', year: 'numeric'}))" stepKey="expectedEndDateUSGrid"/>
62+
<executeJS function="return (new Date('{$startDateUSRaw}T00:00:00Z').toLocaleDateString('en-US', {timeZone: 'UTC', day: 'numeric', month: 'short', year: 'numeric'}))" stepKey="expectedStartDateUSGrid"/>
63+
<executeJS function="return (new Date('{$endDateUSRaw}T00:00:00Z').toLocaleDateString('en-US', {timeZone: 'UTC', day: 'numeric', month: 'short', year: 'numeric'}))" stepKey="expectedEndDateUSGrid"/>
6464
<grabTextFrom selector="{{AdminCartPriceRulesSection.gridStartDateByRuleName(CartPriceRuleWithMaximumQuantity1.name)}}" stepKey="actualStartDateUSGrid"/>
6565
<grabTextFrom selector="{{AdminCartPriceRulesSection.gridEndDateByRuleName(CartPriceRuleWithMaximumQuantity1.name)}}" stepKey="actualEndDateUSGrid"/>
6666
<!-- Verify start date and end date in grid -->
@@ -112,8 +112,8 @@
112112
<click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="clickSearchNL"/>
113113
<waitForPageLoad stepKey="waitForFilterNL"/>
114114
<!-- Verify start date and end date in grid -->
115-
<executeJS function="return (new Date('{$startDateNLRaw}').toLocaleDateString('nl-NL', {day: 'numeric', month: 'short', year: 'numeric'}))" stepKey="expectedStartDateNLGrid"/>
116-
<executeJS function="return (new Date('{$endDateNLRaw}').toLocaleDateString('nl-NL', {day: 'numeric', month: 'short', year: 'numeric'}))" stepKey="expectedEndDateNLGrid"/>
115+
<executeJS function="return (new Date('{$startDateNLRaw}T00:00:00Z').toLocaleDateString('nl-NL', {timeZone: 'UTC', day: 'numeric', month: 'short', year: 'numeric'}))" stepKey="expectedStartDateNLGrid"/>
116+
<executeJS function="return (new Date('{$endDateNLRaw}T00:00:00Z').toLocaleDateString('nl-NL', {timeZone: 'UTC', day: 'numeric', month: 'short', year: 'numeric'}))" stepKey="expectedEndDateNLGrid"/>
117117
<grabTextFrom selector="{{AdminCartPriceRulesSection.gridStartDateByRuleName(CustomSalesRuleWithNoCouponCode.name)}}" stepKey="actualStartDateNLGrid"/>
118118
<grabTextFrom selector="{{AdminCartPriceRulesSection.gridEndDateByRuleName(CustomSalesRuleWithNoCouponCode.name)}}" stepKey="actualEndDateNLGrid"/>
119119
<assertStringContainsString stepKey="verifyStartDateNLInGrid">
@@ -153,8 +153,8 @@
153153
<click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="clickSearchHI"/>
154154
<waitForPageLoad stepKey="waitForFilterHI"/>
155155
<!-- Verify start date and end date in grid -->
156-
<executeJS function="return (new Date('{$startDateHIRaw}').toLocaleDateString('hi-IN', {day: 'numeric', month: 'short', year: 'numeric'}))" stepKey="expectedStartDateHindiGrid"/>
157-
<executeJS function="return (new Date('{$endDateHIRaw}').toLocaleDateString('hi-IN', {day: 'numeric', month: 'short', year: 'numeric'}))" stepKey="expectedEndDateHindiGrid"/>
156+
<executeJS function="return (new Date('{$startDateHIRaw}T00:00:00Z').toLocaleDateString('hi-IN', {timeZone: 'UTC', day: 'numeric', month: 'short', year: 'numeric'}))" stepKey="expectedStartDateHindiGrid"/>
157+
<executeJS function="return (new Date('{$endDateHIRaw}T00:00:00Z').toLocaleDateString('hi-IN', {timeZone: 'UTC', day: 'numeric', month: 'short', year: 'numeric'}))" stepKey="expectedEndDateHindiGrid"/>
158158
<grabTextFrom selector="{{AdminCartPriceRulesSection.gridStartDateByRuleName(TestCartPriceRule.name)}}" stepKey="actualStartDateHindiGrid"/>
159159
<grabTextFrom selector="{{AdminCartPriceRulesSection.gridEndDateByRuleName(TestCartPriceRule.name)}}" stepKey="actualEndDateHindiGrid"/>
160160
<assertStringContainsString stepKey="verifyStartDateHindiInGrid">

0 commit comments

Comments
 (0)