Skip to content

Commit 5d4ee1a

Browse files
committed
MAGETWO-32592: MTF Alternative Web Driver pull request preparation
1 parent 0cdc03b commit 5d4ee1a

File tree

7 files changed

+38
-34
lines changed

7 files changed

+38
-34
lines changed

dev/tests/functional/lib/Mtf/Client/Element/ConditionsElement.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Mtf\ObjectManager;
1010
use Mtf\Client\Locator;
11+
use Mtf\Client\ElementInterface;
1112

1213
/**
1314
* Class ConditionsElement
@@ -185,10 +186,10 @@ public function setValue($value)
185186
* Add condition combination
186187
*
187188
* @param string $condition
188-
* @param SimpleElement $context
189-
* @return SimpleElement
189+
* @param ElementInterface $context
190+
* @return ElementInterface
190191
*/
191-
protected function addConditionsCombination($condition, SimpleElement $context)
192+
protected function addConditionsCombination($condition, ElementInterface $context)
192193
{
193194
$condition = $this->parseCondition($condition);
194195
$newCondition = $context->find($this->newCondition, Locator::SELECTOR_XPATH);
@@ -208,10 +209,10 @@ protected function addConditionsCombination($condition, SimpleElement $context)
208209
* Add conditions
209210
*
210211
* @param array $conditions
211-
* @param SimpleElement $context
212+
* @param ElementInterface $context
212213
* @return void
213214
*/
214-
protected function addMultipleCondition(array $conditions, SimpleElement $context)
215+
protected function addMultipleCondition(array $conditions, ElementInterface $context)
215216
{
216217
foreach ($conditions as $key => $condition) {
217218
$elementContext = is_numeric($key) ? $context : $this->addConditionsCombination($key, $context);
@@ -227,10 +228,10 @@ protected function addMultipleCondition(array $conditions, SimpleElement $contex
227228
* Add single Condition
228229
*
229230
* @param string $condition
230-
* @param SimpleElement $context
231+
* @param ElementInterface $context
231232
* @return void
232233
*/
233-
protected function addSingleCondition($condition, SimpleElement $context)
234+
protected function addSingleCondition($condition, ElementInterface $context)
234235
{
235236
$condition = $this->parseCondition($condition);
236237

@@ -253,15 +254,15 @@ function () use ($newCondition, $typeNew) {
253254
* Fill single condition
254255
*
255256
* @param array $rules
256-
* @param SimpleElement $element
257+
* @param ElementInterface $element
257258
* @return void
258259
* @throws \Exception
259260
*/
260-
protected function fillCondition(array $rules, SimpleElement $element)
261+
protected function fillCondition(array $rules, ElementInterface $element)
261262
{
262263
$this->resetKeyParam();
263264
foreach ($rules as $rule) {
264-
/** @var SimpleElement $param */
265+
/** @var ElementInterface $param */
265266
$param = $this->findNextParam($element);
266267
$param->find('a')->click();
267268

@@ -354,11 +355,11 @@ protected function parseCondition($condition)
354355
/**
355356
* Find next param of condition for fill
356357
*
357-
* @param SimpleElement $context
358-
* @return SimpleElement
358+
* @param ElementInterface $context
359+
* @return ElementInterface
359360
* @throws \Exception
360361
*/
361-
protected function findNextParam(SimpleElement $context)
362+
protected function findNextParam(ElementInterface $context)
362363
{
363364
do {
364365
if (!isset($this->mapParams[$this->findKeyParam])) {
@@ -387,7 +388,7 @@ protected function resetKeyParam()
387388
*
388389
* @return void
389390
*/
390-
protected function waitForCondition(SimpleElement $element)
391+
protected function waitForCondition(ElementInterface $element)
391392
{
392393
$this->waitUntil(
393394
function () use ($element) {

dev/tests/functional/lib/Mtf/Client/Element/GlobalsearchElement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ protected function getSearchResults()
178178
$resultItems = $searchResult->getElements($this->resultItem);
179179
$resultArray = [];
180180

181-
/** @var SimpleElement $resultItem */
181+
/** @var ElementInterface $resultItem */
182182
foreach ($resultItems as $resultItem) {
183183
$resultItemLink = $resultItem->find('a');
184184
$resultText = $resultItemLink->isVisible()

dev/tests/functional/lib/Mtf/Client/Element/JquerytreeElement.php

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

77
namespace Mtf\Client\Element;
88

9+
use Mtf\Client\ElementInterface;
10+
911
/**
1012
* Class JquerytreeElement
1113
* Typified element class for JqueryTree elements
@@ -60,11 +62,11 @@ public function getStructure()
6062
/**
6163
* Recursive walks tree
6264
*
63-
* @param SimpleElement $node
65+
* @param ElementInterface $node
6466
* @param string $parentCssClass
6567
* @return array
6668
*/
67-
protected function _getNodeContent(SimpleElement $node, $parentCssClass)
69+
protected function _getNodeContent(ElementInterface $node, $parentCssClass)
6870
{
6971
$counter = 1;
7072
$nextNodeSelector = $parentCssClass . " > " . $this->nodeSelector . ":nth-of-type($counter)";

dev/tests/functional/lib/Mtf/Client/Element/MultiselectgrouplistElement.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Mtf\Client\Element;
88

99
use Mtf\Client\Locator;
10+
use Mtf\Client\ElementInterface;
1011

1112
/**
1213
* Class MultiselectgrouplistElement
@@ -151,11 +152,11 @@ protected function selectOption($option)
151152
* Get optgroup
152153
*
153154
* @param string $value
154-
* @param SimpleElement $context
155-
* @return SimpleElement
155+
* @param ElementInterface $context
156+
* @return ElementInterface
156157
* @throws \Exception
157158
*/
158-
protected function getOptgroup($value, SimpleElement $context)
159+
protected function getOptgroup($value, ElementInterface $context)
159160
{
160161
$optgroup = $context->find(sprintf($this->optgroupByLabel, $value), Locator::SELECTOR_XPATH);
161162
if (!$optgroup->isVisible()) {
@@ -169,11 +170,11 @@ protected function getOptgroup($value, SimpleElement $context)
169170
* Get child optgroup
170171
*
171172
* @param string $value
172-
* @param SimpleElement $context
173-
* @return SimpleElement
173+
* @param ElementInterface $context
174+
* @return ElementInterface
174175
* @throws \Exception
175176
*/
176-
protected function getChildOptgroup($value, SimpleElement $context)
177+
protected function getChildOptgroup($value, ElementInterface $context)
177178
{
178179
$childOptgroup = null;
179180
$count = 1;
@@ -210,7 +211,7 @@ public function getValue()
210211
foreach ($this->getSelectedOptions() as $option) {
211212
$value = [];
212213

213-
/** @var SimpleElement $option */
214+
/** @var ElementInterface $option */
214215
$optionText = $option->getText();
215216
$optionValue = trim($optionText, $this->trim);
216217
$value[] = $optionValue;
@@ -254,7 +255,7 @@ public function getValue()
254255
/**
255256
* Get options
256257
*
257-
* @return SimpleElement[]
258+
* @return ElementInterface[]
258259
*/
259260
protected function getOptions()
260261
{

dev/tests/functional/lib/Mtf/Client/Element/MultiselectlistElement.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function setValue($values)
3939
$values = is_array($values) ? $values : [$values];
4040

4141
foreach ($options as $option) {
42-
/** @var SimpleElement $option */
42+
/** @var \Mtf\Client\ElementInterface $option */
4343
$optionText = $option->getText();
4444
$isChecked = $option->find($this->optionCheckedElement, Locator::SELECTOR_XPATH)->isVisible();
4545
$inArray = in_array($optionText, $values);
@@ -60,7 +60,7 @@ public function getValue()
6060
$options = $this->getOptions();
6161

6262
foreach ($options as $option) {
63-
/** @var SimpleElement $option */
63+
/** @var \Mtf\Client\ElementInterface $option */
6464
$checkedOption = $option->find($this->optionCheckedElement, Locator::SELECTOR_XPATH);
6565
if ($checkedOption->isVisible()) {
6666
$checkedOptions[] = $checkedOption->getText();
@@ -101,7 +101,7 @@ public function getAllValues()
101101
$options = $this->getOptions();
102102

103103
foreach ($options as $option) {
104-
/** @var SimpleElement $option */
104+
/** @var \Mtf\Client\ElementInterface $option */
105105
$optionsValue[] = $option->getText();
106106
}
107107

dev/tests/functional/lib/Mtf/Client/Element/MultisuggestElement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function getValue()
7373
$values = [];
7474

7575
foreach ($choices as $choice) {
76-
/** @var SimpleElement $choice */
76+
/** @var \Mtf\Client\ElementInterface $choice */
7777
$values[] = $choice->getText();
7878
}
7979
return $values;

dev/tests/functional/lib/Mtf/Client/Element/Tree.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function setValue($path)
9494
++$pathChunkCounter;
9595
}
9696
if ($structureChunk) {
97-
/** @var SimpleElement $needleElement */
97+
/** @var ElementInterface $needleElement */
9898
$needleElement = $structureChunk->find($this->nodeName);
9999
$needleElement->click();
100100
} else {
@@ -108,7 +108,7 @@ public function setValue($path)
108108
*
109109
* @param string $pathChunk
110110
* @param array $structureChunk
111-
* @return array|SimpleElement|false
111+
* @return array|ElementInterface|false
112112
*/
113113
protected function deep($pathChunk, $structureChunk)
114114
{
@@ -127,11 +127,11 @@ protected function deep($pathChunk, $structureChunk)
127127
/**
128128
* Recursive walks tree
129129
*
130-
* @param SimpleElement $node
130+
* @param ElementInterface $node
131131
* @param string $parentCssClass
132132
* @return array
133133
*/
134-
protected function _getNodeContent(SimpleElement $node, $parentCssClass)
134+
protected function _getNodeContent(ElementInterface $node, $parentCssClass)
135135
{
136136
$nodeArray = [];
137137
$nodeList = [];
@@ -145,7 +145,7 @@ protected function _getNodeContent(SimpleElement $node, $parentCssClass)
145145
}
146146
//Write to array values of current node
147147
foreach ($nodeList as $currentNode) {
148-
/** @var SimpleElement $currentNode */
148+
/** @var ElementInterface $currentNode */
149149
$nodesNames = $currentNode->find($this->nodeName);
150150
$nodesContents = $currentNode->find($this->nodeCssClass);
151151
$text = ltrim($nodesNames->getText());

0 commit comments

Comments
 (0)