diff --git a/CHANGELOG.md b/CHANGELOG.md index 98db600cc..4792fa8ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,21 @@ Magento Functional Testing Framework Changelog ================================================ +2.6.2 +----- + +### Fixes +* Fixed float conversion error in test generation + +2.6.1 +----- + +* Usability + * Introduced new `.env` configuration `ELASTICSEARCH_VERSION` to support multiple elasticsearch versions +* Maintainability + * Added deprecation notices for upcoming MFTF 3.0.0 +* Replaced facebook webdriver with php-webdriver to support PHP version updates + 2.6.0 ----- diff --git a/composer.json b/composer.json index e6d081114..ed4656a37 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "magento/magento2-functional-testing-framework", "description": "Magento2 Functional Testing Framework", "type": "library", - "version": "2.6.0", + "version": "2.6.2", "license": "AGPL-3.0", "keywords": ["magento", "automation", "functional", "testing"], "config": { @@ -25,7 +25,8 @@ "monolog/monolog": "^1.0", "mustache/mustache": "~2.5", "symfony/process": "^2.8 || ^3.1 || ^4.0", - "vlucas/phpdotenv": "^2.4" + "vlucas/phpdotenv": "^2.4", + "php-webdriver/webdriver": "^1.8.0" }, "require-dev": { "squizlabs/php_codesniffer": "~3.2", @@ -44,6 +45,9 @@ "suggest": { "epfremme/swagger-php": "^2.0" }, + "replace": { + "facebook/webdriver": "^1.7.1" + }, "autoload": { "files": ["src/Magento/FunctionalTestingFramework/_bootstrap.php"], "psr-4": { diff --git a/composer.lock b/composer.lock index ac510665e..caa95e992 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "859ddf6506836faaabb056ae7b377c63", + "content-hash": "d9ea4056a8f4501c3f2766e09edce40d", "packages": [ { "name": "allure-framework/allure-codeception", @@ -1837,67 +1837,6 @@ ], "time": "2019-06-08T11:03:04+00:00" }, - { - "name": "facebook/webdriver", - "version": "1.7.1", - "source": { - "type": "git", - "url": "https://github.com/facebook/php-webdriver.git", - "reference": "e43de70f3c7166169d0f14a374505392734160e5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/e43de70f3c7166169d0f14a374505392734160e5", - "reference": "e43de70f3c7166169d0f14a374505392734160e5", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*", - "ext-zip": "*", - "php": "^5.6 || ~7.0", - "symfony/process": "^2.8 || ^3.1 || ^4.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.0", - "jakub-onderka/php-parallel-lint": "^0.9.2", - "php-coveralls/php-coveralls": "^2.0", - "php-mock/php-mock-phpunit": "^1.1", - "phpunit/phpunit": "^5.7", - "sebastian/environment": "^1.3.4 || ^2.0 || ^3.0", - "squizlabs/php_codesniffer": "^2.6", - "symfony/var-dumper": "^3.3 || ^4.0" - }, - "suggest": { - "ext-SimpleXML": "For Firefox profile creation" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-community": "1.5-dev" - } - }, - "autoload": { - "psr-4": { - "Facebook\\WebDriver\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "A PHP client for Selenium WebDriver", - "homepage": "https://github.com/facebook/php-webdriver", - "keywords": [ - "facebook", - "php", - "selenium", - "webdriver" - ], - "abandoned": "php-webdriver/webdriver", - "time": "2019-06-13T08:02:18+00:00" - }, { "name": "flow/jsonpath", "version": "0.5.0", @@ -3035,6 +2974,71 @@ "description": "Library for handling version information and constraints", "time": "2017-03-05T17:38:23+00:00" }, + { + "name": "php-webdriver/webdriver", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/php-webdriver/php-webdriver.git", + "reference": "3e33ee3b8a688d719c55acdd7c6788e3006e1d3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/3e33ee3b8a688d719c55acdd7c6788e3006e1d3e", + "reference": "3e33ee3b8a688d719c55acdd7c6788e3006e1d3e", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "ext-zip": "*", + "php": "^5.6 || ~7.0", + "symfony/polyfill-mbstring": "^1.12", + "symfony/process": "^2.8 || ^3.1 || ^4.0 || ^5.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.0", + "jakub-onderka/php-parallel-lint": "^1.0", + "php-coveralls/php-coveralls": "^2.0", + "php-mock/php-mock-phpunit": "^1.1", + "phpunit/phpunit": "^5.7", + "sebastian/environment": "^1.3.4 || ^2.0 || ^3.0", + "sminnee/phpunit-mock-objects": "^3.4", + "squizlabs/php_codesniffer": "^3.5", + "symfony/var-dumper": "^3.3 || ^4.0 || ^5.0" + }, + "suggest": { + "ext-SimpleXML": "For Firefox profile creation" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, + "autoload": { + "files": [ + "lib/Exception/TimeoutException.php" + ], + "psr-4": { + "Facebook\\WebDriver\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A PHP client for Selenium WebDriver. Previously facebook/webdriver.", + "homepage": "https://github.com/php-webdriver/php-webdriver", + "keywords": [ + "Chromedriver", + "geckodriver", + "php", + "selenium", + "webdriver" + ], + "time": "2020-02-10T15:04:25+00:00" + }, { "name": "phpcollection/phpcollection", "version": "0.5.0", diff --git a/dev/tests/verification/Resources/AssertTest.txt b/dev/tests/verification/Resources/AssertTest.txt index bb29759d5..c0cf932ae 100644 --- a/dev/tests/verification/Resources/AssertTest.txt +++ b/dev/tests/verification/Resources/AssertTest.txt @@ -49,6 +49,7 @@ class AssertTestCest $I->assertEmpty([], "pass"); // stepKey: assertEmpty $I->assertEquals($text, "Copyright © 2013-2017 Magento, Inc. All rights reserved.", "pass"); // stepKey: assertEquals1 $I->assertEquals("Copyright © 2013-2017 Magento, Inc. All rights reserved.", $text, "pass"); // stepKey: assertEquals2 + $I->assertEquals(1.5, $text, "pass"); // stepKey: assertFloatTypeIsCorrect $I->assertFalse(false, "pass"); // stepKey: assertFalse1 $I->assertFileNotExists("/out.txt", "pass"); // stepKey: assertFileNotExists1 $I->assertFileNotExists($text, "pass"); // stepKey: assertFileNotExists2 diff --git a/dev/tests/verification/Resources/BasicFunctionalTest.txt b/dev/tests/verification/Resources/BasicFunctionalTest.txt index ac42f395e..072b58261 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..5afd1a6ea 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/dev/tests/verification/TestModule/Test/AssertTest.xml b/dev/tests/verification/TestModule/Test/AssertTest.xml index 82f69b9b0..8cdc724cc 100644 --- a/dev/tests/verification/TestModule/Test/AssertTest.xml +++ b/dev/tests/verification/TestModule/Test/AssertTest.xml @@ -54,6 +54,10 @@ Copyright © 2013-2017 Magento, Inc. All rights reserved. text + + 1.5 + text + 0 diff --git a/docs/actiongroup-list.md b/docs/actiongroup-list.md deleted file mode 100644 index 7b469f4ed..000000000 --- a/docs/actiongroup-list.md +++ /dev/null @@ -1,6 +0,0 @@ -# MFTF action group reference - -Action groups are important building blocks for quickly creating tests for the Magento Functional Testing Framework. -This page lists all current action groups so developers can see what is available to them. - -{% include mftf/actiongroup_data.md %} diff --git a/docs/mftf-tests.md b/docs/mftf-tests.md deleted file mode 100644 index cb1941053..000000000 --- a/docs/mftf-tests.md +++ /dev/null @@ -1,30 +0,0 @@ - - -# MFTF functional test reference - -The Magento Functional Testing Framework runs tests on every Module within Magento. These files are stored within each Module folder in the Magento repo. -This page lists all those tests so that developers can have a good sense of what is covered. - -{% include mftf/functional_data.md %} - -{% for item in mftf %} - -### {{ item.name }} -{% for file in item.items %} -#### [{{ file.filename }}]({{file.repo}}) -{: .mftf-test-link} - -{% for test in file.tests %} -{{test.testname}} - : {{test.description}} -{: .mftf-dl} -{% endfor %} -{% endfor %} -{% endfor %} diff --git a/docs/test/actions.md b/docs/test/actions.md index 59fd12aa2..19ec3f43b 100644 --- a/docs/test/actions.md +++ b/docs/test/actions.md @@ -22,13 +22,13 @@ This step can be referenced within the test using `conditionalClickStep1`. The value format should met the following principles: -* Must be unique within [``](../test.md#test-tag). -* Naming should be as descriptive as possible: - * Describe the action performed. - * Briefly describe the purpose. - * Describe which data is in use. -* Should be in camelCase with lowercase first letter. -* Should be the last attribute of an element. +* Must be unique within [``](../test.md#test-tag). +* Naming should be as descriptive as possible: + * Describe the action performed. + * Briefly describe the purpose. + * Describe which data is in use. +* Should be in camelCase with lowercase first letter. +* Should be the last attribute of an element. ### `before` and `after` @@ -142,14 +142,14 @@ Here, [``](#click) performs a click on a button that can be found by the The following test actions return a variable: -* [grabAttributeFrom](#grabattributefrom) -* [grabCookie](#grabcookie) -* [grabFromCurrentUrl](#grabfromcurrenturl) -* [grabMultiple](#grabmultiple) -* [grabPageSource](#grabpagesource) -* [grabTextFrom](#grabtextfrom) -* [grabValueFrom](#grabvaluefrom) -* [executeJS](#executejs) +* [grabAttributeFrom](#grabattributefrom) +* [grabCookie](#grabcookie) +* [grabFromCurrentUrl](#grabfromcurrenturl) +* [grabMultiple](#grabmultiple) +* [grabPageSource](#grabpagesource) +* [grabTextFrom](#grabtextfrom) +* [grabValueFrom](#grabvaluefrom) +* [executeJS](#executejs) Learn more in [Using data returned by test actions](../data.md#use-data-returned-by-test-actions). @@ -157,10 +157,10 @@ Learn more in [Using data returned by test actions](../data.md#use-data-returned The following test actions handle data entities using [metadata](../metadata.md): -* [createData](#createdata) -* [deleteData](#deletedata) -* [updateData](#updatedata) -* [getData](#getdata) +* [createData](#createdata) +* [deleteData](#deletedata) +* [updateData](#updatedata) +* [getData](#getdata) Learn more in [Handling a REST API response](../metadata.md#rest-response). @@ -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 @@ -1287,7 +1289,6 @@ Attribute|Type|Use|Description `before`|string|optional| `stepKey` of action that must be executed next. `after`|string|optional| `stepKey` of preceding action. - #### Example ```xml @@ -1460,6 +1461,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 @@ -1974,13 +1977,13 @@ Attribute|Type|Use|Description #### Examples ```xml - + ``` ```xml - - + + ``` ### seeOptionIsSelected diff --git a/etc/config/.env.example b/etc/config/.env.example index f5b6ef40e..349d7da9c 100644 --- a/etc/config/.env.example +++ b/etc/config/.env.example @@ -63,4 +63,6 @@ MODULE_WHITELIST=Magento_Framework,ConfigurableProductWishlist,ConfigurableProdu #ENABLE_BROWSER_LOG=true #BROWSER_LOG_BLACKLIST=other +#*** Elastic Search version used for test ***# +ELASTICSEARCH_VERSION=7 #*** End of .env ***# diff --git a/src/Magento/FunctionalTestingFramework/Console/BaseGenerateCommand.php b/src/Magento/FunctionalTestingFramework/Console/BaseGenerateCommand.php index a0d94b16e..3433f23a8 100644 --- a/src/Magento/FunctionalTestingFramework/Console/BaseGenerateCommand.php +++ b/src/Magento/FunctionalTestingFramework/Console/BaseGenerateCommand.php @@ -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. * @@ -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); + } + } } 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..2ec565c44 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, @@ -2180,6 +2194,6 @@ private function wrapParameterArray(string $value): string */ private function hasDecimalPoint(string $outStr) { - return strpos($outStr, localeconv()['decimal_point']) === false; + return strpos($outStr, localeconv()['decimal_point']) !== false; } }