Skip to content

Commit 0f323e7

Browse files
[Magento Community Engineering] Community Contributions - 2.4-develop
- merged latest code from mainline branch
2 parents 799f9a1 + 5112f27 commit 0f323e7

File tree

55 files changed

+1465
-63
lines changed

Some content is hidden

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

55 files changed

+1465
-63
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminNavigateToPersistentShoppingCartSettingsActionGroup">
12+
<amOnPage url="{{AdminConfigurationPersistentShoppingCartPage.url}}" stepKey="navigateToPersistencePage"/>
13+
<conditionalClick selector="{{AdminPersistentShoppingCartSection.DefaultLayoutsTab}}" dependentSelector="{{AdminPersistentShoppingCartSection.CheckIfTabExpand}}" visible="true" stepKey="clickTab"/>
14+
</actionGroup>
15+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertAdminPersistentShoppingCartOptionsAvailableActionGroup">
12+
<seeElement stepKey="seeLifetimeInput" selector="{{AdminPersistentShoppingCartSection.persistenceLifeTime}}"/>
13+
<seeElement stepKey="seeRememberMeEnableInput" selector="{{AdminPersistentShoppingCartSection.rememberMeEnable}}"/>
14+
<seeElement stepKey="seeRememberMeDefaultInput" selector="{{AdminPersistentShoppingCartSection.rememberMeDefault}}"/>
15+
<seeElement stepKey="seeClearPersistence" selector="{{AdminPersistentShoppingCartSection.clearPersistenceOnLogout}}"/>
16+
<seeElement stepKey="seePersistShoppingCart" selector="{{AdminPersistentShoppingCartSection.persistShoppingCart}}"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="AdminConfigurationPersistentShoppingCartPage" url="admin/system_config/edit/section/persistent/" module="Customers" area="admin">
12+
<section name="AdminPersistentShoppingCartSection"/>
13+
</page>
14+
</pages>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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="AdminLoginFailedTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Login on the Admin Login page"/>
15+
<title value="Admin should not be able to log into the backend with invalid credentials"/>
16+
<description value="Admin should not be able to log into the backend with invalid credentials"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MAGETWO-71572"/>
19+
<group value="example"/>
20+
<group value="login"/>
21+
</annotations>
22+
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin">
24+
<argument name="password" value="INVALID!{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/>
25+
</actionGroup>
26+
<actionGroup ref="AssertMessageOnAdminLoginActionGroup" stepKey="assertErrorMessage"/>
27+
</test>
28+
</tests>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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="AdminLoginSuccessfulTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Login on the Admin Login page"/>
15+
<title value="Admin should be able to log into the Magento Admin backend successfully"/>
16+
<description value="Admin should be able to log into the Magento Admin backend successfully"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MAGETWO-71572"/>
19+
<group value="example"/>
20+
<group value="login"/>
21+
</annotations>
22+
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24+
<actionGroup ref="AssertAdminSuccessLoginActionGroup" stepKey="assertLoggedIn"/>
25+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
26+
</test>
27+
</tests>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
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="AdminLoginTest">
11+
<test name="AdminLoginTest" deprecated="Replaced with AdminLoginSuccessfulTest">
1212
<annotations>
1313
<features value="Backend"/>
1414
<stories value="Login on the Admin Login page"/>
@@ -20,7 +20,7 @@
2020
<group value="login"/>
2121
</annotations>
2222

