diff --git a/dev/tests/verification/Resources/BasicFunctionalTest.txt b/dev/tests/verification/Resources/BasicFunctionalTest.txt
index 23e25edec..eb9f12ed4 100644
--- a/dev/tests/verification/Resources/BasicFunctionalTest.txt
+++ b/dev/tests/verification/Resources/BasicFunctionalTest.txt
@@ -79,6 +79,8 @@ class BasicFunctionalTestCest
$grabMultipleKey1 = $I->grabMultiple(".functionalTestSelector");
$grabTextFromKey1 = $I->grabTextFrom(".functionalTestSelector");
$grabValueFromKey1 = $I->grabValueFrom(".functionalTestSelector");
+ $magentoCli1 = $I->executeMagentoCLICommand("maintenance:enable");
+ $I->comment($magentoCli1);
$I->makeScreenshot("screenShotInput");
$I->maximizeWindow();
$I->moveBack();
diff --git a/dev/tests/verification/TestModule/ActionGroup/XmlDuplicateActionGroup.xml b/dev/tests/verification/TestModule/ActionGroup/XmlDuplicateActionGroup.xml
index 786f09237..8c5ba7402 100644
--- a/dev/tests/verification/TestModule/ActionGroup/XmlDuplicateActionGroup.xml
+++ b/dev/tests/verification/TestModule/ActionGroup/XmlDuplicateActionGroup.xml
@@ -104,6 +104,8 @@
+
+
diff --git a/dev/tests/verification/TestModule/Test/BasicFunctionalTest.xml b/dev/tests/verification/TestModule/Test/BasicFunctionalTest.xml
index 4064ef63c..c7934e195 100644
--- a/dev/tests/verification/TestModule/Test/BasicFunctionalTest.xml
+++ b/dev/tests/verification/TestModule/Test/BasicFunctionalTest.xml
@@ -59,6 +59,7 @@
+
diff --git a/dev/tests/verification/TestModule/Test/XmlDuplicateTest.xml b/dev/tests/verification/TestModule/Test/XmlDuplicateTest.xml
index 1171b2cbb..1bb75d651 100644
--- a/dev/tests/verification/TestModule/Test/XmlDuplicateTest.xml
+++ b/dev/tests/verification/TestModule/Test/XmlDuplicateTest.xml
@@ -106,6 +106,8 @@
+
+
@@ -318,6 +320,8 @@
+
+
@@ -529,6 +533,8 @@
+
+
diff --git a/etc/di.xml b/etc/di.xml
index 5098afcc2..b8d95ca1a 100644
--- a/etc/di.xml
+++ b/etc/di.xml
@@ -207,7 +207,7 @@
- createDataKey
- createDataKey
- createDataKey
- - stepKey
+ - stepKey
- keyForRemoval
- keyForRemoval
- keyForRemoval
@@ -221,9 +221,9 @@
- - stepKey
- - stepKey
- - stepKey
+ - stepKey
+ - stepKey
+ - stepKey
- keyForRemoval
- keyForRemoval
- keyForRemoval
@@ -287,7 +287,7 @@
- name
- name
- - stepKey
+ - stepKey
- keyForRemoval
*ActionGroup.xml
@@ -298,7 +298,7 @@
- - stepKey
+ - stepKey
- keyForRemoval
- name
- name
diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php
index ee77e31c4..323fae478 100644
--- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php
+++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php
@@ -17,6 +17,8 @@
use Codeception\Exception\ModuleException;
use Codeception\Util\Uri;
use Codeception\Util\ActionSequence;
+use Magento\FunctionalTestingFramework\Util\Protocol\CurlTransport;
+use Magento\FunctionalTestingFramework\Util\Protocol\CurlInterface;
use Magento\Setup\Exception;
use Magento\FunctionalTestingFramework\Util\ConfigSanitizerUtil;
use Yandex\Allure\Adapter\Support\AttachmentSupport;
@@ -390,6 +392,22 @@ public function scrollToTopOfPage()
$this->executeJS('window.scrollTo(0,0);');
}
+ /**
+ * Takes given $command and executes it against exposed MTF CLI entry point. Returns response from server.
+ * @param string $command
+ * @returns string
+ */
+ public function executeMagentoCLICommand($command)
+ {
+
+ $apiURL = $this->config['url'] . getenv('MAGENTO_CLI_COMMAND_PATH');
+ $executor = new CurlTransport();
+ $executor->write($apiURL, [getenv('MAGENTO_CLI_COMMAND_PARAMETER') => $command], CurlInterface::POST, []);
+ $response = $executor->read();
+ $executor->close();
+ return $response;
+ }
+
/**
* Conditional click for an area that should be visible
*
diff --git a/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd b/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd
index f22d17833..b992d9647 100644
--- a/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd
+++ b/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd
@@ -121,6 +121,7 @@
+
@@ -814,6 +815,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Magento/FunctionalTestingFramework/Util/ConfigSanitizerUtil.php b/src/Magento/FunctionalTestingFramework/Util/ConfigSanitizerUtil.php
index 8dac6a1e6..e09bf2cc3 100644
--- a/src/Magento/FunctionalTestingFramework/Util/ConfigSanitizerUtil.php
+++ b/src/Magento/FunctionalTestingFramework/Util/ConfigSanitizerUtil.php
@@ -25,7 +25,7 @@ public static function sanitizeWebDriverConfig($config, $params = ['url', 'selen
$config['url'] = self::sanitizeUrl($config['url']);
}
- if (array_key_exists('selenium', array_flip($params))) {
+ if (in_array('selenium', $params)) {
$config = self::sanitizeSeleniumEnvs($config);
}
diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php
index 95aaeddb4..0f658595f 100644
--- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php
+++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php
@@ -415,6 +415,7 @@ private function generateStepsPhp($stepsObject, $hookObject = false)
$parameter = null;
$dependentSelector = null;
$visible = null;
+ $command = null;
$assertExpected = null;
$assertActual = null;
@@ -425,6 +426,10 @@ private function generateStepsPhp($stepsObject, $hookObject = false)
// Validate action attributes and print notice messages on violation.
$this->validateXmlAttributesMutuallyExclusive($stepKey, $actionName, $customActionAttributes);
+ if (isset($customActionAttributes['command'])) {
+ $command = $customActionAttributes['command'];
+ }
+
if (isset($customActionAttributes['attribute'])) {
$attribute = $customActionAttributes['attribute'];
}
@@ -1064,6 +1069,19 @@ private function generateStepsPhp($stepsObject, $hookObject = false)
$assertMessage
);
break;
+ case "magentoCLI":
+ $testSteps .= $this->wrapFunctionCallWithReturnValue(
+ $stepKey,
+ $actor,
+ "executeMagentoCLICommand",
+ $this->wrapWithDoubleQuotes($command)
+ );
+ $testSteps .= sprintf(
+ "\t\t$%s->comment(\$%s);\n",
+ $actor,
+ $stepKey
+ );
+ break;
default:
$testSteps .= $this->wrapFunctionCall($actor, $actionName, $selector, $input, $parameter);
}