Skip to content

Commit d4faf13

Browse files
committed
MQE-1711: Switch between Developer mode and Production mode takes long time and the test end up time out
fixed issue with signature of magentoCLI
1 parent 2e1887e commit d4faf13

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

dev/tests/verification/Resources/ActionGroupWithStepKeyReferences.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ActionGroupWithStepKeyReferencesCest
4545
$I->fillField($action1); // stepKey: action1ActionGroup
4646
$I->comment("Invocation stepKey will be appended in non stepKey instances");
4747
$action3ActionGroup = $I->executeJS($action3ActionGroup); // stepKey: action3ActionGroup
48-
$action4ActionGroup = $I->magentoCLI($action4ActionGroup, "\"stuffHere\"", 60); // stepKey: action4ActionGroup
48+
$action4ActionGroup = $I->magentoCLI($action4ActionGroup, 60, "\"stuffHere\""); // stepKey: action4ActionGroup
4949
$I->comment($action4ActionGroup);
5050
$date = new \DateTime();
5151
$date->setTimestamp(strtotime("{$action5}"));

dev/tests/verification/Resources/BasicFunctionalTest.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ class BasicFunctionalTestCest
126126
$grabMultipleKey1 = $I->grabMultiple(".functionalTestSelector"); // stepKey: grabMultipleKey1
127127
$grabTextFromKey1 = $I->grabTextFrom(".functionalTestSelector"); // stepKey: grabTextFromKey1
128128
$grabValueFromKey1 = $I->grabValueFrom(".functionalTestSelector"); // stepKey: grabValueFromKey1
129-
$magentoCli1 = $I->magentoCLI("maintenance:enable", "\"stuffHere\"", 60); // stepKey: magentoCli1
129+
$magentoCli1 = $I->magentoCLI("maintenance:enable", 60, "\"stuffHere\""); // stepKey: magentoCli1
130130
$I->comment($magentoCli1);
131+
$magentoCli2 = $I->magentoCLI("maintenance:enable", 120, "\"stuffHere\""); // stepKey: magentoCli2
132+
$I->comment($magentoCli2);
131133
$I->makeScreenshot("screenShotInput"); // stepKey: makeScreenshotKey1
132134
$I->maximizeWindow(); // stepKey: maximizeWindowKey1
133135
$I->moveBack(); // stepKey: moveBackKey1

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
<grabTextFrom selector=".functionalTestSelector" stepKey="grabTextFromKey1" />
7777
<grabValueFrom selector=".functionalTestSelector" stepKey="grabValueFromKey1" />
7878
<magentoCLI command="maintenance:enable" arguments="&quot;stuffHere&quot;" stepKey="magentoCli1"/>
79+
<magentoCLI command="maintenance:enable" arguments="&quot;stuffHere&quot;" timeout="120" stepKey="magentoCli2"/>
7980
<makeScreenshot userInput="screenShotInput" stepKey="makeScreenshotKey1"/>
8081
<maximizeWindow stepKey="maximizeWindowKey1"/>
8182
<moveBack stepKey="moveBackKey1"/>

src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -511,15 +511,15 @@ public function scrollToTopOfPage()
511511
* Takes given $command and executes it against bin/magento or custom exposed entrypoint. Returns command output.
512512
*
513513
* @param string $command
514-
* @param string $arguments
515514
* @param integer $timeout
515+
* @param string $arguments
516516
* @return string
517517
*
518518
* @throws TestFrameworkException
519519
*/
520-
public function magentoCLI($command, $arguments = null, $timeout = null)
520+
public function magentoCLI($command, $timeout = null, $arguments = null)
521521
{
522-
return $this->curlExecMagentoCLI($command, $arguments, $timeout);
522+
return $this->curlExecMagentoCLI($command, $timeout, $arguments);
523523
//TODO: calling bin/magento from pipeline is timing out, needs investigation (ref: MQE-1774)
524524
// try {
525525
// return $this->shellExecMagentoCLI($command, $arguments);
@@ -674,18 +674,18 @@ public function fillSecretField($field, $value)
674674
* The data is decrypted immediately prior to data creation to avoid exposure in console or log.
675675
*
676676
* @param string $command
677-
* @param null $arguments
678677
* @param null $timeout
678+
* @param null $arguments
679679
* @throws TestFrameworkException
680680
* @return string
681681
*/
682-
public function magentoCLISecret($command, $arguments = null, $timeout = null)
682+
public function magentoCLISecret($command, $timeout = null, $arguments = null)
683683
{
684684
// to protect any secrets from being printed to console the values are executed only at the webdriver level as a
685685
// decrypted value
686686

687687
$decryptedCommand = CredentialStore::getInstance()->decryptAllSecretsInString($command);
688-
return $this->magentoCLI($decryptedCommand, $arguments, $timeout);
688+
return $this->magentoCLI($decryptedCommand, $timeout, $arguments);
689689
}
690690

691691
/**
@@ -845,7 +845,7 @@ public function makeScreenshot($name = null)
845845
* @return string
846846
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
847847
*/
848-
private function shellExecMagentoCLI($command, $arguments, $timeout): string
848+
private function shellExecMagentoCLI($command, $arguments, $timeout = 60): string
849849
{
850850
$php = PHP_BINDIR ? PHP_BINDIR . DIRECTORY_SEPARATOR. 'php' : 'php';
851851
$binMagento = realpath(MAGENTO_BP . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'magento');
@@ -865,13 +865,13 @@ private function shellExecMagentoCLI($command, $arguments, $timeout): string
865865
* Takes given $command and executes it against exposed MTF CLI entry point. Returns response from server.
866866
*
867867
* @param string $command
868-
* @param string $arguments
869868
* @param integer $timeout
869+
* @param string $arguments
870870
*
871871
* @return string
872872
* @throws TestFrameworkException
873873
*/
874-
private function curlExecMagentoCLI($command, $arguments, $timeout): string
874+
private function curlExecMagentoCLI($command, $timeout, $arguments): string
875875
{
876876
// Remove index.php if it's present in url
877877
$baseUrl = rtrim(

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,8 +1285,8 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato
12851285
$actor,
12861286
$actionObject,
12871287
$command,
1288-
$arguments,
1289-
$time
1288+
$time,
1289+
$arguments
12901290
);
12911291
$testSteps .= sprintf(self::STEP_KEY_ANNOTATION, $stepKey) . PHP_EOL;
12921292
$testSteps .= sprintf(

0 commit comments

Comments
 (0)