Skip to content

Commit 68770fc

Browse files
authored
Merge pull request #6220 from magento-tsg/2.4-develop-pr91
[Arrows] Fixes for 2.4 (pr91) (2.4-develop)
2 parents 6cd35e9 + 683ee3c commit 68770fc

File tree

10 files changed

+132
-42
lines changed

10 files changed

+132
-42
lines changed

app/code/Magento/CatalogWidget/Block/Product/ProductsList.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,13 @@ public function createCollection()
337337

338338
$collection->setVisibility($this->catalogProductVisibility->getVisibleInCatalogIds());
339339

340+
/**
341+
* Change sorting attribute to entity_id because created_at can be the same for products fastly created
342+
* one by one and sorting by created_at is indeterministic in this case.
343+
*/
340344
$collection = $this->_addProductAttributesAndPrices($collection)
341345
->addStoreFilter()
342-
->addAttributeToSort('created_at', 'desc')
346+
->addAttributeToSort('entity_id', 'desc')
343347
->setPageSize($this->getPageSize())
344348
->setCurPage($this->getRequest()->getParam($this->getData('page_var_name'), 1));
345349

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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="CatalogProductListCheckWidgetOrderTest">
12+
<annotations>
13+
<features value="CatalogWidget"/>
14+
<stories value="Product list widget"/>
15+
<title value="Checking order of products in the 'catalog Products List' widget"/>
16+
<description value="Check that products are ordered with recently added products first"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-27616"/>
19+
<useCaseId value="MC-5905"/>
20+
<group value="catalogWidget"/>
21+
<group value="catalog"/>
22+
<group value="WYSIWYGDisabled"/>
23+
</annotations>
24+
<before>
25+
<createData entity="SimpleSubCategory" stepKey="simplecategory"/>
26+
<createData entity="SimpleProduct" stepKey="createFirstProduct">
27+
<requiredEntity createDataKey="simplecategory"/>
28+
<field key="price">10</field>
29+
</createData>
30+
<createData entity="SimpleProduct" stepKey="createSecondProduct">
31+
<requiredEntity createDataKey="simplecategory"/>
32+
<field key="price">20</field>
33+
</createData>
34+
<createData entity="SimpleProduct" stepKey="createThirdProduct">
35+
<requiredEntity createDataKey="simplecategory"/>
36+
<field key="price">30</field>
37+
</createData>
38+
<createData entity="_defaultCmsPage" stepKey="createPreReqPage"/>
39+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
40+
<actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/>
41+
</before>
42+
<after>
43+
<actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/>
44+
<deleteData createDataKey="createPreReqPage" stepKey="deletePreReqPage" />
45+
<deleteData createDataKey="simplecategory" stepKey="deleteSimpleCategory"/>
46+
<deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/>
47+
<deleteData createDataKey="createSecondProduct" stepKey="deleteSecondProduct"/>
48+
<deleteData createDataKey="createThirdProduct" stepKey="deleteThirdProduct"/>
49+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
50+
</after>
51+
<!--Open created cms page-->
52+
<actionGroup ref="AdminOpenCmsPageActionGroup" stepKey="openEditPage">
53+
<argument name="page_id" value="$createPreReqPage.id$"/>
54+
</actionGroup>
55+
<click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickExpandContentTabForPage"/>
56+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
57+
<!--Add widget to cms page-->
58+
<waitForElementVisible selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="waitInsertWidgetIconVisible"/>
59+
<click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" />
60+
<waitForElementVisible selector="{{WidgetSection.WidgetType}}" stepKey="waitForWidgetTypeSelectorVisible"/>
61+
<selectOption selector="{{WidgetSection.WidgetType}}" userInput="Catalog Products List" stepKey="selectCatalogProductsList" />
62+
<waitForElementVisible selector="{{WidgetSection.AddParam}}" stepKey="waitForAddParamBtnVisible"/>
63+
<click selector="{{WidgetSection.AddParam}}" stepKey="clickAddParamBtn" />
64+
<waitForElementVisible selector="{{WidgetSection.ConditionsDropdown}}" stepKey="waitForDropdownVisible"/>
65+
<selectOption selector="{{WidgetSection.ConditionsDropdown}}" userInput="Category" stepKey="selectCategoryCondition" />
66+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear2" />
67+
<waitForElementVisible selector="{{WidgetSection.RuleParam}}" stepKey="waitForRuleParamVisible"/>
68+
<click selector="{{WidgetSection.RuleParam}}" stepKey="clickRuleParam" />
69+
<waitForElementVisible selector="{{WidgetSection.Chooser}}" stepKey="waitForElement" />
70+
<click selector="{{WidgetSection.Chooser}}" stepKey="clickChooser" />
71+
<waitForElementVisible selector="{{WidgetSection.PreCreateCategory('$simplecategory.name$')}}" stepKey="waitForCategoryVisible" />
72+
<click selector="{{WidgetSection.PreCreateCategory('$simplecategory.name$')}}" stepKey="selectCategory" />
73+
<click selector="{{WidgetSection.InsertWidget}}" stepKey="clickInsertWidget" />
74+
<!--Save cms page and go to Storefront-->
75+
<actionGroup ref="SaveCmsPageActionGroup" stepKey="saveCmsPage"/>
76+
<actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToTheStoreFront1">
77+
<argument name="page" value="$createPreReqPage.identifier$"/>
78+
</actionGroup>
79+
<!--Check order of products: recently added first-->
80+
<waitForElementVisible selector="{{InsertWidgetSection.checkElementStorefrontByName('1','$createThirdProduct.name$')}}" stepKey="waitForThirdProductVisible"/>
81+
<seeElement selector="{{InsertWidgetSection.checkElementStorefrontByName('1','$createThirdProduct.name$')}}" stepKey="seeElementByName1"/>
82+
<seeElement selector="{{InsertWidgetSection.checkElementStorefrontByName('2','$createSecondProduct.name$')}}" stepKey="seeElementByName2"/>
83+
<seeElement selector="{{InsertWidgetSection.checkElementStorefrontByName('3','$createFirstProduct.name$')}}" stepKey="seeElementByName3"/>
84+
</test>
85+
</tests>

