Skip to content

Commit 548cdbf

Browse files
[Magento Community Engineering] Community Contributions - 2.4-develop
- merged latest code from mainline branch
2 parents 8ccb2c6 + ae5cf1e commit 548cdbf

File tree

45 files changed

+634
-165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+634
-165
lines changed

app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class AjaxLoginTest extends TestCase
6363
/**
6464
* @var array
6565
*/
66-
protected $formIds;
66+
protected $formIds = ['user_login'];
6767

6868
/**
6969
* @var AjaxLogin
@@ -97,7 +97,6 @@ protected function setUp(): void
9797
->method('getCaptcha')
9898
->willReturn($this->captchaMock);
9999

100-
$this->formIds = ['user_login'];
101100
$this->serializerMock = $this->createMock(Json::class);
102101

103102
$this->model = new AjaxLogin(
@@ -194,7 +193,10 @@ public function testAroundExecuteCaptchaIsNotRequired($username, $requestContent
194193

195194
$this->captchaMock->expects($this->once())->method('isRequired')->with($username)
196195
->willReturn(false);
197-
$this->captchaMock->expects($this->never())->method('logAttempt')->with($username);
196+
$expectLogAttempt = $requestContent['captcha_form_id'] ?? false;
197+
$this->captchaMock
198+
->expects($expectLogAttempt ? $this->once() : $this->never())
199+
->method('logAttempt')->with($username);
198200
$this->captchaMock->expects($this->never())->method('isCorrect');
199201

200202
$closure = function () {

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,7 @@
180180

181181
<!--Select shipping method-->
182182
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod"/>
183-
<waitForElementVisible selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
184-
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
185-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterClickNext"/>
183+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>
186184
<!--Select payment method-->
187185
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectPaymentMethod"/>
188186
<!-- Place Order -->
@@ -257,9 +255,7 @@
257255

258256
<!--Select shipping method-->
259257
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod2"/>
260-
<waitForElementVisible selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton2"/>
261-
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext2"/>
262-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterClickNext2"/>
258+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext2"/>
263259

264260
<!--Select payment method-->
265261
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectPaymentMethod2"/>

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsTest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,7 @@
115115
<see selector="{{CheckoutPaymentSection.ProductOptionsActiveByProductItemName($$createProduct.name$$)}}" userInput="1:00 AM" stepKey="seeProductOptionTimeInput" />
116116
<!--Select shipping method-->
117117
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod"/>
118-
<waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
119-
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
120-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterClickNext"/>
118+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>
121119
<!--Select payment method-->
122120
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectPaymentMethod"/>
123121
<!-- Place Order -->

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitleTest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@
7979
<!--Select shipping method-->
8080

8181
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod"/>
82-
<waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
83-
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
84-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterClickNext"/>
82+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>
8583

8684
<!-- Checkout select Check/Money Order payment -->
8785
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/>

app/code/Magento/CatalogInventory/Test/Mftf/Test/AssociatedProductToConfigurableOutOfStockTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@
106106
<waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/>
107107
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goToShoppingCartPage"/>
108108
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
109-
<waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/>
110-
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
109+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>
111110
<!-- Checkout select Check/Money Order payment -->
112111
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/>
113112
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>

app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ private function getBillingAddressComponent($paymentCode, $elements)
351351
],
352352
],
353353
'telephone' => [
354+
'validation' => [
355+
'validate-phoneStrict' => 0,
356+
],
354357
'config' => [
355358
'tooltip' => [
356359
'description' => __('For delivery questions.'),

app/code/Magento/Checkout/Test/Mftf/Test/AddressStateFieldForUKCustomerRemainOptionAfterRefreshTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@
5555
<fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{UK_Address.telephone}}" stepKey="enterTelephone"/>
5656
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
5757
<click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
58-
<waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
59-
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
58+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>
6059
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
6160
<seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/>
6261

app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@
7373
<waitForPageLoad stepKey="waitForAddressSaving"/>
7474

7575
<!-- Click next button to open payment section -->
76-
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
77-
<waitForPageLoad stepKey="waitForShipmentPageLoad"/>
76+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>
7877

7978
<!-- Change the address -->
8079
<uncheckOption selector="{{CheckoutPaymentSection.billingAddressNotSameCheckbox}}" stepKey="selectPaymentSolution"/>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithoutRegionTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="navigateToCheckoutPage"/>
5151

52-
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNextButton"/>
52+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNextButton"/>
5353
<see selector="{{StorefrontMessagesSection.error}}" userInput='Please specify a regionId in shipping address.' stepKey="seeErrorMessages"/>
5454
</test>
5555
</tests>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontOnePageCheckoutDataWhenChangeQtyTest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@
5858

5959
<!--Select shipping method and finalize checkout-->
6060
<click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
61-
<waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
62-
<waitForPageLoad stepKey="waitForShippingMethodLoad"/>
63-
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
61+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>
6462
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
6563
<seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/>
6664

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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="StorefrontOnePageCheckoutPhoneValidationTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<stories value="Checkout validation phone field"/>
15+
<title value="Validate phone field on checkout page"/>
16+
<description value="Validate phone field on checkout page, field must not contain alphabetical symbols"/>
17+
<severity value="MAJOR" />
18+
<testCaseId value="MC-35292"/>
19+
</annotations>
20+
<before>
21+
<createData entity="_defaultCategory" stepKey="createCategory"/>
22+
<createData entity="ApiSimpleProduct" stepKey="createProduct">
23+
<requiredEntity createDataKey="createCategory"/>
24+
</createData>
25+
</before>
26+
<after>
27+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
28+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
29+
</after>
30+
31+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="openCategoryPageOnFrontend">
32+
<argument name="category" value="$createCategory$"/>
33+
</actionGroup>
34+
35+
<actionGroup ref="StorefrontAddSimpleProductToCartActionGroup" stepKey="addToCartFromStorefrontProductPage">
36+
<argument name="product" value="$$createProduct$$"/>
37+
</actionGroup>
38+
39+
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="guestGoToCheckout"/>
40+
41+
<fillField userInput="Sample text" selector="{{CheckoutShippingSection.telephone}}" stepKey="enterAlphabeticalSymbols"/>
42+
<see userInput="Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890." selector="{{CheckoutShippingSection.addressFieldValidationError}}" stepKey="checkPhoneFieldValidationIsPassed"/>
43+
</test>
44+
</tests>

app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@
223223
</item>
224224
</item>
225225
<item name="telephone" xsi:type="array">
226+
<item name="validation" xsi:type="array">
227+
<item name="validate-phoneStrict" xsi:type="number">0</item>
228+
</item>
226229
<item name="config" xsi:type="array">
227230
<item name="tooltip" xsi:type="array">
228231
<item name="description" xsi:type="string" translate="true">For delivery questions.</item>

app/code/Magento/Cron/Model/Schedule.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ public function matchCronExpression($expr, $num)
189189
}
190190

191191
// handle all match by modulus
192+
$offset = 0;
192193
if ($expr === '*') {
193194
$from = 0;
194195
$to = 60;
@@ -201,6 +202,13 @@ public function matchCronExpression($expr, $num)
201202

202203
$from = $this->getNumeric($e[0]);
203204
$to = $this->getNumeric($e[1]);
205+
if ($mod !== 1) {
206+
$offset = $from;
207+
}
208+
} elseif ($mod !== 1) {
209+
$offset = $this->getNumeric($expr);
210+
$from = 0;
211+
$to = 60;
204212
} else {
205213
// handle regular token
206214
$from = $this->getNumeric($expr);
@@ -211,7 +219,7 @@ public function matchCronExpression($expr, $num)
211219
throw new CronException(__('Invalid cron expression: %1', $expr));
212220
}
213221

214-
return $num >= $from && $num <= $to && $num % $mod === 0;
222+
return $num >= $from && $num <= $to && ($num - $offset) % $mod === 0;
215223
}
216224

217225
/**

app/code/Magento/Cron/Test/Unit/Model/ScheduleTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,24 +128,28 @@ public function setCronExprDataProvider(): array
128128
[', * * * *', [',', '*', '*', '*', '*']],
129129
['1-2 * * * *', ['1-2', '*', '*', '*', '*']],
130130
['0/5 * * * *', ['0/5', '*', '*', '*', '*']],
131+
['3/5 * * * *', ['3/5', '*', '*', '*', '*']],
131132

132133
['* 0 * * *', ['*', '0', '*', '*', '*']],
133134
['* 59 * * *', ['*', '59', '*', '*', '*']],
134135
['* , * * *', ['*', ',', '*', '*', '*']],
135136
['* 1-2 * * *', ['*', '1-2', '*', '*', '*']],
136137
['* 0/5 * * *', ['*', '0/5', '*', '*', '*']],
138+
['* 3/5 * * *', ['*', '3/5', '*', '*', '*']],
137139

138140
['* * 0 * *', ['*', '*', '0', '*', '*']],
139141
['* * 23 * *', ['*', '*', '23', '*', '*']],
140142
['* * , * *', ['*', '*', ',', '*', '*']],
141143
['* * 1-2 * *', ['*', '*', '1-2', '*', '*']],
142144
['* * 0/5 * *', ['*', '*', '0/5', '*', '*']],
145+
['* * 3/5 * *', ['*', '*', '3/5', '*', '*']],
143146

144147
['* * * 1 *', ['*', '*', '*', '1', '*']],
145148
['* * * 31 *', ['*', '*', '*', '31', '*']],
146149
['* * * , *', ['*', '*', '*', ',', '*']],
147150
['* * * 1-2 *', ['*', '*', '*', '1-2', '*']],
148151
['* * * 0/5 *', ['*', '*', '*', '0/5', '*']],
152+
['* * * 3/5 *', ['*', '*', '*', '3/5', '*']],
149153
['* * * ? *', ['*', '*', '*', '?', '*']],
150154
['* * * L *', ['*', '*', '*', 'L', '*']],
151155
['* * * W *', ['*', '*', '*', 'W', '*']],
@@ -156,6 +160,7 @@ public function setCronExprDataProvider(): array
156160
['* * * * ,', ['*', '*', '*', '*', ',']],
157161
['* * * * 1-2', ['*', '*', '*', '*', '1-2']],
158162
['* * * * 0/5', ['*', '*', '*', '*', '0/5']],
163+
['* * * * 3/5', ['*', '*', '*', '*', '3/5']],
159164
['* * * * JAN', ['*', '*', '*', '*', 'JAN']],
160165
['* * * * DEC', ['*', '*', '*', '*', 'DEC']],
161166
['* * * * JAN-DEC', ['*', '*', '*', '*', 'JAN-DEC']],
@@ -165,6 +170,7 @@ public function setCronExprDataProvider(): array
165170
['* * * * * ,', ['*', '*', '*', '*', '*', ',']],
166171
['* * * * * 1-2', ['*', '*', '*', '*', '*', '1-2']],
167172
['* * * * * 0/5', ['*', '*', '*', '*', '*', '0/5']],
173+
['* * * * * 3/5', ['*', '*', '*', '*', '*', '3/5']],
168174
['* * * * * ?', ['*', '*', '*', '*', '*', '?']],
169175
['* * * * * L', ['*', '*', '*', '*', '*', 'L']],
170176
['* * * * * 6#3', ['*', '*', '*', '*', '*', '6#3']],
@@ -372,9 +378,19 @@ public function matchCronExpressionDataProvider(): array
372378
['0-20/5', 21, false],
373379
['0-20/5', 25, false],
374380

381+
['3-20/5', 3, true],
382+
['3-20/5', 8, true],
383+
['3-20/5', 13, true],
384+
['3-20/5', 24, false],
385+
['3-20/5', 28, false],
386+
375387
['1/5', 5, false],
376388
['5/5', 5, true],
377389
['10/5', 10, true],
390+
391+
['4/5', 8, false],
392+
['8/5', 8, true],
393+
['13/5', 13, true],
378394
];
379395
}
380396

app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<item>Bld D</item>
2020
</array>
2121
<data key="company">Magento</data>
22-
<data key="telephone">1234568910</data>
22+
<data key="telephone">123-456-7890</data>
2323
<data key="fax">1234568910</data>
2424
<data key="postcode">78729</data>
2525
<data key="city">Austin</data>
@@ -172,7 +172,7 @@
172172
<data key="city">London</data>
173173
<data key="postcode">SE1 7RW</data>
174174
<data key="country_id">GB</data>
175-
<data key="telephone">444-44-444-44</data>
175+
<data key="telephone">444-444-4444</data>
176176
</entity>
177177
<entity name="US_Address_Utah" type="address">
178178
<data key="firstname">John</data>
@@ -227,7 +227,7 @@
227227
<data key="firstname">John</data>
228228
<data key="lastname">Doe</data>
229229
<data key="company">Magento</data>
230-
<data key="telephone">0123456789-02134567</data>
230+
<data key="telephone">888-777-7890</data>
231231
<array key="street">
232232
<item>172, Westminster Bridge Rd</item>
233233
<item>7700 xyz street</item>
@@ -305,7 +305,7 @@
305305
<data key="firstname">Jane</data>
306306
<data key="lastname">Miller</data>
307307
<data key="company">Magento</data>
308-
<data key="telephone">44 20 7123 1234</data>
308+
<data key="telephone">123-456-7899</data>
309309
<array key="street">
310310
<item>1 London Bridge Street</item>
311311
</array>

app/code/Magento/Customer/etc/webapi_rest/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<arguments>
1414
<argument name="userContexts" xsi:type="array">
1515
<item name="customerSessionUserContext" xsi:type="array">
16-
<item name="type" xsi:type="object">Magento\Customer\Model\Authorization\CustomerSessionUserContext</item>
16+
<item name="type" xsi:type="object">Magento\Customer\Model\Authorization\CustomerSessionUserContext\Proxy</item>
1717
<item name="sortOrder" xsi:type="string">20</item>
1818
</item>
1919
</argument>

app/code/Magento/Developer/Test/Unit/Console/Command/XmlCatalogGenerateCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function testExecuteVsCodeFormat()
9797
->with(
9898
$this->equalTo(['urn:magento:framework:Module/etc/module.xsd' => $fixtureXmlFile]),
9999
$this->equalTo('test')
100-
)->willReturn(null);
100+
);
101101

102102
$formats = ['vscode' => $vscodeFormatMock];
103103
$readFactory = $this->createMock(ReadFactory::class);

0 commit comments

Comments
 (0)