Skip to content

Commit

Permalink
Fix functional tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmalevanec authored and eduard13 committed Mar 20, 2019
1 parent 362bbf2 commit a5608f0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ class ConditionsElement extends SimpleElement
*/
protected $exception;

/**
* Condition option text selector.
*
* @var string
*/
private $conditionOptionTextSelector = '//option[normalize-space(text())="%s"]';

/**
* @inheritdoc
*/
Expand Down Expand Up @@ -282,10 +289,16 @@ protected function addCondition($type, ElementInterface $context)
$count = 0;

do {
$newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click();

try {
$newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'selectcondition')->setValue($type);
$specificType = $newCondition->find(
sprintf($this->conditionOptionTextSelector, $type),
Locator::SELECTOR_XPATH
)->isPresent();
$newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click();
$condition = $specificType
? $newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'selectcondition')
: $newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'select');
$condition->setValue($type);
$isSetType = true;
} catch (\PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
$isSetType = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2017 Magento. All rights reserved.
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

Expand Down

0 comments on commit a5608f0

Please sign in to comment.