Skip to content

Commit 956f361

Browse files
committed
MAGETWO-95048: Sidebar navigation is broken for Stores > Configuration, All Stores.
- Pass frontname to getSecretKey if route not found - Add MFTF test to cover this fix
1 parent 09cfa64 commit 956f361

File tree

3 files changed

+54
-3
lines changed

3 files changed

+54
-3
lines changed

app/code/Magento/Backend/Block/Menu.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Menu extends \Magento\Backend\Block\Template
7575
private $anchorRenderer;
7676

7777
/**
78-
* @var ConfigInterface
78+
* @var \Magento\Framework\App\Route\ConfigInterface
7979
*/
8080
private $routeConfig;
8181

@@ -216,7 +216,7 @@ protected function _callbackSecretKey($match)
216216
{
217217
$routeId = $this->routeConfig->getRouteByFrontName($match[1]);
218218
return \Magento\Backend\Model\UrlInterface::SECRET_KEY_PARAM_NAME . '/' . $this->_url->getSecretKey(
219-
$routeId,
219+
$routeId ?: $match[1],
220220
$match[2],
221221
$match[3]
222222
);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
-->
88

99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminMenuSection">
1212
<element name="catalog" type="button" selector="#menu-magento-catalog-catalog"/>
13+
<element name="catalogProducts" type="button" selector="#nav li[data-ui-id='menu-magento-catalog-catalog-products']"/>
1314
<element name="customers" type="button" selector="#menu-magento-customer-customer"/>
1415
<element name="content" type="button" selector="#menu-magento-backend-content"/>
1516
<element name="widgets" type="button" selector="#nav li[data-ui-id='menu-magento-widget-cms-widget-instance']"/>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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="AdminMenuNavigationWithSecretKeysTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Menu Navigation"/>
15+
<title value="Admin should be able to navigate between menu options with secret url keys enabled"/>
16+
<description value="Admin should be able to navigate between menu options with secret url keys enabled"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MAGETWO-95349"/>
19+
<group value="menu"/>
20+
</annotations>
21+
<before>
22+
<magentoCLI command="config:set admin/security/use_form_key 1" stepKey="enableUrlSecretKeys"/>
23+
<magentoCLI command="cache:clean config full_page" stepKey="cleanInvalidatedCaches1"/>
24+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
25+
</before>
26+
<after>
27+
<magentoCLI command="config:set admin/security/use_form_key 0" stepKey="disableUrlSecretKeys"/>
28+
<magentoCLI command="cache:clean config full_page" stepKey="cleanInvalidatedCaches2"/>
29+
<actionGroup ref="logout" stepKey="logout"/>
30+
</after>
31+
32+
<click selector="{{AdminMenuSection.stores}}" stepKey="clickStoresMenuOption1"/>
33+
<waitForLoadingMaskToDisappear stepKey="waitForStoresMenu1" />
34+
<click selector="{{AdminMenuSection.configuration}}" stepKey="clickStoresConfigurationMenuOption1"/>
35+
<waitForPageLoad stepKey="waitForConfigurationPageLoad1"/>
36+
<seeCurrentUrlMatches regex="~\/admin\/system_config\/~" stepKey="seeCurrentUrlMatchesConfigPath1"/>
37+
38+
<click selector="{{AdminMenuSection.catalog}}" stepKey="clickCatalogMenuOption"/>
39+
<waitForLoadingMaskToDisappear stepKey="waitForCatalogMenu1" />
40+
<click selector="{{AdminMenuSection.catalogProducts}}" stepKey="clickCatalogProductsMenuOption"/>
41+
<waitForPageLoad stepKey="waitForProductsPageLoad"/>
42+
<seeCurrentUrlMatches regex="~\/catalog\/product\/~" stepKey="seeCurrentUrlMatchesProductsPath"/>
43+
44+
<click selector="{{AdminMenuSection.stores}}" stepKey="clickStoresMenuOption2"/>
45+
<waitForLoadingMaskToDisappear stepKey="waitForStoresMenu2" />
46+
<click selector="{{AdminMenuSection.configuration}}" stepKey="clickStoresConfigurationMenuOption2"/>
47+
<waitForPageLoad stepKey="waitForConfigurationPageLoad2"/>
48+
<seeCurrentUrlMatches regex="~\/admin\/system_config\/~" stepKey="seeCurrentUrlMatchesConfigPath2"/>
49+
</test>
50+
</tests>

0 commit comments

Comments
 (0)