23-
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
2424
<seeInCurrentUrl url="{{AdminLoginPage.url}}" stepKey="seeAdminLoginUrl"/>
2525
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
2626
</test>
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="AdminPersistentShoppingCartSettingsTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Enable Persistent Shopping cart"/>
15+
<title value="Admin should be able to manage persistent shopping cart settings"/>
16+
<description value="Admin should be able to enable persistent shopping cart in Magento Admin backend and see additional options"/>
17+
<group value="backend"/>
18+
</annotations>
19+
20+
<before>
21+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
22+
<magentoCLI stepKey="enablePersistentShoppingCart" command="config:set persistent/options/enabled 1"/>
23+
<magentoCLI stepKey="cacheClean" command="cache:clean config"/>
24+
</before>
25+
<after>
26+
<magentoCLI stepKey="disablePersistentShoppingCart" command="config:set persistent/options/enabled 0"/>
27+
<magentoCLI stepKey="cacheClean" command="cache:clean config"/>
28+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
29+
</after>
30+
31+
<actionGroup ref="AdminNavigateToPersistentShoppingCartSettingsActionGroup" stepKey="navigateToPersistenceSettings"/>
32+
<actionGroup ref="AssertAdminPersistentShoppingCartOptionsAvailableActionGroup" stepKey="assertOptions"/>
33+
</test>
34+
</tests>
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Model\Config;
9+
10+
use Magento\Framework\App\Config\ScopeConfigInterface;
11+
use Magento\Framework\Exception\NoSuchEntityException;
12+
use Magento\Store\Model\ScopeInterface;
13+
use Magento\Store\Model\StoreManagerInterface;
14+
15+
/**
16+
* Config for category in the layered navigation
17+
*/
18+
class LayerCategoryConfig
19+
{
20+
private const XML_PATH_CATALOG_LAYERED_NAVIGATION_DISPLAY_CATEGORY = 'catalog/layered_navigation/display_category';
21+
22+
/**
23+
* @var ScopeConfigInterface
24+
*/
25+
private $scopeConfig;
26+
27+
/**
28+
* @var StoreManagerInterface
29+
*/
30+
private $storeManager;
31+
32+
/**
33+
* LayerCategoryConfig constructor
34+
*
35+
* @param ScopeConfigInterface $scopeConfig
36+
* @param StoreManagerInterface $storeManager
37+
*/
38+
public function __construct(
39+
ScopeConfigInterface $scopeConfig,
40+
StoreManagerInterface $storeManager
41+
) {
42+
$this->scopeConfig = $scopeConfig;
43+
$this->storeManager = $storeManager;
44+
}
45+
46+
/**
47+
* Check if category filter item should be added in the layered navigation
48+
*
49+
* @param string $scopeType
50+
* @param null|int|string $scopeCode
51+
*
52+
* @return bool
53+
*/
54+
public function isCategoryFilterVisibleInLayerNavigation(
55+
$scopeType = ScopeInterface::SCOPE_STORES,
56+
$scopeCode = null
57+
): bool {
58+
if (!$scopeCode) {
59+
$scopeCode = $this->getStoreId();
60+
}
61+
62+
return $this->scopeConfig->isSetFlag(
63+
static::XML_PATH_CATALOG_LAYERED_NAVIGATION_DISPLAY_CATEGORY,
64+
$scopeType,
65+
$scopeCode
66+
);
67+
}
68+
69+
/**
70+
* Get the current store ID
71+
*
72+
* @return int
73+
*
74+
* @throws NoSuchEntityException
75+
*/
76+
private function getStoreId(): int
77+
{
78+
return (int) $this->storeManager->getStore()->getId();
79+
}
80+
}

app/code/Magento/Catalog/Model/Layer/FilterList.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
namespace Magento\Catalog\Model\Layer;
99

10+
use Magento\Catalog\Model\Config\LayerCategoryConfig;
11+
use Magento\Framework\App\ObjectManager;
12+
1013
/**
1114
* Layer navigation filters
1215
*/
@@ -44,18 +47,26 @@ class FilterList
4447
*/
4548
protected $filters = [];
4649

