diff --git a/dev/tests/verification/Resources/BasicFunctionalTest.txt b/dev/tests/verification/Resources/BasicFunctionalTest.txt index ac42f395e..e76e409d0 100644 --- a/dev/tests/verification/Resources/BasicFunctionalTest.txt +++ b/dev/tests/verification/Resources/BasicFunctionalTest.txt @@ -15,7 +15,7 @@ use Yandex\Allure\Adapter\Annotation\TestCaseId; /** * @Title("[NO TESTCASEID]: A Functional Cest") * @group functional - * @Description("

Test files

verification/TestModule/Test/BasicFunctionalTest.xml
") + * @Description("

Deprecated Notice(s):

Test files

verification/TestModule/Test/BasicFunctionalTest.xml
") */ class BasicFunctionalTestCest { diff --git a/dev/tests/verification/Resources/ExecuteInSeleniumTest.txt b/dev/tests/verification/Resources/ExecuteInSeleniumTest.txt index bbed61691..48b818200 100644 --- a/dev/tests/verification/Resources/ExecuteInSeleniumTest.txt +++ b/dev/tests/verification/Resources/ExecuteInSeleniumTest.txt @@ -13,7 +13,7 @@ use Yandex\Allure\Adapter\Model\SeverityLevel; use Yandex\Allure\Adapter\Annotation\TestCaseId; /** - * @Description("

Test files

verification/TestModule/Test/ExecuteInSeleniumTest.xml
") + * @Description("

Deprecated Notice(s):

Test files

verification/TestModule/Test/ExecuteInSeleniumTest.xml
") */ class ExecuteInSeleniumTestCest { diff --git a/docs/test/actions.md b/docs/test/actions.md index 59fd12aa2..b3aec7204 100644 --- a/docs/test/actions.md +++ b/docs/test/actions.md @@ -973,6 +973,8 @@ Attribute|Type|Use|Description ### executeInSelenium +#### NOTE: `executeInSelenium` action is DEPRECATED and will be removed in MFTF 3.0.0. + See [executeInSelenium docs on codeception.com](http://codeception.com/docs/modules/WebDriver#executeInSelenium). Attribute|Type|Use|Description @@ -1460,6 +1462,8 @@ Attribute|Type|Use|Description ### performOn +#### NOTE: `performOn` action is DEPRECATED and will be removed in MFTF 3.0.0. + See [performOn docs on codeception.com](http://codeception.com/docs/modules/WebDriver#performOn). Attribute|Type|Use|Description diff --git a/src/Magento/FunctionalTestingFramework/Console/BaseGenerateCommand.php b/src/Magento/FunctionalTestingFramework/Console/BaseGenerateCommand.php index a0d94b16e..c33b956fb 100644 --- a/src/Magento/FunctionalTestingFramework/Console/BaseGenerateCommand.php +++ b/src/Magento/FunctionalTestingFramework/Console/BaseGenerateCommand.php @@ -12,15 +12,27 @@ use Magento\FunctionalTestingFramework\Test\Handlers\TestObjectHandler; use Magento\FunctionalTestingFramework\Util\Path\FilePathFormatter; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Magento\FunctionalTestingFramework\Util\Filesystem\DirSetupUtil; use Magento\FunctionalTestingFramework\Util\TestGenerator; use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig; use Magento\FunctionalTestingFramework\Suite\Handlers\SuiteObjectHandler; +use Symfony\Component\Console\Style\SymfonyStyle; class BaseGenerateCommand extends Command { + const MFTF_3_O_0_DEPRECATION_MESSAGE = "MFTF NOTICES:\n" + . "\"executeInSelenium\" and \"performOn\" actions are DEPRECATED and will be removed in MFTF 3.0.0\n"; + + /** + * Console output style + * + * @var SymfonyStyle + */ + private $ioStyle = null; + /** * Configures the base command. * @@ -178,4 +190,33 @@ protected function getGroupAndSuiteConfiguration(array $groupOrSuiteNames) $json = json_encode($result); return $json; } + + /** + * Set Symfony Style for output + * + * @param InputInterface $input + * @param OutputInterface $output + */ + protected function setOutputStyle(InputInterface $input, OutputInterface $output) + { + // For output style + if (null === $this->ioStyle) { + $this->ioStyle = new SymfonyStyle($input, $output); + } + } + + /** + * Show predefined global notice messages + * + * @param OutputInterface $output + * @return void + */ + protected function showMftfNotices(OutputInterface $output) + { + if (null !== $this->ioStyle) { + $this->ioStyle->note(self::MFTF_3_O_0_DEPRECATION_MESSAGE); + } else { + $output->writeln(self::MFTF_3_O_0_DEPRECATION_MESSAGE); + } + } } diff --git a/src/Magento/FunctionalTestingFramework/Console/GenerateSuiteCommand.php b/src/Magento/FunctionalTestingFramework/Console/GenerateSuiteCommand.php index 8da3493aa..2c91aa7f7 100644 --- a/src/Magento/FunctionalTestingFramework/Console/GenerateSuiteCommand.php +++ b/src/Magento/FunctionalTestingFramework/Console/GenerateSuiteCommand.php @@ -58,6 +58,9 @@ protected function execute(InputInterface $input, OutputInterface $output) $allowSkipped ); + $this->setOutputStyle($input, $output); + $this->showMftfNotices($output); + // Remove previous GENERATED_DIR if --remove option is used if ($remove) { $this->removeGeneratedDirectory($output, $output->isVerbose()); diff --git a/src/Magento/FunctionalTestingFramework/Console/GenerateTestsCommand.php b/src/Magento/FunctionalTestingFramework/Console/GenerateTestsCommand.php index 621f29d03..b9378edc1 100644 --- a/src/Magento/FunctionalTestingFramework/Console/GenerateTestsCommand.php +++ b/src/Magento/FunctionalTestingFramework/Console/GenerateTestsCommand.php @@ -82,6 +82,9 @@ protected function execute(InputInterface $input, OutputInterface $output) $allowSkipped ); + $this->setOutputStyle($input, $output); + $this->showMftfNotices($output); + if (!empty($tests)) { $json = $this->getTestAndSuiteConfiguration($tests); } diff --git a/src/Magento/FunctionalTestingFramework/Console/RunTestCommand.php b/src/Magento/FunctionalTestingFramework/Console/RunTestCommand.php index 373256cfc..08b84d6a1 100644 --- a/src/Magento/FunctionalTestingFramework/Console/RunTestCommand.php +++ b/src/Magento/FunctionalTestingFramework/Console/RunTestCommand.php @@ -84,6 +84,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int $allowSkipped ); + $this->setOutputStyle($input, $output); + $this->showMftfNotices($output); + $testConfiguration = $this->getTestAndSuiteConfiguration($tests); if (!$skipGeneration) { diff --git a/src/Magento/FunctionalTestingFramework/Console/RunTestFailedCommand.php b/src/Magento/FunctionalTestingFramework/Console/RunTestFailedCommand.php index 5f0596a7f..1909c7e0b 100644 --- a/src/Magento/FunctionalTestingFramework/Console/RunTestFailedCommand.php +++ b/src/Magento/FunctionalTestingFramework/Console/RunTestFailedCommand.php @@ -96,6 +96,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int $allowSkipped ); + $this->setOutputStyle($input, $output); + $this->showMftfNotices($output); + $testConfiguration = $this->getFailedTestList(); if ($testConfiguration === null) { diff --git a/src/Magento/FunctionalTestingFramework/Console/RunTestGroupCommand.php b/src/Magento/FunctionalTestingFramework/Console/RunTestGroupCommand.php index 6ea37785d..be6236c73 100644 --- a/src/Magento/FunctionalTestingFramework/Console/RunTestGroupCommand.php +++ b/src/Magento/FunctionalTestingFramework/Console/RunTestGroupCommand.php @@ -79,6 +79,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int $allowSkipped ); + $this->setOutputStyle($input, $output); + $this->showMftfNotices($output); + if (!$skipGeneration) { $testConfiguration = $this->getGroupAndSuiteConfiguration($groups); $command = $this->getApplication()->find('generate:tests'); diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index e40f60dcf..527ed7323 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -59,6 +59,8 @@ class TestGenerator const ARRAY_WRAP_OPEN = '['; const ARRAY_WRAP_CLOSE = ']'; + const MFTF_3_O_0_DEPRECATION_MESSAGE = ' is DEPRECATED and will be removed in MFTF 3.0.0.'; + /** * Actor name for AcceptanceTest * @@ -1041,6 +1043,8 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato ); break; case "executeInSelenium": + $this->deprecationMessages[] = "DEPRECATED ACTION in Test: at step {$stepKey} \"executeInSelenium\"" + . self::MFTF_3_O_0_DEPRECATION_MESSAGE; $testSteps .= $this->wrapFunctionCall($actor, $actionObject, $function); break; case "executeJS": @@ -1052,6 +1056,16 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato ); break; case "performOn": + $this->deprecationMessages[] = "DEPRECATED ACTION in Test: at step {$stepKey} \"performOn\"" + . self::MFTF_3_O_0_DEPRECATION_MESSAGE; + $testSteps .= $this->wrapFunctionCall( + $actor, + $actionObject, + $selector, + $function, + $time + ); + break; case "waitForElementChange": $testSteps .= $this->wrapFunctionCall( $actor,