Skip to content

Commit 571f055

Browse files
committed
Fix functional tests.
1 parent e9389ee commit 571f055

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,13 @@ class ConditionsElement extends SimpleElement
195195
*/
196196
protected $exception;
197197

198+
/**
199+
* Condition option text selector.
200+
*
201+
* @var string
202+
*/
203+
private $conditionOptionTextSelector = '//option[normalize-space(text())="%s"]';
204+
198205
/**
199206
* @inheritdoc
200207
*/
@@ -282,10 +289,16 @@ protected function addCondition($type, ElementInterface $context)
282289
$count = 0;
283290

284291
do {
285-
$newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click();
286-
287292
try {
288-
$newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'selectcondition')->setValue($type);
293+
$specificType = $newCondition->find(
294+
sprintf($this->conditionOptionTextSelector, $type),
295+
Locator::SELECTOR_XPATH
296+
)->isPresent();
297+
$newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click();
298+
$condition = $specificType
299+
? $newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'selectcondition')
300+
: $newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'select');
301+
$condition->setValue($type);
289302
$isSetType = true;
290303
} catch (\PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
291304
$isSetType = false;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright © 2017 Magento. All rights reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
66

0 commit comments

Comments
 (0)