Skip to content

Commit 6a676c0

Browse files
committed
MTA-2257: Add an ability to specify several values for one tag type
1 parent b57446b commit 6a676c0

File tree

6 files changed

+47
-17
lines changed

6 files changed

+47
-17
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
* Add an ability to specify several values for one tag type
2+
13
1.0.0-rc.26
24
=============
35
* Removed code duplication in generators

Magento/Mtf/Client/Driver/Selenium/Driver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ public function focus(ElementInterface $element)
837837
{
838838
$elementId = $element->getAttribute('id');
839839
if ($elementId) {
840-
$js = "if (window.jQuery != undefined) jQuery('#$elementId').focus(); ";
840+
$js = "if (window.jQuery != undefined) jQuery('[id=\"$elementId\"').focus(); ";
841841
$js .= "var element = document.getElementById('$elementId'); if (element != undefined) element.focus();";
842842
$this->driver->execute(['script' => $js,'args' => []]);
843843
} else {

Magento/Mtf/Util/CrossModuleReference/Common.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ class Common
2525
protected function mapClassNameToNamespace($className)
2626
{
2727
$pieces = explode('\\', $className);
28+
end($pieces);
29+
unset($pieces[key($pieces)]);
2830

29-
if (strpos($className, '\\') == 0) {
30-
return $pieces[1];
31-
}
32-
return $pieces[0];
31+
return implode('\\', $pieces);
3332
}
3433

3534
/**

Magento/Mtf/Util/Filter/AbstractClassName.php

+17-5
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,24 @@ class AbstractClassName extends AbstractFilter implements FilterInterface
1919
*/
2020
public function apply($class)
2121
{
22-
if ($this->allow && !array_key_exists($class, $this->allow)) {
23-
return false;
22+
$testStatus = true;
23+
24+
if ($this->allow && is_array($this->allow)) {
25+
foreach ($this->allow as $allow) {
26+
if ($class === trim($allow['value'], '\\')) {
27+
$testStatus = true;
28+
break;
29+
}
30+
$testStatus = false;
31+
}
2432
}
25-
if ($this->deny && array_key_exists($class, $this->deny)) {
26-
return false;
33+
if ($this->deny && is_array($this->deny)) {
34+
foreach ($this->deny as $deny) {
35+
if ($class === trim($deny['value'], '\\')) {
36+
$testStatus = false;
37+
}
38+
}
2739
}
28-
return true;
40+
return $testStatus;
2941
}
3042
}

Magento/Mtf/Util/Filter/AbstractClassNamespace.php

+17-5
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,25 @@ abstract class AbstractClassNamespace extends AbstractFilter implements FilterIn
2020
public function apply($class)
2121
{
2222
$namespace = $this->mapClassNameToNamespace($class);
23+
$testStatus = true;
2324

24-
if ($this->allow && !array_key_exists($namespace, $this->allow)) {
25-
return false;
25+
if ($this->allow && is_array($this->allow)) {
26+
foreach (array_keys($this->allow) as $allow) {
27+
if ($namespace === trim($allow, '\\')) {
28+
$testStatus = true;
29+
break;
30+
}
31+
$testStatus = false;
32+
}
2633
}
27-
if ($this->deny && array_key_exists($namespace, $this->deny)) {
28-
return false;
34+
if ($this->deny && is_array($this->deny)) {
35+
foreach (array_keys($this->deny) as $deny) {
36+
if ($namespace === trim($deny, '\\')) {
37+
$testStatus = false;
38+
}
39+
}
2940
}
30-
return true;
41+
42+
return $testStatus;
3143
}
3244
}

Magento/Mtf/Util/Filter/AbstractFilterTag.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,16 @@ public function processApply(array $tags)
4949
*/
5050
protected function inTags(array $needleTags, array $stackTags)
5151
{
52-
if (empty($needleTags) && in_array(self::UNDEFINED_TAG, $stackTags)) {
52+
$tags = [];
53+
foreach ($stackTags as $value) {
54+
$tags = array_merge($tags, explode(', ', $value));
55+
}
56+
57+
if (empty($needleTags) && in_array(self::UNDEFINED_TAG, $tags)) {
5358
return true;
5459
}
5560
foreach ($needleTags as $needleTag) {
56-
if (in_array($needleTag, $stackTags)) {
61+
if (in_array($needleTag, $tags)) {
5762
return true;
5863
}
5964
}

0 commit comments

Comments
 (0)