Skip to content

Commit 511fe24

Browse files
authored
Merge pull request #579 from magento/MQE-1989
Mqe 1989 Deprecation Notices for upcoming MFTF 3.0.0
2 parents 3609f4f + ae04503 commit 511fe24

File tree

10 files changed

+80
-2
lines changed

10 files changed

+80
-2
lines changed

dev/tests/verification/Resources/BasicFunctionalTest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use Yandex\Allure\Adapter\Annotation\TestCaseId;
1515
/**
1616
* @Title("[NO TESTCASEID]: A Functional Cest")
1717
* @group functional
18-
* @Description("<h3>Test files</h3>verification/TestModule/Test/BasicFunctionalTest.xml<br>")
18+
* @Description("<h3 class='y-label y-label_status_broken'>Deprecated Notice(s):</h3><ul><li>DEPRECATED ACTION in Test: at step performOnKey1 "performOn" is DEPRECATED and will be removed in MFTF 3.0.0.</li></ul><h3>Test files</h3>verification/TestModule/Test/BasicFunctionalTest.xml<br>")
1919
*/
2020
class BasicFunctionalTestCest
2121
{

dev/tests/verification/Resources/ExecuteInSeleniumTest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use Yandex\Allure\Adapter\Model\SeverityLevel;
1313
use Yandex\Allure\Adapter\Annotation\TestCaseId;
1414

1515
/**
16-
* @Description("<h3>Test files</h3>verification/TestModule/Test/ExecuteInSeleniumTest.xml<br>")
16+
* @Description("<h3 class='y-label y-label_status_broken'>Deprecated Notice(s):</h3><ul><li>DEPRECATED ACTION in Test: at step executeInSeleniumStep "executeInSelenium" is DEPRECATED and will be removed in MFTF 3.0.0.</li></ul><h3>Test files</h3>verification/TestModule/Test/ExecuteInSeleniumTest.xml<br>")
1717
*/
1818
class ExecuteInSeleniumTestCest
1919
{

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: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,31 @@
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+
. "DEPRECATED ACTIONS: \"executeInSelenium\" and \"performOn\" actions will be removed in MFTF 3.0.0\n"
28+
. "DEPRECATED TEST PATH: support for \"dev/tests/acceptance/tests/functional/Magento/FunctionalTest will be "
29+
. "removed in MFTF 3.0.0\n"
30+
. "XSD schema change to only allow single entity per xml file for all entities except data and metadata in "
31+
. "MFTF 3.0.0\n";
32+
33+
/**
34+
* Console output style
35+
*
36+
* @var SymfonyStyle
37+
*/
38+
private $ioStyle = null;
39+
2440
/**
2541
* Configures the base command.
2642
*
@@ -178,4 +194,33 @@ protected function getGroupAndSuiteConfiguration(array $groupOrSuiteNames)
178194
$json = json_encode($result);
179195
return $json;
180196
}
197+
198+
/**
199+
* Set Symfony Style for output
200+
*
201+
* @param InputInterface $input
202+
* @param OutputInterface $output
203+
*/
204+
protected function setOutputStyle(InputInterface $input, OutputInterface $output)
205+
{
206+
// For output style
207+
if (null === $this->ioStyle) {
208+
$this->ioStyle = new SymfonyStyle($input, $output);
209+
}
210+
}
211+
212+
/**
213+
* Show predefined global notice messages
214+
*
215+
* @param OutputInterface $output
216+
* @return void
217+
*/
218+
protected function showMftfNotices(OutputInterface $output)
219+
{
220+
if (null !== $this->ioStyle) {
221+
$this->ioStyle->note(self::MFTF_3_O_0_DEPRECATION_MESSAGE);
222+
} else {
223+
$output->writeln(self::MFTF_3_O_0_DEPRECATION_MESSAGE);
224+
}
225+
}
181226
}

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)