Skip to content

Commit fb59273

Browse files
committed
MAGETWO-98181: [FT] NavigateMenuTest with NavigateMenuTestBIEssentials variation fails n Jenkins
1 parent 8c02c91 commit fb59273

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

dev/tests/functional/tests/app/Magento/Analytics/Test/Constraint/AssertBIEssentialsLink.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function processAssert(
6363
} catch (\Throwable $e) {
6464
$dashboard->open();
6565
$dashboard->getMenuBlock()->navigate($menuItem, $waitMenuItemNotVisible);
66+
sleep(10);
6667
$count++;
6768
}
6869
} while ($count < self::MAX_TRY_COUNT);

dev/tests/functional/tests/app/Magento/Analytics/Test/TestCase/NavigateMenuTest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
99
<testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest" summary="Navigate to menu chapter">
1010
<variation name="NavigateMenuTestBIEssentials" summary="Navigate through BI Essentials admin menu to Sign Up page" ticketId="MAGETWO-63700">
11-
<data name="issue" xsi:type="string">MAGETWO-97298: [2.2-develop] Magento\Backend\Test\TestCase\NavigateMenuTest fails on Jenkins</data>
1211
<data name="menuItem" xsi:type="string">Reports > BI Essentials</data>
1312
<data name="waitMenuItemNotVisible" xsi:type="boolean">false</data>
1413
<data name="businessIntelligenceLink" xsi:type="string">https://account.magento.com/onboarding/steps/view/step/gmv/</data>
14+
<data name="waitForNewWindow" xsi:type="boolean">true</data>
1515
<constraint name="Magento\Analytics\Test\Constraint\AssertBIEssentialsLink" />
1616
</variation>
1717
<variation name="NavigateMenuTestAdvancedReporting" summary="Navigate through Advanced Reporting admin menu to BI Reports page" ticketId="MAGETWO-65748">
1818
<data name="menuItem" xsi:type="string">Reports > Advanced Reporting</data>
1919
<data name="waitMenuItemNotVisible" xsi:type="boolean">false</data>
2020
<data name="advancedReportingLink" xsi:type="string">https://advancedreporting.rjmetrics.com/report</data>
21+
<data name="waitForNewWindow" xsi:type="boolean">true</data>
2122
<constraint name="Magento\Analytics\Test\Constraint\AssertAdvancedReportingPage" />
2223
</variation>
2324
</testCase>

dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.php

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Magento\Backend\Test\TestCase;
88

9+
use Magento\Mtf\Client\BrowserInterface;
910
use Magento\Mtf\TestCase\Injectable;
1011
use Magento\Backend\Test\Page\Adminhtml\Dashboard;
1112

@@ -23,17 +24,46 @@ class NavigateMenuTest extends Injectable
2324
const MVP = 'no';
2425
/* end tags */
2526

27+
/**
28+
* Browser instance.
29+
*
30+
* @var BrowserInterface
31+
*/
32+
protected $browser;
33+
34+
/**
35+
* Prepare data for further test execution.
36+
*
37+
* @param BrowserInterface $browser
38+
* @return void
39+
*/
40+
public function __inject(
41+
BrowserInterface $browser
42+
) {
43+
$this->browser = $browser;
44+
}
45+
2646
/**
2747
* Run menu navigation test.
2848
*
2949
* @param Dashboard $dashboard
3050
* @param string $menuItem
3151
* @param bool $waitMenuItemNotVisible
52+
* @param bool $waitForNewWindow
3253
* @return void
3354
*/
34-
public function test(Dashboard $dashboard, $menuItem, $waitMenuItemNotVisible = true)
55+
public function test(Dashboard $dashboard, $menuItem, $waitMenuItemNotVisible = true, $waitForNewWindow = false)
3556
{
3657
$dashboard->open();
58+
$windowsCountBeforeClick = count($this->browser->getWindowHandles());
3759
$dashboard->getMenuBlock()->navigate($menuItem, $waitMenuItemNotVisible);
60+
if ($waitForNewWindow) {
61+
$this->browser->waitUntil(function () use ($windowsCountBeforeClick) {
62+
$windowsCount = count($this->browser->getWindowHandles());
63+
64+
return $windowsCount > $windowsCountBeforeClick ? true : null;
65+
});
66+
sleep(10);
67+
}
3868
}
3969
}

0 commit comments

Comments
 (0)