Skip to content

Commit 9e8434e

Browse files
author
Dmytro Aponasenko
committed
Merge pull request #65 from magento-qmt/develop
[Mavericks] Convert all fixtures/repositories for functional tests into *.xml files
2 parents 8f09664 + f3ac9b5 commit 9e8434e

File tree

400 files changed

+14453
-17870
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

400 files changed

+14453
-17870
lines changed

dev/tests/functional/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"require": {
3-
"magento/mtf": "1.0.0-rc14",
3+
"magento/mtf": "1.0.0-rc15",
44
"php": ">=5.4.0",
55
"phpunit/phpunit": "4.1.0",
66
"phpunit/phpunit-selenium": ">=1.2",

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,12 @@ public function setValue($value)
192192
protected function addConditionsCombination($condition, ElementInterface $context)
193193
{
194194
$condition = $this->parseCondition($condition);
195+
196+
$this->driver->selectWindow();
195197
$newCondition = $context->find($this->newCondition, Locator::SELECTOR_XPATH);
196198
$newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click();
199+
200+
$this->driver->selectWindow();
197201
$typeNewCondition = $newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'select');
198202
$typeNewCondition->setValue($condition['type']);
199203

@@ -235,16 +239,23 @@ protected function addSingleCondition($condition, ElementInterface $context)
235239
{
236240
$condition = $this->parseCondition($condition);
237241

242+
$this->driver->selectWindow();
238243
$newCondition = $context->find($this->newCondition, Locator::SELECTOR_XPATH);
239244
$newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click();
245+
240246
$typeNew = $this->typeNew;
241247
$newCondition->waitUntil(
242248
function () use ($newCondition, $typeNew) {
243249
$element = $newCondition->find($typeNew, Locator::SELECTOR_XPATH, 'select');
244-
return $element->isVisible() ? true : null;
250+
if ($element->isVisible()) {
251+
return true;
252+
}
253+
$this->driver->selectWindow();
254+
return null;
245255
}
246256
);
247257
$newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'select')->setValue($condition['type']);
258+
248259
$createdCondition = $context->find($this->created, Locator::SELECTOR_XPATH);
249260
$this->waitForCondition($createdCondition);
250261
$this->fillCondition($condition['rules'], $createdCondition);
@@ -264,6 +275,8 @@ protected function fillCondition(array $rules, ElementInterface $element)
264275
foreach ($rules as $rule) {
265276
/** @var ElementInterface $param */
266277
$param = $this->findNextParam($element);
278+
279+
$this->driver->selectWindow();
267280
$param->find('a')->click();
268281

269282
if (preg_match('`%(.*?)%`', $rule, $chooserGrid)) {
@@ -392,7 +405,11 @@ protected function waitForCondition(ElementInterface $element)
392405
{
393406
$this->waitUntil(
394407
function () use ($element) {
395-
return $element->getAttribute('class') == 'rule-param-wait' ? null : true;
408+
if ($element->getAttribute('class') == 'rule-param-wait') {
409+
$this->driver->selectWindow();
410+
return null;
411+
}
412+
return true;
396413
}
397414
);
398415
}

dev/tests/functional/lib/Magento/Mtf/ObjectManagerFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public function create(array $sharedInstances = [])
5252
$argInterpreter = $this->createArgumentInterpreter(new BooleanUtils());
5353
$argumentMapper = new \Magento\Mtf\ObjectManager\Config\Mapper\Dom($argInterpreter);
5454

55+
$sharedInstances['Magento\Mtf\Data\Argument\InterpreterInterface'] = $argInterpreter;
5556
$sharedInstances['Magento\Mtf\ObjectManager\Config\Mapper\Dom'] = $argumentMapper;
5657
$objectManager = new $this->locatorClassName($factory, $diConfig, $sharedInstances);
5758

dev/tests/functional/lib/Magento/Mtf/Util/Generate/Fixture/FieldsProvider.php

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
/**
1313
* Class FieldsProvider
14-
*
1514
*/
1615
class FieldsProvider implements FieldsProviderInterface
1716
{
@@ -25,6 +24,13 @@ class FieldsProvider implements FieldsProviderInterface
2524
*/
2625
protected $resource;
2726

27+
/**
28+
* Magento connection.
29+
*
30+
* @var \Magento\Framework\DB\Adapter\AdapterInterface
31+
*/
32+
protected $connection;
33+
2834
/**
2935
* @constructor
3036
* @param \Magento\Framework\ObjectManagerInterface $objectManager
@@ -35,6 +41,22 @@ public function __construct(ObjectManagerInterface $objectManager)
3541
$this->resource = $objectManager->create('Magento\Framework\App\Resource');
3642
}
3743

44+
/**
45+
* Check connection to DB.
46+
*
47+
* @return bool
48+
*/
49+
public function checkConnection()
50+
{
51+
$this->connection = $this->getConnection('core_write');
52+
if (!$this->connection || $this->connection instanceof \Zend_Db_Adapter_Exception) {
53+
echo ('Connection to Magento 2 database is absent. Fixture data has not been fetched.' . PHP_EOL);
54+
return false;
55+
}
56+
57+
return true;
58+
}
59+
3860
/**
3961
* Collect fields for the entity based on its type
4062
*
@@ -105,8 +127,7 @@ protected function flatCollectFields(array $fixture)
105127
$entityType = $fixture['entity_type'];
106128

107129
/** @var $connection \Magento\Framework\DB\Adapter\AdapterInterface */
108-
$connection = $this->resource->getConnection('core_write');
109-
$fields = $connection->describeTable($entityType);
130+
$fields = $this->connection->describeTable($entityType);
110131

111132
$attributes = [];
112133
foreach ($fields as $code => $field) {
@@ -132,11 +153,9 @@ protected function compositeCollectFields(array $fixture)
132153
{
133154
$entityTypes = $fixture['entities'];
134155

135-
/** @var $connection \Magento\Framework\DB\Adapter\AdapterInterface */
136-
$connection = $this->resource->getConnection('core_write');
137156
$fields = [];
138157
foreach ($entityTypes as $entityType) {
139-
$fields = array_merge($fields, $connection->describeTable($entityType));
158+
$fields = array_merge($fields, $this->connection->describeTable($entityType));
140159
}
141160

142161
$attributes = [];
@@ -152,4 +171,21 @@ protected function compositeCollectFields(array $fixture)
152171

153172
return $attributes;
154173
}
174+
175+
/**
176+
* Retrieve connection to resource specified by $resourceName.
177+
*
178+
* @param string $resourceName
179+
* @return \Exception|false|\Magento\Framework\DB\Adapter\AdapterInterface|\Zend_Exception
180+
*/
181+
protected function getConnection($resourceName)
182+
{
183+
try {
184+
$connection = $this->resource->getConnection($resourceName);
185+
return $connection;
186+
} catch (\Zend_Exception $e) {
187+
echo $e->getMessage() . PHP_EOL;
188+
return $e;
189+
}
190+
}
155191
}

dev/tests/functional/lib/Magento/Mtf/Util/Generate/Repository/CollectionProvider.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,37 @@ class CollectionProvider implements CollectionProviderInterface
1919
*/
2020
protected $objectManager;
2121

22+
/**
23+
* Magetno resource instance.
24+
*
25+
* @var \Magento\Framework\App\Resource
26+
*/
27+
protected $resource;
28+
2229
/**
2330
* @constructor
2431
* @param \Magento\Framework\ObjectManagerInterface $objectManager
2532
*/
2633
public function __construct(ObjectManagerInterface $objectManager)
2734
{
2835
$this->objectManager = $objectManager;
36+
$this->resource = $objectManager->create('Magento\Framework\App\Resource');
37+
}
38+
39+
/**
40+
* Check connection to DB.
41+
*
42+
* @return bool
43+
*/
44+
public function checkConnection()
45+
{
46+
$connection = $this->getConnection('read');
47+
if (!$connection || $connection instanceof \Zend_Db_Adapter_Exception) {
48+
echo ('Connection to Magento 2 database is absent. Repository data has not been fetched.' . PHP_EOL);
49+
return false;
50+
}
51+
52+
return true;
2953
}
3054

3155
/**
@@ -107,4 +131,21 @@ protected function eavCollection(array $fixture)
107131

108132
return $collection->getItems();
109133
}
134+
135+
/**
136+
* Retrieve connection to resource specified by $resourceName.
137+
*
138+
* @param string $resourceName
139+
* @return \Exception|false|\Magento\Framework\DB\Adapter\AdapterInterface|\Zend_Exception
140+
*/
141+
protected function getConnection($resourceName)
142+
{
143+
try {
144+
$connection = $this->resource->getConnection($resourceName);
145+
return $connection;
146+
} catch (\Zend_Exception $e) {
147+
echo $e->getMessage() . PHP_EOL;
148+
return $e;
149+
}
150+
}
110151
}

dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
* @spi
43
* Copyright © 2015 Magento. All rights reserved.
54
* See COPYING.txt for license details.
65
*/

dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
* @spi
43
* Copyright © 2015 Magento. All rights reserved.
54
* See COPYING.txt for license details.
65
*/

dev/tests/functional/lib/Magento/Mtf/Util/Protocol/SoapTransport.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
* @spi
43
* Copyright © 2015 Magento. All rights reserved.
54
* See COPYING.txt for license details.
65
*/

dev/tests/functional/phpunit.xml.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@
3838
<env name="handlers_config_path" value="config/handler.yml.dist" />
3939
<env name="install_config_path" value="config/install_data.yml.dist" />
4040
<env name="testsuite_rule" value="basic" />
41-
<env name="testsuite_rule_path" value="Mtf/TestSuite/InjectableTests" />
41+
<env name="testsuite_rule_path" value="Magento/Mtf/TestSuite/InjectableTests" />
4242
<env name="log_directory" value="var/log" />
4343
<env name="events_preset" value="base" />
4444
<env name="module_whitelist" value="Magento_Install" />
4545
<env name="report_file_name" value="test-cases-report.xml"/>
46+
<env name="basedir" value="var/log" />
4647
</php>
4748

4849
</phpunit>

dev/tests/functional/tests/app/Magento/Backend/Test/Block/Menu.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
* @spi
43
* Copyright © 2015 Magento. All rights reserved.
54
* See COPYING.txt for license details.
65
*/

0 commit comments

Comments
 (0)