Skip to content

Mqe 1989 Deprecation Notices for upcoming MFTF 3.0.0 #579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev/tests/verification/Resources/BasicFunctionalTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use Yandex\Allure\Adapter\Annotation\TestCaseId;
/**
* @Title("[NO TESTCASEID]: A Functional Cest")
* @group functional
* @Description("<h3>Test files</h3>verification/TestModule/Test/BasicFunctionalTest.xml<br>")
* @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>")
*/
class BasicFunctionalTestCest
{
Expand Down
2 changes: 1 addition & 1 deletion dev/tests/verification/Resources/ExecuteInSeleniumTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use Yandex\Allure\Adapter\Model\SeverityLevel;
use Yandex\Allure\Adapter\Annotation\TestCaseId;

/**
* @Description("<h3>Test files</h3>verification/TestModule/Test/ExecuteInSeleniumTest.xml<br>")
* @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>")
*/
class ExecuteInSeleniumTestCest
{
Expand Down
4 changes: 4 additions & 0 deletions docs/test/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,31 @@
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"
. "DEPRECATED ACTIONS: \"executeInSelenium\" and \"performOn\" actions will be removed in MFTF 3.0.0\n"
. "DEPRECATED TEST PATH: support for \"dev/tests/acceptance/tests/functional/Magento/FunctionalTest will be "
. "removed in MFTF 3.0.0\n"
. "XSD schema change to only allow single entity per xml file for all entities except data and metadata in "
. "MFTF 3.0.0\n";

/**
* Console output style
*
* @var SymfonyStyle
*/
private $ioStyle = null;

/**
* Configures the base command.
*
Expand Down Expand Up @@ -178,4 +194,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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
14 changes: 14 additions & 0 deletions src/Magento/FunctionalTestingFramework/Util/TestGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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":
Expand All @@ -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,
Expand Down