Skip to content

Commit d7d4f28

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into MC-38518
2 parents 49e6eb0 + c644b3d commit d7d4f28

File tree

105 files changed

+4232
-531
lines changed

Some content is hidden

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

105 files changed

+4232
-531
lines changed

app/code/Magento/Backend/Test/Mftf/Section/AdminHeaderSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
<section name="AdminHeaderSection">
1212
<element name="pageTitle" type="text" selector=".page-header h1.page-title"/>
1313
<element name="adminUserAccountText" type="text" selector=".page-header .admin-user-account-text" />
14+
<element name="globalSearchInput" type="text" selector="#search-global" />
15+
<element name="globalSearchInputVisible" type="text" selector=".search-global-field._active #search-global" />
1416
<!-- Legacy heading section. Mostly used for admin 404 and 403 pages -->
1517
<element name="pageHeading" type="text" selector=".page-content .page-heading"/>
1618
<!-- Used for page not found error -->

app/code/Magento/Backend/Test/Mftf/Test/AdminExpireAdminSessionTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<!-- 2. Wait for session to expire. -->
3030
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
3131
<wait time="60" stepKey="waitForSessionLifetime"/>
32-
<reloadPage stepKey="reloadPage"/>
32+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadPage"/>
3333

3434
<!-- 3. Perform asserts. -->
3535
<seeElement selector="{{AdminLoginFormSection.loginBlock}}" stepKey="assertAdminLoginPageIsAvailable"/>

app/code/Magento/Backend/Test/Mftf/Test/AdminExpireCustomerSessionTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<argument name="Customer" value="$$createCustomer$$" />
4141
</actionGroup>
4242
<wait time="60" stepKey="waitForCookieLifetime"/>
43-
<reloadPage stepKey="reloadPage"/>
43+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadPage"/>
4444

4545
<!-- 5. Perform asserts. -->
4646
<seeElement selector="{{StorefrontPanelHeaderSection.customerLoginLink}}" stepKey="assertAuthorizationLinkIsVisibleOnStoreFront"/>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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="AdminSearchHotkeyTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Search form hotkey in backend"/>
15+
<title value="Admin should be able focus on the search field with a hotkey"/>
16+
<description value="Admin should be able focus on the search field with a hotkey - forwardslash"/>
17+
<severity value="MINOR"/>
18+
<group value="backend"/>
19+
<group value="search"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
23+
</before>
24+
<after>
25+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
26+
</after>
27+
28+
<pressKey selector="body" parameterArray="[/]" stepKey="pressForwardslashKey"/>
29+
<seeElement selector="{{AdminHeaderSection.globalSearchInputVisible}}" stepKey="seeActiveGlobalSearchInput"/>
30+
<seeInField userInput="" selector="{{AdminHeaderSection.globalSearchInput}}" stepKey="seeEmptyGlobalSearchInput"/>
31+
<pressKey selector="{{AdminHeaderSection.globalSearchInput}}" parameterArray="[/]" stepKey="pressForwardslashKeyAgain"/>
32+
<seeInField userInput="/" selector="{{AdminHeaderSection.globalSearchInput}}" stepKey="seeForwardSlashInGlobalSearchInput"/>
33+
</test>
34+
</tests>

app/code/Magento/Captcha/Test/Mftf/Test/CaptchaFormsDisplayingTest/CaptchaWithDisabledGuestCheckoutTest.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@
4646
<waitForElementVisible selector="{{StorefrontCustomerSignInPopupFormSection.captchaField}}" stepKey="seeCaptchaField"/>
4747
<waitForElementVisible selector="{{StorefrontCustomerSignInPopupFormSection.captchaImg}}" stepKey="seeCaptchaImage"/>
4848
<waitForElementVisible selector="{{StorefrontCustomerSignInPopupFormSection.captchaReload}}" stepKey="seeCaptchaReloadButton"/>
49-
<reloadPage stepKey="refreshPage"/>
50-
<waitForPageLoad stepKey="waitForPageLoad2"/>
49+
50+
<actionGroup ref="ReloadPageActionGroup" stepKey="refreshPage"/>
51+
<comment userInput="Replacing reload action and preserve Backward Compatibility" stepKey="waitForPageLoad2" />
52+
5153
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickCart2"/>
5254
<click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout2"/>
5355
<waitForElementVisible selector="{{StorefrontCustomerSignInPopupFormSection.email}}" stepKey="waitEmailFieldVisible2"/>

app/code/Magento/Catalog/Model/Category/Product/PositionResolver.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,30 @@ public function getPositions(int $categoryId): array
4949

