Skip to content

Commit f7f56fc

Browse files
committed
MAGETWO-67129: Function test Magento\GroupedProduct\Test\TestCase\CreateGroupedProductEntityTest fails randomly
1 parent e5c1527 commit f7f56fc

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Adminhtml/Product/Grouped/AssociatedProducts/Search/Grid.php

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ class Grid extends DataGrid
2020
*/
2121
protected $addProducts = '.action-primary[data-role="action"]';
2222

23+
/**
24+
* Grid selector.
25+
*
26+
* @var string
27+
*/
28+
private $gridSelector = '[data-role="grid-wrapper"]';
29+
2330
/**
2431
* Filters array mapping
2532
*
@@ -40,4 +47,59 @@ public function addProducts()
4047
{
4148
$this->_rootElement->find($this->addProducts)->click();
4249
}
50+
51+
/**
52+
* @inheritdoc
53+
*/
54+
public function searchAndSelect(array $filter)
55+
{
56+
$this->waitGridVisible();
57+
$this->waitLoader();
58+
parent::searchAndSelect($filter);
59+
}
60+
61+
/**
62+
* @inheritdoc
63+
*/
64+
protected function waitLoader()
65+
{
66+
parent::waitLoader();
67+
$this->waitGridLoaderInvisible();
68+
}
69+
70+
/**
71+
* Wait for grid to appear.
72+
*
73+
* @return void
74+
*/
75+
private function waitGridVisible()
76+
{
77+
$browser = $this->_rootElement;
78+
$selector = $this->gridSelector;
79+
80+
return $browser->waitUntil(
81+
function () use ($browser, $selector) {
82+
$element = $browser->find($selector);
83+
return $element->isVisible() ? true : null;
84+
}
85+
);
86+
}
87+
88+
/**
89+
* Wait for grid spinner disappear.
90+
*
91+
* @return void
92+
*/
93+
private function waitGridLoaderInvisible()
94+
{
95+
$browser = $this->_rootElement;
96+
$selector = $this->loader;
97+
98+
return $browser->waitUntil(
99+
function () use ($browser, $selector) {
100+
$element = $browser->find($selector);
101+
return $element->isVisible() === false ? true : null;
102+
}
103+
);
104+
}
43105
}

dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
99
<testCase name="Magento\GroupedProduct\Test\TestCase\CreateGroupedProductEntityTest" summary="Create Grouped Product" ticketId="MAGETWO-24877">
1010
<variation name="CreateGroupedProductEntityTestVariation1" summary="Create Grouped Product and Assign It to the Category" ticketId="MAGETWO-13610">
11-
<data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test, stable:no</data>
11+
<data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test</data>
1212
<data name="product/data/url_key" xsi:type="string">test-grouped-product-%isolation%</data>
1313
<data name="product/data/name" xsi:type="string">GroupedProduct %isolation%</data>
1414
<data name="product/data/sku" xsi:type="string">GroupedProduct_sku%isolation%</data>

0 commit comments

Comments
 (0)