Skip to content

Commit eb2c5f5

Browse files
committed
Merge remote-tracking branch 'okapis/MAGETWO-71416-JS-minification' into Okapis-PR
2 parents 024f8aa + 8b5ec1b commit eb2c5f5

File tree

4 files changed

+150
-0
lines changed

4 files changed

+150
-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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,15 @@
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+
</field>
194+
</dataset>
186195

187196
<dataset name="enable_https_frontend_admin">
188197
<field name="web/secure/use_in_frontend" xsi:type="array">
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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(
48+
Dashboard $adminDashboardPage,
49+
TestStepFactory $stepFactory
50+
) {
51+
$this->adminDashboardPage = $adminDashboardPage;
52+
$this->stepFactory = $stepFactory;
53+
}
54+
55+
/**
56+
* Admin login test after JS minification is turned on in production mode
57+
* @param DeployMode $cli
58+
* @param null $configData
59+
* @return void
60+
*/
61+
public function test(
62+
DeployMode $cli,
63+
$configData = null
64+
) {
65+
$this->configData = $configData;
66+
67+
//Pre-conditions
68+
$cli->setDeployModeToDeveloper();
69+
$this->objectManager->create(
70+
\Magento\Config\Test\TestStep\SetupConfigurationStep::class,
71+
['configData' => $this->configData]
72+
)->run();
73+
74+
// Steps
75+
$cli->setDeployModeToProduction();
76+
$this->adminDashboardPage->open();
77+
}
78+
}
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)