Skip to content

Commit 0e6dcf2

Browse files
committed
Merge pull request #381 from magento-qmt/develop
[Mavericks] Functional tests maintenance
2 parents 4b4adab + 1001f2f commit 0e6dcf2

File tree

31 files changed

+402
-178
lines changed

31 files changed

+402
-178
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-rc40",
3+
"magento/mtf": "1.0.0-rc41",
44
"php": "~5.5.0|~5.6.0|~7.0.0",
55
"phpunit/phpunit": "4.1.0",
66
"phpunit/phpunit-selenium": ">=1.2"

dev/tests/functional/lib/Magento/Mtf/Util/ModuleResolver/SequenceSorter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ public function sort(array $paths)
6363
$modules = array_keys($this->getModuleSequence());
6464
foreach ($modules as $module) {
6565
foreach ($paths as $key => $path) {
66-
$modulePath = realpath(MTF_TESTS_PATH . str_replace('_', '/', $module));
66+
$modulePath = realpath(MTF_TESTS_PATH . str_replace('_', DIRECTORY_SEPARATOR, $module));
67+
$path = realpath($path);
6768
if (strpos($path, $modulePath) !== false) {
6869
$sortedPaths[] = $path;
6970
unset($paths[$key]);

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,24 @@ public function openTab($tabName)
9191
'Tab "' . $tabName . '" is not visible.'
9292
);
9393
}
94-
$this->getContainerElement($tabName)->click();
94+
$this->browser->find($this->header)->hover();
95+
$this->clickOnTabName($tabName);
96+
$this->browser->find($this->header)->hover();
97+
9598
return $this;
9699
}
97100

