Skip to content

Commit 99fa025

Browse files
committed
MAGETWO-67431: Functional test \Magento\ConfigurableProduct\Test\TestCase\CreateConfigurableProductEntityTest fails randomly
- fixed MAGETWO-69870 - fixed MAGETWO-57942 - fixed MAGETWO-69084 - fixed MAGETWO-60449
1 parent 68fa72c commit 99fa025

File tree

3 files changed

+45
-12
lines changed

3 files changed

+45
-12
lines changed

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

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,23 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Analytics\Test\Constraint;
78

89
use Magento\Mtf\Client\BrowserInterface;
910
use Magento\Mtf\Constraint\AbstractConstraint;
11+
use Magento\Backend\Test\Page\Adminhtml\Dashboard;
1012

1113
/**
1214
* Assert BI Essentials Sign Up page is opened by admin menu link
1315
*/
1416
class AssertBIEssentialsLink extends AbstractConstraint
1517
{
18+
/**
19+
* Count of try for choose menu item.
20+
*/
21+
const MAX_TRY_COUNT = 2;
22+
1623
/**
1724
* Browser instance.
1825
*
@@ -25,19 +32,46 @@ class AssertBIEssentialsLink extends AbstractConstraint
2532
*
2633
* @param BrowserInterface $browser
2734
* @param string $businessIntelligenceLink
35+
* @param Dashboard $dashboard
36+
* @param string $menuItem
37+
* @param bool $waitMenuItemNotVisible
2838
* @return void
2939
*/
30-
public function processAssert(BrowserInterface $browser, $businessIntelligenceLink)
31-
{
40+
public function processAssert(
41+
BrowserInterface $browser,
42+
$businessIntelligenceLink,
43+
Dashboard $dashboard,
44+
$menuItem,
45+
$waitMenuItemNotVisible = false
46+
) {
47+
/**
48+
* In the parallel run case new windows that adding to selenium grid windows handler
49+
* are in competition with another windows in another browsers in the same selenium grid.
50+
* During this case need to have some algorithm for retrying some operations that changed
51+
* current window for browser, because it's some times happens.
52+
*/
3253
$this->browser = $browser;
33-
$this->browser->selectWindow();
34-
\PHPUnit_Framework_Assert::assertTrue(
35-
$this->browser->waitUntil(
36-
function () use ($businessIntelligenceLink) {
54+
$count = 0;
55+
$isVisible = false;
56+
do {
57+
try {
58+
$this->browser->selectWindow();
59+
$isVisible = $this->browser->waitUntil(function () use ($businessIntelligenceLink) {
3760
return ($this->browser->getUrl() === $businessIntelligenceLink) ?: null;
38-
}
39-
),
40-
'BI Essentials Sign Up page was not opened by link.'
61+
});
62+
break;
63+
} catch (\Throwable $e) {
64+
$dashboard->open();
65+
$dashboard->getMenuBlock()->navigate($menuItem, $waitMenuItemNotVisible);
66+
$count++;
67+
}
68+
} while ($count < self::MAX_TRY_COUNT);
69+
70+
\PHPUnit_Framework_Assert::assertTrue(
71+
$isVisible,
72+
"BI Essentials Sign Up page was not opened by link.\n
73+
Actual link is '{$this->browser->getUrl()}'\n
74+
Expected link is '$businessIntelligenceLink'"
4175
);
4276
}
4377

dev/tests/functional/tests/app/Magento/SalesRule/Test/Repository/SalesRule.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@
202202
<field name="coupon_type" xsi:type="string">No Coupon</field>
203203
<field name="sort_order" xsi:type="string">0</field>
204204
<field name="is_rss" xsi:type="string">Yes</field>
205-
<field name="conditions_serialized" xsi:type="string">{Products subselection|total quantity|is|2|:[[Price in cart|is|50]]}</field>
206-
<field name="actions_serialized" xsi:type="string">[Price in cart|is|50]</field>
205+
<field name="conditions_serialized" xsi:type="string">{Products subselection|qty|is|2|:[[Price in cart|is|50]]}</field>
206+
<field name="actions_serialized" xsi:type="string">{Conditions combination|ALL|TRUE|:[[Price in cart|is|50]]}</field>
207207
<field name="simple_action" xsi:type="string">Percent of product price discount</field>
208208
<field name="discount_amount" xsi:type="string">10</field>
209209
<field name="discount_qty" xsi:type="string">1</field>

dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/ApplySeveralSalesRuleEntityTest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
99
<testCase name="Magento\SalesRule\Test\TestCase\ApplySeveralSalesRuleEntityTest" summary="Apply Several Sales Rules" ticketId="MAGETWO-45883">
1010
<variation name="ApplySeveralSalesRuleEntityTestVariation1" summary="Rules with same priority, both are applied">
11-
<data name="tag" xsi:type="string">to_maintain:yes</data>
1211
<data name="salesRules/rule1" xsi:type="string">active_sales_rule_product_subselection</data>
1312
<data name="salesRules/rule2" xsi:type="string">active_sales_rule_product_attribute</data>
1413
<data name="cartPrice/sub_total" xsi:type="string">200.00</data>

0 commit comments

Comments
 (0)