Skip to content

Commit 5f7f226

Browse files
authored
Merge pull request #1197 from magento-troll/MAGETWO-67431
MAGETWO-67431 Functional test \Magento\ConfigurableProduct\Test\TestCase\CreateConfigurableProductEntityTest fails randomly
2 parents 5c4ee14 + 952abad commit 5f7f226

File tree

5 files changed

+68
-16
lines changed

5 files changed

+68
-16
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/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Section/Variations/Config/Attribute.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,13 @@ class Attribute extends Form
174174
*/
175175
private $attributesGridSpinner = '.productFormConfigurable [data-role="spinner"]';
176176

177+
/**
178+
* CSS Selector for attribute grid.
179+
*
180+
* @var string
181+
*/
182+
private $attributesGridSelector = '#variation-steps-wizard_step1 .admin__data-grid-outer-wrap';
183+
177184
/**
178185
* Fill attributes
179186
*
@@ -192,6 +199,7 @@ public function fillAttributes(array $attributes, ConfigurableAttributesData $at
192199
}
193200

194201
//select attributes
202+
$this->waitAttributesGridLoad();
195203
$this->getAttributesGrid()->resetFilter();
196204
$this->getAttributesGrid()->waitForElementNotVisible($this->attributesGridSpinner);
197205
$this->getTemplateBlock()->waitLoader();
@@ -220,14 +228,25 @@ public function fillAttributes(array $attributes, ConfigurableAttributesData $at
220228
$this->browser->find($this->nextButton)->click();
221229
}
222230

231+
/**
232+
* Wait for 'Attributes Grid' loaded.
233+
*
234+
* @return void
235+
*/
236+
private function waitAttributesGridLoad()
237+
{
238+
$this->waitForElementVisible($this->attributesGridSelector);
239+
$this->waitForElementNotVisible($this->attributesGridSpinner);
240+
}
241+
223242
/**
224243
* @return \Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\AttributesGrid
225244
*/
226245
public function getAttributesGrid()
227246
{
228247
return $this->blockFactory->create(
229248
\Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\AttributesGrid::class,
230-
['element' => $this->browser->find('#variation-steps-wizard_step1 .admin__data-grid-outer-wrap')]
249+
['element' => $this->browser->find($this->attributesGridSelector)]
231250
);
232251
}
233252

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
<constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertProductTierPriceOnProductPage" />
171171
</variation>
172172
<variation name="CreateConfigurableProductEntityTestVariation11" summary="Create Configurable Product with out of stock child" ticketId="MAGETWO-65660">
173-
<data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test, stable:no</data>
173+
<data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test</data>
174174
<data name="product/data/configurable_attributes_data/dataset" xsi:type="string">with_out_of_stock_item</data>
175175
<data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data>
176176
<data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data>
@@ -188,7 +188,7 @@
188188
<constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" />
189189
</variation>
190190
<variation name="CreateConfigurableProductEntityTestVariation12" summary="Create Configurable Product with disabled child" ticketId="MAGETWO-65661">
191-
<data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test, stable:no</data>
191+
<data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test</data>
192192
<data name="product/data/configurable_attributes_data/dataset" xsi:type="string">with_disabled_item</data>
193193
<data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data>
194194
<data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data>
@@ -206,7 +206,7 @@
206206
<constraint name="Magento\Catalog\Test\Constraint\AssertProductNotVisibleInCategory" />
207207
</variation>
208208
<variation name="CreateConfigurableProductEntityTestVariation13" summary="Create Configurable Product with one disabled child and with one out of stock child" ticketId="MAGETWO-65662">
209-
<data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test, stable:no</data>
209+
<data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test</data>
210210
<data name="product/data/configurable_attributes_data/dataset" xsi:type="string">with_one_disabled_item_and_one_out_of_stock_item</data>
211211
<data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data>
212212
<data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data>

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)