Skip to content

Commit ed94ab4

Browse files
committed
MQE-1189: Suite Generation - Precondition body must always get and reset driver
- bug fix
1 parent 487a9c0 commit ed94ab4

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/Magento/FunctionalTestingFramework/Suite/Generators/GroupClassGenerator.php

+3-11
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,15 @@ private function extractClassVar($beforeArray, $afterArray)
129129
*/
130130
private function buildHookMustacheArray($hookObj)
131131
{
132-
$mustacheHookArray = [];
133132
$actions = [];
134-
$hasWebDriverActions = false;
133+
$mustacheHookArray['actions'][] = ['webDriverInit' => true];
135134

136135
foreach ($hookObj->getActions() as $action) {
137136
/** @var ActionObject $action */
138137
$index = count($actions);
139138
//deleteData contains either url or createDataKey, if it contains the former it needs special formatting
140139
if ($action->getType() !== "createData"
141140
&& !array_key_exists(TestGenerator::REQUIRED_ENTITY_REFERENCE, $action->getCustomActionAttributes())) {
142-
if (!$hasWebDriverActions) {
143-
$hasWebDriverActions = true;
144-
}
145-
146141
$actions = $this->buildWebDriverActionsMustacheArray($action, $actions, $index);
147142
continue;
148143
}
@@ -159,11 +154,8 @@ private function buildHookMustacheArray($hookObj)
159154
$entityArray = $this->buildPersistenceMustacheArray($action, $entityArray);
160155
$actions[$index] = $entityArray;
161156
}
162-
$mustacheHookArray['actions'] = $actions;
163-
if ($hasWebDriverActions) {
164-
array_unshift($mustacheHookArray['actions'], ['webDriverInit' => true]);
165-
$mustacheHookArray['actions'][] = ['webDriverReset' => true];
166-
}
157+
$mustacheHookArray['actions'] = array_merge($mustacheHookArray['actions'], $actions);
158+
$mustacheHookArray['actions'][] = ['webDriverReset' => true];
167159

168160
return $mustacheHookArray;
169161
}

0 commit comments

Comments
 (0)