50+
/**
51+
* @var LayerCategoryConfig
52+
*/
53+
private $layerCategoryConfig;
54+
4755
/**
4856
* @param \Magento\Framework\ObjectManagerInterface $objectManager
4957
* @param FilterableAttributeListInterface $filterableAttributes
58+
* @param LayerCategoryConfig $layerCategoryConfig
5059
* @param array $filters
5160
*/
5261
public function __construct(
5362
\Magento\Framework\ObjectManagerInterface $objectManager,
5463
FilterableAttributeListInterface $filterableAttributes,
64+
LayerCategoryConfig $layerCategoryConfig,
5565
array $filters = []
5666
) {
5767
$this->objectManager = $objectManager;
5868
$this->filterableAttributes = $filterableAttributes;
69+
$this->layerCategoryConfig = $layerCategoryConfig;
5970

6071
/** Override default filter type models */
6172
$this->filterTypes = array_merge($this->filterTypes, $filters);
@@ -70,9 +81,11 @@ public function __construct(
7081
public function getFilters(\Magento\Catalog\Model\Layer $layer)
7182
{
7283
if (!count($this->filters)) {
73-
$this->filters = [
74-
$this->objectManager->create($this->filterTypes[self::CATEGORY_FILTER], ['layer' => $layer]),
75-
];
84+
if ($this->layerCategoryConfig->isCategoryFilterVisibleInLayerNavigation()) {
85+
$this->filters = [
86+
$this->objectManager->create($this->filterTypes[self::CATEGORY_FILTER], ['layer' => $layer]),
87+
];
88+
}
7689
foreach ($this->filterableAttributes->getList() as $attribute) {
7790
$this->filters[] = $this->createAttributeFilter($attribute, $layer);
7891
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminAssignImageBaseRoleActionGroup">
12+
<annotations>
13+
<description>Requires the navigation to the Product Creation page. Checks the Base Role area for image.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="image"/>
17+
</arguments>
18+
<conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageFile(image.fileName)}}" visible="false" stepKey="expandImages"/>
19+
<waitForElementVisible selector="{{AdminProductImagesSection.imageFile(image.fileName)}}" stepKey="seeProductImageName"/>
20+
<click selector="{{AdminProductImagesSection.imageFile(image.fileName)}}" stepKey="clickProductImage"/>
21+
<waitForElementVisible selector="{{AdminProductImagesSection.altText}}" stepKey="seeAltTextSection"/>
22+
<checkOption selector="{{AdminProductImagesSection.roleBase}}" stepKey="checkRoles"/>
23+
<click selector="{{AdminSlideOutDialogSection.closeButton}}" stepKey="clickCloseButton"/>
24+
</actionGroup>
25+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
9+
<!-- On a category page with layered navigation, verify if the category filter item is NOT present -->
10+
<actionGroup name="AssertStorefrontLayeredNavigationCategoryFilterNotVisibleActionGroup">
11+
<!-- Verify category filter item is NOT present -->
12+
<dontSee selector="{{StorefrontCategorySidebarSection.layeredFilterBlock}}" userInput="Category" stepKey="seeCategoryFilterInLayeredNav"/>
13+
</actionGroup>
14+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
9+
<!-- On a category page with layered navigation, verify if the category filter item is present -->
10+
<actionGroup name="AssertStorefrontLayeredNavigationCategoryFilterVisibleActionGroup">
11+
<!-- Verify category filter item is present -->
12+
<see selector="{{StorefrontCategorySidebarSection.layeredFilterBlock}}" userInput="Category" stepKey="seeCategoryFilterInLayeredNav"/>
13+
</actionGroup>
14+
</actionGroups>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="EnableCategoryFilterOnCategoryPageConfigData">
12+
<data key="path">catalog/layered_navigation/display_category</data>
13+
<data key="value">1</data>
14+
</entity>
15+
<entity name="DisableCategoryFilterOnCategoryPageConfigData">
16+
<data key="path">catalog/layered_navigation/display_category</data>
17+
<data key="value">0</data>
18+
</entity>
19+
</entities>

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,14 @@
880880
<data key="weight">5</data>
881881
<requiredEntity type="product_extension_attribute">EavStock100</requiredEntity>
882882
</entity>
883+
<entity name="Magento2" type="image">
884+
<data key="title" unique="suffix">Magento2</data>
885+
<data key="file_type">Upload File</data>
886+
<data key="shareable">Yes</data>
887+
<data key="file">magento2.jpg</data>
888+
<data key="filename">magento2</data>
889+
<data key="file_extension">jpg</data>
890+
</entity>
883891
<entity name="Magento3" type="image">
884892
<data key="title" unique="suffix">Magento3</data>
885893
<data key="price">1.00</data>

0 commit comments

Comments
 (0)