From 66fb4c2809afe7897f4b1c59c722b57f5bba4720 Mon Sep 17 00:00:00 2001 From: John S Date: Tue, 11 Jun 2019 15:30:49 -0500 Subject: [PATCH 01/34] MQE-1427: Support _CREDS in action and in Data - Adding new logic to support _CREDS in magentoCLI, createData and updateData. --- .../Module/MagentoWebDriver.php | 20 +++++- .../Test/Util/ActionMergeUtil.php | 72 ++++++++++++++++--- 2 files changed, 83 insertions(+), 9 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index 93e6a5968..7ec9a3088 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -14,6 +14,7 @@ use Codeception\Exception\ModuleException; use Codeception\Util\Uri; use Magento\FunctionalTestingFramework\DataGenerator\Handlers\CredentialStore; +use Magento\FunctionalTestingFramework\DataGenerator\Handlers\PersistedObjectHandler; use Magento\FunctionalTestingFramework\DataGenerator\Persist\Curl\WebapiExecutor; use Magento\FunctionalTestingFramework\Util\Protocol\CurlTransport; use Magento\FunctionalTestingFramework\Util\Protocol\CurlInterface; @@ -620,7 +621,7 @@ public function dragAndDrop($source, $target, $xOffset = null, $yOffset = null) } /** - * Function used to fill sensitive crednetials with user data, data is decrypted immediately prior to fill to avoid + * Function used to fill sensitive credentials with user data, data is decrypted immediately prior to fill to avoid * exposure in console or log. * * @param string $field @@ -636,6 +637,23 @@ public function fillSecretField($field, $value) $this->fillField($field, $decryptedValue); } + /** + * @param string $key + * @param string $scope + * @param string $entity + * @param array $requiredEntity + * @param object $overrideFields + * @throws \Exception + */ + public function createSecretData($key, $scope, $entity, $requiredEntity, $overrideFields) + { + // to protect any secrets from being printed to console the values are executed only at the webdriver level as a + // decrypted value + + $decryptedValue = CredentialStore::getInstance()->decryptSecretValue($overrideFields); + PersistedObjectHandler::getInstance()->createEntity($key, $scope, $entity, $requiredEntity, $decryptedValue); + } + /** * Override for _failed method in Codeception method. Adds png and html attachments to allure report * following parent execution of test failure processing. diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index 65fe7c857..af2d5954c 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -95,7 +95,7 @@ public function resolveActionSteps($parsedSteps, $skipActionGroupResolution = fa /** * Takes an array of actions and resolves any references to secret fields. The function then validates whether the - * refernece is valid and replaces the function name accordingly to hide arguments at runtime. + * reference is valid and replaces the function name accordingly to hide arguments at runtime. * * @param ActionObject[] $resolvedActions * @return ActionObject[] @@ -106,13 +106,16 @@ private function resolveSecretFieldAccess($resolvedActions) $actions = []; foreach ($resolvedActions as $resolvedAction) { $action = $resolvedAction; - $hasSecretRef = $this->actionAttributeContainsSecretRef($resolvedAction->getCustomActionAttributes()); + $actionHasSecretRef = $this->actionAttributeContainsSecretRef($resolvedAction->getCustomActionAttributes()); + $dataHasSecretRef = $this->dataFieldContainsSecretRef($resolvedAction->getCustomActionAttributes()); + $approvedActions = array('fillField', 'magentoCLI', 'field', 'updateData'); + $actionType = $resolvedAction->getType(); - if ($resolvedAction->getType() !== 'fillField' && $hasSecretRef) { - throw new TestReferenceException("You cannot reference secret data outside of fill field actions"); + if (!(in_array($resolvedAction->getType(), $approvedActions)) && ($actionHasSecretRef || $dataHasSecretRef)) { + throw new TestReferenceException("You cannot reference secret data outside of the fillField, magentoCli and createData actions"); } - if ($resolvedAction->getType() === 'fillField' && $hasSecretRef) { + if ($actionType === 'fillField' && $actionHasSecretRef) { $action = new ActionObject( $action->getStepKey(), 'fillSecretField', @@ -122,6 +125,36 @@ private function resolveSecretFieldAccess($resolvedActions) ); } + if ($actionType === 'magentoCLI' && $actionHasSecretRef) { + $action = new ActionObject( + $action->getStepKey(), + 'magentoCliSecretData', + $action->getCustomActionAttributes(), + $action->getLinkedAction(), + $action->getActionOrigin() + ); + } + + if ($actionType === 'createData' && $dataHasSecretRef) { + $action = new ActionObject( + $action->getStepKey(), + 'createData', + $action->getCustomActionAttributes(), + $action->getLinkedAction(), + $action->getActionOrigin() + ); + } + + if ($actionType === 'updateData' && $actionHasSecretRef) { + $action = new ActionObject( + $action->getStepKey(), + 'updateData', + $action->getCustomActionAttributes(), + $action->getLinkedAction(), + $action->getActionOrigin() + ); + } + $actions[$action->getStepKey()] = $action; } @@ -151,6 +184,29 @@ private function actionAttributeContainsSecretRef($actionAttributes) return false; } + /** + * Returns a boolean based on whether or not the createData field contains a reference to a secret field. + * + * @param array $dataFields + * @return boolean + */ + private function dataFieldContainsSecretRef($dataFields) + { + foreach ($dataFields as $dataField) { + if (is_array($dataField)) { + return $this->dataFieldContainsSecretRef($dataField); + } + + preg_match_all("/{{_CREDS\.([\w]+)}}/", $dataField, $matches); + + if (!empty($matches[0])) { + return true; + } + } + + return false; + } + /** * Method to resolve action group references and insert relevant actions into step flow * @@ -320,9 +376,9 @@ private function mergeAction($stepToMerge) private function insertStep($stepToMerge) { $position = array_search( - $stepToMerge->getLinkedAction(), - array_keys($this->orderedSteps) - ) + $stepToMerge->getOrderOffset(); + $stepToMerge->getLinkedAction(), + array_keys($this->orderedSteps) + ) + $stepToMerge->getOrderOffset(); $previous_items = array_slice($this->orderedSteps, 0, $position, true); $next_items = array_slice($this->orderedSteps, $position, null, true); $this->orderedSteps = $previous_items + [$stepToMerge->getStepKey() => $stepToMerge] + $next_items; From 55e64217ee1ab4284676c214e99bd42259ebe122 Mon Sep 17 00:00:00 2001 From: John S Date: Tue, 11 Jun 2019 15:33:48 -0500 Subject: [PATCH 02/34] MQE-1427: Support _CREDS in action and in Data - Removing "updateData", does NOT contain a . --- .../Test/Util/ActionMergeUtil.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index af2d5954c..c0204f070 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -108,7 +108,7 @@ private function resolveSecretFieldAccess($resolvedActions) $action = $resolvedAction; $actionHasSecretRef = $this->actionAttributeContainsSecretRef($resolvedAction->getCustomActionAttributes()); $dataHasSecretRef = $this->dataFieldContainsSecretRef($resolvedAction->getCustomActionAttributes()); - $approvedActions = array('fillField', 'magentoCLI', 'field', 'updateData'); + $approvedActions = array('fillField', 'magentoCLI', 'field'); $actionType = $resolvedAction->getType(); if (!(in_array($resolvedAction->getType(), $approvedActions)) && ($actionHasSecretRef || $dataHasSecretRef)) { @@ -145,16 +145,6 @@ private function resolveSecretFieldAccess($resolvedActions) ); } - if ($actionType === 'updateData' && $actionHasSecretRef) { - $action = new ActionObject( - $action->getStepKey(), - 'updateData', - $action->getCustomActionAttributes(), - $action->getLinkedAction(), - $action->getActionOrigin() - ); - } - $actions[$action->getStepKey()] = $action; } From 5fc6347bdf151897d78880d20b01352eb5d69e00 Mon Sep 17 00:00:00 2001 From: John S Date: Thu, 13 Jun 2019 09:19:00 -0500 Subject: [PATCH 03/34] MQE-1427: Support _CREDS in action and in Data - Correcting the magentoCLI action when secret data is present. - Adding support for createData when secret data is present. --- .../Module/MagentoWebDriver.php | 15 +++++---------- .../Test/Util/ActionMergeUtil.php | 12 +----------- .../Util/TestGenerator.php | 11 ++++++++++- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index 7ec9a3088..3af508ecf 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -14,7 +14,6 @@ use Codeception\Exception\ModuleException; use Codeception\Util\Uri; use Magento\FunctionalTestingFramework\DataGenerator\Handlers\CredentialStore; -use Magento\FunctionalTestingFramework\DataGenerator\Handlers\PersistedObjectHandler; use Magento\FunctionalTestingFramework\DataGenerator\Persist\Curl\WebapiExecutor; use Magento\FunctionalTestingFramework\Util\Protocol\CurlTransport; use Magento\FunctionalTestingFramework\Util\Protocol\CurlInterface; @@ -638,20 +637,16 @@ public function fillSecretField($field, $value) } /** - * @param string $key - * @param string $scope - * @param string $entity - * @param array $requiredEntity - * @param object $overrideFields - * @throws \Exception + * @param string $command + * @throws TestFrameworkException */ - public function createSecretData($key, $scope, $entity, $requiredEntity, $overrideFields) + public function magentoCliSecret($command) { // to protect any secrets from being printed to console the values are executed only at the webdriver level as a // decrypted value - $decryptedValue = CredentialStore::getInstance()->decryptSecretValue($overrideFields); - PersistedObjectHandler::getInstance()->createEntity($key, $scope, $entity, $requiredEntity, $decryptedValue); + $decryptedCommand = CredentialStore::getInstance()->decryptSecretValue($command); + $this->magentoCLI($decryptedCommand); } /** diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index c0204f070..2e5e3eada 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -128,17 +128,7 @@ private function resolveSecretFieldAccess($resolvedActions) if ($actionType === 'magentoCLI' && $actionHasSecretRef) { $action = new ActionObject( $action->getStepKey(), - 'magentoCliSecretData', - $action->getCustomActionAttributes(), - $action->getLinkedAction(), - $action->getActionOrigin() - ); - } - - if ($actionType === 'createData' && $dataHasSecretRef) { - $action = new ActionObject( - $action->getStepKey(), - 'createData', + 'magentoCLI', $action->getCustomActionAttributes(), $action->getLinkedAction(), $action->getActionOrigin() diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index 07cb96b3a..353c248d3 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -1267,7 +1267,16 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato $actionObject->getActionOrigin() )[0]; $argRef = "\t\t\$"; - $argRef .= str_replace(ucfirst($fieldKey), "", $stepKey) . "Fields['{$fieldKey}'] = ${input};\n"; + + preg_match_all("/{{_CREDS\.([\w]+)}}/", "${input}", $matches); + + if (!empty($matches[0])) { + $secretFieldValue = $matches[1][0]; + $argRef .= str_replace(ucfirst($fieldKey), "", $stepKey) . "Fields['{$fieldKey}'] = CredentialStore::getInstance()->decryptSecretValue(CredentialStore::getInstance()->getSecret(\"{$secretFieldValue}\"));\n"; + } else { + $argRef .= str_replace(ucfirst($fieldKey), "", $stepKey) . "Fields['{$fieldKey}'] = ${input};\n"; + } + $testSteps .= $argRef; break; case "generateDate": From d9060d7a96018cbdc60c764f9a46c6ae63c26a53 Mon Sep 17 00:00:00 2001 From: John S Date: Fri, 14 Jun 2019 08:54:43 -0500 Subject: [PATCH 04/34] MQE-1427: Support _CREDS in action and in Data - Adding a missing annotation to a doc block. - Adjusting line lengths. - Replaced array with short array. --- .../Module/MagentoWebDriver.php | 1 + .../Test/Util/ActionMergeUtil.php | 11 ++++++----- .../FunctionalTestingFramework/Util/TestGenerator.php | 6 ++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index 3af508ecf..ae0d7ac6c 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -639,6 +639,7 @@ public function fillSecretField($field, $value) /** * @param string $command * @throws TestFrameworkException + * @return void */ public function magentoCliSecret($command) { diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index 2e5e3eada..be186c9af 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -108,11 +108,12 @@ private function resolveSecretFieldAccess($resolvedActions) $action = $resolvedAction; $actionHasSecretRef = $this->actionAttributeContainsSecretRef($resolvedAction->getCustomActionAttributes()); $dataHasSecretRef = $this->dataFieldContainsSecretRef($resolvedAction->getCustomActionAttributes()); - $approvedActions = array('fillField', 'magentoCLI', 'field'); + $approvedActions = ['fillField', 'magentoCLI', 'field']; $actionType = $resolvedAction->getType(); - if (!(in_array($resolvedAction->getType(), $approvedActions)) && ($actionHasSecretRef || $dataHasSecretRef)) { - throw new TestReferenceException("You cannot reference secret data outside of the fillField, magentoCli and createData actions"); + if (!(in_array($resolvedAction->getType(),$approvedActions)) && ($actionHasSecretRef||$dataHasSecretRef)) { + throw new TestReferenceException("You cannot reference secret data outside " . + "of the fillField, magentoCli and createData actions"); } if ($actionType === 'fillField' && $actionHasSecretRef) { @@ -356,8 +357,8 @@ private function mergeAction($stepToMerge) private function insertStep($stepToMerge) { $position = array_search( - $stepToMerge->getLinkedAction(), - array_keys($this->orderedSteps) + $stepToMerge->getLinkedAction(), + array_keys($this->orderedSteps) ) + $stepToMerge->getOrderOffset(); $previous_items = array_slice($this->orderedSteps, 0, $position, true); $next_items = array_slice($this->orderedSteps, $position, null, true); diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index 353c248d3..3990cfb32 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -1272,9 +1272,11 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato if (!empty($matches[0])) { $secretFieldValue = $matches[1][0]; - $argRef .= str_replace(ucfirst($fieldKey), "", $stepKey) . "Fields['{$fieldKey}'] = CredentialStore::getInstance()->decryptSecretValue(CredentialStore::getInstance()->getSecret(\"{$secretFieldValue}\"));\n"; + $argRef .= str_replace(ucfirst($fieldKey), "", $stepKey) . + "Fields['{$fieldKey}'] = CredentialStore::getInstance()->decryptSecretValue(" . + "CredentialStore::getInstance()->getSecret(\"{$secretFieldValue}\"));\n"; } else { - $argRef .= str_replace(ucfirst($fieldKey), "", $stepKey) . "Fields['{$fieldKey}'] = ${input};\n"; + $argRef .= str_replace(ucfirst($fieldKey), "", $stepKey)."Fields['{$fieldKey}'] = ${input};\n"; } $testSteps .= $argRef; From 6dcd2f4e72b8d2b1bf21a7ed0a358de53f8ca954 Mon Sep 17 00:00:00 2001 From: John S Date: Fri, 14 Jun 2019 09:21:21 -0500 Subject: [PATCH 05/34] MQE-1427: Support _CREDS in action and in Data - Adjusting line lengths. --- .../FunctionalTestingFramework/Test/Util/ActionMergeUtil.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index be186c9af..9d17c62fc 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -111,7 +111,8 @@ private function resolveSecretFieldAccess($resolvedActions) $approvedActions = ['fillField', 'magentoCLI', 'field']; $actionType = $resolvedAction->getType(); - if (!(in_array($resolvedAction->getType(),$approvedActions)) && ($actionHasSecretRef||$dataHasSecretRef)) { + if (!(in_array($resolvedAction->getType(), $approvedActions)) && + ($actionHasSecretRef || $dataHasSecretRef)) { throw new TestReferenceException("You cannot reference secret data outside " . "of the fillField, magentoCli and createData actions"); } @@ -359,7 +360,7 @@ private function insertStep($stepToMerge) $position = array_search( $stepToMerge->getLinkedAction(), array_keys($this->orderedSteps) - ) + $stepToMerge->getOrderOffset(); + ) + $stepToMerge->getOrderOffset(); $previous_items = array_slice($this->orderedSteps, 0, $position, true); $next_items = array_slice($this->orderedSteps, $position, null, true); $this->orderedSteps = $previous_items + [$stepToMerge->getStepKey() => $stepToMerge] + $next_items; From 7b8de7e98346a346992b08b179c6840b3b969e3c Mon Sep 17 00:00:00 2001 From: John S Date: Fri, 14 Jun 2019 13:32:23 -0500 Subject: [PATCH 06/34] MQE-1427: Support _CREDS in action and in Data - Replacing getter functions with a variable. --- .../FunctionalTestingFramework/Test/Util/ActionMergeUtil.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index 9d17c62fc..f9b61baf6 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -111,7 +111,7 @@ private function resolveSecretFieldAccess($resolvedActions) $approvedActions = ['fillField', 'magentoCLI', 'field']; $actionType = $resolvedAction->getType(); - if (!(in_array($resolvedAction->getType(), $approvedActions)) && + if (!(in_array($actionType, $approvedActions)) && ($actionHasSecretRef || $dataHasSecretRef)) { throw new TestReferenceException("You cannot reference secret data outside " . "of the fillField, magentoCli and createData actions"); From acf87b6d9f21b7d8d5722f5ee620cfba800242d0 Mon Sep 17 00:00:00 2001 From: John S Date: Fri, 14 Jun 2019 13:34:48 -0500 Subject: [PATCH 07/34] MQE-1427: Support _CREDS in action and in Data - Removing duplicate function. --- .../FunctionalTestingFramework/Test/Util/ActionMergeUtil.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index f9b61baf6..9844bf525 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -107,12 +107,10 @@ private function resolveSecretFieldAccess($resolvedActions) foreach ($resolvedActions as $resolvedAction) { $action = $resolvedAction; $actionHasSecretRef = $this->actionAttributeContainsSecretRef($resolvedAction->getCustomActionAttributes()); - $dataHasSecretRef = $this->dataFieldContainsSecretRef($resolvedAction->getCustomActionAttributes()); $approvedActions = ['fillField', 'magentoCLI', 'field']; $actionType = $resolvedAction->getType(); - if (!(in_array($actionType, $approvedActions)) && - ($actionHasSecretRef || $dataHasSecretRef)) { + if (!(in_array($actionType, $approvedActions)) && $actionHasSecretRef) { throw new TestReferenceException("You cannot reference secret data outside " . "of the fillField, magentoCli and createData actions"); } From b0e821f473099ab2b532954d126e42d555fdeac3 Mon Sep 17 00:00:00 2001 From: John S Date: Fri, 14 Jun 2019 13:38:22 -0500 Subject: [PATCH 08/34] MQE-1427: Support _CREDS in action and in Data - Adding docblock description. --- .../FunctionalTestingFramework/Module/MagentoWebDriver.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index ae0d7ac6c..3056484df 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -637,6 +637,9 @@ public function fillSecretField($field, $value) } /** + * Function used to create data that contains sensitive credentials in a override. + * The data is decrypted immediately prior to data creation to avoid exposure in console or log. + * * @param string $command * @throws TestFrameworkException * @return void From 847e5fff8488457f23dbedcb87c77e1ec8750023 Mon Sep 17 00:00:00 2001 From: John S Date: Fri, 14 Jun 2019 14:56:19 -0500 Subject: [PATCH 09/34] MQE-1427: Support _CREDS in action and in Data - Replacing my logic for decrypting the value with existing logic I was unaware of. --- .../Util/TestGenerator.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index 3990cfb32..6ab5b1cc3 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -1268,16 +1268,9 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato )[0]; $argRef = "\t\t\$"; - preg_match_all("/{{_CREDS\.([\w]+)}}/", "${input}", $matches); - - if (!empty($matches[0])) { - $secretFieldValue = $matches[1][0]; - $argRef .= str_replace(ucfirst($fieldKey), "", $stepKey) . - "Fields['{$fieldKey}'] = CredentialStore::getInstance()->decryptSecretValue(" . - "CredentialStore::getInstance()->getSecret(\"{$secretFieldValue}\"));\n"; - } else { - $argRef .= str_replace(ucfirst($fieldKey), "", $stepKey)."Fields['{$fieldKey}'] = ${input};\n"; - } + $input = $this->resolveAllRuntimeReferences([$input])[0]; + $argRef .= str_replace(ucfirst($fieldKey), "", $stepKey) . + "Fields['{$fieldKey}'] = ${input};\n"; $testSteps .= $argRef; break; From eeb174a1199ea8040f482a5df6282849a8cb6231 Mon Sep 17 00:00:00 2001 From: John S Date: Mon, 17 Jun 2019 09:16:15 -0500 Subject: [PATCH 10/34] MQE-1427: Support _CREDS in action and in Data - Replacing my logic with a cleaner version. --- .../Test/Util/ActionMergeUtil.php | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index 9844bf525..ebe8ec3fa 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -108,32 +108,25 @@ private function resolveSecretFieldAccess($resolvedActions) $action = $resolvedAction; $actionHasSecretRef = $this->actionAttributeContainsSecretRef($resolvedAction->getCustomActionAttributes()); $approvedActions = ['fillField', 'magentoCLI', 'field']; + $secretMapping = ['fillField' => 'fillSecretField']; $actionType = $resolvedAction->getType(); - if (!(in_array($actionType, $approvedActions)) && $actionHasSecretRef) { + if ($actionHasSecretRef && !(in_array($actionType, $approvedActions))) { throw new TestReferenceException("You cannot reference secret data outside " . - "of the fillField, magentoCli and createData actions"); + "of the fillField, magentoCli and createData actions"); } - if ($actionType === 'fillField' && $actionHasSecretRef) { - $action = new ActionObject( - $action->getStepKey(), - 'fillSecretField', - $action->getCustomActionAttributes(), - $action->getLinkedAction(), - $action->getActionOrigin() - ); + if (isset($secretMapping[$actionType])) { + $actionType = $secretMapping[$actionType]; } - if ($actionType === 'magentoCLI' && $actionHasSecretRef) { - $action = new ActionObject( - $action->getStepKey(), - 'magentoCLI', - $action->getCustomActionAttributes(), - $action->getLinkedAction(), - $action->getActionOrigin() - ); - } + $action = new ActionObject( + $action->getStepKey(), + $actionType, + $action->getCustomActionAttributes(), + $action->getLinkedAction(), + $action->getActionOrigin() + ); $actions[$action->getStepKey()] = $action; } From 352b660db32a04483a40a4a87c7e17a7379408bc Mon Sep 17 00:00:00 2001 From: John S Date: Mon, 17 Jun 2019 09:20:51 -0500 Subject: [PATCH 11/34] MQE-1427: Support _CREDS in action and in Data - Correcting exception. --- .../FunctionalTestingFramework/Test/Util/ActionMergeUtil.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index ebe8ec3fa..84bd7948e 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -290,7 +290,7 @@ private function insertReadinessSkips() * * @param array $parsedSteps * @return void - * @throws XmlException + * @throws TestReferenceException */ private function sortActions($parsedSteps) { From 0eaaa01727e48ff9ddc4289a8806b75a864e1788 Mon Sep 17 00:00:00 2001 From: John S Date: Mon, 17 Jun 2019 09:59:45 -0500 Subject: [PATCH 12/34] MQE-1427: Support _CREDS in action and in Data - Removing unused function. --- .../Test/Util/ActionMergeUtil.php | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index 84bd7948e..344254cd1 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -157,29 +157,6 @@ private function actionAttributeContainsSecretRef($actionAttributes) return false; } - /** - * Returns a boolean based on whether or not the createData field contains a reference to a secret field. - * - * @param array $dataFields - * @return boolean - */ - private function dataFieldContainsSecretRef($dataFields) - { - foreach ($dataFields as $dataField) { - if (is_array($dataField)) { - return $this->dataFieldContainsSecretRef($dataField); - } - - preg_match_all("/{{_CREDS\.([\w]+)}}/", $dataField, $matches); - - if (!empty($matches[0])) { - return true; - } - } - - return false; - } - /** * Method to resolve action group references and insert relevant actions into step flow * From f83c8934bc8ec53b70b8e9154c70d77988df5363 Mon Sep 17 00:00:00 2001 From: John S Date: Mon, 17 Jun 2019 10:59:39 -0500 Subject: [PATCH 13/34] MQE-1427: Support _CREDS in action and in Data - Adding const. - Referencing const values. --- .../Test/Util/ActionMergeUtil.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index 344254cd1..21fa4bfda 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -29,6 +29,8 @@ class ActionMergeUtil const DEFAULT_SKIP_ON_ORDER = 'before'; const DEFAULT_SKIP_OFF_ORDER = 'after'; const DEFAULT_WAIT_ORDER = 'after'; + const APPROVED_ACTIONS = ['fillField', 'magentoCLI', 'field']; + const SECRET_MAPPING = ['fillField' => 'fillSecretField']; /** * Array holding final resulting steps @@ -107,17 +109,15 @@ private function resolveSecretFieldAccess($resolvedActions) foreach ($resolvedActions as $resolvedAction) { $action = $resolvedAction; $actionHasSecretRef = $this->actionAttributeContainsSecretRef($resolvedAction->getCustomActionAttributes()); - $approvedActions = ['fillField', 'magentoCLI', 'field']; - $secretMapping = ['fillField' => 'fillSecretField']; $actionType = $resolvedAction->getType(); - if ($actionHasSecretRef && !(in_array($actionType, $approvedActions))) { + if ($actionHasSecretRef && !(in_array($actionType, self::APPROVED_ACTIONS))) { throw new TestReferenceException("You cannot reference secret data outside " . "of the fillField, magentoCli and createData actions"); } - if (isset($secretMapping[$actionType])) { - $actionType = $secretMapping[$actionType]; + if (isset(self::SECRET_MAPPING[$actionType])) { + $actionType = self::SECRET_MAPPING[$actionType]; } $action = new ActionObject( From 2d5e178431911e52d4f4c5f882b83c719dd5b483 Mon Sep 17 00:00:00 2001 From: John S Date: Tue, 18 Jun 2019 09:15:23 -0500 Subject: [PATCH 14/34] MQE-1427: Support _CREDS in action and in Data - Correcting a failing static test. Assert was not properly configured originally. --- .../Test/Util/ActionMergeUtilTest.php | 2 +- .../Test/Objects/ActionObject.php | 2 +- .../Test/Util/ActionMergeUtil.php | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php index 0f367c226..1abd67680 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php @@ -168,7 +168,7 @@ public function testInsertWait() 'waitForPageLoad', ['timeout' => 42], 'actionKey1', - 0 + 'after' ); $this->assertEquals($expected, $actual); } diff --git a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php index 8a3bb27a6..f073eb837 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php +++ b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php @@ -153,7 +153,7 @@ public function __construct( $this->linkedAction = $linkedAction; $this->actionOrigin = $actionOrigin; - if ($order == ActionObject::MERGE_ACTION_ORDER_AFTER) { + if ($order === ActionObject::MERGE_ACTION_ORDER_AFTER) { $this->orderOffset = 1; } } diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index 21fa4bfda..2a09173b3 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -116,15 +116,20 @@ private function resolveSecretFieldAccess($resolvedActions) "of the fillField, magentoCli and createData actions"); } - if (isset(self::SECRET_MAPPING[$actionType])) { - $actionType = self::SECRET_MAPPING[$actionType]; + // Do NOT remap actions that don't need it. + if (!isset(self::SECRET_MAPPING[$actionType])) { + $actions[$action->getStepKey()] = $action; + continue; } + $actionType = self::SECRET_MAPPING[$actionType]; + $action = new ActionObject( $action->getStepKey(), $actionType, $action->getCustomActionAttributes(), $action->getLinkedAction(), + $action->getOrderOffset(), $action->getActionOrigin() ); From 7a1a4e56dff2d4e1828cdfad0638c7f62993de7e Mon Sep 17 00:00:00 2001 From: John S Date: Tue, 18 Jun 2019 10:19:16 -0500 Subject: [PATCH 15/34] MQE-1427: Support _CREDS in action and in Data - Adding verification test. --- .../Test/SecretCredentialDataTest.xml | 27 +++++++++ .../Tests/SecretCredentialDataTest.php | 57 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 dev/tests/verification/TestModule/Test/SecretCredentialDataTest.xml create mode 100644 dev/tests/verification/Tests/SecretCredentialDataTest.php diff --git a/dev/tests/verification/TestModule/Test/SecretCredentialDataTest.xml b/dev/tests/verification/TestModule/Test/SecretCredentialDataTest.xml new file mode 100644 index 000000000..7e39fdf0a --- /dev/null +++ b/dev/tests/verification/TestModule/Test/SecretCredentialDataTest.xml @@ -0,0 +1,27 @@ + + + + + + + 123 + 12.34 + + + {{_CREDS.payment_authorizenet_trans_key}} + {{_CREDS.carriers_dhl_account_eu}} + + + + + + + + + diff --git a/dev/tests/verification/Tests/SecretCredentialDataTest.php b/dev/tests/verification/Tests/SecretCredentialDataTest.php new file mode 100644 index 000000000..8893f91b6 --- /dev/null +++ b/dev/tests/verification/Tests/SecretCredentialDataTest.php @@ -0,0 +1,57 @@ +amGoingTo("create entity that has the stepKey: createProductWithFieldOverridesUsingHardcodedData1"); + PersistedObjectHandler::getInstance()->createEntity( + "createProductWithFieldOverridesUsingHardcodedData1", + "test", + "_defaultProduct", + [], + $createProductWithFieldOverridesUsingHardcodedData1Fields + ); + $createProductWithFieldOverridesUsingSecretCredData1Fields['qty'] = CredentialStore::getInstance()->getSecret("payment_authorizenet_trans_key"); + $createProductWithFieldOverridesUsingSecretCredData1Fields['price'] = CredentialStore::getInstance()->getSecret("carriers_dhl_account_eu"); + $I->amGoingTo("create entity that has the stepKey: createProductWithFieldOverridesUsingSecretCredData1"); + PersistedObjectHandler::getInstance()->createEntity( + "createProductWithFieldOverridesUsingSecretCredData1", + "test", + "_defaultProduct", + [], + $createProductWithFieldOverridesUsingSecretCredData1Fields + ); + $I->fillSecretField("#username", "Hardcoded"); + $I->fillSecretField("#username", CredentialStore::getInstance()->getSecret("carriers_dhl_id_eu")); + $magentoCliUsingHardcodedData1 = $I->magentoCLI("config:set cms/wysiwyg/enabled 0"); + $I->comment($magentoCliUsingHardcodedData1); + $magentoCliUsingSecretCredData1 = $I->magentoCLI("config:set cms/wysiwyg/enabled " . CredentialStore::getInstance()->getSecret("payment_authorizenet_login")); + $I->comment($magentoCliUsingSecretCredData1); + } +} From ad99e9623ce8f3a5291423bfc4319aa5b5b4ad3a Mon Sep 17 00:00:00 2001 From: John S Date: Tue, 18 Jun 2019 13:42:28 -0500 Subject: [PATCH 16/34] MQE-1427: Support _CREDS in action and in Data - Correcting if logic for non-secret actions. --- .../TestModule/Test/SecretCredentialDataTest.xml | 2 +- .../Test/Util/ActionMergeUtil.php | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/dev/tests/verification/TestModule/Test/SecretCredentialDataTest.xml b/dev/tests/verification/TestModule/Test/SecretCredentialDataTest.xml index 7e39fdf0a..3c403cdb9 100644 --- a/dev/tests/verification/TestModule/Test/SecretCredentialDataTest.xml +++ b/dev/tests/verification/TestModule/Test/SecretCredentialDataTest.xml @@ -7,7 +7,7 @@ --> + xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> 123 diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index 2a09173b3..a1d54f6ae 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -117,13 +117,10 @@ private function resolveSecretFieldAccess($resolvedActions) } // Do NOT remap actions that don't need it. - if (!isset(self::SECRET_MAPPING[$actionType])) { - $actions[$action->getStepKey()] = $action; - continue; + if (isset(self::SECRET_MAPPING[$actionType])) { + $actionType = self::SECRET_MAPPING[$actionType]; } - $actionType = self::SECRET_MAPPING[$actionType]; - $action = new ActionObject( $action->getStepKey(), $actionType, From d1b3be395f7f65effa07153491b53f8ccbc1ba74 Mon Sep 17 00:00:00 2001 From: John S Date: Tue, 18 Jun 2019 14:07:31 -0500 Subject: [PATCH 17/34] MQE-1427: Support _CREDS in action and in Data - Correcting static test. --- .../FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php index 1abd67680..0f367c226 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php @@ -168,7 +168,7 @@ public function testInsertWait() 'waitForPageLoad', ['timeout' => 42], 'actionKey1', - 'after' + 0 ); $this->assertEquals($expected, $actual); } From 6cf64008992563282e5bd9c46262f70bb7cd3c44 Mon Sep 17 00:00:00 2001 From: John S Date: Tue, 18 Jun 2019 15:51:16 -0500 Subject: [PATCH 18/34] MQE-1427: Support _CREDS in action and in Data - Correcting ActionMergeUtil so it doesn't use fillSecretField when the creds aren't present. --- .../FunctionalTestingFramework/Test/Util/ActionMergeUtil.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index a1d54f6ae..946739fc6 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -117,7 +117,7 @@ private function resolveSecretFieldAccess($resolvedActions) } // Do NOT remap actions that don't need it. - if (isset(self::SECRET_MAPPING[$actionType])) { + if (isset(self::SECRET_MAPPING[$actionType]) && $actionHasSecretRef) { $actionType = self::SECRET_MAPPING[$actionType]; } From 1e22a8c79d913f4dc71710c456e46d3fd3ae2e1b Mon Sep 17 00:00:00 2001 From: John S Date: Wed, 19 Jun 2019 08:59:31 -0500 Subject: [PATCH 19/34] MQE-1427: Support _CREDS in action and in Data - Correcting an issue in the verification test. --- dev/tests/verification/Tests/SecretCredentialDataTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/verification/Tests/SecretCredentialDataTest.php b/dev/tests/verification/Tests/SecretCredentialDataTest.php index 8893f91b6..1be5b4c41 100644 --- a/dev/tests/verification/Tests/SecretCredentialDataTest.php +++ b/dev/tests/verification/Tests/SecretCredentialDataTest.php @@ -47,7 +47,7 @@ public function SecretCredentialDataTest(AcceptanceTester $I) [], $createProductWithFieldOverridesUsingSecretCredData1Fields ); - $I->fillSecretField("#username", "Hardcoded"); + $I->fillField("#username", "Hardcoded"); $I->fillSecretField("#username", CredentialStore::getInstance()->getSecret("carriers_dhl_id_eu")); $magentoCliUsingHardcodedData1 = $I->magentoCLI("config:set cms/wysiwyg/enabled 0"); $I->comment($magentoCliUsingHardcodedData1); From fd66a0cd066d25ca7ae641ba219d88ff84148ebe Mon Sep 17 00:00:00 2001 From: John S Date: Wed, 19 Jun 2019 09:22:50 -0500 Subject: [PATCH 20/34] MQE-1427: Support _CREDS in action and in Data - Updating verification test so it is compatible with the latest version of the Test Generator. --- .../Tests/SecretCredentialDataTest.php | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/dev/tests/verification/Tests/SecretCredentialDataTest.php b/dev/tests/verification/Tests/SecretCredentialDataTest.php index 1be5b4c41..91ef1d235 100644 --- a/dev/tests/verification/Tests/SecretCredentialDataTest.php +++ b/dev/tests/verification/Tests/SecretCredentialDataTest.php @@ -28,8 +28,10 @@ class SecretCredentialDataTestCest public function SecretCredentialDataTest(AcceptanceTester $I) { $createProductWithFieldOverridesUsingHardcodedData1Fields['qty'] = "123"; + $createProductWithFieldOverridesUsingHardcodedData1Fields['price'] = "12.34"; - $I->amGoingTo("create entity that has the stepKey: createProductWithFieldOverridesUsingHardcodedData1"); + + $I->comment("[createProductWithFieldOverridesUsingHardcodedData1] create '_defaultProduct' entity"); PersistedObjectHandler::getInstance()->createEntity( "createProductWithFieldOverridesUsingHardcodedData1", "test", @@ -37,9 +39,12 @@ public function SecretCredentialDataTest(AcceptanceTester $I) [], $createProductWithFieldOverridesUsingHardcodedData1Fields ); + $createProductWithFieldOverridesUsingSecretCredData1Fields['qty'] = CredentialStore::getInstance()->getSecret("payment_authorizenet_trans_key"); + $createProductWithFieldOverridesUsingSecretCredData1Fields['price'] = CredentialStore::getInstance()->getSecret("carriers_dhl_account_eu"); - $I->amGoingTo("create entity that has the stepKey: createProductWithFieldOverridesUsingSecretCredData1"); + + $I->comment("[createProductWithFieldOverridesUsingSecretCredData1] create '_defaultProduct' entity"); PersistedObjectHandler::getInstance()->createEntity( "createProductWithFieldOverridesUsingSecretCredData1", "test", @@ -47,11 +52,14 @@ public function SecretCredentialDataTest(AcceptanceTester $I) [], $createProductWithFieldOverridesUsingSecretCredData1Fields ); - $I->fillField("#username", "Hardcoded"); - $I->fillSecretField("#username", CredentialStore::getInstance()->getSecret("carriers_dhl_id_eu")); - $magentoCliUsingHardcodedData1 = $I->magentoCLI("config:set cms/wysiwyg/enabled 0"); + + $I->fillField("#username", "Hardcoded"); // stepKey: fillFieldUsingHardCodedData1 + $I->fillSecretField("#username", CredentialStore::getInstance()->getSecret("carriers_dhl_id_eu")); // stepKey: fillFieldUsingSecretCredData1 + $magentoCliUsingHardcodedData1 = $I->magentoCLI("config:set cms/wysiwyg/enabled 0"); // stepKey: magentoCliUsingHardcodedData1 $I->comment($magentoCliUsingHardcodedData1); - $magentoCliUsingSecretCredData1 = $I->magentoCLI("config:set cms/wysiwyg/enabled " . CredentialStore::getInstance()->getSecret("payment_authorizenet_login")); + + $magentoCliUsingSecretCredData1 = $I->magentoCLI("config:set cms/wysiwyg/enabled " . CredentialStore::getInstance()->getSecret("payment_authorizenet_login")); // stepKey: magentoCliUsingSecretCredData1 $I->comment($magentoCliUsingSecretCredData1); + } } From 537b404388845090cbb25314fb2c9c6bd49c67b1 Mon Sep 17 00:00:00 2001 From: John S Date: Wed, 19 Jun 2019 14:39:58 -0500 Subject: [PATCH 21/34] MQE-1427: Support _CREDS in action and in Data - Correcting verification test issues. --- .../Test/SecretCredentialDataTest.xml | 2 +- .../Tests/SecretCredentialDataTest.php | 24 +++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/dev/tests/verification/TestModule/Test/SecretCredentialDataTest.xml b/dev/tests/verification/TestModule/Test/SecretCredentialDataTest.xml index 3c403cdb9..4044a86e3 100644 --- a/dev/tests/verification/TestModule/Test/SecretCredentialDataTest.xml +++ b/dev/tests/verification/TestModule/Test/SecretCredentialDataTest.xml @@ -8,7 +8,7 @@ - + 123 12.34 diff --git a/dev/tests/verification/Tests/SecretCredentialDataTest.php b/dev/tests/verification/Tests/SecretCredentialDataTest.php index 91ef1d235..46391feee 100644 --- a/dev/tests/verification/Tests/SecretCredentialDataTest.php +++ b/dev/tests/verification/Tests/SecretCredentialDataTest.php @@ -1,4 +1,9 @@ getSecret("payment_authorizenet_trans_key"); + $createProductWithFieldOverridesUsingSecretCredData1Fields['qty'] = + CredentialStore::getInstance()->getSecret("payment_authorizenet_trans_key"); - $createProductWithFieldOverridesUsingSecretCredData1Fields['price'] = CredentialStore::getInstance()->getSecret("carriers_dhl_account_eu"); + $createProductWithFieldOverridesUsingSecretCredData1Fields['price'] = + CredentialStore::getInstance()->getSecret("carriers_dhl_account_eu"); $I->comment("[createProductWithFieldOverridesUsingSecretCredData1] create '_defaultProduct' entity"); PersistedObjectHandler::getInstance()->createEntity( @@ -54,12 +61,15 @@ public function SecretCredentialDataTest(AcceptanceTester $I) ); $I->fillField("#username", "Hardcoded"); // stepKey: fillFieldUsingHardCodedData1 - $I->fillSecretField("#username", CredentialStore::getInstance()->getSecret("carriers_dhl_id_eu")); // stepKey: fillFieldUsingSecretCredData1 - $magentoCliUsingHardcodedData1 = $I->magentoCLI("config:set cms/wysiwyg/enabled 0"); // stepKey: magentoCliUsingHardcodedData1 + $I->fillSecretField("#username", CredentialStore::getInstance()->getSecret("carriers_dhl_id_eu")); + // stepKey: fillFieldUsingSecretCredData1 + $magentoCliUsingHardcodedData1 = $I->magentoCLI("config:set cms/wysiwyg/enabled 0"); + // stepKey: magentoCliUsingHardcodedData1 $I->comment($magentoCliUsingHardcodedData1); - $magentoCliUsingSecretCredData1 = $I->magentoCLI("config:set cms/wysiwyg/enabled " . CredentialStore::getInstance()->getSecret("payment_authorizenet_login")); // stepKey: magentoCliUsingSecretCredData1 + $magentoCliUsingSecretCredData1 = $I->magentoCLI("config:set cms/wysiwyg/enabled " . + CredentialStore::getInstance()->getSecret("payment_authorizenet_login")); + // stepKey: magentoCliUsingSecretCredData1 $I->comment($magentoCliUsingSecretCredData1); - } } From 82a80c66b2dee2e2a28edc167ed0366de454ffa5 Mon Sep 17 00:00:00 2001 From: John S Date: Thu, 20 Jun 2019 10:03:02 -0500 Subject: [PATCH 22/34] MQE-1427: Support _CREDS in action and in Data - Adding unit tests. --- .../Test/Util/ActionMergeUtilTest.php | 93 ++++++++++++++++++- 1 file changed, 90 insertions(+), 3 deletions(-) diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php index 0f367c226..94d5b3125 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php @@ -8,6 +8,8 @@ use AspectMock\Test as AspectMock; use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler; use Magento\FunctionalTestingFramework\DataGenerator\Objects\EntityDataObject; +use Magento\FunctionalTestingFramework\Exceptions\TestReferenceException; +use Magento\FunctionalTestingFramework\Exceptions\XmlException; use Magento\FunctionalTestingFramework\Test\Objects\ActionObject; use Magento\FunctionalTestingFramework\Test\Util\ActionMergeUtil; use Magento\FunctionalTestingFramework\Test\Util\ActionObjectExtractor; @@ -100,7 +102,7 @@ public function testResolveActionStepEntityData() $dataFieldName = 'myfield'; $dataFieldValue = 'myValue'; $userInputKey = "userInput"; - $userinputValue = "{{" . "${dataObjectName}.${dataFieldName}}}"; + $userInputValue = "{{" . "${dataObjectName}.${dataFieldName}}}"; $actionName = "myAction"; $actionType = "myCustomType"; @@ -113,10 +115,10 @@ public function testResolveActionStepEntityData() AspectMock::double(DataObjectHandler::class, ['getInstance' => $mockDOHInstance]); // Create test object and action object - $actionAttributes = [$userInputKey => $userinputValue]; + $actionAttributes = [$userInputKey => $userInputValue]; $actions[$actionName] = new ActionObject($actionName, $actionType, $actionAttributes); - $this->assertEquals($userinputValue, $actions[$actionName]->getCustomActionAttributes()[$userInputKey]); + $this->assertEquals($userInputValue, $actions[$actionName]->getCustomActionAttributes()[$userInputKey]); $mergeUtil = new ActionMergeUtil("test", "TestCase"); $resolvedActions = $mergeUtil->resolveActionSteps($actions); @@ -127,8 +129,14 @@ public function testResolveActionStepEntityData() /** * Verify that an XmlException is thrown when an action references a non-existant action. * + * @throws TestReferenceException + * @throws XmlException * @return void */ + /** + * @throws TestReferenceException + * @throws XmlException + */ public function testNoActionException() { $actionObjects = []; @@ -151,6 +159,8 @@ public function testNoActionException() /** * Verify that a action is added after actions that have a wait (timeout property). * + * @throws TestReferenceException + * @throws XmlException * @return void */ public function testInsertWait() @@ -173,6 +183,83 @@ public function testInsertWait() $this->assertEquals($expected, $actual); } + /** + * Verify that a action is replaced by when secret _CREDS are referenced. + * + * @throws TestReferenceException + * @throws XmlException + */ + public function testValidFillFieldSecretFunction() + { + $actionObjectOne = new ActionObject('actionKey1', 'fillField', ['userInput' => '{{_CREDS.username}}']); + $actionObject = [$actionObjectOne]; + + $actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase'); + + $result = $actionMergeUtil->resolveActionSteps($actionObject); + + $expectedValue = new ActionObject('actionKey1', 'fillSecretField', ['userInput' => '{{_CREDS.username}}']); + $this->assertEquals($expectedValue, $result['actionKey1']); + } + + /** + * Verify that a action uses when secret _CREDS are referenced. + * + * @throws TestReferenceException + * @throws XmlException + */ + public function testValidMagentoCliSecretFunction() + { + $actionObjectOne = new ActionObject('actionKey1', 'magentoCLI', ['command' => 'config:set cms/wysiwyg/enabled {{_CREDS.payment_authorizenet_login}}']); + $actionObject = [$actionObjectOne]; + + $actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase'); + + $result = $actionMergeUtil->resolveActionSteps($actionObject); + + $expectedValue = new ActionObject('actionKey1', 'magentoCLI', ['command' => 'config:set cms/wysiwyg/enabled {{_CREDS.payment_authorizenet_login}}']); + $this->assertEquals($expectedValue, $result['actionKey1']); + } + + /** + * Verify that a override in a action uses when secret _CREDS are referenced. + * + * @throws TestReferenceException + * @throws XmlException + */ + public function testValidCreateDataSecretFunction() + { + $actionObjectOne = new ActionObject('actionKey1', 'field', ['value' => '{{_CREDS.payment_authorizenet_login}}']); + $actionObject = [$actionObjectOne]; + + $actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase'); + + $result = $actionMergeUtil->resolveActionSteps($actionObject); + + $expectedValue = new ActionObject('actionKey1', 'field', ['value' => '{{_CREDS.payment_authorizenet_login}}']); + $this->assertEquals($expectedValue, $result['actionKey1']); + } + + /** + * Verify that a action throws an exception when secret _CREDS are referenced. + * + * @throws TestReferenceException + * @throws XmlException + */ + public function testInvalidSecretFunctions() + { + $this->expectException(TestReferenceException::class); + $this->expectExceptionMessage( + 'You cannot reference secret data outside of the fillField, magentoCli and createData actions' + ); + + $actionObjectOne = new ActionObject('actionKey1', 'click', ['userInput' => '{{_CREDS.username}}']); + $actionObject = [$actionObjectOne]; + + $actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase'); + $actionMergeUtil->resolveActionSteps($actionObject); + } + /** * After class functionality * @return void From c38ab3726aea75e68e8d0ee48a9f55a341aa331c Mon Sep 17 00:00:00 2001 From: John S Date: Thu, 20 Jun 2019 10:24:33 -0500 Subject: [PATCH 23/34] MQE-1427: Support _CREDS in action and in Data - Correcting line lengths for the Travis CI build. --- .../Test/Util/ActionMergeUtilTest.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php index 94d5b3125..eb01d0f3d 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php @@ -210,14 +210,16 @@ public function testValidFillFieldSecretFunction() */ public function testValidMagentoCliSecretFunction() { - $actionObjectOne = new ActionObject('actionKey1', 'magentoCLI', ['command' => 'config:set cms/wysiwyg/enabled {{_CREDS.payment_authorizenet_login}}']); + $actionObjectOne = new ActionObject('actionKey1', 'magentoCLI', + ['command' => 'config:set cms/wysiwyg/enabled {{_CREDS.payment_authorizenet_login}}']); $actionObject = [$actionObjectOne]; $actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase'); $result = $actionMergeUtil->resolveActionSteps($actionObject); - $expectedValue = new ActionObject('actionKey1', 'magentoCLI', ['command' => 'config:set cms/wysiwyg/enabled {{_CREDS.payment_authorizenet_login}}']); + $expectedValue = new ActionObject('actionKey1', 'magentoCLI', + ['command' => 'config:set cms/wysiwyg/enabled {{_CREDS.payment_authorizenet_login}}']); $this->assertEquals($expectedValue, $result['actionKey1']); } @@ -229,14 +231,16 @@ public function testValidMagentoCliSecretFunction() */ public function testValidCreateDataSecretFunction() { - $actionObjectOne = new ActionObject('actionKey1', 'field', ['value' => '{{_CREDS.payment_authorizenet_login}}']); + $actionObjectOne = new ActionObject('actionKey1', 'field', + ['value' => '{{_CREDS.payment_authorizenet_login}}']); $actionObject = [$actionObjectOne]; $actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase'); $result = $actionMergeUtil->resolveActionSteps($actionObject); - $expectedValue = new ActionObject('actionKey1', 'field', ['value' => '{{_CREDS.payment_authorizenet_login}}']); + $expectedValue = new ActionObject('actionKey1', 'field', + ['value' => '{{_CREDS.payment_authorizenet_login}}']); $this->assertEquals($expectedValue, $result['actionKey1']); } From a07275f9a700f0b53f15fc14af3ca088cffa61ef Mon Sep 17 00:00:00 2001 From: John S Date: Thu, 20 Jun 2019 13:23:19 -0500 Subject: [PATCH 24/34] MQE-1427: Support _CREDS in action and in Data - Correcting Travis CI issues regarding multi line functions. --- .../Test/Util/ActionMergeUtilTest.php | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php index eb01d0f3d..b306aad04 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php @@ -210,8 +210,11 @@ public function testValidFillFieldSecretFunction() */ public function testValidMagentoCliSecretFunction() { - $actionObjectOne = new ActionObject('actionKey1', 'magentoCLI', - ['command' => 'config:set cms/wysiwyg/enabled {{_CREDS.payment_authorizenet_login}}']); + $actionObjectOne = new ActionObject( + 'actionKey1', + 'magentoCLI', + ['command' => 'config:set cms/wysiwyg/enabled {{_CREDS.payment_authorizenet_login}}'] + ); $actionObject = [$actionObjectOne]; $actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase'); @@ -231,8 +234,11 @@ public function testValidMagentoCliSecretFunction() */ public function testValidCreateDataSecretFunction() { - $actionObjectOne = new ActionObject('actionKey1', 'field', - ['value' => '{{_CREDS.payment_authorizenet_login}}']); + $actionObjectOne = new ActionObject( + 'actionKey1', + 'field', + ['value' => '{{_CREDS.payment_authorizenet_login}}'] + ); $actionObject = [$actionObjectOne]; $actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase'); @@ -257,7 +263,11 @@ public function testInvalidSecretFunctions() 'You cannot reference secret data outside of the fillField, magentoCli and createData actions' ); - $actionObjectOne = new ActionObject('actionKey1', 'click', ['userInput' => '{{_CREDS.username}}']); + $actionObjectOne = new ActionObject( + 'actionKey1', + 'click', + ['userInput' => '{{_CREDS.username}}'] + ); $actionObject = [$actionObjectOne]; $actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase'); From 95101357f98e33d9064e3b175287f389731d87c3 Mon Sep 17 00:00:00 2001 From: John S Date: Thu, 20 Jun 2019 14:33:12 -0500 Subject: [PATCH 25/34] MQE-1427: Support _CREDS in action and in Data - Correcting multiline function errors in Travis CI. - Updating the function signature for the CLI function to match the other CLI function casing. - Adding new function to properly decrypt CLI actions. - Adding MagentoCLISecret to the ActionMergeUtil. --- .../Test/Util/ActionMergeUtilTest.php | 28 ++++++++++++++----- .../Handlers/CredentialStore.php | 18 ++++++++++++ .../Module/MagentoWebDriver.php | 8 +++--- .../Test/Util/ActionMergeUtil.php | 4 +-- .../Util/TestGenerator.php | 5 ++-- 5 files changed, 48 insertions(+), 15 deletions(-) diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php index b306aad04..fd45e4403 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php @@ -191,14 +191,22 @@ public function testInsertWait() */ public function testValidFillFieldSecretFunction() { - $actionObjectOne = new ActionObject('actionKey1', 'fillField', ['userInput' => '{{_CREDS.username}}']); + $actionObjectOne = new ActionObject( + 'actionKey1', + 'fillField', + ['userInput' => '{{_CREDS.username}}'] + ); $actionObject = [$actionObjectOne]; $actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase'); $result = $actionMergeUtil->resolveActionSteps($actionObject); - $expectedValue = new ActionObject('actionKey1', 'fillSecretField', ['userInput' => '{{_CREDS.username}}']); + $expectedValue = new ActionObject( + 'actionKey1', + 'fillSecretField', + ['userInput' => '{{_CREDS.username}}'] + ); $this->assertEquals($expectedValue, $result['actionKey1']); } @@ -208,7 +216,7 @@ public function testValidFillFieldSecretFunction() * @throws TestReferenceException * @throws XmlException */ - public function testValidMagentoCliSecretFunction() + public function testValidMagentoCLISecretFunction() { $actionObjectOne = new ActionObject( 'actionKey1', @@ -221,8 +229,11 @@ public function testValidMagentoCliSecretFunction() $result = $actionMergeUtil->resolveActionSteps($actionObject); - $expectedValue = new ActionObject('actionKey1', 'magentoCLI', - ['command' => 'config:set cms/wysiwyg/enabled {{_CREDS.payment_authorizenet_login}}']); + $expectedValue = new ActionObject( + 'actionKey1', + 'magentoCLISecret', + ['command' => 'config:set cms/wysiwyg/enabled {{_CREDS.payment_authorizenet_login}}'] + ); $this->assertEquals($expectedValue, $result['actionKey1']); } @@ -245,8 +256,11 @@ public function testValidCreateDataSecretFunction() $result = $actionMergeUtil->resolveActionSteps($actionObject); - $expectedValue = new ActionObject('actionKey1', 'field', - ['value' => '{{_CREDS.payment_authorizenet_login}}']); + $expectedValue = new ActionObject( + 'actionKey1', + 'field', + ['value' => '{{_CREDS.payment_authorizenet_login}}'] + ); $this->assertEquals($expectedValue, $result['actionKey1']); } diff --git a/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/CredentialStore.php b/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/CredentialStore.php index 3f635a040..da1a29324 100644 --- a/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/CredentialStore.php +++ b/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/CredentialStore.php @@ -156,4 +156,22 @@ public function decryptSecretValue($value) { return openssl_decrypt($value, self::ENCRYPTION_ALGO, $this->encodedKey, 0, $this->iv); } + + /** + * Takes a string that contains encrypted data at runtime and decrypts each value. + * + * @param string $string + * @return mixed + */ + public function decryptAllSecretsInString($string) + { + $newString = $string; + foreach ($this->credentials as $name => $secretValue) { + if (strpos($newString, $secretValue !== false)) { + $decryptedValue = $this->decryptSecretValue($secretValue); + $newString = str_replace($secretValue, $decryptedValue, $newString); + } + } + return $newString; + } } diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index 3056484df..adcb2320d 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -641,16 +641,16 @@ public function fillSecretField($field, $value) * The data is decrypted immediately prior to data creation to avoid exposure in console or log. * * @param string $command + * @param null $arguments * @throws TestFrameworkException - * @return void */ - public function magentoCliSecret($command) + public function magentoCLISecret($command, $arguments = null) { // to protect any secrets from being printed to console the values are executed only at the webdriver level as a // decrypted value - $decryptedCommand = CredentialStore::getInstance()->decryptSecretValue($command); - $this->magentoCLI($decryptedCommand); + $decryptedCommand = CredentialStore::getInstance()->decryptAllSecretsInString($command); + $this->magentoCLI($decryptedCommand, $arguments); } /** diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index 946739fc6..2a939a8c7 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -30,7 +30,7 @@ class ActionMergeUtil const DEFAULT_SKIP_OFF_ORDER = 'after'; const DEFAULT_WAIT_ORDER = 'after'; const APPROVED_ACTIONS = ['fillField', 'magentoCLI', 'field']; - const SECRET_MAPPING = ['fillField' => 'fillSecretField']; + const SECRET_MAPPING = ['fillField' => 'fillSecretField', 'magentoCLI' => 'magentoCLISecret']; /** * Array holding final resulting steps @@ -113,7 +113,7 @@ private function resolveSecretFieldAccess($resolvedActions) if ($actionHasSecretRef && !(in_array($actionType, self::APPROVED_ACTIONS))) { throw new TestReferenceException("You cannot reference secret data outside " . - "of the fillField, magentoCli and createData actions"); + "of the fillField, magentoCLI and createData actions"); } // Do NOT remap actions that don't need it. diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index ce90e5f12..f38069eea 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -1266,6 +1266,7 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato ); break; case "magentoCLI": + case "magentoCLISecret": $testSteps .= $this->wrapFunctionCallWithReturnValue( $stepKey, $actor, @@ -1275,7 +1276,7 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato ); $testSteps .= sprintf(self::STEP_KEY_ANNOTATION, $stepKey) . PHP_EOL; $testSteps .= sprintf( - "\t\t$%s->comment(\$%s);\n", + "\t\t$%s->comment(\$%s);", $actor, $stepKey ); @@ -1290,7 +1291,7 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato $input = $this->resolveAllRuntimeReferences([$input])[0]; $argRef .= str_replace(ucfirst($fieldKey), "", $stepKey) . - "Fields['{$fieldKey}'] = ${input};\n"; + "Fields['{$fieldKey}'] = ${input};"; $testSteps .= $argRef; break; From 29b37f45e1e60f12c8602d3c04b06d7adb0c3396 Mon Sep 17 00:00:00 2001 From: John S Date: Thu, 20 Jun 2019 15:06:46 -0500 Subject: [PATCH 26/34] MQE-1427: Support _CREDS in action and in Data - Correcting verification test issue due to casing. --- .../FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php index fd45e4403..7917d663b 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php @@ -274,7 +274,7 @@ public function testInvalidSecretFunctions() { $this->expectException(TestReferenceException::class); $this->expectExceptionMessage( - 'You cannot reference secret data outside of the fillField, magentoCli and createData actions' + 'You cannot reference secret data outside of the fillField, magentoCLI and createData actions' ); $actionObjectOne = new ActionObject( From 9f96927d4975a3a9d374445a85f7e85627c862f8 Mon Sep 17 00:00:00 2001 From: John S Date: Thu, 20 Jun 2019 15:09:56 -0500 Subject: [PATCH 27/34] MQE-1427: Support _CREDS in action and in Data - Correcting spacing issues. --- .../FunctionalTestingFramework/Module/MagentoWebDriver.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index adcb2320d..db131b036 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -641,8 +641,9 @@ public function fillSecretField($field, $value) * The data is decrypted immediately prior to data creation to avoid exposure in console or log. * * @param string $command - * @param null $arguments + * @param null $arguments * @throws TestFrameworkException + * @return void */ public function magentoCLISecret($command, $arguments = null) { From 3d2d8573b29a2aa27bbc73c362146a298e6c259c Mon Sep 17 00:00:00 2001 From: John S Date: Thu, 20 Jun 2019 15:10:16 -0500 Subject: [PATCH 28/34] MQE-1427: Support _CREDS in action and in Data - Correcting verification test issues. --- .../FunctionalTestingFramework/Module/MagentoWebDriver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index db131b036..e272a9a85 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -643,7 +643,7 @@ public function fillSecretField($field, $value) * @param string $command * @param null $arguments * @throws TestFrameworkException - * @return void + * @return mixed */ public function magentoCLISecret($command, $arguments = null) { From 8cd1a39590640ce7ac3546e7602e9689081c87e9 Mon Sep 17 00:00:00 2001 From: John S Date: Fri, 21 Jun 2019 11:19:12 -0500 Subject: [PATCH 29/34] MQE-1427: Support _CREDS in action and in Data - Correcting verification test issues around extra new lines. Removed the extra new lines. --- .../Resources/ActionGroupWithStepKeyReferences.txt | 1 - .../verification/Resources/BasicFunctionalTest.txt | 1 - .../verification/Resources/DataReplacementTest.txt | 1 - .../Resources/PersistenceCustomFieldsTest.txt | 10 ---------- 4 files changed, 13 deletions(-) diff --git a/dev/tests/verification/Resources/ActionGroupWithStepKeyReferences.txt b/dev/tests/verification/Resources/ActionGroupWithStepKeyReferences.txt index 336cd6610..9694637e6 100644 --- a/dev/tests/verification/Resources/ActionGroupWithStepKeyReferences.txt +++ b/dev/tests/verification/Resources/ActionGroupWithStepKeyReferences.txt @@ -46,7 +46,6 @@ class ActionGroupWithStepKeyReferencesCest $action3ActionGroup = $I->executeJS($action3ActionGroup); // stepKey: action3ActionGroup $action4ActionGroup = $I->magentoCLI($action4ActionGroup, "\"stuffHere\""); // stepKey: action4ActionGroup $I->comment($action4ActionGroup); - $date = new \DateTime(); $date->setTimestamp(strtotime("{$action5}")); $date->setTimezone(new \DateTimeZone("America/Los_Angeles")); diff --git a/dev/tests/verification/Resources/BasicFunctionalTest.txt b/dev/tests/verification/Resources/BasicFunctionalTest.txt index 3cb373a4c..fc4284005 100644 --- a/dev/tests/verification/Resources/BasicFunctionalTest.txt +++ b/dev/tests/verification/Resources/BasicFunctionalTest.txt @@ -121,7 +121,6 @@ class BasicFunctionalTestCest $grabValueFromKey1 = $I->grabValueFrom(".functionalTestSelector"); // stepKey: grabValueFromKey1 $magentoCli1 = $I->magentoCLI("maintenance:enable", "\"stuffHere\""); // stepKey: magentoCli1 $I->comment($magentoCli1); - $I->makeScreenshot("screenShotInput"); // stepKey: makeScreenshotKey1 $I->maximizeWindow(); // stepKey: maximizeWindowKey1 $I->moveBack(); // stepKey: moveBackKey1 diff --git a/dev/tests/verification/Resources/DataReplacementTest.txt b/dev/tests/verification/Resources/DataReplacementTest.txt index 211dfd5a1..4eb305e32 100644 --- a/dev/tests/verification/Resources/DataReplacementTest.txt +++ b/dev/tests/verification/Resources/DataReplacementTest.txt @@ -53,6 +53,5 @@ class DataReplacementTestCest $I->fillField(".selector", "0"); // stepKey: insertZero $insertCommand = $I->magentoCLI("do something Doe" . msq("uniqueData") . " with uniqueness"); // stepKey: insertCommand $I->comment($insertCommand); - } } diff --git a/dev/tests/verification/Resources/PersistenceCustomFieldsTest.txt b/dev/tests/verification/Resources/PersistenceCustomFieldsTest.txt index 68ded6711..4853619e1 100644 --- a/dev/tests/verification/Resources/PersistenceCustomFieldsTest.txt +++ b/dev/tests/verification/Resources/PersistenceCustomFieldsTest.txt @@ -25,9 +25,7 @@ class PersistenceCustomFieldsTestCest public function _before(AcceptanceTester $I) { $createData1Fields['firstname'] = "Mac"; - $createData1Fields['lastname'] = "Doe"; - $I->comment("[createData1] create 'DefaultPerson' entity"); PersistedObjectHandler::getInstance()->createEntity( "createData1", @@ -38,7 +36,6 @@ class PersistenceCustomFieldsTestCest ); $createData2Fields['firstname'] = PersistedObjectHandler::getInstance()->retrieveEntityField('createData1', 'firstname', 'hook'); - $I->comment("[createData2] create 'uniqueData' entity"); PersistedObjectHandler::getInstance()->createEntity( "createData2", @@ -60,9 +57,7 @@ class PersistenceCustomFieldsTestCest public function PersistenceCustomFieldsTest(AcceptanceTester $I) { $createdDataFields['favoriteIndex'] = "1"; - $createdDataFields['middlename'] = "Kovacs"; - $I->comment("[createdData] create 'simpleData' entity"); PersistedObjectHandler::getInstance()->createEntity( "createdData", @@ -73,9 +68,7 @@ class PersistenceCustomFieldsTestCest ); $createdData3Fields['firstname'] = "Takeshi"; - $createdData3Fields['lastname'] = "Kovacs"; - $I->comment("[createdData3] create 'UniquePerson' entity"); PersistedObjectHandler::getInstance()->createEntity( "createdData3", @@ -87,7 +80,6 @@ class PersistenceCustomFieldsTestCest $I->comment("Entering Action Group [createdAG] PersistenceActionGroup"); $createDataAG1CreatedAGFields['firstname'] = "string1"; - $I->comment("[createDataAG1CreatedAG] create 'simpleData' entity"); PersistedObjectHandler::getInstance()->createEntity( "createDataAG1CreatedAG", @@ -98,7 +90,6 @@ class PersistenceCustomFieldsTestCest ); $createDataAG2CreatedAGFields['firstname'] = "Jane"; - $I->comment("[createDataAG2CreatedAG] create 'simpleData' entity"); PersistedObjectHandler::getInstance()->createEntity( "createDataAG2CreatedAG", @@ -109,7 +100,6 @@ class PersistenceCustomFieldsTestCest ); $createDataAG3CreatedAGFields['firstname'] = PersistedObjectHandler::getInstance()->retrieveEntityField('createdData3', 'firstname', 'test'); - $I->comment("[createDataAG3CreatedAG] create 'simpleData' entity"); PersistedObjectHandler::getInstance()->createEntity( "createDataAG3CreatedAG", From 9ef7ea795773a86f26655e2187f9c6f2751abc12 Mon Sep 17 00:00:00 2001 From: John S Date: Fri, 21 Jun 2019 11:27:37 -0500 Subject: [PATCH 30/34] MQE-1427: Support _CREDS in action and in Data - Adding missing parentheses. --- .../DataGenerator/Handlers/CredentialStore.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/CredentialStore.php b/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/CredentialStore.php index da1a29324..a83540683 100644 --- a/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/CredentialStore.php +++ b/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/CredentialStore.php @@ -167,7 +167,7 @@ public function decryptAllSecretsInString($string) { $newString = $string; foreach ($this->credentials as $name => $secretValue) { - if (strpos($newString, $secretValue !== false)) { + if (strpos($newString, $secretValue) !== false) { $decryptedValue = $this->decryptSecretValue($secretValue); $newString = str_replace($secretValue, $decryptedValue, $newString); } From 637c3eb3f13ac30bc4a8f3895d6766617425e0e7 Mon Sep 17 00:00:00 2001 From: John S Date: Fri, 21 Jun 2019 11:29:27 -0500 Subject: [PATCH 31/34] MQE-1427: Support _CREDS in action and in Data - Adding missing return. --- .../FunctionalTestingFramework/Module/MagentoWebDriver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index e272a9a85..d268e23b4 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -643,7 +643,7 @@ public function fillSecretField($field, $value) * @param string $command * @param null $arguments * @throws TestFrameworkException - * @return mixed + * @return string */ public function magentoCLISecret($command, $arguments = null) { @@ -651,7 +651,7 @@ public function magentoCLISecret($command, $arguments = null) // decrypted value $decryptedCommand = CredentialStore::getInstance()->decryptAllSecretsInString($command); - $this->magentoCLI($decryptedCommand, $arguments); + return $this->magentoCLI($decryptedCommand, $arguments); } /** From 32fac0c60e43fc0d793a8cb87689b2111f0b4bb0 Mon Sep 17 00:00:00 2001 From: John S Date: Fri, 21 Jun 2019 13:45:05 -0500 Subject: [PATCH 32/34] MQE-1427: Support _CREDS in action and in Data - Correcting an issue around null values in the PersistedObjectHandler. --- .../DataGenerator/Handlers/PersistedObjectHandler.php | 4 ++++ src/Magento/FunctionalTestingFramework/Util/TestGenerator.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/PersistedObjectHandler.php b/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/PersistedObjectHandler.php index 64bb5f0a0..cc35bbc52 100644 --- a/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/PersistedObjectHandler.php +++ b/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/PersistedObjectHandler.php @@ -84,6 +84,10 @@ public function createEntity( foreach ($dependentObjectKeys as $objectKey) { $retrievedDependentObjects[] = $this->retrieveEntity($objectKey, $scope); } + + foreach ($overrideFields as $index => $field) { + $overrideFields[$index] = CredentialStore::getInstance()->decryptAllSecretsInString($field); + } $retrievedEntity = DataObjectHandler::getInstance()->getObject($entity); $persistedObject = new DataPersistenceHandler( diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index f38069eea..d07c5e1e0 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -755,7 +755,7 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato if (count($customEntityFields) > 1) { $createEntityFunctionCall .= ",\n\t\t\t\${$stepKey}Fields"; } else { - $createEntityFunctionCall .= ",\n\t\t\tnull"; + $createEntityFunctionCall .= ",\n\t\t\t[]"; } if ($storeCode !== null) { $createEntityFunctionCall .= ",\n\t\t\t\"{$storeCode}\""; From cd0d2374646354d7be5fe4c826842c2906d11dea Mon Sep 17 00:00:00 2001 From: John S Date: Fri, 21 Jun 2019 15:47:02 -0500 Subject: [PATCH 33/34] MQE-1427: Support _CREDS in action and in Data - Correcting verification tests by replacing null with []. --- .../Resources/ActionGroupUsingCreateData.txt | 4 ++-- .../Resources/ActionGroupWithDataOverrideTest.txt | 2 +- .../verification/Resources/ActionGroupWithDataTest.txt | 2 +- .../Resources/ActionGroupWithNoDefaultTest.txt | 2 +- .../Resources/ActionGroupWithPersistedData.txt | 4 ++-- .../Resources/ActionGroupWithStepKeyReferences.txt | 6 +++--- .../Resources/ActionGroupWithTopLevelPersistedData.txt | 2 +- .../Resources/ArgumentWithSameNameAsElement.txt | 2 +- dev/tests/verification/Resources/AssertTest.txt | 4 ++-- .../verification/Resources/BasicActionGroupTest.txt | 2 +- dev/tests/verification/Resources/DataActionsTest.txt | 4 ++-- .../verification/Resources/ExtendParentDataTest.txt | 2 +- .../Resources/ExtendedParameterArrayTest.txt | 2 +- dev/tests/verification/Resources/HookActionsTest.txt | 6 +++--- dev/tests/verification/Resources/LocatorFunctionTest.txt | 2 +- .../verification/Resources/MergedActionGroupTest.txt | 2 +- .../verification/Resources/MultipleActionGroupsTest.txt | 2 +- dev/tests/verification/Resources/PageReplacementTest.txt | 2 +- dev/tests/verification/Resources/ParameterArrayTest.txt | 2 +- .../verification/Resources/PersistedReplacementTest.txt | 4 ++-- .../Resources/PersistenceActionGroupAppendingTest.txt | 9 +++++---- .../verification/Resources/SectionReplacementTest.txt | 2 +- 22 files changed, 35 insertions(+), 34 deletions(-) diff --git a/dev/tests/verification/Resources/ActionGroupUsingCreateData.txt b/dev/tests/verification/Resources/ActionGroupUsingCreateData.txt index 6831b0914..97369c6ea 100644 --- a/dev/tests/verification/Resources/ActionGroupUsingCreateData.txt +++ b/dev/tests/verification/Resources/ActionGroupUsingCreateData.txt @@ -31,7 +31,7 @@ class ActionGroupUsingCreateDataCest "hook", "ApiCategory", [], - null + [] ); $I->comment("[createConfigProductKey1] create 'ApiConfigurableProduct' entity"); @@ -40,7 +40,7 @@ class ActionGroupUsingCreateDataCest "hook", "ApiConfigurableProduct", ["createCategoryKey1"], - null + [] ); $I->comment("Exiting Action Group [Key1] actionGroupWithCreateData"); diff --git a/dev/tests/verification/Resources/ActionGroupWithDataOverrideTest.txt b/dev/tests/verification/Resources/ActionGroupWithDataOverrideTest.txt index 3785b4dd6..f9984944a 100644 --- a/dev/tests/verification/Resources/ActionGroupWithDataOverrideTest.txt +++ b/dev/tests/verification/Resources/ActionGroupWithDataOverrideTest.txt @@ -31,7 +31,7 @@ class ActionGroupWithDataOverrideTestCest "hook", "ReplacementPerson", [], - null + [] ); $I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup"); diff --git a/dev/tests/verification/Resources/ActionGroupWithDataTest.txt b/dev/tests/verification/Resources/ActionGroupWithDataTest.txt index 3e812cdd0..79bda5f1b 100644 --- a/dev/tests/verification/Resources/ActionGroupWithDataTest.txt +++ b/dev/tests/verification/Resources/ActionGroupWithDataTest.txt @@ -31,7 +31,7 @@ class ActionGroupWithDataTestCest "hook", "ReplacementPerson", [], - null + [] ); $I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup"); diff --git a/dev/tests/verification/Resources/ActionGroupWithNoDefaultTest.txt b/dev/tests/verification/Resources/ActionGroupWithNoDefaultTest.txt index 955596301..b24362028 100644 --- a/dev/tests/verification/Resources/ActionGroupWithNoDefaultTest.txt +++ b/dev/tests/verification/Resources/ActionGroupWithNoDefaultTest.txt @@ -31,7 +31,7 @@ class ActionGroupWithNoDefaultTestCest "hook", "ReplacementPerson", [], - null + [] ); $I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup"); diff --git a/dev/tests/verification/Resources/ActionGroupWithPersistedData.txt b/dev/tests/verification/Resources/ActionGroupWithPersistedData.txt index aba5c5796..f774269ea 100644 --- a/dev/tests/verification/Resources/ActionGroupWithPersistedData.txt +++ b/dev/tests/verification/Resources/ActionGroupWithPersistedData.txt @@ -31,7 +31,7 @@ class ActionGroupWithPersistedDataCest "hook", "ReplacementPerson", [], - null + [] ); $I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup"); @@ -78,7 +78,7 @@ class ActionGroupWithPersistedDataCest "test", "DefaultPerson", [], - null + [] ); $I->comment("Entering Action Group [actionGroupWithPersistedData1] FunctionalActionGroupWithData"); diff --git a/dev/tests/verification/Resources/ActionGroupWithStepKeyReferences.txt b/dev/tests/verification/Resources/ActionGroupWithStepKeyReferences.txt index 9694637e6..3669843aa 100644 --- a/dev/tests/verification/Resources/ActionGroupWithStepKeyReferences.txt +++ b/dev/tests/verification/Resources/ActionGroupWithStepKeyReferences.txt @@ -34,7 +34,7 @@ class ActionGroupWithStepKeyReferencesCest "test", "simpleData", [], - null + [] ); $grabTextDataActionGroup = $I->grabTextFrom(".class"); // stepKey: grabTextDataActionGroup @@ -64,7 +64,7 @@ class ActionGroupWithStepKeyReferencesCest "test", "{$action8}", [], - null + [] ); $I->comment("[action9ActionGroup] update '1' entity to '{$action9}'"); @@ -81,7 +81,7 @@ class ActionGroupWithStepKeyReferencesCest "test", "{$action10}", [], - null + [] ); $action11ActionGroup = $I->grabAttributeFrom($action11ActionGroup, "someInput"); // stepKey: action11ActionGroup diff --git a/dev/tests/verification/Resources/ActionGroupWithTopLevelPersistedData.txt b/dev/tests/verification/Resources/ActionGroupWithTopLevelPersistedData.txt index fffaebbfd..c579d165e 100644 --- a/dev/tests/verification/Resources/ActionGroupWithTopLevelPersistedData.txt +++ b/dev/tests/verification/Resources/ActionGroupWithTopLevelPersistedData.txt @@ -31,7 +31,7 @@ class ActionGroupWithTopLevelPersistedDataCest "hook", "ReplacementPerson", [], - null + [] ); $I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup"); diff --git a/dev/tests/verification/Resources/ArgumentWithSameNameAsElement.txt b/dev/tests/verification/Resources/ArgumentWithSameNameAsElement.txt index 4ccc2d169..5b9f838a4 100644 --- a/dev/tests/verification/Resources/ArgumentWithSameNameAsElement.txt +++ b/dev/tests/verification/Resources/ArgumentWithSameNameAsElement.txt @@ -31,7 +31,7 @@ class ArgumentWithSameNameAsElementCest "hook", "ReplacementPerson", [], - null + [] ); $I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup"); diff --git a/dev/tests/verification/Resources/AssertTest.txt b/dev/tests/verification/Resources/AssertTest.txt index 697bc3d21..1f8eef56e 100644 --- a/dev/tests/verification/Resources/AssertTest.txt +++ b/dev/tests/verification/Resources/AssertTest.txt @@ -30,7 +30,7 @@ class AssertTestCest "hook", "ReplacementPerson", [], - null + [] ); } @@ -50,7 +50,7 @@ class AssertTestCest "test", "UniquePerson", [], - null + [] ); $grabTextFrom1 = $I->grabTextFrom(".copyright>span"); // stepKey: grabTextFrom1 diff --git a/dev/tests/verification/Resources/BasicActionGroupTest.txt b/dev/tests/verification/Resources/BasicActionGroupTest.txt index 17e5e2bdf..c6b3cec81 100644 --- a/dev/tests/verification/Resources/BasicActionGroupTest.txt +++ b/dev/tests/verification/Resources/BasicActionGroupTest.txt @@ -31,7 +31,7 @@ class BasicActionGroupTestCest "hook", "ReplacementPerson", [], - null + [] ); $I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup"); diff --git a/dev/tests/verification/Resources/DataActionsTest.txt b/dev/tests/verification/Resources/DataActionsTest.txt index 5d1ee9e00..728bef2e7 100644 --- a/dev/tests/verification/Resources/DataActionsTest.txt +++ b/dev/tests/verification/Resources/DataActionsTest.txt @@ -30,7 +30,7 @@ class DataActionsTestCest "hook", "entity", [], - null + [] ); $I->comment("[updateInBefore] update 'createdInBefore' entity to 'entity'"); @@ -64,7 +64,7 @@ class DataActionsTestCest "test", "entity", [], - null + [] ); $I->comment("[updateInTest] update 'createdInTest' entity to 'entity'"); diff --git a/dev/tests/verification/Resources/ExtendParentDataTest.txt b/dev/tests/verification/Resources/ExtendParentDataTest.txt index a80f3cf19..a91c2f464 100644 --- a/dev/tests/verification/Resources/ExtendParentDataTest.txt +++ b/dev/tests/verification/Resources/ExtendParentDataTest.txt @@ -33,7 +33,7 @@ class ExtendParentDataTestCest "test", "extendParentData", [], - null + [] ); $I->searchAndMultiSelectOption("#selector", ["otherName"]); // stepKey: getName diff --git a/dev/tests/verification/Resources/ExtendedParameterArrayTest.txt b/dev/tests/verification/Resources/ExtendedParameterArrayTest.txt index 41bea9d6f..21212ba1a 100644 --- a/dev/tests/verification/Resources/ExtendedParameterArrayTest.txt +++ b/dev/tests/verification/Resources/ExtendedParameterArrayTest.txt @@ -33,7 +33,7 @@ class ExtendParentDataTestCest "test", "extendParentData", [], - null + [] ); $I->searchAndMultiSelectOption("#selector", ["otherName"]); $I->searchAndMultiSelectOption("#selector", ["extendName"]); diff --git a/dev/tests/verification/Resources/HookActionsTest.txt b/dev/tests/verification/Resources/HookActionsTest.txt index 74a49eca3..3068e6ac1 100644 --- a/dev/tests/verification/Resources/HookActionsTest.txt +++ b/dev/tests/verification/Resources/HookActionsTest.txt @@ -30,7 +30,7 @@ class HookActionsTestCest "hook", "sampleCreatedEntity", [], - null + [] ); $I->comment("[sampleDeleteBefore] delete entity 'sampleCreateBefore'"); @@ -45,7 +45,7 @@ class HookActionsTestCest "hook", "sampleCreatedEntity", [], - null + [] ); } @@ -62,7 +62,7 @@ class HookActionsTestCest "hook", "sampleCreatedEntity", [], - null + [] ); $I->comment("[sampleDeleteAfter] delete entity 'sampleCreateForAfter'"); diff --git a/dev/tests/verification/Resources/LocatorFunctionTest.txt b/dev/tests/verification/Resources/LocatorFunctionTest.txt index 4c96f100b..ad9a1a9e7 100644 --- a/dev/tests/verification/Resources/LocatorFunctionTest.txt +++ b/dev/tests/verification/Resources/LocatorFunctionTest.txt @@ -33,7 +33,7 @@ class LocatorFunctionTestCest "test", "ReplacementPerson", [], - null + [] ); $I->click(Locator::contains("'label'", "'Name'")); // stepKey: SimpleLocator diff --git a/dev/tests/verification/Resources/MergedActionGroupTest.txt b/dev/tests/verification/Resources/MergedActionGroupTest.txt index 03ab1287b..9bd6c0ded 100644 --- a/dev/tests/verification/Resources/MergedActionGroupTest.txt +++ b/dev/tests/verification/Resources/MergedActionGroupTest.txt @@ -31,7 +31,7 @@ class MergedActionGroupTestCest "hook", "ReplacementPerson", [], - null + [] ); $I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup"); diff --git a/dev/tests/verification/Resources/MultipleActionGroupsTest.txt b/dev/tests/verification/Resources/MultipleActionGroupsTest.txt index e0796ae39..4f12b2f07 100644 --- a/dev/tests/verification/Resources/MultipleActionGroupsTest.txt +++ b/dev/tests/verification/Resources/MultipleActionGroupsTest.txt @@ -31,7 +31,7 @@ class MultipleActionGroupsTestCest "hook", "ReplacementPerson", [], - null + [] ); $I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup"); diff --git a/dev/tests/verification/Resources/PageReplacementTest.txt b/dev/tests/verification/Resources/PageReplacementTest.txt index 6b27b55b1..c7bede23e 100644 --- a/dev/tests/verification/Resources/PageReplacementTest.txt +++ b/dev/tests/verification/Resources/PageReplacementTest.txt @@ -33,7 +33,7 @@ class PageReplacementTestCest "test", "simpleData", [], - null + [] ); $I->amOnPage("/page.html"); // stepKey: noParamPage diff --git a/dev/tests/verification/Resources/ParameterArrayTest.txt b/dev/tests/verification/Resources/ParameterArrayTest.txt index 8f49ca05c..8e278b826 100644 --- a/dev/tests/verification/Resources/ParameterArrayTest.txt +++ b/dev/tests/verification/Resources/ParameterArrayTest.txt @@ -33,7 +33,7 @@ class ParameterArrayTestCest "test", "simpleParamData", [], - null + [] ); $I->searchAndMultiSelectOption("#selector", ["name"]); // stepKey: xmlSimpleReplace diff --git a/dev/tests/verification/Resources/PersistedReplacementTest.txt b/dev/tests/verification/Resources/PersistedReplacementTest.txt index 2c5d99bc2..6058e34f5 100644 --- a/dev/tests/verification/Resources/PersistedReplacementTest.txt +++ b/dev/tests/verification/Resources/PersistedReplacementTest.txt @@ -30,7 +30,7 @@ class PersistedReplacementTestCest "hook", "ReplacementPerson", [], - null + [] ); } @@ -50,7 +50,7 @@ class PersistedReplacementTestCest "test", "simpleData", [], - null + [] ); $I->fillField("#selector", "StringBefore " . PersistedObjectHandler::getInstance()->retrieveEntityField('createdData', 'firstname', 'test') . " StringAfter"); // stepKey: inputReplace diff --git a/dev/tests/verification/Resources/PersistenceActionGroupAppendingTest.txt b/dev/tests/verification/Resources/PersistenceActionGroupAppendingTest.txt index af6507abc..1e2c895ee 100644 --- a/dev/tests/verification/Resources/PersistenceActionGroupAppendingTest.txt +++ b/dev/tests/verification/Resources/PersistenceActionGroupAppendingTest.txt @@ -31,7 +31,7 @@ class PersistenceActionGroupAppendingTestCest "hook", "entity", [], - null + [] ); $I->comment("[updateDataACTIONGROUPBEFORE] update 'createDataACTIONGROUPBEFORE' entity to 'newEntity'"); @@ -39,6 +39,7 @@ class PersistenceActionGroupAppendingTestCest "createDataACTIONGROUPBEFORE", "hook", "newEntity", + [], [] ); @@ -54,7 +55,7 @@ class PersistenceActionGroupAppendingTestCest "hook", "someEneity", [], - null + [] ); $I->comment(PersistedObjectHandler::getInstance()->retrieveEntityField('createData', 'field', 'hook')); @@ -77,7 +78,7 @@ class PersistenceActionGroupAppendingTestCest "test", "entity", [], - null + [] ); $I->comment("[updateDataACTIONGROUP] update 'createDataACTIONGROUP' entity to 'newEntity'"); @@ -100,7 +101,7 @@ class PersistenceActionGroupAppendingTestCest "test", "someEneity", [], - null + [] ); $I->comment(PersistedObjectHandler::getInstance()->retrieveEntityField('createDataACTIONGROUP', 'field', 'test')); diff --git a/dev/tests/verification/Resources/SectionReplacementTest.txt b/dev/tests/verification/Resources/SectionReplacementTest.txt index a237faf38..aab4a87a0 100644 --- a/dev/tests/verification/Resources/SectionReplacementTest.txt +++ b/dev/tests/verification/Resources/SectionReplacementTest.txt @@ -52,7 +52,7 @@ class SectionReplacementTestCest "test", "simpleData", [], - null + [] ); $I->click("#element ." . PersistedObjectHandler::getInstance()->retrieveEntityField('createdData', 'firstname', 'test')); // stepKey: selectorReplaceOneParamPersisted From d103842d55156c7d9af80717985d4646e6500347 Mon Sep 17 00:00:00 2001 From: John S Date: Mon, 24 Jun 2019 09:27:36 -0500 Subject: [PATCH 34/34] MQE-1427: Support _CREDS in action and in Data -Correcting final verification tests. --- .../Resources/ActionGroupWithStepKeyReferences.txt | 2 +- .../Resources/PersistenceActionGroupAppendingTest.txt | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dev/tests/verification/Resources/ActionGroupWithStepKeyReferences.txt b/dev/tests/verification/Resources/ActionGroupWithStepKeyReferences.txt index 3669843aa..d83447d03 100644 --- a/dev/tests/verification/Resources/ActionGroupWithStepKeyReferences.txt +++ b/dev/tests/verification/Resources/ActionGroupWithStepKeyReferences.txt @@ -64,7 +64,7 @@ class ActionGroupWithStepKeyReferencesCest "test", "{$action8}", [], - [] + null ); $I->comment("[action9ActionGroup] update '1' entity to '{$action9}'"); diff --git a/dev/tests/verification/Resources/PersistenceActionGroupAppendingTest.txt b/dev/tests/verification/Resources/PersistenceActionGroupAppendingTest.txt index 1e2c895ee..bc5e16294 100644 --- a/dev/tests/verification/Resources/PersistenceActionGroupAppendingTest.txt +++ b/dev/tests/verification/Resources/PersistenceActionGroupAppendingTest.txt @@ -39,7 +39,6 @@ class PersistenceActionGroupAppendingTestCest "createDataACTIONGROUPBEFORE", "hook", "newEntity", - [], [] ); @@ -55,7 +54,7 @@ class PersistenceActionGroupAppendingTestCest "hook", "someEneity", [], - [] + null ); $I->comment(PersistedObjectHandler::getInstance()->retrieveEntityField('createData', 'field', 'hook')); @@ -101,7 +100,7 @@ class PersistenceActionGroupAppendingTestCest "test", "someEneity", [], - [] + null ); $I->comment(PersistedObjectHandler::getInstance()->retrieveEntityField('createDataACTIONGROUP', 'field', 'test'));