|
| 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="AdminCartPriceRuleDateFormatWithMultipleLocalesTest"> |
| 12 | + <annotations> |
| 13 | + <features value="SalesRule"/> |
| 14 | + <stories value="Cart price rule date format preservation with different interface locales"/> |
| 15 | + <title value="Cart price rule start/end dates display correctly with different admin interface locales"/> |
| 16 | + <description value="Admin creates cart price rules with different interface locales and confirms dates display in correct locale format."/> |
| 17 | + <severity value="MAJOR"/> |
| 18 | + <testCaseId value="AC-4200"/> |
| 19 | + <group value="SalesRule"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <!-- Deploy static content for all required locales --> |
| 23 | + <magentoCLI command="setup:static-content:deploy -f nl_NL" stepKey="deployStaticContentNL"/> |
| 24 | + <magentoCLI command="setup:static-content:deploy -f hi_IN" stepKey="deployStaticContentHI"/> |
| 25 | + <magentoCLI command="setup:static-content:deploy -f de_DE" stepKey="deployStaticContentDE"/> |
| 26 | + <!-- Step1: Log in to admin --> |
| 27 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 28 | + </before> |
| 29 | + <after> |
| 30 | + <!-- Reset locale to en_US --> |
| 31 | + <actionGroup ref="SetAdminAccountActionGroup" stepKey="resetLocaleToUS"> |
| 32 | + <argument name="InterfaceLocaleByValue" value="en_US"/> |
| 33 | + </actionGroup> |
| 34 | + <!-- Delete all created cart price rules --> |
| 35 | + <actionGroup ref="AdminCartPriceRuleDeleteAllActionGroup" stepKey="deleteAllCartPriceRules"/> |
| 36 | + <!-- Logout --> |
| 37 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 38 | + </after> |
| 39 | + <!-- Step2,3,4,5: Change interface locale to English (US) --> |
| 40 | + <actionGroup ref="SetAdminAccountActionGroup" stepKey="setLocaleToUS"> |
| 41 | + <argument name="InterfaceLocaleByValue" value="en_US"/> |
| 42 | + </actionGroup> |
| 43 | + <generateDate date="+1 day" format="n/j/Y" stepKey="startDateUS"/> |
| 44 | + <generateDate date="+2 day" format="n/j/Y" stepKey="endDateUS"/> |
| 45 | + <!-- Step6: Navigate to cart price rules --> |
| 46 | + <actionGroup ref="AdminOpenCartPriceRulesPageActionGroup" stepKey="openCartPriceRulesPageUS"/> |
| 47 | + <!-- Step7: Fill cart price rule main information --> |
| 48 | + <actionGroup ref="AdminCartPriceRuleMultiCustomerActionGroup" stepKey="fillUSCartPriceRuleMainInfo"> |
| 49 | + <argument name="ruleName" value="CartPriceRuleWithMaximumQuantity1"/> |
| 50 | + </actionGroup> |
| 51 | + <fillField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$startDateUS}" stepKey="fillFromDateUS"/> |
| 52 | + <fillField selector="{{AdminCartPriceRulesFormSection.toDate}}" userInput="{$endDateUS}" stepKey="fillToDateUS"/> |
| 53 | + <!-- Step8: Save cart price rule --> |
| 54 | + <actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="assertUSCartPriceRuleSuccessSaveMessage"/> |
| 55 | + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> |
| 56 | + <waitForElementVisible selector="{{AdminCartPriceRulesSection.filterByNameInput}}" stepKey="waitForGridStartDateUS"/> |
| 57 | + <fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="{{CartPriceRuleWithMaximumQuantity1.name}}" stepKey="filterByNameUS"/> |
| 58 | + <click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="clickSearchUS"/> |
| 59 | + <waitForPageLoad stepKey="waitForFilterUS"/> |
| 60 | + <generateDate date="+1 day" format="Y-m-d" stepKey="startDateUSRaw"/> |
| 61 | + <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"/> |
| 64 | + <grabTextFrom selector="{{AdminCartPriceRulesSection.gridStartDateByRuleName(CartPriceRuleWithMaximumQuantity1.name)}}" stepKey="actualStartDateUSGrid"/> |
| 65 | + <grabTextFrom selector="{{AdminCartPriceRulesSection.gridEndDateByRuleName(CartPriceRuleWithMaximumQuantity1.name)}}" stepKey="actualEndDateUSGrid"/> |
| 66 | + <!-- Verify start date and end date in grid --> |
| 67 | + <assertStringContainsString stepKey="verifyStartDateUSInGrid"> |
| 68 | + <expectedResult type="variable">expectedStartDateUSGrid</expectedResult> |
| 69 | + <actualResult type="variable">actualStartDateUSGrid</actualResult> |
| 70 | + </assertStringContainsString> |
| 71 | + <assertStringContainsString stepKey="verifyEndDateUSInGrid"> |
| 72 | + <expectedResult type="variable">expectedEndDateUSGrid</expectedResult> |
| 73 | + <actualResult type="variable">actualEndDateUSGrid</actualResult> |
| 74 | + </assertStringContainsString> |
| 75 | + <!-- Step9: Open cart price rule edit page --> |
| 76 | + <click selector="{{AdminCartPriceRulesSection.rowContainingText(CartPriceRuleWithMaximumQuantity1.name)}}" stepKey="openRuleUS"/> |
| 77 | + <waitForPageLoad stepKey="waitForEditPageUS"/> |
| 78 | + <!-- Verify start date and end date in edit page --> |
| 79 | + <seeInField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$startDateUS}" stepKey="verifyFromDateUS"/> |
| 80 | + <seeInField selector="{{AdminCartPriceRulesFormSection.toDate}}" userInput="{$endDateUS}" stepKey="verifyToDateUS"/> |
| 81 | + <!-- Step10: Save cart price rule again --> |
| 82 | + <actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="saveRuleUSAgain"/> |
| 83 | + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFiltersAgain"/> |
| 84 | + <fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="{{CartPriceRuleWithMaximumQuantity1.name}}" stepKey="filterByNameUSAgain"/> |
| 85 | + <click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="clickSearchUSAgain"/> |
| 86 | + <waitForPageLoad stepKey="waitForFilterUSAgain"/> |
| 87 | + <click selector="{{AdminCartPriceRulesSection.rowContainingText(CartPriceRuleWithMaximumQuantity1.name)}}" stepKey="openRuleUSAgain"/> |
| 88 | + <waitForPageLoad stepKey="waitForEditPageUSAgain"/> |
| 89 | + <!-- Verify start date and end date in edit page again --> |
| 90 | + <seeInField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$startDateUS}" stepKey="verifyFromDateUSPreserved"/> |
| 91 | + <seeInField selector="{{AdminCartPriceRulesFormSection.toDate}}" userInput="{$endDateUS}" stepKey="verifyToDateUSPreserved"/> |
| 92 | + <!-- Step11: Change interface locale to Dutch (Netherlands) --> |
| 93 | + <actionGroup ref="SetAdminAccountActionGroup" stepKey="setLocaleToNL"> |
| 94 | + <argument name="InterfaceLocaleByValue" value="nl_NL"/> |
| 95 | + </actionGroup> |
| 96 | + <generateDate date="+1 day" format="d-m-Y" stepKey="startDateNL"/> |
| 97 | + <generateDate date="+2 day" format="d-m-Y" stepKey="endDateNL"/> |
| 98 | + <generateDate date="+1 day" format="Y-m-d" stepKey="startDateNLRaw"/> |
| 99 | + <generateDate date="+2 day" format="Y-m-d" stepKey="endDateNLRaw"/> |
| 100 | + <!-- Step12: Fill cart price rule main information --> |
| 101 | + <actionGroup ref="AdminOpenCartPriceRulesPageActionGroup" stepKey="openCartPriceRulesPageNL"/> |
| 102 | + <actionGroup ref="AdminCartPriceRuleMultiCustomerActionGroup" stepKey="fillNLCartPriceRuleMainInfo"> |
| 103 | + <argument name="ruleName" value="CustomSalesRuleWithNoCouponCode"/> |
| 104 | + </actionGroup> |
| 105 | + <fillField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$startDateNL}" stepKey="fillFromDateNL"/> |
| 106 | + <fillField selector="{{AdminCartPriceRulesFormSection.toDate}}" userInput="{$endDateNL}" stepKey="fillToDateNL"/> |
| 107 | + <!-- Step13: Save cart price rule --> |
| 108 | + <actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="assertNLCartPriceRuleSuccessSaveMessage"/> |
| 109 | + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFiltersNL"/> |
| 110 | + <waitForElementVisible selector="{{AdminCartPriceRulesSection.filterByNameInput}}" stepKey="waitForGridStartDateNL"/> |
| 111 | + <fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="{{CustomSalesRuleWithNoCouponCode.name}}" stepKey="filterByNameNL"/> |
| 112 | + <click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="clickSearchNL"/> |
| 113 | + <waitForPageLoad stepKey="waitForFilterNL"/> |
| 114 | + <!-- 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"/> |
| 117 | + <grabTextFrom selector="{{AdminCartPriceRulesSection.gridStartDateByRuleName(CustomSalesRuleWithNoCouponCode.name)}}" stepKey="actualStartDateNLGrid"/> |
| 118 | + <grabTextFrom selector="{{AdminCartPriceRulesSection.gridEndDateByRuleName(CustomSalesRuleWithNoCouponCode.name)}}" stepKey="actualEndDateNLGrid"/> |
| 119 | + <assertStringContainsString stepKey="verifyStartDateNLInGrid"> |
| 120 | + <expectedResult type="variable">expectedStartDateNLGrid</expectedResult> |
| 121 | + <actualResult type="variable">actualStartDateNLGrid</actualResult> |
| 122 | + </assertStringContainsString> |
| 123 | + <assertStringContainsString stepKey="verifyEndDateNLInGrid"> |
| 124 | + <expectedResult type="variable">expectedEndDateNLGrid</expectedResult> |
| 125 | + <actualResult type="variable">actualEndDateNLGrid</actualResult> |
| 126 | + </assertStringContainsString> |
| 127 | + <!-- Open cart price rule edit page --> |
| 128 | + <click selector="{{AdminCartPriceRulesSection.rowContainingText(CustomSalesRuleWithNoCouponCode.name)}}" stepKey="openRuleNL"/> |
| 129 | + <waitForPageLoad stepKey="waitForEditPageNL"/> |
| 130 | + <!-- Verify start date and end date in edit page --> |
| 131 | + <seeInField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$startDateNL}" stepKey="verifyFromDateNL"/> |
| 132 | + <seeInField selector="{{AdminCartPriceRulesFormSection.toDate}}" userInput="{$endDateNL}" stepKey="verifyToDateNL"/> |
| 133 | + <!-- Step14: Change interface locale to Hindi (India) --> |
| 134 | + <actionGroup ref="SetAdminAccountActionGroup" stepKey="setLocaleToHI"> |
| 135 | + <argument name="InterfaceLocaleByValue" value="hi_IN"/> |
| 136 | + </actionGroup> |
| 137 | + <generateDate date="+1 day" format="j/m/Y" stepKey="startDateHI"/> |
| 138 | + <generateDate date="+2 day" format="j/m/Y" stepKey="endDateHI"/> |
| 139 | + <generateDate date="+1 day" format="Y-m-d" stepKey="startDateHIRaw"/> |
| 140 | + <generateDate date="+2 day" format="Y-m-d" stepKey="endDateHIRaw"/> |
| 141 | + <!-- Step15: Fill cart price rule main information --> |
| 142 | + <actionGroup ref="AdminOpenCartPriceRulesPageActionGroup" stepKey="openCartPriceRulesPageHI"/> |
| 143 | + <actionGroup ref="AdminCartPriceRuleMultiCustomerActionGroup" stepKey="fillHICartPriceRuleMainInfo"> |
| 144 | + <argument name="ruleName" value="TestCartPriceRule"/> |
| 145 | + </actionGroup> |
| 146 | + <fillField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$startDateHI}" stepKey="fillFromDateHI"/> |
| 147 | + <fillField selector="{{AdminCartPriceRulesFormSection.toDate}}" userInput="{$endDateHI}" stepKey="fillToDateHI"/> |
| 148 | + <!-- Step16: Save cart price rule --> |
| 149 | + <actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="assertHICartPriceRuleSuccessSaveMessage"/> |
| 150 | + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFiltersHI"/> |
| 151 | + <waitForElementVisible selector="{{AdminCartPriceRulesSection.filterByNameInput}}" stepKey="waitForGridStartDateHI"/> |
| 152 | + <fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="{{TestCartPriceRule.name}}" stepKey="filterByNameHI"/> |
| 153 | + <click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="clickSearchHI"/> |
| 154 | + <waitForPageLoad stepKey="waitForFilterHI"/> |
| 155 | + <!-- 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"/> |
| 158 | + <grabTextFrom selector="{{AdminCartPriceRulesSection.gridStartDateByRuleName(TestCartPriceRule.name)}}" stepKey="actualStartDateHindiGrid"/> |
| 159 | + <grabTextFrom selector="{{AdminCartPriceRulesSection.gridEndDateByRuleName(TestCartPriceRule.name)}}" stepKey="actualEndDateHindiGrid"/> |
| 160 | + <assertStringContainsString stepKey="verifyStartDateHindiInGrid"> |
| 161 | + <expectedResult type="variable">expectedStartDateHindiGrid</expectedResult> |
| 162 | + <actualResult type="variable">actualStartDateHindiGrid</actualResult> |
| 163 | + </assertStringContainsString> |
| 164 | + <assertStringContainsString stepKey="verifyEndDateHindiInGrid"> |
| 165 | + <expectedResult type="variable">expectedEndDateHindiGrid</expectedResult> |
| 166 | + <actualResult type="variable">actualEndDateHindiGrid</actualResult> |
| 167 | + </assertStringContainsString> |
| 168 | + <!-- Open cart price rule edit page --> |
| 169 | + <click selector="{{AdminCartPriceRulesSection.rowContainingText(TestCartPriceRule.name)}}" stepKey="openRuleHI"/> |
| 170 | + <waitForPageLoad stepKey="waitForEditPageHI"/> |
| 171 | + <!-- Verify start date and end date in edit page --> |
| 172 | + <seeInField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$startDateHI}" stepKey="verifyFromDateHI"/> |
| 173 | + <seeInField selector="{{AdminCartPriceRulesFormSection.toDate}}" userInput="{$endDateHI}" stepKey="verifyToDateHI"/> |
| 174 | + <!-- Step17: Change interface locale to German (Germany) --> |
| 175 | + <actionGroup ref="SetAdminAccountActionGroup" stepKey="setLocaleToDE"> |
| 176 | + <argument name="InterfaceLocaleByValue" value="de_DE"/> |
| 177 | + </actionGroup> |
| 178 | + <generateDate date="+1 day" format="d.m.Y" stepKey="startDateDE"/> |
| 179 | + <generateDate date="+2 day" format="d.m.Y" stepKey="endDateDE"/> |
| 180 | + <generateDate date="+1 day" format="Y-m-d" stepKey="startDateDERaw"/> |
| 181 | + <generateDate date="+2 day" format="Y-m-d" stepKey="endDateDERaw"/> |
| 182 | + <!-- Step18: Fill cart price rule main information --> |
| 183 | + <actionGroup ref="AdminOpenCartPriceRulesPageActionGroup" stepKey="openCartPriceRulesPageDE"/> |
| 184 | + <actionGroup ref="AdminCartPriceRuleMultiCustomerActionGroup" stepKey="fillDECartPriceRuleMainInfo"> |
| 185 | + <argument name="ruleName" value="TestSalesRule"/> |
| 186 | + </actionGroup> |
| 187 | + <fillField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$startDateDE}" stepKey="fillFromDateDE"/> |
| 188 | + <fillField selector="{{AdminCartPriceRulesFormSection.toDate}}" userInput="{$endDateDE}" stepKey="fillToDateDE"/> |
| 189 | + <!-- Step19: Save cart price rule --> |
| 190 | + <actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="assertDECartPriceRuleSuccessSaveMessage"/> |
| 191 | + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFiltersDE"/> |
| 192 | + <waitForElementVisible selector="{{AdminCartPriceRulesSection.filterByNameInput}}" stepKey="waitForGridStartDateDE"/> |
| 193 | + <fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="{{TestSalesRule.name}}" stepKey="filterByNameDE"/> |
| 194 | + <click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="clickSearchDE"/> |
| 195 | + <waitForPageLoad stepKey="waitForFilterDE"/> |
| 196 | + <!-- Verify start date and end date in grid --> |
| 197 | + <grabTextFrom selector="{{AdminCartPriceRulesSection.gridStartDateByRuleName(TestSalesRule.name)}}" stepKey="actualStartDateDEGrid"/> |
| 198 | + <grabTextFrom selector="{{AdminCartPriceRulesSection.gridEndDateByRuleName(TestSalesRule.name)}}" stepKey="actualEndDateDEGrid"/> |
| 199 | + <assertStringContainsString stepKey="verifyStartDateDEInGrid"> |
| 200 | + <expectedResult type="variable">startDateDE</expectedResult> |
| 201 | + <actualResult type="variable">actualStartDateDEGrid</actualResult> |
| 202 | + </assertStringContainsString> |
| 203 | + <assertStringContainsString stepKey="verifyEndDateDEInGrid"> |
| 204 | + <expectedResult type="variable">endDateDE</expectedResult> |
| 205 | + <actualResult type="variable">actualEndDateDEGrid</actualResult> |
| 206 | + </assertStringContainsString> |
| 207 | + <!-- Open cart price rule edit page --> |
| 208 | + <click selector="{{AdminCartPriceRulesSection.rowContainingText(TestSalesRule.name)}}" stepKey="openRuleDE"/> |
| 209 | + <waitForPageLoad stepKey="waitForEditPageDE"/> |
| 210 | + <!-- Verify start date and end date in edit page --> |
| 211 | + <seeInField selector="{{AdminCartPriceRulesFormSection.fromDate}}" userInput="{$startDateDE}" stepKey="verifyFromDateDE"/> |
| 212 | + <seeInField selector="{{AdminCartPriceRulesFormSection.toDate}}" userInput="{$endDateDE}" stepKey="verifyToDateDE"/> |
| 213 | + </test> |
| 214 | +</tests> |
0 commit comments