Skip to content

Commit 2f4f8df

Browse files
committed
MQE-1060: Allow magentoCLI Action To Run Without Manipulating Command
That Is Sent To CLI - Adding Arguments argument for MagentoCLI
1 parent 6281e31 commit 2f4f8df

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

dev/tests/verification/Resources/BasicFunctionalTest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class BasicFunctionalTestCest
105105
$grabMultipleKey1 = $I->grabMultiple(".functionalTestSelector");
106106
$grabTextFromKey1 = $I->grabTextFrom(".functionalTestSelector");
107107
$grabValueFromKey1 = $I->grabValueFrom(".functionalTestSelector");
108-
$magentoCli1 = $I->magentoCLI("maintenance:enable");
108+
$magentoCli1 = $I->magentoCLI("maintenance:enable", "\"stuffHere\"");
109109
$I->comment($magentoCli1);
110110
$I->makeScreenshot("screenShotInput");
111111
$I->maximizeWindow();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<grabMultiple selector=".functionalTestSelector" stepKey="grabMultipleKey1" />
6767
<grabTextFrom selector=".functionalTestSelector" stepKey="grabTextFromKey1" />
6868
<grabValueFrom selector=".functionalTestSelector" stepKey="grabValueFromKey1" />
69-
<magentoCLI command="maintenance:enable" stepKey="magentoCli1"/>
69+
<magentoCLI command="maintenance:enable" arguments="&quot;stuffHere&quot;" stepKey="magentoCli1"/>
7070
<makeScreenshot userInput="screenShotInput" stepKey="makeScreenshotKey1"/>
7171
<maximizeWindow stepKey="maximizeWindowKey1"/>
7272
<moveBack stepKey="moveBackKey1"/>

src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,13 +435,14 @@ public function scrollToTopOfPage()
435435
/**
436436
* Takes given $command and executes it against exposed MTF CLI entry point. Returns response from server.
437437
* @param string $command
438-
* @returns string
438+
* @param string $arguments
439+
* @return string
439440
*/
440-
public function magentoCLI($command)
441+
public function magentoCLI($command, $arguments)
441442
{
442443
$apiURL = $this->config['url'] . getenv('MAGENTO_CLI_COMMAND_PATH');
443444
$executor = new CurlTransport();
444-
$executor->write($apiURL, [getenv('MAGENTO_CLI_COMMAND_PARAMETER') => $command], CurlInterface::POST, []);
445+
$executor->write($apiURL, [getenv('MAGENTO_CLI_COMMAND_PARAMETER') => $command], CurlInterface::POST, [$arguments]);
445446
$response = $executor->read();
446447
$executor->close();
447448
return $response;

src/Magento/FunctionalTestingFramework/Test/etc/Actions/customActions.xsd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@
4242
</xs:documentation>
4343
</xs:annotation>
4444
</xs:attribute>
45+
<xs:attribute type="xs:string" name="arguments">
46+
<xs:annotation>
47+
<xs:documentation>
48+
Arguments for Magento CLI command, will not be escaped.
49+
</xs:documentation>
50+
</xs:annotation>
51+
</xs:attribute>
4552
<xs:attributeGroup ref="commonActionAttributes"/>
4653
</xs:extension>
4754
</xs:simpleContent>

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
489489
$dependentSelector = null;
490490
$visible = null;
491491
$command = null;
492+
$arguments = null;
492493
$sortOrder = null;
493494
$storeCode = null;
494495

@@ -504,6 +505,9 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
504505
if (isset($customActionAttributes['command'])) {
505506
$command = $this->addUniquenessFunctionCall($customActionAttributes['command']);
506507
}
508+
if (isset($customActionAttributes['arguments'])) {
509+
$arguments = $this->addUniquenessFunctionCall($customActionAttributes['arguments']);
510+
}
507511

508512
if (isset($customActionAttributes['attribute'])) {
509513
$attribute = $customActionAttributes['attribute'];
@@ -1219,7 +1223,8 @@ public function generateStepsPhp($actionObjects, $hookObject = false, $actor = "
12191223
$stepKey,
12201224
$actor,
12211225
$actionObject,
1222-
$command
1226+
$command,
1227+
$arguments
12231228
);
12241229
$testSteps .= sprintf(
12251230
"\t\t$%s->comment(\$%s);\n",

0 commit comments

Comments
 (0)