Skip to content

Commit 5307abb

Browse files
authored
MQE-1016: Variable Substitution Does Not Work For Command Attribute In MagentoCLI Action
- Enabled MagentoCLI's command attribtue to have data substitution.
1 parent 3ff6d16 commit 5307abb

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

dev/tests/verification/Resources/DataReplacementTest.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,7 @@ class DataReplacementTestCest
5151
$I->searchAndMultiSelectOption("#selector", [msq("uniqueData") . "John", "Doe" . msq("uniqueData")]);
5252
$I->selectMultipleOptions("#Doe" . msq("uniqueData"), "#element", [msq("uniqueData") . "John", "Doe" . msq("uniqueData")]);
5353
$I->fillField(".selector", "0");
54+
$insertCommand = $I->magentoCLI("do something Doe" . msq("uniqueData") . " with uniqueness");
55+
$I->comment($insertCommand);
5456
}
5557
}

dev/tests/verification/TestModule/Test/DataReplacementTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@
3737
</selectMultipleOptions>
3838

3939
<fillField stepKey="insertZero" selector=".selector" userInput="{{simpleData.favoriteIndex}}"/>
40+
<magentoCLI stepKey="insertCommand" command="do something {{uniqueData.lastname}} with uniqueness"/>
4041
</test>
4142
</tests>

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ class ActionObject
3131
"x",
3232
"y",
3333
"expectedResult",
34-
"actualResult"
34+
"actualResult",
35+
"command"
3536
];
3637
const SELECTOR_ENABLED_ATTRIBUTES = [
3738
'selector',
@@ -40,7 +41,8 @@ class ActionObject
4041
"selector2",
4142
"function",
4243
'filterSelector',
43-
'optionSelector'
44+
'optionSelector',
45+
"command"
4446
];
4547
const OLD_ASSERTION_ATTRIBUTES = ["expected", "expectedType", "actual", "actualType"];
4648
const ASSERTION_ATTRIBUTES = ["expectedResult" => "expected", "actualResult" => "actual"];

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
500500
$this->validateXmlAttributesMutuallyExclusive($stepKey, $actionObject->getType(), $customActionAttributes);
501501

502502
if (isset($customActionAttributes['command'])) {
503-
$command = $customActionAttributes['command'];
503+
$command = $this->addUniquenessFunctionCall($customActionAttributes['command']);
504504
}
505505

506506
if (isset($customActionAttributes['attribute'])) {
@@ -1217,7 +1217,7 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
12171217
$stepKey,
12181218
$actor,
12191219
$actionObject,
1220-
$this->wrapWithDoubleQuotes($command)
1220+
$command
12211221
);
12221222
$testSteps .= sprintf(
12231223
"\t\t$%s->comment(\$%s);\n",

0 commit comments

Comments
 (0)