Skip to content

Commit e9de1d2

Browse files
committed
MTA-1814: Analyse functional test failures - Sprint 9
1 parent a7ffa41 commit e9de1d2

File tree

13 files changed

+89
-36
lines changed

13 files changed

+89
-36
lines changed

dev/tests/functional/lib/Magento/Mtf/App/State/State1.php

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,33 @@
77
namespace Magento\Mtf\App\State;
88

99
use Magento\Mtf\ObjectManager;
10-
use Magento\Mtf\Fixture\FixtureFactory;
11-
use Magento\Config\Test\Fixture\ConfigData;
1210

1311
/**
1412
* Example Application State class.
1513
*/
1614
class State1 extends AbstractState
1715
{
18-
// TODO: Move data set to ConfigData fixture after implement merging fixture xml
1916
/**
20-
* Data set for configuration state.
17+
* Object Manager.
2118
*
22-
* @var array
19+
* @var ObjectManager
2320
*/
24-
protected $configDataSet = [
25-
'section' => [
26-
[
27-
'path' => 'cms/wysiwyg/enabled',
28-
'scope' => 'default',
29-
'scope_id' => 1,
30-
'value' => 'disabled',
31-
],
32-
]
33-
];
21+
protected $objectManager;
3422

3523
/**
36-
* Configuration fixture.
24+
* Data for configuration state.
3725
*
38-
* @var ConfigData
26+
* @var string
3927
*/
40-
protected $config;
28+
protected $config ='admin_session_lifetime_1_hour, wysiwyg_disabled';
4129

4230
/**
4331
* @construct
44-
* @param FixtureFactory $fixtureFactory
32+
* @param ObjectManager $objectManager
4533
*/
46-
public function __construct(FixtureFactory $fixtureFactory)
34+
public function __construct(ObjectManager $objectManager)
4735
{
48-
$this->config = $fixtureFactory->createByCode('configData', ['data' => $this->configDataSet]);
36+
$this->objectManager = $objectManager;
4937
}
5038

5139
/**
@@ -57,7 +45,10 @@ public function apply()
5745
{
5846
parent::apply();
5947
if (file_exists(dirname(dirname(dirname(MTF_BP))) . '/app/etc/config.php')) {
60-
$this->config->persist();
48+
$this->objectManager->create(
49+
'\Magento\Config\Test\TestStep\SetupConfigurationStep',
50+
['configData' => $this->config]
51+
)->run();
6152
}
6253
}
6354

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Magento\Mtf\Client\Element;
88

9+
use Magento\Framework\Webapi\Exception;
910
use Magento\Mtf\Client\Locator;
1011

1112
/**
@@ -69,8 +70,13 @@ public function setValue($value)
6970
$this->waitResult();
7071
$searchedItem = $this->find(sprintf($this->resultItem, $value), Locator::SELECTOR_XPATH);
7172
if ($searchedItem->isVisible()) {
72-
$searchedItem->click();
73-
break;
73+
try {
74+
$searchedItem->click();
75+
break;
76+
} catch (\Exception $e) {
77+
// In parallel run on windows change the focus is lost on element
78+
// that causes disappearing of category suggest list.
79+
}
7480
}
7581
}
7682
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* {license_notice}
4+
*
5+
* @copyright {copyright}
6+
* @license {license_link}
7+
*/
8+
9+
namespace Magento\AdminNotification\Test\Block\System;
10+
11+
use Magento\Mtf\Block\Block;
12+
13+
/**
14+
* Global messages block.
15+
*/
16+
class Messages extends Block
17+
{
18+
/**
19+
* Locator for close message block.
20+
*
21+
* @var string
22+
*/
23+
protected $closePopup = '.ui-dialog-titlebar-close';
24+
25+
/**
26+
* Close popup block.
27+
*
28+
* @return void
29+
*/
30+
public function closePopup()
31+
{
32+
if ($this->_rootElement->isVisible()) {
33+
$this->_rootElement->find($this->closePopup)->click();
34+
}
35+
}
36+
}

dev/tests/functional/tests/app/Magento/Backend/Test/Repository/ConfigData.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@
1717
<field path="general/store_information/street_line1" scope="general" scope_id="1" label="" xsi:type="string">10441 Jefferson Blvd</field>
1818
<field path="general/store_information/street_line2" scope="general" scope_id="1" label="" xsi:type="string">Suite 200</field>
1919
</dataset>
20+
21+
<dataset name="admin_session_lifetime_1_hour">
22+
<field path="admin/security/session_lifetime" scope="default" scope_id="0" label="3600" xsi:type="string">3600</field>
23+
</dataset>
2024
</repository>
2125
</config>

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ListProduct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ListProduct extends Block
2121
*
2222
* @var string
2323
*/
24-
protected $productItem = './/*[contains(@class,"product-item-link") and text()="%s"]/ancestor::li';
24+
protected $productItem = './/*[contains(@class,"product-item-link") and normalize-space(text())="%s"]/ancestor::li';
2525

2626
/**
2727
* Sorter dropdown selector.

dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCategory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function assertPrice(FixtureInterface $product, CatalogCategoryView $c
6767
$price = $catalogCategoryView->getListProductBlock()->getProductItem($product)->getPriceBlock()->getPrice();
6868

6969
\PHPUnit_Framework_Assert::assertEquals(
70-
number_format($product->getPrice(), 2),
70+
number_format($product->getPrice(), 2, '.', ''),
7171
$price,
7272
'Product regular price on category page is not correct.'
7373
);

dev/tests/functional/tests/app/Magento/CatalogRule/Test/Handler/CatalogRule/Curl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public function getCategoryPriceRuleId(array $data)
158158
$response = $curl->read();
159159
$curl->close();
160160

161-
$pattern = '/col\-rule_id[\s\W]*(\d+)\s*<.td>\s*<[^<>]*?>' . $data['name'] . '/siu';
161+
$pattern = '/col\-rule_id[\s\W]*(\d+).*?' . $data['name'] . '/siu';
162162
preg_match($pattern, $response, $matches);
163163
if (empty($matches)) {
164164
throw new \Exception('Cannot find Catalog Price Rule id! Response: ' . $response);

dev/tests/functional/tests/app/Magento/CatalogRule/Test/Page/Adminhtml/CatalogRuleIndex.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd">
9-
<page name="CatalogRuleIndex" area="Adminhtml" mca="catalog_rule/promo_catalog/index" module="Magento_CatalogRule">
10-
<block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/>
11-
<block name="gridPageActions" class="Magento\CatalogRule\Test\Block\Adminhtml\Promo\GridPageActions" locator=".page-main-actions" strategy="css selector"/>
12-
<block name="catalogRuleGrid" class="Magento\CatalogRule\Test\Block\Adminhtml\Promo\Catalog" locator="#promo_catalog_grid" strategy="css selector"/>
13-
</page>
9+
<page name="CatalogRuleIndex" area="Adminhtml" mca="catalog_rule/promo_catalog/index" module="Magento_CatalogRule">
10+
<block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector" />
11+
<block name="gridPageActions" class="Magento\CatalogRule\Test\Block\Adminhtml\Promo\GridPageActions" locator=".page-main-actions" strategy="css selector" />
12+
<block name="catalogRuleGrid" class="Magento\CatalogRule\Test\Block\Adminhtml\Promo\Catalog" locator="#promo_catalog_grid" strategy="css selector" />
13+
<block name="systemMessageDialog" class="Magento\AdminNotification\Test\Block\System\Messages" locator='[role="dialog"].ui-popup-message' strategy="css selector" />
14+
</page>
1415
</config>

dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestStep/DeleteAllCatalogRulesStep.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function run()
5454
while ($this->catalogRuleIndex->getCatalogRuleGrid()->isFirstRowVisible()) {
5555
$this->catalogRuleIndex->getCatalogRuleGrid()->openFirstRow();
5656
$this->catalogRuleNew->getFormPageActions()->delete();
57+
$this->catalogRuleIndex->getSystemMessageDialog()->closePopup();
5758
}
5859
}
5960
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Sidebar extends Block
4242
*
4343
* @var string
4444
*/
45-
protected $cartItemByProductName = './/*[contains(@class,"products minilist")]//li[.//a[.="%s"]]';
45+
protected $cartProductName = './/*[@id="mini-cart"]//li[.//a[normalize-space(text())="%s"]]';
4646

4747
/**
4848
* Counter qty locator
@@ -110,7 +110,7 @@ public function getCartItem(FixtureInterface $product)
110110
$cartItem = $this->callRender($typeId, 'getCartItem', ['product' => $product]);
111111
} else {
112112
$cartItemBlock = $this->_rootElement->find(
113-
sprintf($this->cartItemByProductName, $product->getName()),
113+
sprintf($this->cartProductName, $product->getName()),
114114
Locator::SELECTOR_XPATH
115115
);
116116
$cartItem = $this->blockFactory->create(

0 commit comments

Comments
 (0)