Skip to content

Commit e7447af

Browse files
author
olysenko
committed
MAGETWO-63737: [FT] Analytics Subscription Tests are failing on CI
1 parent 58562df commit e7447af

File tree

1 file changed

+33
-24
lines changed
  • dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Config

1 file changed

+33
-24
lines changed

dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Config/Form.php

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
namespace Magento\Backend\Test\Block\System\Config;
99

1010
use Magento\Mtf\Factory\Factory;
11-
use Magento\Mtf\Block\BlockFactory;
1211
use Magento\Mtf\Block\Block;
13-
use Magento\Mtf\Client\ElementInterface;
14-
use Magento\Mtf\Client\BrowserInterface;
1512
use Magento\Mtf\Client\Locator;
1613

1714
/**
@@ -54,26 +51,6 @@ class Form extends Block
5451
*/
5552
protected $baseUrl;
5653

57-
/**
58-
* @constructor
59-
* @param ElementInterface $element
60-
* @param BlockFactory $blockFactory
61-
* @param BrowserInterface $browser
62-
* @param array $config
63-
*/
64-
public function __construct(
65-
ElementInterface $element,
66-
BlockFactory $blockFactory,
67-
BrowserInterface $browser,
68-
array $config = []
69-
) {
70-
parent::__construct($element, $blockFactory, $browser, $config);
71-
$this->baseUrl = $this->browser->getUrl();
72-
if (substr($this->baseUrl, -1) !== '/') {
73-
$this->baseUrl = $this->baseUrl . '/';
74-
}
75-
}
76-
7754
/**
7855
* Obtain store configuration form group.
7956
*
@@ -83,7 +60,13 @@ public function __construct(
8360
*/
8461
public function getGroup($tabName, $groupName)
8562
{
86-
$tabUrl = $this->baseUrl . 'section/' . $tabName;
63+
$this->baseUrl = $this->getBrowserUrl();
64+
if (substr($this->baseUrl, -1) !== '/') {
65+
$this->baseUrl = $this->baseUrl . '/';
66+
}
67+
68+
$tabUrl = $this->getTabUrl($tabName);
69+
8770
if ($this->getBrowserUrl() !== $tabUrl) {
8871
$this->browser->open($tabUrl);
8972
}
@@ -127,4 +110,30 @@ public function save()
127110
{
128111
$this->_rootElement->find($this->saveButton, Locator::SELECTOR_CSS)->click();
129112
}
113+
114+
/**
115+
* Checks whether secret key is presented in base url and returns menu tab url.
116+
*
117+
* @param string $tabName
118+
* @return string
119+
*/
120+
private function getTabUrl($tabName)
121+
{
122+
$tabIndex = 'index/section/' . $tabName;
123+
if (strpos($this->baseUrl, '/key/') !== false) {
124+
/*
125+
* Slashes are concatenated to cover case when string 'index' presented in domain name
126+
* or somewhere else in url additionally.
127+
*/
128+
$tabUrl = str_replace('/index/', '/' . $tabIndex . '/', $this->baseUrl);
129+
}
130+
elseif (strpos($this->baseUrl, '/edit/') !== false) {
131+
$tabUrl = str_replace('/edit/', '/' . $tabIndex . '/', $this->baseUrl);
132+
}
133+
else {
134+
$tabUrl = $this->baseUrl . $tabIndex;
135+
}
136+
137+
return $tabUrl;
138+
}
130139
}

0 commit comments

Comments
 (0)