Skip to content
Snippets Groups Projects
Commit cb4396c3 authored by Dmytro Aponasenko's avatar Dmytro Aponasenko
Browse files

MTA-2712: Functional test maintenance. Part 1

parent 0a63aa89
Branches
No related merge requests found
......@@ -17,7 +17,7 @@ use Magento\Mtf\Client\BrowserInterface;
use Magento\Mtf\Client\Element\SimpleElement;
/**
* Is used to represent any form with tabs on the page
* Is used to represent any form with tabs on the page.
*
* @SuppressWarnings(PHPMD.NumberOfChildren)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
......@@ -25,17 +25,26 @@ use Magento\Mtf\Client\Element\SimpleElement;
class FormTabs extends Form
{
/**
* Tabs list.
*
* @var array
*/
protected $tabs = [];
/**
* Fields which aren't assigned to any tab
* Fields which aren't assigned to any tab.
*
* @var array
*/
protected $unassignedFields = [];
/**
* Page header selector.
*
* @var string
*/
protected $header = 'header';
/**
* @constructor
* @param SimpleElement $element
......@@ -55,7 +64,7 @@ class FormTabs extends Form
}
/**
* Initialize block
* Initialize block.
*/
protected function init()
{
......@@ -63,7 +72,7 @@ class FormTabs extends Form
}
/**
* Fill form with tabs
* Fill form with tabs.
*
* @param FixtureInterface $fixture
* @param SimpleElement|null $element
......@@ -76,7 +85,7 @@ class FormTabs extends Form
}
/**
* Fill specified form with tabs
* Fill specified form with tabs.
*
* @param array $tabs
* @param SimpleElement|null $element
......@@ -91,14 +100,14 @@ class FormTabs extends Form
$tab->fillFormTab($tabFields, $context);
}
if (!empty($this->unassignedFields)) {
$this->fillMissedFields($tabs);
$this->fillMissedFields();
}
return $this;
}
/**
* Fill fields which weren't found on filled tabs
* Fill fields which weren't found on filled tabs.
*
* @throws \Exception
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
......@@ -130,7 +139,7 @@ class FormTabs extends Form
}
/**
* Get data of the tabs
* Get data of the tabs.
*
* @param FixtureInterface|null $fixture
* @param SimpleElement|null $element
......@@ -163,7 +172,7 @@ class FormTabs extends Form
}
/**
* Update form with tabs
* Update form with tabs.
*
* @param FixtureInterface $fixture
* @return FormTabs
......@@ -178,7 +187,7 @@ class FormTabs extends Form
}
/**
* Create data array for filling tabs
* Create data array for filling tabs.
*
* @param FixtureInterface $fixture
* @return array
......@@ -194,7 +203,7 @@ class FormTabs extends Form
}
/**
* Create data array for filling tabs (new fixture specification)
* Create data array for filling tabs (new fixture specification).
*
* @param InjectableFixture $fixture
* @return array
......@@ -217,7 +226,7 @@ class FormTabs extends Form
}
/**
* Create data array for filling tabs (deprecated fixture specification)
* Create data array for filling tabs (deprecated fixture specification).
*
* @param FixtureInterface $fixture
* @return array
......@@ -284,6 +293,7 @@ class FormTabs extends Form
*/
public function openTab($tabName)
{
$this->browser->find($this->header)->hover();
$this->getTabElement($tabName)->click();
return $this;
}
......
......@@ -8,22 +8,13 @@ namespace Magento\CatalogRule\Test\Block\Adminhtml\Promo\Catalog\Edit\Tab;
use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
use Magento\Mtf\Client\Locator;
use Magento\Mtf\Factory\Factory;
use Magento\Backend\Test\Block\Widget\Tab;
use Magento\Mtf\Client\Element\SimpleElement;
/**
* Form Tab for specifying catalog price rule conditions.
*/
class Conditions extends Tab
{
/**
* Rule conditions block selector.
*
* @var string
*/
protected $ruleConditions = '#rule_conditions_fieldset';
/**
* Add button.
*
......@@ -38,27 +29,6 @@ class Conditions extends Tab
*/
protected $conditionFormat = '//*[@id="conditions__1__new_child"]//option[contains(.,"%s")]';
/**
* Fill condition options.
*
* @param array $fields
* @param SimpleElement|null $element
* @return void
*/
public function fillFormTab(array $fields, SimpleElement $element = null)
{
$data = $this->dataMapping($fields);
$conditionsBlock = Factory::getBlockFactory()->getMagentoCatalogRuleConditions(
$element->find($this->ruleConditions)
);
$conditionsBlock->clickAddNew();
$conditionsBlock->selectCondition($data['condition_type']['value']);
$conditionsBlock->clickEllipsis();
$conditionsBlock->selectConditionValue($data['condition_value']['value']);
}
/**
* Check if attribute is available in conditions.
*
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment