Skip to content

Commit cb4396c

Browse files
author
Dmytro Aponasenko
committed
MTA-2712: Functional test maintenance. Part 1
1 parent 0a63aa8 commit cb4396c

File tree

2 files changed

+22
-42
lines changed
  • dev/tests/functional/tests/app/Magento

2 files changed

+22
-42
lines changed

dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,34 @@
1717
use Magento\Mtf\Client\Element\SimpleElement;
1818

1919
/**
20-
* Is used to represent any form with tabs on the page
20+
* Is used to represent any form with tabs on the page.
2121
*
2222
* @SuppressWarnings(PHPMD.NumberOfChildren)
2323
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2424
*/
2525
class FormTabs extends Form
2626
{
2727
/**
28+
* Tabs list.
29+
*
2830
* @var array
2931
*/
3032
protected $tabs = [];
3133

3234
/**
33-
* Fields which aren't assigned to any tab
35+
* Fields which aren't assigned to any tab.
3436
*
3537
* @var array
3638
*/
3739
protected $unassignedFields = [];
3840

41+
/**
42+
* Page header selector.
43+
*
44+
* @var string
45+
*/
46+
protected $header = 'header';
47+
3948
/**
4049
* @constructor
4150
* @param SimpleElement $element
@@ -55,15 +64,15 @@ public function __construct(
5564
}
5665

5766
/**
58-
* Initialize block
67+
* Initialize block.
5968
*/
6069
protected function init()
6170
{
6271
$this->tabs = $this->getFormMapping();
6372
}
6473

6574
/**
66-
* Fill form with tabs
75+
* Fill form with tabs.
6776
*
6877
* @param FixtureInterface $fixture
6978
* @param SimpleElement|null $element
@@ -76,7 +85,7 @@ public function fill(FixtureInterface $fixture, SimpleElement $element = null)
7685
}
7786

7887
/**
79-
* Fill specified form with tabs
88+
* Fill specified form with tabs.
8089
*
8190
* @param array $tabs
8291
* @param SimpleElement|null $element
@@ -91,14 +100,14 @@ protected function fillTabs(array $tabs, SimpleElement $element = null)
91100
$tab->fillFormTab($tabFields, $context);
92101
}
93102
if (!empty($this->unassignedFields)) {
94-
$this->fillMissedFields($tabs);
103+
$this->fillMissedFields();
95104
}
96105

97106
return $this;
98107
}
99108

100109
/**
101-
* Fill fields which weren't found on filled tabs
110+
* Fill fields which weren't found on filled tabs.
102111
*
103112
* @throws \Exception
104113
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
@@ -130,7 +139,7 @@ protected function fillMissedFields()
130139
}
131140

132141
/**
133-
* Get data of the tabs
142+
* Get data of the tabs.
134143
*
135144
* @param FixtureInterface|null $fixture
136145
* @param SimpleElement|null $element
@@ -163,7 +172,7 @@ public function getData(FixtureInterface $fixture = null, SimpleElement $element
163172
}
164173

165174
/**
166-
* Update form with tabs
175+
* Update form with tabs.
167176
*
168177
* @param FixtureInterface $fixture
169178
* @return FormTabs
@@ -178,7 +187,7 @@ public function update(FixtureInterface $fixture)
178187
}
179188

180189
/**
181-
* Create data array for filling tabs
190+
* Create data array for filling tabs.
182191
*
183192
* @param FixtureInterface $fixture
184193
* @return array
@@ -194,7 +203,7 @@ protected function getFieldsByTabs(FixtureInterface $fixture)
194203
}
195204

196205
/**
197-
* Create data array for filling tabs (new fixture specification)
206+
* Create data array for filling tabs (new fixture specification).
198207
*
199208
* @param InjectableFixture $fixture
200209
* @return array
@@ -217,7 +226,7 @@ private function getFixtureFieldsByTabs(InjectableFixture $fixture)
217226
}
218227

219228
/**
220-
* Create data array for filling tabs (deprecated fixture specification)
229+
* Create data array for filling tabs (deprecated fixture specification).
221230
*
222231
* @param FixtureInterface $fixture
223232
* @return array
@@ -284,6 +293,7 @@ protected function getTabElement($tabName)
284293
*/
285294
public function openTab($tabName)
286295
{
296+
$this->browser->find($this->header)->hover();
287297
$this->getTabElement($tabName)->click();
288298
return $this;
289299
}

dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,13 @@
88

99
use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
1010
use Magento\Mtf\Client\Locator;
11-
use Magento\Mtf\Factory\Factory;
1211
use Magento\Backend\Test\Block\Widget\Tab;
13-
use Magento\Mtf\Client\Element\SimpleElement;
1412

1513
/**
1614
* Form Tab for specifying catalog price rule conditions.
1715
*/
1816
class Conditions extends Tab
1917
{
20-
/**
21-
* Rule conditions block selector.
22-
*
23-
* @var string
24-
*/
25-
protected $ruleConditions = '#rule_conditions_fieldset';
26-
2718
/**
2819
* Add button.
2920
*
@@ -38,27 +29,6 @@ class Conditions extends Tab
3829
*/
3930
protected $conditionFormat = '//*[@id="conditions__1__new_child"]//option[contains(.,"%s")]';
4031

41-
/**
42-
* Fill condition options.
43-
*
44-
* @param array $fields
45-
* @param SimpleElement|null $element
46-
* @return void
47-
*/
48-
public function fillFormTab(array $fields, SimpleElement $element = null)
49-
{
50-
$data = $this->dataMapping($fields);
51-
52-
$conditionsBlock = Factory::getBlockFactory()->getMagentoCatalogRuleConditions(
53-
$element->find($this->ruleConditions)
54-
);
55-
$conditionsBlock->clickAddNew();
56-
57-
$conditionsBlock->selectCondition($data['condition_type']['value']);
58-
$conditionsBlock->clickEllipsis();
59-
$conditionsBlock->selectConditionValue($data['condition_value']['value']);
60-
}
61-
6232
/**
6333
* Check if attribute is available in conditions.
6434
*

0 commit comments

Comments
 (0)