5050
return array_flip($connection->fetchCol($select));
5151
}
52+
53+
/**
54+
* Get category product minimum position
55+
*
56+
* @param int $categoryId
57+
* @return int
58+
*/
59+
public function getMinPosition(int $categoryId): int
60+
{
61+
$connection = $this->getConnection();
62+
63+
$select = $connection->select()->from(
64+
['cpe' => $this->getTable('catalog_product_entity')],
65+
['position' => new \Zend_Db_Expr('MIN(position)')]
66+
)->joinLeft(
67+
['ccp' => $this->getTable('catalog_category_product')],
68+
'ccp.product_id=cpe.entity_id'
69+
)->where(
70+
'ccp.category_id = ?',
71+
$categoryId
72+
)->order(
73+
'ccp.product_id ' . \Magento\Framework\DB\Select::SQL_DESC
74+
);
75+
76+
return (int)$connection->fetchOne($select);
77+
}
5278
}

app/code/Magento/Catalog/Model/Product/Option/Type/Date.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ public function validateUserValue($values)
7272
$dateValid = true;
7373
if ($this->_dateExists()) {
7474
if ($this->useCalendar()) {
75+
if (is_array($value) && $this->checkDateWithoutJSCalendar($value)) {
76+
$value['date'] = sprintf("%s/%s/%s", $value['day'], $value['month'], $value['year']);
77+
}
7578
/* Fixed validation if the date was not saved correctly after re-saved the order
7679
for example: "09\/24\/2020,2020-09-24 00:00:00" */
7780
if (is_string($value) && preg_match('/^\d{1,4}.+\d{1,4}.+\d{1,4},+(\w|\W)*$/', $value)) {
@@ -81,6 +84,9 @@ public function validateUserValue($values)
8184
}
8285
$dateValid = isset($value['date']) && preg_match('/^\d{1,4}.+\d{1,4}.+\d{1,4}$/', $value['date']);
8386
} else {
87+
if (is_array($value)) {
88+
$value = $this->prepareDateByDateInternal($value);
89+
}
8490
$dateValid = isset(
8591
$value['day']
8692
) && isset(
@@ -411,4 +417,38 @@ protected function _timeExists()
411417
]
412418
);
413419
}
420+
421+
/**
422+
* Check is date without JS Calendar
423+
*
424+
* @param array $value
425+
*
426+
* @return bool
427+
*/
428+
private function checkDateWithoutJSCalendar(array $value): bool
429+
{
430+
return empty($value['date'])
431+
&& !empty($value['day'])
432+
&& !empty($value['month'])
433+
&& !empty($value['year']);
434+
}
435+
436+
/**
437+
* Prepare date by date internal
438+
*
439+
* @param array $value
440+
* @return array
441+
*/
442+
private function prepareDateByDateInternal(array $value): array
443+
{
444+
if (!empty($value['date']) && !empty($value['date_internal'])) {
445+
$formatDate = explode(' ', $value['date_internal']);
446+
$date = explode('-', $formatDate[0]);
447+
$value['year'] = $date[0];
448+
$value['month'] = $date[1];
449+
$value['day'] = $date[2];
450+
}
451+
452+
return $value;
453+
}
414454
}

app/code/Magento/Catalog/Model/Product/Type/AbstractType.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Catalog\Model\Product\Type;
89

@@ -620,7 +621,7 @@ protected function _prepareOptions(\Magento\Framework\DataObject $buyRequest, $p
620621
}
621622
}
622623
if (count($results) > 0) {
623-
throw new LocalizedException(__(implode("\n", $results)));
624+
throw new LocalizedException(__(implode("\n", array_unique($results))));
624625
}
625626
}
626627

