Skip to content

Commit cd6a746

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into spartans_pr_18022025
2 parents 627af94 + 3a6536d commit cd6a746

File tree

49 files changed

+2201
-853
lines changed

Some content is hidden

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

49 files changed

+2201
-853
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -25,5 +25,7 @@
2525
<element name="noticeMessage" type="text" selector=".message-notice"/>
2626
<element name="assertCacheManagementConfigurationStatus" type="button" selector="//td[@data-column='tags' and contains(text(),'CONFIG')]/following-sibling::td//span[@class='grid-severity-notice']//span"/>
2727
<element name="assertCacheManagementLayoutsStatus" type="button" selector="//td[@data-column='tags' and contains(text(),'LAYOUT_GENERAL_CACHE_TAG')]/following-sibling::td//span[@class='grid-severity-notice']//span"/>
28+
<element name="assertCacheManagementStatusEnabled" type="button" selector="//td[@data-column='tags' and contains(text(),'{{cache}}')]/following-sibling::td//span[@class='grid-severity-notice']//span" parameterized="true"/>
29+
<element name="assertCacheManagementStatusInvalidated" type="button" selector="//td[@data-column='tags' and contains(text(),'{{cacheType}}')]/following-sibling::td//span[@class='grid-severity-minor']//span" parameterized="true"/>
2830
</section>
2931
</sections>
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminValidateEAVTypesAndAttributesConfigurationTest">
11+
<annotations>
12+
<features value="Cache"/>
13+
<stories value="Cache Management"/>
14+
<title value="Validate EAVTypes And Attributes Cache Type"/>
15+
<description value="Validate EAVTypes And Attributes Cache Type After Cache Management"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="AC-3833"/>
18+
</annotations>
19+
<before>
20+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
21+
<actionGroup ref="AdminGoToCacheManagementPageActionGroup" stepKey="goToCacheManagementPage"/>
22+
<!--Verify Cache Type EAV Types And Attributes Is ENABLED -->
23+
<waitForText selector="{{AdminMessagesSection.assertCacheManagementStatusEnabled('EAV')}}" userInput="ENABLED" stepKey="verifyCacheTypeEAVTypesAndAttributesIsENABLED"/>
24+
</before>
25+
<after>
26+
<!--Delete created entity -->
27+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteFirstProduct"/>
28+
<actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage">
29+
<argument name="ProductAttribute" value="{{multiselectProductAttribute.attribute_code}}"/>
30+
</actionGroup>
31+
<actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttribute"/>
32+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
33+
<argument name="indices" value=""/>
34+
</actionGroup>
35+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
36+
</after>
37+
<!-- Create Simple Product -->
38+
<createData entity="SimpleProduct" stepKey="createSimpleProduct"/>
39+
<!--Navigate to Stores > Attributes > Product.-->
40+
<actionGroup ref="AdminOpenProductAttributePageActionGroup" stepKey="goToProductAttributes"/>
41+
<!--Create new Product Attribute as TextField, with code and default value.-->
42+
<actionGroup ref="CreateProductAttributeActionGroup" stepKey="createAttribute">
43+
<argument name="attribute" value="multiselectProductAttribute"/>
44+
</actionGroup>
45+
<!--Navigate to Product Attribute, add Product Options and Save - 1-->
46+
<actionGroup ref="NavigateToEditProductAttributeActionGroup" stepKey="goToEditPage1">
47+
<argument name="ProductAttribute" value="{{multiselectProductAttribute.attribute_code}}"/>
48+
</actionGroup>
49+
<actionGroup ref="CreateAttributeDropdownNthOptionActionGroup" stepKey="createOption1">
50+
<argument name="adminName" value="{{multiselectProductAttribute.option1_admin}}"/>
51+
<argument name="frontName" value="{{multiselectProductAttribute.option1_frontend}}"/>
52+
<argument name="row" value="1"/>
53+
</actionGroup>
54+
<actionGroup ref="AdminSetProductAttributeUseInLayeredNavigationOptionActionGroup" stepKey="setDropdownUseInLayeredNavigationNoResults">
55+
<argument name="useInLayeredNavigationValue" value="Filterable (with results)"/>
56+
</actionGroup>
57+
<selectOption selector="{{AdvancedAttributePropertiesSection.UseInSearch}}" userInput="Yes" stepKey="selectIsSearchAble"/>
58+
<selectOption selector="{{AttributePropertiesSection.useInSearchResultsLayeredNavigation}}" userInput="Yes" stepKey="selectUseInLayeredNavigationOption"/>
59+
<click stepKey="saveAttribute" selector="{{AttributePropertiesSection.Save}}"/>
60+
<!-- Open created product for edit -->
61+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProductEditPage">
62+
<argument name="productId" value="$createSimpleProduct.id$"/>
63+
</actionGroup>
64+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
65+
<click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickAddAttributeBtn"/>
66+
<waitForPageLoad stepKey="waitForAttributeAdded"/>
67+
<!-- Filter By Attribute Label on Add Attribute Page -->
68+
<click selector="{{AdminProductFiltersSection.filter}}" stepKey="clickOnFilter"/>
69+
<fillField selector="{{AdminProductAddAttributeModalSection.attributeCodeFilter}}" userInput="{{multiselectProductAttribute.attribute_code}}" stepKey="fillAttrCodeField" />
70+
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="clickSearchBtn" />
71+
<click stepKey="clickonFirstRow" selector="{{AdminProductAddAttributeModalSection.firstRowCheckBox}}"/>
72+
<click stepKey="clickOnAddSelected" selector="{{AdminProductAttributeGridSection.addSelected}}"/>
73+
<waitForPageLoad stepKey="waitForAttributeAdded2"/>
74+
<!-- Expand 'Attributes' tab -->
75+
<actionGroup ref="AdminExpandProductAttributesTabActionGroup" stepKey="expandAttributesTab"/>
76+
<!-- Check created attribute presents in the 'Attributes' tab -->
77+
<waitForElementVisible selector="{{AdminProductAttributesSection.attributeDropdownByCode(multiselectProductAttribute.attribute_code)}}" stepKey="assertAttributeIsPresentInTab"/>
78+
<!-- Select attribute options -->
79+
<selectOption selector="{{AdminProductAttributesSection.attributeDropdownByCode(multiselectProductAttribute.attribute_code)}}" userInput="{{multiselectProductAttribute.option1_admin}}" stepKey="selectProduct1AttributeOption"/>
80+
<!-- Save product -->
81+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/>
82+
<!--Verify Cache Type Page Cache Is INVALIDATED -->
83+
<actionGroup ref="AdminGoToCacheManagementPageActionGroup" stepKey="goToCacheManagementPageAgain"/>
84+
<waitForText selector="{{AdminMessagesSection.assertCacheManagementStatusInvalidated('FPC')}}" userInput="INVALIDATED" stepKey="verifyCacheTypePageCacheIsInvalidated"/>
85+
<!--Flush Cache -->
86+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
87+
<argument name="indices" value=""/>
88+
</actionGroup>
89+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="flushCache">
90+
<argument name="tags" value="full_page"/>
91+
</actionGroup>
92+
<!--Verify Cache Type Page Cache s Is Enabled -->
93+
<actionGroup ref="AdminGoToCacheManagementPageActionGroup" stepKey="goToCacheManagementPageAgain1"/>
94+
<waitForText selector="{{AdminMessagesSection.assertCacheManagementStatusEnabled('FPC')}}" userInput="ENABLED" stepKey="verifyCacheTypePageCacheIsENABLED"/>
95+
<!-- Go to Storefront and search for product-->
96+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToFrontPage"/>
97+
<actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront">
98+
<argument name="phrase" value="$createSimpleProduct.name$"/>
99+
</actionGroup>
100+
<!-- Assert custom Attribute in Layered Navigation-->
101+
<waitForElementVisible selector="{{StorefrontCategorySidebarSection.filterOptionsTitle(multiselectProductAttribute.attribute_code)}}" stepKey="waitForAttributeVisible"/>
102+
<conditionalClick selector="{{StorefrontCategorySidebarSection.filterOptionsTitle(multiselectProductAttribute.attribute_code)}}" dependentSelector="{{StorefrontCategorySidebarSection.activeFilterOptions}}" visible="false" stepKey="clickToExpandAttribute"/>
103+
<waitForElementVisible selector="{{StorefrontCategorySidebarSection.activeFilterOptions}}" stepKey="waitForAttributeOptionsVisible"/>
104+
</test>
105+
</tests>

