Skip to content

Commit

Permalink
ENGCOM-7237: Fixed 24990: link doesn't redirect to dashboard #26100
Browse files Browse the repository at this point in the history
  • Loading branch information
slavvka authored Apr 1, 2020
2 parents 89bc078 + 2d42bfc commit d086d3a
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminClickLogoActionGroup">
<click selector="{{AdminMenuSection.logo}}" stepKey="clickLogoInAdmin"/>
<waitForPageLoad stepKey="waitForAdminDashboardPageLoaded"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminNavigateToSetupWizardPageActionGroup">
<annotations>
<description>Open Setup Wizard Page.</description>
</annotations>
<amOnPage url="{{AdminSetupWizardPage.url}}" stepKey="navigateToSetupWizardPage"/>
<waitForPageLoad stepKey="waitForSetupWizardPageLoaded"/>
</actionGroup>
</actionGroups>
12 changes: 12 additions & 0 deletions app/code/Magento/Backend/Test/Mftf/Page/AdminSetupWizardPage.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="AdminSetupWizardPage" url="admin/backendapp/redirect/app/setup/" area="admin" module="Magento_Backend"/>
</pages>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminMenuSection">
<element name="logo" type="button" selector=".menu-wrapper a.logo"/>
<element name="catalog" type="button" selector="#menu-magento-catalog-catalog"/>
<element name="catalogProducts" type="button" selector="#nav li[data-ui-id='menu-magento-catalog-catalog-products']"/>
<element name="customers" type="button" selector="#menu-magento-customer-customer"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminRedirectToAdminPanelOnLogoClickFromWizardPageTest">
<annotations>
<features value="Backend"/>
<stories value="Navigate to dashboard from Setup Wizard Page"/>
<title value="Navigate to dashboard after click on logo on Setup Wizard Page"/>
<description value="Check navigate to dashboard after click on logo on Setup Wizard Page"/>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdminPanel"/>
</before>
<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
</after>

<actionGroup ref="AdminNavigateToSetupWizardPageActionGroup" stepKey="navigateToSetupWizardPage"/>
<actionGroup ref="AdminClickLogoActionGroup" stepKey="clickOnLogo"/>
<actionGroup ref="AssertAdminDashboardPageIsVisibleActionGroup" stepKey="checkTheDashboardPage"/>
</test>
</tests>
19 changes: 16 additions & 3 deletions setup/src/Magento/Setup/Controller/Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\JsonModel;
use Laminas\View\Model\ViewModel;
use Magento\Backend\Model\UrlInterface;
use Magento\Framework\ObjectManagerInterface;
use Magento\Setup\Model\Cron\Status;
use Magento\Setup\Model\Navigation as NavModel;
use Magento\Setup\Model\ObjectManagerProvider;

/**
* Navigation controller
Expand All @@ -32,13 +35,20 @@ class Navigation extends AbstractActionController
protected $view;

/**
* @param NavModel $navigation
* @param Status $status
* @var ObjectManagerInterface
*/
public function __construct(NavModel $navigation, Status $status)
private $objectManagerProvider;

/**
* @param NavModel $navigation
* @param Status $status
* @param ObjectManagerProvider $objectManagerProvider
*/
public function __construct(NavModel $navigation, Status $status, ObjectManagerProvider $objectManagerProvider)
{
$this->navigation = $navigation;
$this->status = $status;
$this->objectManagerProvider = $objectManagerProvider->get();
$this->view = new ViewModel();
$this->view->setVariable('menu', $this->navigation->getMenuItems());
$this->view->setVariable('main', $this->navigation->getMainItems());
Expand Down Expand Up @@ -80,8 +90,11 @@ public function menuAction()
*/
public function sideMenuAction()
{
/** @var UrlInterface $backendUrl */
$backendUrl = $this->objectManagerProvider->get(UrlInterface::class);
$this->view->setTemplate('/magento/setup/navigation/side-menu.phtml');
$this->view->setVariable('isInstaller', $this->navigation->getType() == NavModel::NAV_INSTALLER);
$this->view->setVariable('backendUrl', $backendUrl->getRouteUrl('adminhtml'));
$this->view->setTerminal(true);
return $this->view;
}
Expand Down
8 changes: 5 additions & 3 deletions setup/view/magento/setup/navigation/side-menu.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
ng-show="<?= implode( '&&', $expressions) ?>"
>
<nav class="admin__menu" ng-controller="mainController">
<span class="logo logo-static" data-edition="Community Edition">
<img class="logo-img" src="<?= $this->basePath() ?>/pub/images/logo.svg" alt="Magento Admin Panel">
</span>
<a href="<?= $this->backendUrl ?>" class="logo" data-edition="Community Edition">
<span>
<img class="logo-img" src="<?= $this->basePath() ?>/pub/images/logo.svg" alt="Magento Admin Panel">
</span>
</a>
<ul id="nav" role="menubar">
<li class="item-home level-0" ng-class="{_active: $state.current.name === 'root.home'}">
<a href="" ui-sref="root.home">
Expand Down

0 comments on commit d086d3a

Please sign in to comment.