Skip to content

Commit a0c6b2e

Browse files
committed
MAGETWO-71416: Admin login is successful after JS magnification is enabled and mode set to production
- Added functional test
1 parent 86eed24 commit a0c6b2e

File tree

4 files changed

+141
-0
lines changed

4 files changed

+141
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Mtf\Util\Command\Cli;
8+
9+
use Magento\Mtf\Util\Command\Cli;
10+
11+
/**
12+
* Setup Magento for tests executions.
13+
*/
14+
class DeployMode extends Cli
15+
{
16+
/**
17+
* Parameter for Magento command to set the deploy mode
18+
*/
19+
const PARAM_DEPLOY_MODE_DEVELOPER = 'deploy:mode:set developer';
20+
21+
/**
22+
* Parameter for Magento command to set the deploy mode to Production
23+
*/
24+
const PARAM_DEPLOY_MODE_PRODUCTION = 'deploy:mode:set production';
25+
26+
/**
27+
* set the deployment mode to developer
28+
*
29+
* @return void
30+
*/
31+
public function setDeployModeToDeveloper()
32+
{
33+
parent::execute(DeployMode::PARAM_DEPLOY_MODE_DEVELOPER);
34+
}
35+
36+
/**
37+
* set the deployment mode to production
38+
*
39+
* @return void
40+
*/
41+
public function setDeployModeToProduction()
42+
{
43+
parent::execute(DeployMode::PARAM_DEPLOY_MODE_PRODUCTION);
44+
}
45+
}

dev/tests/functional/tests/app/Magento/Backend/Test/Repository/ConfigData.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,16 @@
183183
<item name="value" xsi:type="number">1</item>
184184
</field>
185185
</dataset>
186+
187+
<dataset name="minify_js_files">
188+
<field name="dev/js/minify_files" xsi:type="array">
189+
<item name="scope" xsi:type="string">default</item>
190+
<item name="scope_id" xsi:type="number">0</item>
191+
<item name="label" xsi:type="string">Yes</item>
192+
<item name="value" xsi:type="number">1</item>
193+
194+
</field>
195+
</dataset>
186196

187197
<dataset name="enable_https_frontend_admin">
188198
<field name="web/secure/use_in_frontend" xsi:type="array">
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Backend\Test\TestCase;
7+
8+
use Magento\Mtf\TestCase\Injectable;
9+
use Magento\Backend\Test\Page\Adminhtml\Dashboard;
10+
use Magento\Mtf\Util\Command\Cli\DeployMode;
11+
use Magento\Mtf\TestStep\TestStepFactory;
12+
13+
/**
14+
* Verify visibility of form elements on Configuration page.
15+
*
16+
* @ZephyrId MAGETWO-71416
17+
*/
18+
class LoginAfterJSMinificationTest extends Injectable
19+
{
20+
21+
/**
22+
* Admin dashboard page
23+
* @var Dashboard
24+
*/
25+
private $adminDashboardPage;
26+
27+
/**
28+
* Factory for Test Steps.
29+
*
30+
* @var TestStepFactory
31+
*/
32+
private $stepFactory;
33+
34+
/**
35+
* Configuration setting.
36+
*
37+
* @var string
38+
*/
39+
private $configData;
40+
41+
/**
42+
* Prepare data for further test execution.
43+
*
44+
* @param Dashboard $adminDashboardPage
45+
* @return void
46+
*/
47+
public function __inject(Dashboard $adminDashboardPage, TestStepFactory $stepFactory)
48+
{
49+
$this->adminDashboardPage = $adminDashboardPage;
50+
$this->stepFactory = $stepFactory;
51+
}
52+
53+
public function test(DeployMode $cli, $configData = null)
54+
{
55+
//Pre-conditions
56+
$cli->setDeployModeToDeveloper();
57+
$this->configData = $configData;
58+
$this->objectManager->create(
59+
\Magento\Config\Test\TestStep\SetupConfigurationStep::class,
60+
['configData' => $this->configData]
61+
)->run();
62+
$cli->setDeployModeToProduction();
63+
$this->adminDashboardPage->open();
64+
}
65+
66+
67+
68+
}
Lines changed: 18 additions & 0 deletions
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+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
9+
<testCase name="Magento\Backend\Test\TestCase\LoginAfterJSMinificationTest" summary="Verify login is successful after JS minification is enabled">
10+
<variation name="LoginAfterJSMinificationEnabledVariation1" summary="Verify login is successful after JS minification" ticketId="MAGETWO-71416">
11+
<data name="tag" xsi:type="string">severity:S1</data>
12+
<data name="configData" xsi:type="string">minify_js_files</data>
13+
<data name="menuItem" xsi:type="string">Dashboard</data>
14+
<data name="pageTitle" xsi:type="string">Dashboard</data>
15+
<constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable" />
16+
</variation>
17+
</testCase>
18+
</config>

0 commit comments

Comments
 (0)