app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOrderTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11-
<test name="CatalogProductListWidgetOrderTest">
11+
<test name="CatalogProductListWidgetOrderTest" deprecated="Use CatalogProductListCheckWidgetOrderTest instead">
1212
<annotations>
1313
<features value="CatalogWidget"/>
1414
<stories value="MC-5905: Wrong sorting on Products component"/>
15-
<title value="Checking order of products in the 'catalog Products List' widget"/>
15+
<title value="Deprecated. Checking order of products in the 'catalog Products List' widget"/>
1616
<description value="Check that products are ordered with recently added products first"/>
1717
<severity value="MAJOR"/>
1818
<testCaseId value="MC-13794"/>
1919
<group value="CatalogWidget"/>
2020
<group value="WYSIWYGDisabled"/>
2121
<skip>
22-
<issueId value="MC-13923"/>
22+
<issueId value="DEPRECATED">Use CatalogProductListCheckWidgetOrderTest instead</issueId>
2323
</skip>
2424
</annotations>
2525
<before>

app/code/Magento/CatalogWidget/Test/Unit/Block/Product/ProductsListTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ public function testCreateCollection($pagerEnable, $productsCount, $productsPerP
314314
$collection->expects($this->once())->method('addAttributeToSelect')->willReturnSelf();
315315
$collection->expects($this->once())->method('addUrlRewrite')->willReturnSelf();
316316
$collection->expects($this->once())->method('addStoreFilter')->willReturnSelf();
317-
$collection->expects($this->once())->method('addAttributeToSort')->with('created_at', 'desc')->willReturnSelf();
317+
$collection->expects($this->once())->method('addAttributeToSort')->with('entity_id', 'desc')->willReturnSelf();
318318
$collection->expects($this->once())->method('setPageSize')->with($expectedPageSize)->willReturnSelf();
319319
$collection->expects($this->once())->method('setCurPage')->willReturnSelf();
320320
$collection->expects($this->once())->method('distinct')->willReturnSelf();

app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckCartActionGroup.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@
2727
<scrollTo selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="scrollToSummary"/>
2828
<see userInput="{{subtotal}}" selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="assertSubtotal"/>
2929
<see userInput="({{shippingMethod}})" selector="{{CheckoutCartSummarySection.shippingMethod}}" stepKey="assertShippingMethod"/>
30-
<reloadPage stepKey="reloadPage" after="assertShippingMethod" />
31-
<waitForPageLoad stepKey="WaitForPageLoaded" after="reloadPage" />
32-
<waitForText userInput="{{shipping}}" selector="{{CheckoutCartSummarySection.shipping}}" time="45" stepKey="assertShipping" after="WaitForPageLoaded"/>
33-
<see userInput="{{total}}" selector="{{CheckoutCartSummarySection.total}}" stepKey="assertTotal" after="assertShipping"/>
30+
<waitForText userInput="{{shipping}}" selector="{{CheckoutCartSummarySection.shipping}}" time="45" stepKey="assertShipping"/>
31+
<see userInput="{{total}}" selector="{{CheckoutCartSummarySection.total}}" stepKey="assertTotal"/>
3432
</actionGroup>
3533
</actionGroups>

app/code/Magento/Cms/Test/Mftf/Section/TinyMCESection/TinyMCESection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<element name="CheckIfTabExpand" type="button" selector="//div[@data-state-collapsible='closed']//span[text()='Content']"/>
1313
<element name="TinyMCE4" type="text" selector=".mce-branding"/>
1414
<element name="InsertWidgetBtn" type="button" selector=".action-add-widget"/>
15-
<element name="InsertWidgetIcon" type="button" selector="div[aria-label='Insert Widget']"/>
15+
<element name="InsertWidgetIcon" type="button" selector="div[aria-label='Insert Widget']" timeout="30"/>
1616
<element name="InsertVariableBtn" type="button" selector=".scalable.add-variable.plugin"/>
1717
<element name="InsertVariableIcon" type="button" selector="div[aria-label='Insert Variable']"/>
1818
<element name="InsertImageBtn" type="button" selector=".scalable.action-add-image.plugin"/>

app/code/Magento/Customer/Model/AccountManagement.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,6 @@ protected function sendEmailConfirmation(CustomerInterface $customer, $redirectU
977977
$templateType = self::NEW_ACCOUNT_EMAIL_REGISTERED_NO_PASSWORD;
978978
}
979979
$this->getEmailNotification()->newAccount($customer, $templateType, $redirectUrl, $customer->getStoreId());
980-
$customer->setConfirmation(null);
981980
} catch (MailException $e) {
982981
// If we are not able to send a new account email, this should be ignored
983982
$this->logger->critical($e);
@@ -1615,37 +1614,6 @@ private function getEmailNotification()
16151614
}
16161615
}
16171616

