Skip to content

Commit 7620c92

Browse files
committed
MAGETWO-51472: [FT] Form page action block is covering fields on product page
- Category on product page is searched not by each symbol but by whole category name;
1 parent eb51f73 commit 7620c92

File tree

2 files changed

+29
-9
lines changed
  • dev/tests/functional

2 files changed

+29
-9
lines changed

dev/tests/functional/lib/Magento/Mtf/Client/Element/SuggestElement.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,21 @@ public function setValue($value)
7575
if ($value == '') {
7676
return;
7777
}
78+
$this->selectSearchedItem($value);
79+
$closeButton = $this->find($this->closeButton);
80+
if ($closeButton->isVisible()) {
81+
$closeButton->click();
82+
}
83+
}
84+
85+
/**
86+
* Select searched item.
87+
*
88+
* @param string $value
89+
* @return void
90+
*/
91+
protected function selectSearchedItem($value)
92+
{
7893
foreach (str_split($value) as $symbol) {
7994
$this->keys([$symbol]);
8095
$searchedItem = $this->find(sprintf($this->resultItem, $value), Locator::SELECTOR_XPATH);
@@ -88,10 +103,6 @@ public function setValue($value)
88103
}
89104
}
90105
}
91-
$closeButton = $this->find($this->closeButton);
92-
if ($closeButton->isVisible()) {
93-
$closeButton->click();
94-
}
95106
}
96107

97108
/**

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/ProductDetails/CategoryIds.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Section\ProductDetails;
88

99
use Magento\Mtf\Client\Element\MultisuggestElement;
10+
use Magento\Mtf\Client\Locator;
1011

1112
/**
1213
* Typified element class for category element.
@@ -21,14 +22,22 @@ class CategoryIds extends MultisuggestElement
2122
protected $resultItem = './/label[contains(@class, "admin__action-multiselect-label")]/span[text() = "%s"]';
2223

2324
/**
24-
* Set value.
25+
* Select searched item.
2526
*
26-
* @param array|string $values
27+
* @param string $value
2728
* @return void
2829
*/
29-
public function setValue($values)
30+
protected function selectSearchedItem($value)
3031
{
31-
$this->getContext()->hover();
32-
parent::setValue($values);
32+
$this->keys([$value]);
33+
$searchedItem = $this->find(sprintf($this->resultItem, $value), Locator::SELECTOR_XPATH);
34+
if ($searchedItem->isVisible()) {
35+
try {
36+
$searchedItem->click();
37+
} catch (\Exception $e) {
38+
// In parallel run on windows change the focus is lost on element
39+
// that causes disappearing of category suggest list.
40+
}
41+
}
3342
}
3443
}

0 commit comments

Comments
 (0)