Skip to content

Commit deefb61

Browse files
author
Dmytro Aponasenko
committed
Merge pull request #102 from magento-qmt/develop
[Mavericks] Re-factor product end-to-end tests
2 parents a9e59f8 + 27d5cfa commit deefb61

File tree

428 files changed

+4733
-9173
lines changed

Some content is hidden

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

428 files changed

+4733
-9173
lines changed

dev/tests/functional/.gitignore

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
**/var
12
/composer.lock
2-
/vendor
3-
/generated
4-
/var
53
/config/*
4+
/generated
5+
/lib/Magento/Mtf/Util/Generate/testcase.xml
6+
/vendor
67
!/config/application.yml.dist
78
!/config/handler.yml.dist
89
!/config/isolation.yml.dist
910
!/config/server.yml.dist
1011
phpunit.xml
11-
/lib/Magento/Mtf/Util/Generate/testcase.xml
12+
credentials.xml

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-rc17",
3+
"magento/mtf": "1.0.0-rc18",
44
"php": "~5.5.0|~5.6.0",
55
"phpunit/phpunit": "4.1.0",
66
"phpunit/phpunit-selenium": ">=1.2",
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<replace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="./vendor/magento/mtf/Magento/Mtf/Fixture/InjectableFixture/etc/replace.xsd">
10+
11+
<field path="section/carriers_dhl_id/value" value="" />
12+
<field path="section/carriers_dhl_password/value" value="" />
13+
<field path="section/carriers_dhl_account/value" value="" />
14+
15+
<field path="section/carriers_fedex_account/value" value="" />
16+
<field path="section/carriers_fedex_meter_number/value" value="" />
17+
<field path="section/carriers_fedex_key/value" value="" />
18+
<field path="section/carriers_fedex_password/value" value="" />
19+
20+
<field path="section/carriers_ups_password/value" value="" />
21+
<field path="section/carriers_ups_username/value" value="" />
22+
<field path="section/carriers_ups_access_license_number/value" value="" />
23+
<field path="section/carriers_ups_shipper_number/value" value="" />
24+
25+
<field path="section/carriers_usps_userid/value" value="" />
26+
<field path="section/carriers_usps_password/value" value="" />
27+
</replace>

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

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,62 @@
99
use Magento\Mtf\Client\Locator;
1010

1111
/**
12-
* Class OptgroupselectElement
13-
* Typified element class for option group selectors
12+
* Typified element class for option group selectors.
1413
*/
1514
class OptgroupselectElement extends SelectElement
1615
{
1716
/**
18-
* Option group selector
17+
* Option locator.
18+
*
19+
* @var string
20+
*/
21+
protected $optionByIndex = './/option';
22+
23+
/**
24+
* Option group selector.
1925
*
2026
* @var string
2127
*/
2228
protected $optGroup = 'optgroup[option[contains(.,"%s")]]';
2329

2430
/**
25-
* Get the value of form element
31+
* Option group locator.
32+
*
33+
* @var string
34+
*/
35+
protected $optionGroupValue = ".//optgroup[@label = '%s']/option[text() = '%s']";
36+
37+
/**
38+
* Get the value of form element.
2639
*
2740
* @return string
41+
* @throws \Exception
2842
*/
2943
public function getValue()
3044
{
3145
$this->eventManager->dispatchEvent(['get_value'], [(string)$this->getAbsoluteSelector()]);
32-
$selectedLabel = trim(parent::getValue());
46+
47+
$selectedLabel = '';
48+
$labels = $this->getElements($this->optionByIndex, Locator::SELECTOR_XPATH);
49+
foreach ($labels as $label) {
50+
if ($label->isSelected()) {
51+
$selectedLabel = $label->getText();
52+
break;
53+
}
54+
}
55+
if ($selectedLabel == '') {
56+
throw new \Exception('Selected value has not been found in optgroup select.');
57+
}
58+
3359
$element = $this->find(sprintf($this->optGroup, $selectedLabel), Locator::SELECTOR_XPATH);
3460
$value = trim($element->getAttribute('label'), chr(0xC2) . chr(0xA0));
3561
$value .= '/' . $selectedLabel;
62+
3663
return $value;
3764
}
3865

3966
/**
40-
* Select value in dropdown which has option groups
67+
* Select value in dropdown which has option groups.
4168
*
4269
* @param string $value
4370
* @return void
@@ -46,6 +73,8 @@ public function setValue($value)
4673
{
4774
$this->eventManager->dispatchEvent(['set_value'], [__METHOD__, $this->getAbsoluteSelector()]);
4875
list($group, $option) = explode('/', $value);
49-
parent::setOptionGroupValue($group, $option);
76+
$xpath = sprintf($this->optionGroupValue, $group, $option);
77+
$option = $this->find($xpath, Locator::SELECTOR_XPATH);
78+
$option->click();
5079
}
5180
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
*/
1414
class SelectstoreElement extends SelectElement
1515
{
16+
/**
17+
* Option locator
18+
*
19+
* @var string
20+
*/
21+
protected $optionByIndex = './/optgroup/option[%d]';
22+
1623
/**
1724
* Store option group selector.
1825
*

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public function setValue($value)
5858
$this->eventManager->dispatchEvent(['set_value'], [__METHOD__, $this->getAbsoluteSelector()]);
5959

6060
$this->clear();
61+
62+
if ($value == '') {
63+
return;
64+
}
6165
foreach (str_split($value) as $symbol) {
6266
$input = $this->find($this->suggest);
6367
$input->click();

dev/tests/functional/lib/Magento/Mtf/Util/Generate/Factory/Block.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function addBlockToFactory(array $item)
4444
$params = "\$element, \$driver = null, \$config = []";
4545

4646
$this->factoryContent .= "\n /**\n";
47-
$this->factoryContent .= " * @return \\{$item['class']}\n";
47+
$this->factoryContent .= " * @return {$item['class']}\n";
4848
$this->factoryContent .= " */\n";
4949
$this->factoryContent .= " public function get{$methodNameSuffix}({$params})\n";
5050
$this->factoryContent .= " {";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function addFixtureToFactory($item)
4343

4444
$this->factoryContent .= "\n";
4545
$this->factoryContent .= " /**\n";
46-
$this->factoryContent .= " * @return \\{$item['class']}\n";
46+
$this->factoryContent .= " * @return {$item['class']}\n";
4747
$this->factoryContent .= " */\n";
4848
$this->factoryContent .= " public function get{$methodNameSuffix}(array \$placeholders = [])\n";
4949
$this->factoryContent .= " {";

dev/tests/functional/lib/Magento/Mtf/Util/Generate/Factory/Page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function _addPageToFactory($item)
4444
$fallbackComment = $this->_buildFallbackComment($item);
4545

4646
$this->factoryContent .= "\n /**\n";
47-
$this->factoryContent .= " * @return \\{$item['class']}\n";
47+
$this->factoryContent .= " * @return {$item['class']}\n";
4848
$this->factoryContent .= " */\n";
4949
$this->factoryContent .= " public function get{$methodNameSuffix}()\n";
5050
$this->factoryContent .= " {";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function _addToFactory($item)
4444
$fallbackComment = $this->_buildFallbackComment($item);
4545

4646
$this->factoryContent .= "\n /**\n";
47-
$this->factoryContent .= " * @return \\{$item['class']}\n";
47+
$this->factoryContent .= " * @return {$item['class']}\n";
4848
$this->factoryContent .= " */\n";
4949
$this->factoryContent .= " public function get{$methodNameSuffix}(array \$defaultConfig = [], "
5050
. "array \$defaultData = [])\n";

0 commit comments

Comments
 (0)