app/code/Magento/Catalog/Block/Category/View.php

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,66 +5,81 @@
55
*/
66
namespace Magento\Catalog\Block\Category;
77

8+
use Magento\Catalog\Block\Breadcrumbs;
9+
use Magento\Catalog\Helper\Data;
10+
use Magento\Catalog\Helper\Category as CategoryHelper;
11+
use Magento\Catalog\Model\Category;
12+
use Magento\Catalog\Model\Layer;
13+
use Magento\Catalog\Model\Layer\Resolver;
14+
use Magento\Framework\App\ObjectManager;
15+
use Magento\Cms\Block\Block;
16+
use Magento\Framework\DataObject\IdentityInterface;
17+
use Magento\Framework\Exception\LocalizedException;
18+
use Magento\Framework\Registry;
19+
use Magento\Framework\View\Element\Template;
20+
use Magento\Framework\View\Element\Template\Context;
21+
822
/**
923
* Category View Block class
1024
* @api
1125
* @since 100.0.2
1226
*/
13-
class View extends \Magento\Framework\View\Element\Template implements \Magento\Framework\DataObject\IdentityInterface
27+
class View extends Template implements IdentityInterface
1428
{
1529
/**
16-
* @var \Magento\Framework\Registry
30+
* @var Registry
1731
*/
1832
protected $_coreRegistry = null;
1933

2034
/**
21-
* @var \Magento\Catalog\Model\Layer
35+
* @var Layer
2236
*/
2337
protected $_catalogLayer;
2438

2539
/**
26-
* @var \Magento\Catalog\Helper\Category
40+
* @var CategoryHelper
2741
*/
2842
protected $_categoryHelper;
2943

3044
/**
31-
* @var \Magento\Catalog\Helper\Data|null
45+
* @var Data|null
3246
*/
3347
private $catalogData;
3448

3549
/**
36-
* @param \Magento\Framework\View\Element\Template\Context $context
37-
* @param \Magento\Catalog\Model\Layer\Resolver $layerResolver
38-
* @param \Magento\Framework\Registry $registry
39-
* @param \Magento\Catalog\Helper\Category $categoryHelper
50+
* @param Context $context
51+
* @param Resolver $layerResolver
52+
* @param Registry $registry
53+
* @param CategoryHelper $categoryHelper
4054
* @param array $data
41-
* @param \Magento\Catalog\Helper\Data|null $catalogData
55+
* @param Data|null $catalogData
4256
*/
4357
public function __construct(
44-
\Magento\Framework\View\Element\Template\Context $context,
45-
\Magento\Catalog\Model\Layer\Resolver $layerResolver,
46-
\Magento\Framework\Registry $registry,
47-
\Magento\Catalog\Helper\Category $categoryHelper,
48-
array $data = [],
49-
?\Magento\Catalog\Helper\Data $catalogData = null
58+
Context $context,
59+
Resolver $layerResolver,
60+
Registry $registry,
61+
CategoryHelper $categoryHelper,
62+
array $data = [],
63+
?Data $catalogData = null
5064
) {
5165
$this->_categoryHelper = $categoryHelper;
5266
$this->_catalogLayer = $layerResolver->get();
5367
$this->_coreRegistry = $registry;
54-
$this->catalogData = $catalogData ?? \Magento\Framework\App\ObjectManager::getInstance()
55-
->get(\Magento\Catalog\Helper\Data::class);
68+
$this->catalogData = $catalogData ?? ObjectManager::getInstance()
69+
->get(Data::class);
5670
parent::__construct($context, $data);
5771
}
5872

5973
/**
6074
* @inheritdoc
6175
* @return $this
76+
* @throws LocalizedException
6277
*/
6378
protected function _prepareLayout()
6479
{
6580
parent::_prepareLayout();
6681

67-
$block = $this->getLayout()->createBlock(\Magento\Catalog\Block\Breadcrumbs::class);
82+
$block = $this->getLayout()->createBlock(Breadcrumbs::class);
6883

6984
$category = $this->getCurrentCategory();
7085
if ($category) {
@@ -88,7 +103,7 @@ protected function _prepareLayout()
88103
}
89104
if ($this->_categoryHelper->canUseCanonicalTag()) {
90105
$this->pageConfig->addRemotePageAsset(
91-
$category->getUrl(),
106+
$this->_categoryHelper->getCanonicalUrl($category->getUrl()),
92107
'canonical',
93108
['attributes' => ['rel' => 'canonical']]
94109
);
@@ -116,7 +131,7 @@ public function getProductListHtml()
116131
/**
117132
* Retrieve current category model object
118133
*
119-
* @return \Magento\Catalog\Model\Category
134+
* @return Category
120135
*/
121136
public function getCurrentCategory()
122137
{
@@ -135,7 +150,7 @@ public function getCmsBlockHtml()
135150
{
136151
if (!$this->getData('cms_block_html')) {
137152
$html = $this->getLayout()->createBlock(
138-
\Magento\Cms\Block\Block::class
153+
Block::class
139154
)->setBlockId(
140155
$this->getCurrentCategory()->getLandingPage()
141156
)->toHtml();
@@ -151,7 +166,7 @@ public function getCmsBlockHtml()
151166
*/
152167
public function isProductMode()
153168
{
154-
return $this->getCurrentCategory()->getDisplayMode() == \Magento\Catalog\Model\Category::DM_PRODUCT;
169+
return $this->getCurrentCategory()->getDisplayMode() == Category::DM_PRODUCT;
155170
}
156171

157172
/**
@@ -161,7 +176,7 @@ public function isProductMode()
161176
*/
162177
public function isMixedMode()
163178
{
164-
return $this->getCurrentCategory()->getDisplayMode() == \Magento\Catalog\Model\Category::DM_MIXED;
179+
return $this->getCurrentCategory()->getDisplayMode() == Category::DM_MIXED;
165180
}
166181

167182
/**
@@ -175,7 +190,7 @@ public function isContentMode()
175190
{
176191
$category = $this->getCurrentCategory();
177192
$res = false;
178-
if ($category->getDisplayMode() == \Magento\Catalog\Model\Category::DM_PAGE) {
193+
if ($category->getDisplayMode() == Category::DM_PAGE) {
179194
$res = true;
180195
if ($category->getIsAnchor()) {
181196
$state = $this->_catalogLayer->getState();

0 commit comments

Comments
 (0)