Skip to content

Commit c67ffdd

Browse files
committed
MQE-1986: Mark executeInSelenium and performOn as deprecated in MFTF
1 parent 55ac3b8 commit c67ffdd

File tree

8 files changed

+74
-0
lines changed

8 files changed

+74
-0
lines changed

docs/test/actions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,8 @@ Attribute|Type|Use|Description
973973

974974
### executeInSelenium
975975

976+
#### NOTE: `executeInSelenium` action is DEPRECATED and will be removed in MFTF 3.0.0.
977+
976978
See [executeInSelenium docs on codeception.com](http://codeception.com/docs/modules/WebDriver#executeInSelenium).
977979

978980
Attribute|Type|Use|Description
@@ -1460,6 +1462,8 @@ Attribute|Type|Use|Description
14601462

14611463
### performOn
14621464

1465+
#### NOTE: `performOn` action is DEPRECATED and will be removed in MFTF 3.0.0.
1466+
14631467
See [performOn docs on codeception.com](http://codeception.com/docs/modules/WebDriver#performOn).
14641468

14651469
Attribute|Type|Use|Description

src/Magento/FunctionalTestingFramework/Console/BaseGenerateCommand.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,27 @@
1212
use Magento\FunctionalTestingFramework\Test\Handlers\TestObjectHandler;
1313
use Magento\FunctionalTestingFramework\Util\Path\FilePathFormatter;
1414
use Symfony\Component\Console\Command\Command;
15+
use Symfony\Component\Console\Input\InputInterface;
1516
use Symfony\Component\Console\Input\InputOption;
1617
use Symfony\Component\Console\Output\OutputInterface;
1718
use Magento\FunctionalTestingFramework\Util\Filesystem\DirSetupUtil;
1819
use Magento\FunctionalTestingFramework\Util\TestGenerator;
1920
use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig;
2021
use Magento\FunctionalTestingFramework\Suite\Handlers\SuiteObjectHandler;
22+
use Symfony\Component\Console\Style\SymfonyStyle;
2123

2224
class BaseGenerateCommand extends Command
2325
{
26+
const MFTF_3_O_0_DEPRECATION_MESSAGE = "MFTF NOTICES:\n"
27+
. "\"executeInSelenium\" and \"performOn\" actions are DEPRECATED and will be removed in MFTF 3.0.0\n";
28+
29+
/**
30+
* Console output style
31+
*
32+
* @var SymfonyStyle
33+
*/
34+
private $ioStyle = null;
35+
2436
/**
2537
* Configures the base command.
2638
*
@@ -178,4 +190,33 @@ protected function getGroupAndSuiteConfiguration(array $groupOrSuiteNames)
178190
$json = json_encode($result);
179191
return $json;
180192
}
193+
194+
/**
195+
* Set Symfony Style for output
196+
*
197+
* @param InputInterface $input
198+
* @param OutputInterface $output
199+
*/
200+
protected function setOutputStyle(InputInterface $input, OutputInterface $output)
201+
{
202+
// For output style
203+
if (null === $this->ioStyle) {
204+
$this->ioStyle = new SymfonyStyle($input, $output);
205+
}
206+
}
207+
208+
/**
209+
* Show predefined global notice messages
210+
*
211+
* @param OutputInterface $output
212+
* @return void
213+
*/
214+
protected function showMftfNotices(OutputInterface $output)
215+
{
216+
if (null !== $this->ioStyle) {
217+
$this->ioStyle->note(self::MFTF_3_O_0_DEPRECATION_MESSAGE);
218+
} else {
219+
$output->writeln(self::MFTF_3_O_0_DEPRECATION_MESSAGE);
220+
}
221+
}
181222
}

src/Magento/FunctionalTestingFramework/Console/GenerateSuiteCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
5858
$allowSkipped
5959
);
6060

61+
$this->setOutputStyle($input, $output);
62+
$this->showMftfNotices($output);
63+
6164
// Remove previous GENERATED_DIR if --remove option is used
6265
if ($remove) {
6366
$this->removeGeneratedDirectory($output, $output->isVerbose());

src/Magento/FunctionalTestingFramework/Console/GenerateTestsCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
8282
$allowSkipped
8383
);
8484

85+
$this->setOutputStyle($input, $output);
86+
$this->showMftfNotices($output);
87+
8588
if (!empty($tests)) {
8689
$json = $this->getTestAndSuiteConfiguration($tests);
8790
}

src/Magento/FunctionalTestingFramework/Console/RunTestCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8484
$allowSkipped
8585
);
8686

87+
$this->setOutputStyle($input, $output);
88+
$this->showMftfNotices($output);
89+
8790
$testConfiguration = $this->getTestAndSuiteConfiguration($tests);
8891

8992
if (!$skipGeneration) {

src/Magento/FunctionalTestingFramework/Console/RunTestFailedCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9696
$allowSkipped
9797
);
9898

99+
$this->setOutputStyle($input, $output);
100+
$this->showMftfNotices($output);
101+
99102
$testConfiguration = $this->getFailedTestList();
100103

101104
if ($testConfiguration === null) {

src/Magento/FunctionalTestingFramework/Console/RunTestGroupCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7979
$allowSkipped
8080
);
8181

82+
$this->setOutputStyle($input, $output);
83+
$this->showMftfNotices($output);
84+
8285
if (!$skipGeneration) {
8386
$testConfiguration = $this->getGroupAndSuiteConfiguration($groups);
8487
$command = $this->getApplication()->find('generate:tests');

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ class TestGenerator
5959
const ARRAY_WRAP_OPEN = '[';
6060
const ARRAY_WRAP_CLOSE = ']';
6161

62+
const MFTF_3_O_0_DEPRECATION_MESSAGE = ' is DEPRECATED and will be removed in MFTF 3.0.0.';
63+
6264
/**
6365
* Actor name for AcceptanceTest
6466
*
@@ -1041,6 +1043,8 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato
10411043
);
10421044
break;
10431045
case "executeInSelenium":
1046+
$this->deprecationMessages[] = "DEPRECATED ACTION in Test: at step {$stepKey} \"executeInSelenium\""
1047+
. self::MFTF_3_O_0_DEPRECATION_MESSAGE;
10441048
$testSteps .= $this->wrapFunctionCall($actor, $actionObject, $function);
10451049
break;
10461050
case "executeJS":
@@ -1052,6 +1056,16 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato
10521056
);
10531057
break;
10541058
case "performOn":
1059+
$this->deprecationMessages[] = "DEPRECATED ACTION in Test: at step {$stepKey} \"performOn\""
1060+
. self::MFTF_3_O_0_DEPRECATION_MESSAGE;
1061+
$testSteps .= $this->wrapFunctionCall(
1062+
$actor,
1063+
$actionObject,
1064+
$selector,
1065+
$function,
1066+
$time
1067+
);
1068+
break;
10551069
case "waitForElementChange":
10561070
$testSteps .= $this->wrapFunctionCall(
10571071
$actor,

0 commit comments

Comments
 (0)