1618-
/**
1619-
* Destroy all active customer sessions by customer id (current session will not be destroyed).
1620-
*
1621-
* Customer sessions which should be deleted are collecting from the "customer_visitor" table considering
1622-
* configured session lifetime.
1623-
*
1624-
* @param string|int $customerId
1625-
* @return void
1626-
*/
1627-
private function destroyCustomerSessions($customerId)
1628-
{
1629-
$this->sessionManager->regenerateId();
1630-
$sessionLifetime = $this->scopeConfig->getValue(
1631-
\Magento\Framework\Session\Config::XML_PATH_COOKIE_LIFETIME,
1632-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
1633-
);
1634-
$dateTime = $this->dateTimeFactory->create();
1635-
$activeSessionsTime = $dateTime->setTimestamp($dateTime->getTimestamp() - $sessionLifetime)
1636-
->format(DateTime::DATETIME_PHP_FORMAT);
1637-
/** @var \Magento\Customer\Model\ResourceModel\Visitor\Collection $visitorCollection */
1638-
$visitorCollection = $this->visitorCollectionFactory->create();
1639-
$visitorCollection->addFieldToFilter('customer_id', $customerId);
1640-
$visitorCollection->addFieldToFilter('last_visit_at', ['from' => $activeSessionsTime]);
1641-
$visitorCollection->addFieldToFilter('session_id', ['neq' => $this->sessionManager->getSessionId()]);
1642-
/** @var \Magento\Customer\Model\Visitor $visitor */
1643-
foreach ($visitorCollection->getItems() as $visitor) {
1644-
$sessionId = $visitor->getSessionId();
1645-
$this->saveHandler->destroy($sessionId);
1646-
}
1647-
}
1648-
16491617
/**
16501618
* Set ignore_validation_flag for reset password flow to skip unnecessary address and customer validation
16511619
*
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Customer\Model;
8+
9+
use Magento\Customer\Api\Data\CustomerInterface;
10+
11+
/**
12+
* Account Management service implementation for external API access.
13+
* Handle various customer account actions.
14+
*
15+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
16+
*/
17+
class AccountManagementApi extends AccountManagement
18+
{
19+
/**
20+
* @inheritDoc
21+
*
22+
* Override createAccount method to unset confirmation attribute for security purposes.
23+
*/
24+
public function createAccount(CustomerInterface $customer, $password = null, $redirectUrl = '')
25+
{
26+
$customer = parent::createAccount($customer, $password, $redirectUrl);
27+
$customer->setConfirmation(null);
28+
29+
return $customer;
30+
}
31+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@
3131
</argument>
3232
</arguments>
3333
</type>
34+
<preference for="Magento\Customer\Api\AccountManagementInterface"
35+
type="Magento\Customer\Model\AccountManagementApi" />
3436
</config>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@
1818
</argument>
1919
</arguments>
2020
</type>
21+
<preference for="Magento\Customer\Api\AccountManagementInterface"
22+
type="Magento\Customer\Model\AccountManagementApi" />
2123
</config>

0 commit comments

Comments
 (0)