Skip to content

Commit 76c0d7c

Browse files
committed
MQE-3124: fix unbalanced parallel groups
1 parent 060fe8c commit 76c0d7c

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/Magento/FunctionalTestingFramework/Test/Objects/TestObject.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ class TestObject
3737
'getOTP' => 1000,
3838
];
3939

40+
const WEBAPI_AUTH_TEST_ACTIONS = [
41+
'createData',
42+
'deleteData',
43+
'updateData',
44+
'getData',
45+
];
46+
47+
const WEBAPI_AUTH_TEST_ACTION_WEIGHT = 6000;
48+
4049
/**
4150
* Name of the test
4251
*
@@ -93,6 +102,11 @@ class TestObject
93102
*/
94103
private $deprecated;
95104

105+
/**
106+
* Indicates if a test contains an action that requires Web API authentication.
107+
*/
108+
private bool $hasWebApiAuthAction;
109+
96110
/**
97111
* TestObject constructor.
98112
*
@@ -120,6 +134,7 @@ public function __construct(
120134
$this->filename = $filename;
121135
$this->parentTest = $parentTest;
122136
$this->deprecated = $deprecated;
137+
$this->hasWebApiAuthAction = false;
123138
}
124139

125140
/**
@@ -230,7 +245,11 @@ public function getEstimatedDuration()
230245

231246
$testTime = $this->calculateWeightedActionTimes($this->getOrderedActions());
232247

233-
return $hookTime + $testTime;
248+
if ($this->hasWebApiAuthAction) {
249+
return $hookTime + $testTime + self::WEBAPI_AUTH_TEST_ACTION_WEIGHT;
250+
} else {
251+
return $hookTime + $testTime;
252+
}
234253
}
235254

236255
/**
@@ -245,6 +264,11 @@ private function calculateWeightedActionTimes($actions)
245264
// search for any actions of special type
246265
foreach ($actions as $action) {
247266
/** @var ActionObject $action */
267+
268+
if (!$this->hasWebApiAuthAction && in_array($action->getType(), self::WEBAPI_AUTH_TEST_ACTIONS)) {
269+
$this->hasWebApiAuthAction = true;
270+
}
271+
248272
if (array_key_exists($action->getType(), self::TEST_ACTION_WEIGHT)) {
249273
$weight = self::TEST_ACTION_WEIGHT[$action->getType()];
250274
if ($weight === self::WAIT_TIME_ATTRIBUTE) {

0 commit comments

Comments
 (0)