app/code/Magento/Catalog/Model/ResourceModel/Product/Option/Value/Collection.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@
1414
*/
1515
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
1616
{
17+
/**
18+
* Name prefix of events that are dispatched by model
19+
*
20+
* @var string
21+
*/
22+
protected $_eventPrefix = 'catalog_product_option_value_collection';
23+
24+
/**
25+
* Name of event parameter
26+
*
27+
* @var string
28+
*/
29+
protected $_eventObject = 'product_option_value_collection';
30+
1731
/**
1832
* Resource initialization
1933
*

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
<magentoCLI command="cron:run" stepKey="runCron"/>
9898

9999
<!-- 5. Open category A on Storefront again -->
100-
<reloadPage stepKey="reloadCategoryA"/>
100+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadCategoryA"/>
101101

102102
<!-- Category A displays product A1 now -->
103103
<see userInput="$$createCategoryA.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeTitleCategoryA1"/>
@@ -126,7 +126,7 @@
126126
<magentoCLI command="cron:run" stepKey="runCron1"/>
127127

128128
<!-- 9. Open category A on Storefront again -->
129-
<reloadPage stepKey="refreshCategoryAPage"/>
129+
<actionGroup ref="ReloadPageActionGroup" stepKey="refreshCategoryAPage"/>
130130

131131
<!-- Category A is empty now -->
132132
<see userInput="$$createCategoryA.name$$" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="seeOnPageCategoryAName"/>

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@
4040

4141
<!-- Assert single row - no hover state -->
4242
<createData entity="ApiCategoryA" stepKey="createFirstCategoryBlank"/>
43-
<reloadPage stepKey="refreshPage"/>
44-
<waitForPageLoad stepKey="waitForBlankSingleRowAppear"/>
43+
44+
<actionGroup ref="ReloadPageActionGroup" stepKey="refreshPage"/>
45+
<comment userInput="Replacing reload action and preserve Backward Compatibility" stepKey="waitForBlankSingleRowAppear"/>
46+
4547
<moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createFirstCategoryBlank.name$$)}}" stepKey="hoverFirstCategoryBlank"/>
4648
<dontSeeElement selector="{{StorefrontNavigationMenuSection.subItemLevelHover('level0')}}" stepKey="assertNoHoverState"/>
4749

@@ -87,8 +89,9 @@
8789
</createData>
8890

8991
<!-- Several rows. Hover on category without children -->
90-
<reloadPage stepKey="reloadPage"/>
91-
<waitForPageLoad stepKey="waitForBlankSeveralRowsAppear"/>
92+
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadPage"/>
93+
<comment userInput="Replacing reload action and preserve Backward Compatibility" stepKey="waitForBlankSeveralRowsAppear"/>
94+
9295
<moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategoryWithoutChildrenBlank.name$$)}}" stepKey="hoverCategoryWithoutChildren"/>
9396
<dontSeeElement selector="{{StorefrontNavigationMenuSection.itemByNameAndLevel($$createCategoryWithoutChildrenBlank.name$$, 'level0')}}" stepKey="dontSeeChildrenInCategory"/>
9497

@@ -167,8 +170,9 @@
167170
<createData entity="ApiCategory" stepKey="createFourthCategoryLuma"/>
168171

169172
<!-- Single row. No hover state -->
170-
<reloadPage stepKey="reload"/>
171-
<waitForPageLoad stepKey="waitForLumaSingleRowAppear"/>
173+
<actionGroup ref="ReloadPageActionGroup" stepKey="reload"/>
174+
<comment userInput="Replacing reload action and preserve Backward Compatibility" stepKey="waitForLumaSingleRowAppear"/>
175+
172176
<dontSeeElement selector="{{StorefrontNavigationMenuSection.itemByNameAndLevel($$createFirstCategoryLuma.name$$, 'level0')}}" stepKey="noHoverStateInFirstCategory"/>
173177
<dontSeeElement selector="{{StorefrontNavigationMenuSection.itemByNameAndLevel($$createSecondCategoryLuma.name$$, 'level0')}}" stepKey="noHoverStateInSecondCategory"/>
174178
<dontSeeElement selector="{{StorefrontNavigationMenuSection.itemByNameAndLevel($$createThirdCategoryLuma.name$$, 'level0')}}" stepKey="noHoverStateThirdCategory"/>
@@ -203,8 +207,9 @@
203207
<createData entity="ApiCategory" stepKey="createEighthCategoryLuma"/>
204208

205209
<!-- Several rows. Hover on Category without children -->
206-
<reloadPage stepKey="refresh"/>
207-
<waitForPageLoad stepKey="waitForLumaSeveralRowsAppear"/>
210+
<actionGroup ref="ReloadPageActionGroup" stepKey="refresh"/>
211+
<comment userInput="Replacing reload action and preserve Backward Compatibility" stepKey="waitForLumaSeveralRowsAppear"/>
212+
208213
<moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createFifthCategoryLuma.name$$)}}" stepKey="hoverOnCategoryWithoutChildren"/>
209214
<dontSeeElement selector="{{StorefrontNavigationMenuSection.itemByNameAndLevel($$createFifthCategoryLuma.name$$, 'level0')}}" stepKey="dontSeeSubcategoriesInCategory"/>
210215

app/code/Magento/CatalogImportExport/Model/Import/Product/Type/AbstractType.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ public function prepareAttributesWithDefaultValueForSave(array $rowData, $withDe
533533
if ($attrParams['is_static']) {
534534
continue;
535535
}
536+
$attrCode = mb_strtolower($attrCode);
536537
if (isset($rowData[$attrCode]) && strlen(trim($rowData[$attrCode]))) {
537538
if (in_array($attrParams['type'], ['select', 'boolean'])) {
538539
$resultAttrs[$attrCode] = $attrParams['options'][strtolower($rowData[$attrCode])];

0 commit comments

Comments
 (0)