diff --git a/src/Magento/FunctionalTestingFramework/Suite/Generators/GroupClassGenerator.php b/src/Magento/FunctionalTestingFramework/Suite/Generators/GroupClassGenerator.php index 2b9662a1a..2e062f235 100644 --- a/src/Magento/FunctionalTestingFramework/Suite/Generators/GroupClassGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Suite/Generators/GroupClassGenerator.php @@ -129,9 +129,8 @@ private function extractClassVar($beforeArray, $afterArray) */ private function buildHookMustacheArray($hookObj) { - $mustacheHookArray = []; $actions = []; - $hasWebDriverActions = false; + $mustacheHookArray['actions'][] = ['webDriverInit' => true]; foreach ($hookObj->getActions() as $action) { /** @var ActionObject $action */ @@ -139,10 +138,6 @@ private function buildHookMustacheArray($hookObj) //deleteData contains either url or createDataKey, if it contains the former it needs special formatting if ($action->getType() !== "createData" && !array_key_exists(TestGenerator::REQUIRED_ENTITY_REFERENCE, $action->getCustomActionAttributes())) { - if (!$hasWebDriverActions) { - $hasWebDriverActions = true; - } - $actions = $this->buildWebDriverActionsMustacheArray($action, $actions, $index); continue; } @@ -159,11 +154,8 @@ private function buildHookMustacheArray($hookObj) $entityArray = $this->buildPersistenceMustacheArray($action, $entityArray); $actions[$index] = $entityArray; } - $mustacheHookArray['actions'] = $actions; - if ($hasWebDriverActions) { - array_unshift($mustacheHookArray['actions'], ['webDriverInit' => true]); - $mustacheHookArray['actions'][] = ['webDriverReset' => true]; - } + $mustacheHookArray['actions'] = array_merge($mustacheHookArray['actions'], $actions); + $mustacheHookArray['actions'][] = ['webDriverReset' => true]; return $mustacheHookArray; }