Skip to content

Commit 10fcc19

Browse files
author
Dmytro Vilchynskyi
committed
MAGETWO-60185: Remove distinction in http/https for requirejs-config.js
- Changes after CR.
1 parent eb4cb4b commit 10fcc19

File tree

2 files changed

+18
-81
lines changed

2 files changed

+18
-81
lines changed

dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertHttpUsedOnFrontend.php

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
namespace Magento\Backend\Test\Constraint;
88

9-
use Magento\Mtf\ObjectManager;
10-
use Magento\Mtf\System\Event\EventManagerInterface;
119
use Magento\Mtf\Constraint\AbstractConstraint;
1210
use Magento\Mtf\Client\BrowserInterface;
1311
use Magento\Customer\Test\Fixture\Customer;
@@ -16,7 +14,6 @@
1614

1715
/**
1816
* Assert that http is used all over the Storefront.
19-
* It would be great to assert somehow that browser console does not contain JS-related errors as well.
2017
*/
2118
class AssertHttpUsedOnFrontend extends AbstractConstraint
2219
{
@@ -25,7 +22,7 @@ class AssertHttpUsedOnFrontend extends AbstractConstraint
2522
*
2623
* @var string
2724
*/
28-
private $unsecuredProtocol = 'http://';
25+
private $unsecuredProtocol = \Magento\Framework\HTTP\PhpEnvironment\Request::SCHEME_HTTP;
2926

3027
/**
3128
* Browser interface.
@@ -42,37 +39,18 @@ class AssertHttpUsedOnFrontend extends AbstractConstraint
4239
protected $customer;
4340

4441
/**
45-
* Prepare data for further validations execution.
42+
* Validations execution.
4643
*
47-
* @param ObjectManager $objectManager
48-
* @param EventManagerInterface $eventManager
4944
* @param BrowserInterface $browser
5045
* @param Customer $customer
51-
* @param string $severity
52-
* @param bool $active
46+
* @return void
5347
*/
54-
public function __construct(
55-
ObjectManager $objectManager,
56-
EventManagerInterface $eventManager,
57-
BrowserInterface $browser,
58-
Customer $customer,
59-
$severity = 'low',
60-
$active = true
61-
) {
62-
parent::__construct($objectManager, $eventManager, $severity, $active);
48+
public function processAssert(BrowserInterface $browser, Customer $customer)
49+
{
6350
$this->browser = $browser;
6451
$this->customer = $customer;
65-
6652
$this->customer->persist();
67-
}
6853

69-
/**
70-
* Validations execution.
71-
*
72-
* @return void
73-
*/
74-
public function processAssert()
75-
{
7654
// Log in to Customer Account on Storefront to assert that http is used indeed.
7755
$this->objectManager->create(LogInCustomerOnStorefront::class, ['customer' => $this->customer])->run();
7856
$this->assertUsedProtocol($this->unsecuredProtocol);

dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertHttpsUsedOnBackend.php

Lines changed: 13 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@
66

77
namespace Magento\Backend\Test\Constraint;
88

9-
use Magento\Mtf\ObjectManager;
10-
use Magento\Mtf\System\Event\EventManagerInterface;
119
use Magento\Mtf\Constraint\AbstractConstraint;
1210
use Magento\Mtf\Client\BrowserInterface;
1311
use Magento\Backend\Test\Page\Adminhtml\Dashboard;
1412

1513
/**
16-
* Assert that https protocol is used all over the Admin panel
17-
* It would be great if several different pages to validate are selected randomly in order to increase the coverage.
18-
* It would be great to assert somehow that browser console does not contain JS-related errors as well.
14+
* Assert that https protocol is used all over the Admin panel.
1915
*/
2016
class AssertHttpsUsedOnBackend extends AbstractConstraint
2117
{
@@ -24,14 +20,14 @@ class AssertHttpsUsedOnBackend extends AbstractConstraint
2420
*
2521
* @var string
2622
*/
27-
private $securedProtocol = 'https://';
23+
private $securedProtocol = \Magento\Framework\HTTP\PhpEnvironment\Request::SCHEME_HTTPS;
2824

2925
/**
3026
* Unsecured protocol format.
3127
*
3228
* @var string
3329
*/
34-
private $unsecuredProtocol = 'http://';
30+
private $unsecuredProtocol = \Magento\Framework\HTTP\PhpEnvironment\Request::SCHEME_HTTP;
3531

3632
/**
3733
* Browser interface.
@@ -41,56 +37,21 @@ class AssertHttpsUsedOnBackend extends AbstractConstraint
4137
protected $browser;
4238

4339
/**
44-
* "Dashboard" page in Admin panel.
45-
*
46-
* @var Dashboard
47-
*/
48-
protected $adminDashboardPage;
49-
50-
/**
51-
* The list of Navigation Menu paths for Admin pages to verify.
52-
*
53-
* @var array
54-
*/
55-
protected $pagesPaths;
56-
57-
/**
58-
* Prepare data for further validations execution.
40+
* Validations execution.
5941
*
60-
* @param ObjectManager $objectManager
61-
* @param EventManagerInterface $eventManager
6242
* @param BrowserInterface $browser
6343
* @param Dashboard $adminDashboardPage
64-
* @param string $severity
65-
* @param bool $active
66-
*/
67-
public function __construct(
68-
ObjectManager $objectManager,
69-
EventManagerInterface $eventManager,
70-
BrowserInterface $browser,
71-
Dashboard $adminDashboardPage,
72-
$severity = 'low',
73-
$active = true
74-
) {
75-
parent::__construct($objectManager, $eventManager, $severity, $active);
76-
$this->browser = $browser;
77-
$this->adminDashboardPage = $adminDashboardPage;
78-
$this->pagesPaths = ['Products>Catalog', 'Marketing>Catalog Price Rule'];
79-
}
80-
81-
/**
82-
* Validations execution.
83-
*
44+
* @param string $navMenuPath
8445
* @return void
8546
*/
86-
public function processAssert()
47+
public function processAssert(BrowserInterface $browser, Dashboard $adminDashboardPage, $navMenuPath)
8748
{
88-
// Open specified Admin pages using Navigation Menu to assert that JS is deployed validly as a part of statics.
89-
foreach ($this->pagesPaths as $pagePath) {
90-
$this->adminDashboardPage->open()->getMenuBlock()->navigate($pagePath);
91-
$this->assertUsedProtocol($this->securedProtocol);
92-
$this->assertDirectHttpUnavailable();
93-
}
49+
$this->browser = $browser;
50+
51+
// Open specified Admin page using Navigation Menu to assert that JS is deployed validly as a part of statics.
52+
$adminDashboardPage->open()->getMenuBlock()->navigate($navMenuPath);
53+
$this->assertUsedProtocol($this->securedProtocol);
54+
$this->assertDirectHttpUnavailable();
9455
}
9556

9657
/**
@@ -109,7 +70,6 @@ protected function assertUsedProtocol($expectedProtocol)
10970
}
11071

11172
/**
112-
*
11373
* Assert that Merchant is redirected to https if trying to access the page directly via http.
11474
*
11575
* @return void
@@ -123,7 +83,6 @@ protected function assertDirectHttpUnavailable()
12383
$this->browser->getUrl(),
12484
'Merchant is not redirected to https if tries to access the Admin panel page directly via http.'
12585
);
126-
12786
}
12887

12988
/**
@@ -133,6 +92,6 @@ protected function assertDirectHttpUnavailable()
13392
*/
13493
public function toString()
13594
{
136-
return 'Unsecured URLs are used for Storefront pages.';
95+
return 'Secured URLs are used for Admin panel pages.';
13796
}
13897
}

0 commit comments

Comments
 (0)