101+
/**
102+
* Click on tab name.
103+
*
104+
* @param string $tabName
105+
* @return void
106+
*/
107+
protected function clickOnTabName($tabName)
108+
{
109+
$this->getContainerElement($tabName)->click();
110+
}
111+
98112
/**
99113
* Check whether tab is visible.
100114
*

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
use Magento\Backend\Test\Block\Widget\FormTabs;
1010
use Magento\Backend\Test\Block\Widget\Tab;
11-
use Magento\Mtf\Block\BlockFactory;
12-
use Magento\Mtf\Block\Mapper;
13-
use Magento\Mtf\Client\BrowserInterface;
1411
use Magento\Mtf\Client\Element;
1512
use Magento\Mtf\Client\Element\SimpleElement;
1613
use Magento\Mtf\Client\Locator;
@@ -43,21 +40,13 @@ class AttributeForm extends FormTabs
4340
protected $isTabOpened = '.opened ';
4441

4542
/**
46-
* @constructor
47-
* @param SimpleElement $element
48-
* @param BlockFactory $blockFactory
49-
* @param Mapper $mapper
50-
* @param BrowserInterface $browser
51-
* @param array $config
43+
* Initialize block. Switch to frame.
44+
*
45+
* @return void
5246
*/
53-
public function __construct(
54-
SimpleElement $element,
55-
BlockFactory $blockFactory,
56-
Mapper $mapper,
57-
BrowserInterface $browser,
58-
array $config = []
59-
) {
60-
parent::__construct($element, $blockFactory, $mapper, $browser, $config);
47+
protected function init()
48+
{
49+
parent::init();
6150
$this->browser->switchToFrame(new Locator($this->iFrame));
6251
}
6352

@@ -82,7 +71,7 @@ function () use ($browser, $selector) {
8271
}
8372

8473
/**
85-
* Open tab
74+
* Open tab.
8675
*
8776
* @param string $tabName
8877
* @return Tab

dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/FormPageActions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class FormPageActions extends PageActions
1919
*
2020
* @var string
2121
*/
22-
protected $saveAndApplyButton = '#save_apply';
22+
protected $saveAndApplyButton = '#save_and_apply';
2323

2424
/**
2525
* Click on "Save and Apply" button

dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/PromoForm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<strategy>xpath</strategy>
3131
<fields>
3232
<conditions>
33-
<selector>#catalog_rule_formrule_conditions_fieldset_</selector>
33+
<selector>[id^="catalog_rule_formrule_conditions_fieldset_"]</selector>
3434
<input>conditions</input>
3535
</conditions>
3636
</fields>

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/CartEmpty.php

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,46 @@
1010
use Magento\Mtf\Client\Locator;
1111

1212
/**
13-
* Class CartEmpty
14-
* Block for text of empty cart
13+
* Block for text of empty cart.
1514
*/
1615
class CartEmpty extends Block
1716
{
1817
/**
19-
* Selector for link "here" to main page
18+
* Selector for link "here" to main page.
2019
*
2120
* @var string
2221
*/
23-
protected $linkToMainPage = './/a';
22+
private $linkToMainPage = 'p a';
2423

2524
/**
26-
* Get test for empty cart
25+
* CSS selector for message text.
26+
*
27+
* @var string
28+
*/
29+
private $messageText = 'p';
30+
31+
/**
32+
* Get test for empty cart.
2733
*
2834
* @return string
2935
*/
3036
public function getText()
3137
{
32-
return str_replace("\n", ' ', $this->_rootElement->getText());
38+
$result = [];
39+
foreach ($this->_rootElement->getElements($this->messageText) as $item) {
40+
$result[] = str_replace("\n", ' ', $item->getText());
41+
}
42+
43+
return implode(' ', $result);
3344
}
3445

3546
/**
36-
* Click link to main page
47+
* Click link to main page.
3748
*
3849
* @return void
3950
*/
4051
public function clickLinkToMainPage()
4152
{
42-
$this->_rootElement->find($this->linkToMainPage, Locator::SELECTOR_XPATH)->click();
53+
$this->_rootElement->find($this->linkToMainPage)->click();
4354
}
4455
}

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Sidebar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Sidebar extends Block
2020
*
2121
* @var string
2222
*/
23-
protected $qty = '//*[@class="product"]/*[@title="%s"]/following-sibling::*//*[contains(@class,"item-qty")]';
23+
private $qty = '//*[@class="product"]/*[@title="%s"]/following-sibling::*//*[contains(@class,"item-qty")]';
2424

2525
/**
2626
* Mini cart link selector.

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Sidebar/Item.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,20 @@ class Item extends Sidebar
3535
*/
3636
protected $confirmModal = '.confirm._show[data-role=modal]';
3737

38+
/**
39+
* CSS selector for qty field.
40+
*
41+
* @var string
42+
*/
43+
private $qty = 'input.cart-item-qty';
44+
45+
/**
46+
* CSS selector for update button.
47+
*
48+
* @var string
49+
*/
50+
private $updateButton = 'button.update-cart-item';
51+
3852
/**
3953
* Remove product item from mini cart
4054
*
@@ -59,4 +73,18 @@ public function clickEditItem()
5973
{
6074
$this->_rootElement->find($this->editItem)->click();
6175
}
76+
77+
/**
78+
* Edit qty.
79+
*
80+
* @param array $checkoutData
81+
* @return void
82+
*/
83+
public function editQty(array $checkoutData)
84+
{
85+
if (isset($checkoutData['qty'])) {
86+
$this->_rootElement->find($this->qty)->setValue($checkoutData['qty']);
87+
$this->_rootElement->find($this->updateButton)->click();
88+
}
89+
}
6290
}

dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
* 7. Save Rewrite.
2626
* 8. Perform all assertions.
2727
*
28-
* @group URL_Rewrites_(PS)
28+
* @group URL_Rewrites_(MX)
2929
* @ZephyrId MAGETWO-24847
3030
*/
3131
class CreateCmsPageRewriteEntityTest extends Injectable
3232
{
3333
/* tags */
3434
const MVP = 'yes';
35-
const DOMAIN = 'PS';
35+
const DOMAIN = 'MX';
3636
const TEST_TYPE = 'extended_acceptance_test';
3737
/* end tags */
3838

0 commit comments

Comments
 (0)