From fe5e815ff4928d7e2393ca38b30cb126dfcee629 Mon Sep 17 00:00:00 2001 From: Tom Reece Date: Tue, 21 Nov 2017 10:21:02 -0600 Subject: [PATCH 01/35] MQE-494: Create MFTF demo repository - Fail gracefully if Magento is not running --- .../FunctionalTestingFramework/Module/MagentoRestDriver.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoRestDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoRestDriver.php index 790626629..4509a65b5 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoRestDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoRestDriver.php @@ -104,6 +104,11 @@ class MagentoRestDriver extends REST public function _beforeSuite($settings = []) { parent::_beforeSuite($settings); + + if (empty($this->config['url']) || empty($this->config['username']) || empty($this->config['password'])) { + return; + } + $this->haveHttpHeader('Content-Type', 'application/json'); $this->sendPOST( 'integration/admin/token', From 7f3545b9bb4bbca571ee9f7512e515498baee67d Mon Sep 17 00:00:00 2001 From: Tom Reece Date: Tue, 21 Nov 2017 10:44:51 -0600 Subject: [PATCH 02/35] MQE-494: Create MFTF demo repository - Do not error when Data, Section, or Page XML does not exist --- .../DataGenerator/Handlers/DataObjectHandler.php | 2 +- .../Page/Handlers/PageObjectHandler.php | 2 +- .../Page/Handlers/SectionObjectHandler.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/DataObjectHandler.php b/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/DataObjectHandler.php index 0ca3d459a..bac2342a2 100644 --- a/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/DataObjectHandler.php +++ b/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/DataObjectHandler.php @@ -116,7 +116,7 @@ private function initDataObjects() $entityParsedData = $entityParser->readDataProfiles(); if (!$entityParsedData) { - trigger_error("No entities could be parsed from xml definitions", E_USER_NOTICE); + // No *Data.xml files found so give up return; } diff --git a/src/Magento/FunctionalTestingFramework/Page/Handlers/PageObjectHandler.php b/src/Magento/FunctionalTestingFramework/Page/Handlers/PageObjectHandler.php index 928911150..e2c280ac5 100644 --- a/src/Magento/FunctionalTestingFramework/Page/Handlers/PageObjectHandler.php +++ b/src/Magento/FunctionalTestingFramework/Page/Handlers/PageObjectHandler.php @@ -97,7 +97,7 @@ private function initPageObjects() $parsedObjs = $parser->getData(self::TYPE); if (!$parsedObjs) { - trigger_error("No " . self::TYPE . " objects defined", E_USER_NOTICE); + // No *Page.xml files found so give up return; } diff --git a/src/Magento/FunctionalTestingFramework/Page/Handlers/SectionObjectHandler.php b/src/Magento/FunctionalTestingFramework/Page/Handlers/SectionObjectHandler.php index a39db4c69..171eb5376 100644 --- a/src/Magento/FunctionalTestingFramework/Page/Handlers/SectionObjectHandler.php +++ b/src/Magento/FunctionalTestingFramework/Page/Handlers/SectionObjectHandler.php @@ -101,7 +101,7 @@ private function initSectionObjects() $parsedObjs = $parser->getData(self::TYPE); if (!$parsedObjs) { - trigger_error("No " . self::TYPE . " objects defined", E_USER_NOTICE); + // No *Section.xml files found so give up return; } From 36755e56f1c52fb094bea3734b60a8f63c581f6d Mon Sep 17 00:00:00 2001 From: Kevin Kozan Date: Mon, 27 Nov 2017 09:28:26 -0600 Subject: [PATCH 03/35] MQE-507: [Action Groups] Strange behavior with argument replacement in selector - Changed str_replace to preg_replace, regex disallows replacement when the argument is attached to another word (cases like categorySideButton versus category.name) - Added Verification test for useCase --- .../Resources/ActionGroupFunctionalCest.txt | 11 +++++++++++ .../TestModule/ActionGroup/FunctionalActionGroup.xml | 7 +++++++ .../TestModule/Cest/ActionGroupFunctionalCest.xml | 3 +++ .../verification/TestModule/Section/SampleSection.xml | 1 + .../Test/Objects/ActionGroupObject.php | 3 ++- 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/dev/tests/verification/Resources/ActionGroupFunctionalCest.txt b/dev/tests/verification/Resources/ActionGroupFunctionalCest.txt index 39a406e20..8cd9964c8 100644 --- a/dev/tests/verification/Resources/ActionGroupFunctionalCest.txt +++ b/dev/tests/verification/Resources/ActionGroupFunctionalCest.txt @@ -162,4 +162,15 @@ class ActionGroupFunctionalCest $I->amOnPage("/Jane/Dane.html"); } + /** + * @Parameter(name = "AcceptanceTester", value="$I") + * @param AcceptanceTester $I + * @return void + */ + public function ArgumentWithSameNameAsElement(AcceptanceTester $I) + { + $I->seeElement("#element"); + $I->seeElement("#element .John"); + } + } diff --git a/dev/tests/verification/TestModule/ActionGroup/FunctionalActionGroup.xml b/dev/tests/verification/TestModule/ActionGroup/FunctionalActionGroup.xml index a4b1e4cd6..64d804c2e 100644 --- a/dev/tests/verification/TestModule/ActionGroup/FunctionalActionGroup.xml +++ b/dev/tests/verification/TestModule/ActionGroup/FunctionalActionGroup.xml @@ -38,4 +38,11 @@ + + + + + + + diff --git a/dev/tests/verification/TestModule/Cest/ActionGroupFunctionalCest.xml b/dev/tests/verification/TestModule/Cest/ActionGroupFunctionalCest.xml index 2237853f3..76a53b534 100644 --- a/dev/tests/verification/TestModule/Cest/ActionGroupFunctionalCest.xml +++ b/dev/tests/verification/TestModule/Cest/ActionGroupFunctionalCest.xml @@ -67,5 +67,8 @@ + + + diff --git a/dev/tests/verification/TestModule/Section/SampleSection.xml b/dev/tests/verification/TestModule/Section/SampleSection.xml index 63a525886..d4f3da09a 100644 --- a/dev/tests/verification/TestModule/Section/SampleSection.xml +++ b/dev/tests/verification/TestModule/Section/SampleSection.xml @@ -10,6 +10,7 @@ xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
+ diff --git a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionGroupObject.php b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionGroupObject.php index 40feb93de..b20b342c0 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionGroupObject.php +++ b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionGroupObject.php @@ -217,7 +217,8 @@ private function replaceAttributeArgumentInVariable( ); } - return str_replace($variableName, $arguments[$variableName], $attributeValue); + //replace argument ONLY when there is no letters attached before after (ex. category.name vs categoryTreeButton) + return preg_replace("/(? Date: Tue, 21 Nov 2017 17:01:48 -0600 Subject: [PATCH 04/35] MQE-565: User are not able to use after updating the latest composer.json - add new test actions type - updated verification tests to include check for actionGroup in hook type --- .../Resources/ActionGroupFunctionalCest.txt | 8 ++++++++ .../TestModule/Cest/ActionGroupFunctionalCest.xml | 4 ++++ .../Test/etc/testSchema.xsd | 12 +++++++++--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/dev/tests/verification/Resources/ActionGroupFunctionalCest.txt b/dev/tests/verification/Resources/ActionGroupFunctionalCest.txt index 8cd9964c8..b40724cbf 100644 --- a/dev/tests/verification/Resources/ActionGroupFunctionalCest.txt +++ b/dev/tests/verification/Resources/ActionGroupFunctionalCest.txt @@ -35,6 +35,14 @@ class ActionGroupFunctionalCest $ReplacementPerson = DataObjectHandler::getInstance()->getObject("ReplacementPerson"); $this->createPersonParam = new DataPersistenceHandler($ReplacementPerson); $this->createPersonParam->createEntity(); + $I->fillField("#foo", "myData1"); + $I->fillField("#bar", "myData2"); + } + + public function _after(AcceptanceTester $I) + { + $I->fillField("#foo", "myData1"); + $I->fillField("#bar", "myData2"); } /** diff --git a/dev/tests/verification/TestModule/Cest/ActionGroupFunctionalCest.xml b/dev/tests/verification/TestModule/Cest/ActionGroupFunctionalCest.xml index 76a53b534..64dc58910 100644 --- a/dev/tests/verification/TestModule/Cest/ActionGroupFunctionalCest.xml +++ b/dev/tests/verification/TestModule/Cest/ActionGroupFunctionalCest.xml @@ -18,6 +18,7 @@ + @@ -70,5 +71,8 @@ + + + diff --git a/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd b/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd index d54eb1060..1bb521a3e 100644 --- a/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd +++ b/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd @@ -69,18 +69,24 @@ - + - + - + + + + + + + From a948df685421f30851b4dca1aa1ba50559c49b41 Mon Sep 17 00:00:00 2001 From: Tom Reece Date: Tue, 28 Nov 2017 14:16:14 -0600 Subject: [PATCH 05/35] MQE-494: Create MFTF demo repository - Do not blow up if admin username or admin password not set in .env file --- .../FunctionalTestingFramework/Util/ModuleResolver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php b/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php index 19c541f10..237ce0828 100644 --- a/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php +++ b/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php @@ -193,8 +193,8 @@ public function getModulesPath() */ protected function getAdminToken() { - $login = $_ENV['MAGENTO_ADMIN_USERNAME']; - $password = $_ENV['MAGENTO_ADMIN_PASSWORD']; + $login = $_ENV['MAGENTO_ADMIN_USERNAME'] ?? null; + $password = $_ENV['MAGENTO_ADMIN_PASSWORD'] ?? null; if (!$login || !$password || !isset($_ENV['MAGENTO_BASE_URL'])) { return false; } From 06ccb744cc06ceaf172808deeefae585e67b2627 Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Tue, 28 Nov 2017 21:09:58 -0600 Subject: [PATCH 06/35] MQE-469: use 'number' for operation data type according to swagger 2.0 spec. --- .../Persist/OperationDataArrayResolverTest.php | 6 +++--- dev/tests/unit/Util/EntityDataObjectBuilder.php | 2 +- dev/tests/unit/Util/OperationElementBuilder.php | 2 +- .../DataGenerator/Persist/OperationDataArrayResolver.php | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/DataGenerator/Persist/OperationDataArrayResolverTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/DataGenerator/Persist/OperationDataArrayResolverTest.php index 513c80e9b..4b57a2f73 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/DataGenerator/Persist/OperationDataArrayResolverTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/DataGenerator/Persist/OperationDataArrayResolverTest.php @@ -20,14 +20,14 @@ class OperationDataArrayResolverTest extends TestCase "name" => "Hopper", "address" => ["city" => "Hawkins", "state" => "Indiana", "zip" => 78758], "isPrimary" => true, - "gpa" => 3.5, + "gpa" => 3.5678, "phone" => 5555555 ]]; const NESTED_METADATA_ARRAY_RESULT = ["parentType" => [ "name" => "Hopper", "isPrimary" => true, - "gpa" => 3.5, + "gpa" => 3.5678, "phone" => 5555555, "address" => [ ["city" => "Hawkins", "state" => "Indiana", "zip" => 78758], @@ -65,7 +65,7 @@ public function testBasicPrimitiveMetadataResolve() // assert on result $expectedResult = ["testType" => [ "name" => "Hopper", - "gpa" => 3.5, + "gpa" => 3.5678, "phone" => 5555555, "isPrimary" => true ]]; diff --git a/dev/tests/unit/Util/EntityDataObjectBuilder.php b/dev/tests/unit/Util/EntityDataObjectBuilder.php index ead183b8c..dfe7d6836 100644 --- a/dev/tests/unit/Util/EntityDataObjectBuilder.php +++ b/dev/tests/unit/Util/EntityDataObjectBuilder.php @@ -16,7 +16,7 @@ class EntityDataObjectBuilder */ private $data = [ "name" => "Hopper", - "gpa" => "3.5", + "gpa" => "3.5678", "phone" => "5555555", "isprimary" => "true" ]; diff --git a/dev/tests/unit/Util/OperationElementBuilder.php b/dev/tests/unit/Util/OperationElementBuilder.php index a7a021ac2..cf9322e17 100644 --- a/dev/tests/unit/Util/OperationElementBuilder.php +++ b/dev/tests/unit/Util/OperationElementBuilder.php @@ -18,7 +18,7 @@ class OperationElementBuilder */ private $fields = [ 'name' => 'string', - 'gpa' => 'double', + 'gpa' => 'number', 'phone' => 'integer', 'isPrimary' => 'boolean' ]; diff --git a/src/Magento/FunctionalTestingFramework/DataGenerator/Persist/OperationDataArrayResolver.php b/src/Magento/FunctionalTestingFramework/DataGenerator/Persist/OperationDataArrayResolver.php index bbe713c06..7521acc10 100644 --- a/src/Magento/FunctionalTestingFramework/DataGenerator/Persist/OperationDataArrayResolver.php +++ b/src/Magento/FunctionalTestingFramework/DataGenerator/Persist/OperationDataArrayResolver.php @@ -18,7 +18,7 @@ class OperationDataArrayResolver 'string', 'boolean', 'integer', - 'double' + 'number' ]; const EXCEPTION_REQUIRED_DATA = "%s of key \" %s\" in \"%s\" is required by metadata, but was not provided."; @@ -362,8 +362,8 @@ private function castValue($type, $value) } $newVal = (boolean)$value; break; - case 'double': - $newVal = (double)$value; + case 'number': + $newVal = (float)$value; break; } From 39bfa9fb2caf8893d269512fabd479b38dfd4fae Mon Sep 17 00:00:00 2001 From: John Stennett Date: Wed, 29 Nov 2017 15:15:56 -0600 Subject: [PATCH 07/35] MQE-382: Adding a "assertElementContainsAttribute" method. - Adding the "assertElementContainsAttribute" method to the MagentoWebDriver file. - Adding the "assertElementContainsAttribute" method to the Test Schema. - Adding the "assertElementContainsAttribute" method to the di.xml so it can be listed multiple times in a test. - Adding the "assertElementContainsAttribute" method to the MagentoWebDriver.php file. - Adding verification tests. - Expanding comments for the function to make it clearer. - Replaced "userInput" with "expectedValue". - Adding "expectedValue" to the TestGenerator. --- .../verification/Resources/AssertCest.txt | 8 +++++++ .../TestModule/Cest/AssertCest.xml | 10 +++++++++ etc/di.xml | 12 +++++------ .../Module/MagentoWebDriver.php | 20 ++++++++++++++++++ .../Test/etc/testSchema.xsd | 15 +++++++++++++ .../Util/TestGenerator.php | 21 +++++++++++++++++++ 6 files changed, 80 insertions(+), 6 deletions(-) diff --git a/dev/tests/verification/Resources/AssertCest.txt b/dev/tests/verification/Resources/AssertCest.txt index fd2fe2259..0caa44062 100644 --- a/dev/tests/verification/Resources/AssertCest.txt +++ b/dev/tests/verification/Resources/AssertCest.txt @@ -98,5 +98,13 @@ class AssertCest $I->fail("fail"); $I->fail($createData2->getCreatedDataByName('firstname') . " " . $createData2->getCreatedDataByName('lastname')); $I->fail($this->createData1->getCreatedDataByName('firstname') . " " . $this->createData1->getCreatedDataByName('lastname')); + $I->assertElementContainsAttribute("#username", "class", "admin__control-text"); + $I->assertElementContainsAttribute("#username", "name", "login[username]"); + $I->assertElementContainsAttribute("#username", "autofocus", ""); + $I->assertElementContainsAttribute("#username", "data-validate", "{required:true}"); + $I->assertElementContainsAttribute(".admin__menu-overlay", "style", "display: none;"); + $I->assertElementContainsAttribute(".admin__menu-overlay", "border", "0"); + $I->assertElementContainsAttribute("#username", "value", $createData2->getCreatedDataByName('firstname')); + $I->assertElementContainsAttribute("#username", "value", $this->createData1->getCreatedDataByName('firstname')); } } diff --git a/dev/tests/verification/TestModule/Cest/AssertCest.xml b/dev/tests/verification/TestModule/Cest/AssertCest.xml index 9444da9f6..20e46b33c 100644 --- a/dev/tests/verification/TestModule/Cest/AssertCest.xml +++ b/dev/tests/verification/TestModule/Cest/AssertCest.xml @@ -76,6 +76,16 @@ + + + + + + + + + + diff --git a/etc/di.xml b/etc/di.xml index c6e77e5b8..f4261b9d8 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -208,7 +208,7 @@ createDataKey createDataKey createDataKey - mergeKey + mergeKey *Cest.xml Cest @@ -218,9 +218,9 @@ - mergeKey - mergeKey - mergeKey + mergeKey + mergeKey + mergeKey name name createDataKey @@ -286,7 +286,7 @@ name name - mergeKey + mergeKey *ActionGroup.xml ActionGroup @@ -296,7 +296,7 @@ - mergeKey + mergeKey name name diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index b6e6e2800..26dbe2274 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -325,6 +325,26 @@ public function clearField($selector) $this->fillField($selector, ""); } + /** + * Assert that an element contains a given value for the specific attribute. + * + * @param string $selector + * @param string $attribute + * @param $value + */ + public function assertElementContainsAttribute($selector, $attribute, $value) + { + $attributes = $this->grabAttributeFrom($selector, $attribute); + + if (isset($value) && empty($value)) { + // If an "attribute" is blank, "", or null we need to be able to assert that it's present. + // When an "attribute" is blank or null it returns "true" so we assert that "true" is present. + $this->assertEquals($attributes, 'true'); + } else { + $this->assertContains($value, $attributes); + } + } + /** * Override for _failed method in Codeception method. Adds png and html attachments to allure report * following parent execution of test failure processing. diff --git a/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd b/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd index 1bb521a3e..e4c8c4f8e 100644 --- a/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd +++ b/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd @@ -95,6 +95,7 @@ + @@ -318,6 +319,20 @@ + + + + + + + + + + + + + + diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index 94e1117ac..c80e7dc6a 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -344,6 +344,7 @@ private function generateStepsPhp($stepsObject, $stepsData, $hookObject = false) foreach ($stepsObject as $steps) { $actor = "I"; $actionName = $steps->getType(); + $attribute = null; $customActionAttributes = $steps->getCustomActionAttributes(); $selector = null; $selector1 = null; @@ -379,6 +380,10 @@ private function generateStepsPhp($stepsObject, $stepsData, $hookObject = false) $returnVariable = $customActionAttributes['returnVariable']; } + if (isset($customActionAttributes['attribute'])) { + $attribute = $customActionAttributes['attribute']; + } + if (isset($customActionAttributes['variable'])) { $input = $this->addDollarSign($customActionAttributes['variable']); } elseif (isset($customActionAttributes['userInput']) && isset($customActionAttributes['url'])) { @@ -388,6 +393,8 @@ private function generateStepsPhp($stepsObject, $stepsData, $hookObject = false) $input = $this->addUniquenessFunctionCall($customActionAttributes['userInput']); } elseif (isset($customActionAttributes['url'])) { $input = $this->addUniquenessFunctionCall($customActionAttributes['url']); + } elseif (isset($customActionAttributes['expectedValue'])) { + $input = $this->addUniquenessFunctionCall($customActionAttributes['expectedValue']); } if (isset($customActionAttributes['expected'])) { $assertExpected = $this->resolveValueByType( @@ -968,6 +975,20 @@ private function generateStepsPhp($stepsObject, $stepsData, $hookObject = false) $assertDelta ); break; + case "assertElementContainsAttribute": + // If a blank string or null is passed in we need to pass a blank string to the function. + if (empty($input)) { + $input = '""'; + } + + $testSteps .= $this->wrapFunctionCall( + $actor, + $actionName, + $selector, + $this->wrapWithDoubleQuotes($attribute), + $input + ); + break; case "assertEmpty": case "assertFalse": case "assertFileExists": From e1b663c346a5271518e4cbb4fc1131b9b343d543 Mon Sep 17 00:00:00 2001 From: Tom Reece Date: Thu, 30 Nov 2017 15:03:06 -0600 Subject: [PATCH 08/35] MQE-586: Ignore _generated folder for mftf code sniffer --- bin/blacklist.txt | 3 ++- bin/static-checks | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/blacklist.txt b/bin/blacklist.txt index c85d25b5c..ea81ed858 100644 --- a/bin/blacklist.txt +++ b/bin/blacklist.txt @@ -6,4 +6,5 @@ bin/blacklist.txt dev/tests/static/Magento/Sniffs/Annotations/Helper.php dev/tests/static/Magento/Sniffs/Annotations/RequireAnnotatedAttributesSniff.php -dev/tests/static/Magento/Sniffs/Annotations/RequireAnnotatedMethodsSniff.php \ No newline at end of file +dev/tests/static/Magento/Sniffs/Annotations/RequireAnnotatedMethodsSniff.php +dev/tests/verification/_generated diff --git a/bin/static-checks b/bin/static-checks index cdc6b8c7b..c01ad8091 100755 --- a/bin/static-checks +++ b/bin/static-checks @@ -4,7 +4,7 @@ echo "===============================PHP CODE SNIFFER REPORT===============================" vendor/bin/phpcs ./src --standard=./dev/tests/static/Magento vendor/bin/phpcs ./dev/tests/unit --standard=./dev/tests/static/Magento -vendor/bin/phpcs ./dev/tests/verification --standard=./dev/tests/static/Magento +vendor/bin/phpcs ./dev/tests/verification --standard=./dev/tests/static/Magento --ignore=dev/tests/verification/_generated echo "===============================COPY PASTE DETECTOR REPORT===============================" vendor/bin/phpcpd ./src From bab10a82848732428197c0e549fe9075882ec90b Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Fri, 1 Dec 2017 15:33:20 -0600 Subject: [PATCH 09/35] MQE-569: added SampleTests in module blacklist and not allowed to generate them. --- .../Util/ModuleResolver.php | 41 +++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php b/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php index 19c541f10..a0e3cf838 100644 --- a/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php +++ b/src/Magento/FunctionalTestingFramework/Util/ModuleResolver.php @@ -74,6 +74,15 @@ class ModuleResolver */ protected $sequenceSorter; + /** + * List of module names that will be ignored. + * + * @var array + */ + protected $moduleBlacklist = [ + 'SampleTests', + ]; + /** * Get ModuleResolver instance. * @@ -157,7 +166,7 @@ protected function getModuleWhitelist() public function getModulesPath() { if (isset($this->enabledModulePaths)) { - return $this->enabledModulePaths; + return $this->removeBlacklistModules($this->enabledModulePaths); } $enabledModules = $this->getEnabledModules(); @@ -165,7 +174,7 @@ public function getModulesPath() $allModulePaths = glob($modulePath . '*/*'); if (empty($enabledModules)) { $this->enabledModulePaths = $allModulePaths; - return $this->enabledModulePaths; + return $this->removeBlacklistModules($this->enabledModulePaths); } $enabledModules = array_merge($enabledModules, $this->getModuleWhitelist()); @@ -183,7 +192,7 @@ public function getModulesPath() } $this->enabledModulePaths = $allModulePaths; - return $this->enabledModulePaths; + return $this->removeBlacklistModules($this->enabledModulePaths); } /** @@ -231,4 +240,30 @@ public function sortFilesByModuleSequence(array $files) { return $this->sequenceSorter->sort($files); } + + /** + * Remove blacklist modules from input module paths. + * + * @param array &$modulePaths + * @return array + */ + protected function removeBlacklistModules(&$modulePaths) + { + foreach ($modulePaths as $index => $modulePath) { + if (in_array(basename($modulePath), $this->getModuleBlacklist())) { + unset($modulePaths[$index]); + } + } + return $modulePaths; + } + + /** + * Getter for moduleBlacklist. + * + * @return array + */ + protected function getModuleBlacklist() + { + return $this->moduleBlacklist; + } } From 3649824eded270eb7140ca8daa6e2c6a45dc942a Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Fri, 1 Dec 2017 10:37:31 -0600 Subject: [PATCH 10/35] MQE-541: changed to use stepKey for test step sequencing. --- .../Test/Objects/ActionObjectTest.php | 4 +- .../Test/Util/ActionMergeUtilTest.php | 16 +- .../Resources/ActionGroupFunctionalCest.txt | 4 +- .../verification/Resources/AssertCest.txt | 4 +- .../Resources/LocatorFunctionCest.txt | 2 +- .../Resources/PageReplacementCest.txt | 2 +- .../Resources/ParameterArrayCest.txt | 2 +- .../Resources/PersistedReplacementCest.txt | 4 +- .../Resources/SectionReplacementCest.txt | 2 +- .../ActionGroup/FunctionalActionGroup.xml | 30 +- .../MergeFunctionalActionGroup.xml | 6 +- .../Cest/ActionGroupFunctionalCest.xml | 48 +- .../TestModule/Cest/AssertCest.xml | 130 +++--- .../TestModule/Cest/BasicFunctionalCest.xml | 170 +++---- .../TestModule/Cest/DataReplacementCest.xml | 38 +- .../TestModule/Cest/LocatorFunctionCest.xml | 26 +- .../Cest/MergeBaseFunctionalCest.xml | 16 +- .../TestModule/Cest/MergeInFunctionalCest.xml | 16 +- .../TestModule/Cest/PageReplacementCest.xml | 18 +- .../TestModule/Cest/ParameterArrayCest.xml | 22 +- .../Cest/PersistedReplacementCest.xml | 20 +- .../TestModule/Cest/SampleSuiteCest.xml | 72 +-- .../Cest/SectionReplacementCest.xml | 66 +-- etc/di.xml | 16 +- .../Suite/Generators/GroupClassGenerator.php | 6 +- .../Suite/etc/sampleSuite.xml | 23 - .../Suite/views/SuiteClass.mustache | 2 +- .../views/partials/dataPersistence.mustache | 4 +- .../Test/Config/Converter/Dom/Flat.php | 7 + .../Test/Objects/ActionGroupObject.php | 4 +- .../Test/Objects/ActionObject.php | 18 +- .../Test/Util/ActionMergeUtil.php | 12 +- .../Test/Util/ActionObjectExtractor.php | 2 +- .../Test/Util/TestEntityExtractor.php | 2 +- .../Test/etc/sampleActionGroup.xml | 93 ---- .../Test/etc/sampleCest.xml | 101 ----- .../Test/etc/testSchema.xsd | 427 ++++++++++++------ .../Util/TestGenerator.php | 16 +- 38 files changed, 692 insertions(+), 759 deletions(-) delete mode 100644 src/Magento/FunctionalTestingFramework/Suite/etc/sampleSuite.xml delete mode 100644 src/Magento/FunctionalTestingFramework/Test/etc/sampleActionGroup.xml delete mode 100644 src/Magento/FunctionalTestingFramework/Test/etc/sampleCest.xml diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Objects/ActionObjectTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Objects/ActionObjectTest.php index 5ab71810c..17e6ad468 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Objects/ActionObjectTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Objects/ActionObjectTest.php @@ -27,7 +27,7 @@ class ActionObjectTest extends TestCase */ public function testConstructOrderBefore() { - $actionObject = new ActionObject('mergeKey', 'type', [], null, 'before'); + $actionObject = new ActionObject('stepKey', 'type', [], null, 'before'); $this->assertEquals(0, $actionObject->getOrderOffset()); } @@ -36,7 +36,7 @@ public function testConstructOrderBefore() */ public function testConstructOrderAfter() { - $actionObject = new ActionObject('mergeKey', 'type', [], null, 'after'); + $actionObject = new ActionObject('stepKey', 'type', [], null, 'after'); $this->assertEquals(1, $actionObject->getOrderOffset()); } diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php index bbe88bf54..a185253e3 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php @@ -49,39 +49,39 @@ public function testResolveActionStepOrdering() $testObjNamePosAfterEnd = 'testAfterAfterMerge10'; for ($i = 1; $i < $actionsLength; $i++) { - $mergeKey = 'mergeKey'. $i; + $stepKey = 'stepKey'. $i; $type = 'testType'; $actionAttributes = []; - $actions[] = new ActionObject($mergeKey, $type, $actionAttributes); + $actions[] = new ActionObject($stepKey, $type, $actionAttributes); } $actions[] = new ActionObject( $testObjNamePosAfterEnd, - 'mergeType', + 'stepType', [], $testObjNamePosEnd, ActionObject::MERGE_ACTION_ORDER_AFTER ); $actions[] = new ActionObject( $testObjNamePosBeforeFirst, - 'mergeType', + 'stepType', [], $testObjNamePosFirst, ActionObjectExtractor::TEST_ACTION_BEFORE ); $actions[] = new ActionObject( $testObjNamePosFirst, - 'mergeType', + 'stepType', [], - 'mergeKey1', + 'stepKey1', ActionObjectExtractor::TEST_ACTION_BEFORE ); $actions[] = new ActionObject( $testObjNamePosEnd, - 'mergeType', + 'stepType', [], - 'mergeKey' . (string)($actionsLength - 1), + 'stepKey' . (string)($actionsLength - 1), ActionObject::MERGE_ACTION_ORDER_AFTER ); diff --git a/dev/tests/verification/Resources/ActionGroupFunctionalCest.txt b/dev/tests/verification/Resources/ActionGroupFunctionalCest.txt index b40724cbf..00697e8f2 100644 --- a/dev/tests/verification/Resources/ActionGroupFunctionalCest.txt +++ b/dev/tests/verification/Resources/ActionGroupFunctionalCest.txt @@ -31,7 +31,7 @@ class ActionGroupFunctionalCest public function _before(AcceptanceTester $I) { - $I->amGoingTo("create entity that has the mergeKey: createPersonParam"); + $I->amGoingTo("create entity that has the stepKey: createPersonParam"); $ReplacementPerson = DataObjectHandler::getInstance()->getObject("ReplacementPerson"); $this->createPersonParam = new DataPersistenceHandler($ReplacementPerson); $this->createPersonParam->createEntity(); @@ -111,7 +111,7 @@ class ActionGroupFunctionalCest */ public function ActionGroupWithPersistedData(AcceptanceTester $I) { - $I->amGoingTo("create entity that has the mergeKey: createPerson"); + $I->amGoingTo("create entity that has the stepKey: createPerson"); $DefaultPerson = DataObjectHandler::getInstance()->getObject("DefaultPerson"); $createPerson = new DataPersistenceHandler($DefaultPerson); $createPerson->createEntity(); diff --git a/dev/tests/verification/Resources/AssertCest.txt b/dev/tests/verification/Resources/AssertCest.txt index 0caa44062..1affb20db 100644 --- a/dev/tests/verification/Resources/AssertCest.txt +++ b/dev/tests/verification/Resources/AssertCest.txt @@ -26,7 +26,7 @@ class AssertCest public function _before(AcceptanceTester $I) { - $I->amGoingTo("create entity that has the mergeKey: createData1"); + $I->amGoingTo("create entity that has the stepKey: createData1"); $ReplacementPerson = DataObjectHandler::getInstance()->getObject("ReplacementPerson"); $this->createData1 = new DataPersistenceHandler($ReplacementPerson); $this->createData1->createEntity(); @@ -39,7 +39,7 @@ class AssertCest */ public function AssertTest(AcceptanceTester $I) { - $I->amGoingTo("create entity that has the mergeKey: createData2"); + $I->amGoingTo("create entity that has the stepKey: createData2"); $UniquePerson = DataObjectHandler::getInstance()->getObject("UniquePerson"); $createData2 = new DataPersistenceHandler($UniquePerson); $createData2->createEntity(); diff --git a/dev/tests/verification/Resources/LocatorFunctionCest.txt b/dev/tests/verification/Resources/LocatorFunctionCest.txt index b716443c0..17b1136b6 100644 --- a/dev/tests/verification/Resources/LocatorFunctionCest.txt +++ b/dev/tests/verification/Resources/LocatorFunctionCest.txt @@ -26,7 +26,7 @@ class LocatorFunctionCest */ public function LocatorFuctionTest(AcceptanceTester $I) { - $I->amGoingTo("create entity that has the mergeKey: data"); + $I->amGoingTo("create entity that has the stepKey: data"); $ReplacementPerson = DataObjectHandler::getInstance()->getObject("ReplacementPerson"); $data = new DataPersistenceHandler($ReplacementPerson); $data->createEntity(); diff --git a/dev/tests/verification/Resources/PageReplacementCest.txt b/dev/tests/verification/Resources/PageReplacementCest.txt index bfb459b5b..788513e31 100644 --- a/dev/tests/verification/Resources/PageReplacementCest.txt +++ b/dev/tests/verification/Resources/PageReplacementCest.txt @@ -26,7 +26,7 @@ class PageReplacementCest */ public function PageReplacementTest(AcceptanceTester $I) { - $I->amGoingTo("create entity that has the mergeKey: datakey"); + $I->amGoingTo("create entity that has the stepKey: datakey"); $simpleData = DataObjectHandler::getInstance()->getObject("simpleData"); $datakey = new DataPersistenceHandler($simpleData); $datakey->createEntity(); diff --git a/dev/tests/verification/Resources/ParameterArrayCest.txt b/dev/tests/verification/Resources/ParameterArrayCest.txt index c07354af1..29950491a 100644 --- a/dev/tests/verification/Resources/ParameterArrayCest.txt +++ b/dev/tests/verification/Resources/ParameterArrayCest.txt @@ -26,7 +26,7 @@ class ParameterArrayCest */ public function ParameterArrayTest(AcceptanceTester $I) { - $I->amGoingTo("create entity that has the mergeKey: simpleDataKey"); + $I->amGoingTo("create entity that has the stepKey: simpleDataKey"); $simpleParamData = DataObjectHandler::getInstance()->getObject("simpleParamData"); $simpleDataKey = new DataPersistenceHandler($simpleParamData); $simpleDataKey->createEntity(); diff --git a/dev/tests/verification/Resources/PersistedReplacementCest.txt b/dev/tests/verification/Resources/PersistedReplacementCest.txt index 4ff8d853e..1e2d8d325 100644 --- a/dev/tests/verification/Resources/PersistedReplacementCest.txt +++ b/dev/tests/verification/Resources/PersistedReplacementCest.txt @@ -26,7 +26,7 @@ class PersistedReplacementCest public function _before(AcceptanceTester $I) { - $I->amGoingTo("create entity that has the mergeKey: createData1"); + $I->amGoingTo("create entity that has the stepKey: createData1"); $ReplacementPerson = DataObjectHandler::getInstance()->getObject("ReplacementPerson"); $this->createData1 = new DataPersistenceHandler($ReplacementPerson); $this->createData1->createEntity(); @@ -39,7 +39,7 @@ class PersistedReplacementCest */ public function PersistedReplacementTest(AcceptanceTester $I) { - $I->amGoingTo("create entity that has the mergeKey: createdData"); + $I->amGoingTo("create entity that has the stepKey: createdData"); $simpleData = DataObjectHandler::getInstance()->getObject("simpleData"); $createdData = new DataPersistenceHandler($simpleData); $createdData->createEntity(); diff --git a/dev/tests/verification/Resources/SectionReplacementCest.txt b/dev/tests/verification/Resources/SectionReplacementCest.txt index 333f5ac4f..2fb4d0b29 100644 --- a/dev/tests/verification/Resources/SectionReplacementCest.txt +++ b/dev/tests/verification/Resources/SectionReplacementCest.txt @@ -45,7 +45,7 @@ class SectionReplacementCest $I->click("#Doe".msq("uniqueData")." .stringLiteral2"); $I->click("#Doe".msq("uniqueData")."-stringLiteral2 .stringLiteral3"); $I->click("#Doe".msq("uniqueData")."-stringLiteral2 .Doe"); - $I->amGoingTo("create entity that has the mergeKey: createdData"); + $I->amGoingTo("create entity that has the stepKey: createdData"); $simpleData = DataObjectHandler::getInstance()->getObject("simpleData"); $createdData = new DataPersistenceHandler($simpleData); $createdData->createEntity(); diff --git a/dev/tests/verification/TestModule/ActionGroup/FunctionalActionGroup.xml b/dev/tests/verification/TestModule/ActionGroup/FunctionalActionGroup.xml index 64d804c2e..8215dbe97 100644 --- a/dev/tests/verification/TestModule/ActionGroup/FunctionalActionGroup.xml +++ b/dev/tests/verification/TestModule/ActionGroup/FunctionalActionGroup.xml @@ -9,40 +9,40 @@ - - + + - - - - - + + + + + - - - + + + - - - + + + - - + + diff --git a/dev/tests/verification/TestModule/ActionGroup/MergeFunctionalActionGroup.xml b/dev/tests/verification/TestModule/ActionGroup/MergeFunctionalActionGroup.xml index 37f648f43..028daf11e 100644 --- a/dev/tests/verification/TestModule/ActionGroup/MergeFunctionalActionGroup.xml +++ b/dev/tests/verification/TestModule/ActionGroup/MergeFunctionalActionGroup.xml @@ -9,8 +9,8 @@ - - - + + + diff --git a/dev/tests/verification/TestModule/Cest/ActionGroupFunctionalCest.xml b/dev/tests/verification/TestModule/Cest/ActionGroupFunctionalCest.xml index 64dc58910..e9c677c64 100644 --- a/dev/tests/verification/TestModule/Cest/ActionGroupFunctionalCest.xml +++ b/dev/tests/verification/TestModule/Cest/ActionGroupFunctionalCest.xml @@ -17,62 +17,62 @@ - - + + - - - + + + - - - + + + - - + + - + - - + + - + - - + + - + - - - - + + + + - + - + - + diff --git a/dev/tests/verification/TestModule/Cest/AssertCest.xml b/dev/tests/verification/TestModule/Cest/AssertCest.xml index 20e46b33c..f50bd3299 100644 --- a/dev/tests/verification/TestModule/Cest/AssertCest.xml +++ b/dev/tests/verification/TestModule/Cest/AssertCest.xml @@ -10,82 +10,82 @@ xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + diff --git a/dev/tests/verification/TestModule/Cest/BasicFunctionalCest.xml b/dev/tests/verification/TestModule/Cest/BasicFunctionalCest.xml index 28578bd44..c6cd98374 100644 --- a/dev/tests/verification/TestModule/Cest/BasicFunctionalCest.xml +++ b/dev/tests/verification/TestModule/Cest/BasicFunctionalCest.xml @@ -17,10 +17,10 @@ - + - + @@ -30,89 +30,89 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/tests/verification/TestModule/Cest/DataReplacementCest.xml b/dev/tests/verification/TestModule/Cest/DataReplacementCest.xml index 1e33dd731..e466e6684 100644 --- a/dev/tests/verification/TestModule/Cest/DataReplacementCest.xml +++ b/dev/tests/verification/TestModule/Cest/DataReplacementCest.xml @@ -10,27 +10,27 @@ xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - + + + + + + + \ No newline at end of file diff --git a/dev/tests/verification/TestModule/Cest/LocatorFunctionCest.xml b/dev/tests/verification/TestModule/Cest/LocatorFunctionCest.xml index 497320d15..3865bb0ac 100644 --- a/dev/tests/verification/TestModule/Cest/LocatorFunctionCest.xml +++ b/dev/tests/verification/TestModule/Cest/LocatorFunctionCest.xml @@ -10,23 +10,23 @@ xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - + - - - + + + - - - + + + - - - + + + - - - + + + \ No newline at end of file diff --git a/dev/tests/verification/TestModule/Cest/MergeBaseFunctionalCest.xml b/dev/tests/verification/TestModule/Cest/MergeBaseFunctionalCest.xml index 01801c15b..7d5e242bf 100644 --- a/dev/tests/verification/TestModule/Cest/MergeBaseFunctionalCest.xml +++ b/dev/tests/verification/TestModule/Cest/MergeBaseFunctionalCest.xml @@ -17,20 +17,20 @@ - + - + - - - - + + + + - - + + diff --git a/dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml b/dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml index 304000252..a901b46e8 100644 --- a/dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml +++ b/dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml @@ -13,18 +13,18 @@ - + - + - - - - - - + + + + + + diff --git a/dev/tests/verification/TestModule/Cest/PageReplacementCest.xml b/dev/tests/verification/TestModule/Cest/PageReplacementCest.xml index 26ad49337..2bdbcb8c1 100644 --- a/dev/tests/verification/TestModule/Cest/PageReplacementCest.xml +++ b/dev/tests/verification/TestModule/Cest/PageReplacementCest.xml @@ -10,15 +10,15 @@ xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/dev/tests/verification/TestModule/Cest/ParameterArrayCest.xml b/dev/tests/verification/TestModule/Cest/ParameterArrayCest.xml index 8bd88fdd7..7dfe55943 100644 --- a/dev/tests/verification/TestModule/Cest/ParameterArrayCest.xml +++ b/dev/tests/verification/TestModule/Cest/ParameterArrayCest.xml @@ -7,19 +7,19 @@ --> + xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - - - - - - - - - - + + + + + + + + + + diff --git a/dev/tests/verification/TestModule/Cest/PersistedReplacementCest.xml b/dev/tests/verification/TestModule/Cest/PersistedReplacementCest.xml index 663c51ef7..02df18016 100644 --- a/dev/tests/verification/TestModule/Cest/PersistedReplacementCest.xml +++ b/dev/tests/verification/TestModule/Cest/PersistedReplacementCest.xml @@ -10,19 +10,19 @@ xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - + - + - - - - - - - - + + + + + + + + diff --git a/dev/tests/verification/TestModule/Cest/SampleSuiteCest.xml b/dev/tests/verification/TestModule/Cest/SampleSuiteCest.xml index 712fe2636..a88c91cab 100644 --- a/dev/tests/verification/TestModule/Cest/SampleSuiteCest.xml +++ b/dev/tests/verification/TestModule/Cest/SampleSuiteCest.xml @@ -10,16 +10,16 @@ xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - - - - + + + + - - - - + + + + @@ -27,10 +27,10 @@ - - - - + + + + @@ -38,16 +38,16 @@ - - - - + + + + - - - - + + + + @@ -55,16 +55,16 @@ - - - - + + + + - - - - + + + + @@ -72,16 +72,16 @@ - - - - + + + + - - - - + + + + diff --git a/dev/tests/verification/TestModule/Cest/SectionReplacementCest.xml b/dev/tests/verification/TestModule/Cest/SectionReplacementCest.xml index ca91fef27..4cd8c9e5b 100644 --- a/dev/tests/verification/TestModule/Cest/SectionReplacementCest.xml +++ b/dev/tests/verification/TestModule/Cest/SectionReplacementCest.xml @@ -10,39 +10,39 @@ xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/etc/di.xml b/etc/di.xml index f4261b9d8..f096ab8cc 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -208,7 +208,7 @@ createDataKey createDataKey createDataKey - mergeKey + stepKey *Cest.xml Cest @@ -218,9 +218,9 @@ - mergeKey - mergeKey - mergeKey + stepKey + stepKey + stepKey name name createDataKey @@ -286,7 +286,7 @@ name name - mergeKey + stepKey *ActionGroup.xml ActionGroup @@ -296,7 +296,7 @@ - mergeKey + stepKey name name @@ -360,8 +360,8 @@ name - mergeKey - mergeKey + stepKey + stepKey createDataKey createDataKey name diff --git a/src/Magento/FunctionalTestingFramework/Suite/Generators/GroupClassGenerator.php b/src/Magento/FunctionalTestingFramework/Suite/Generators/GroupClassGenerator.php index 043c267c2..ed7f690ed 100644 --- a/src/Magento/FunctionalTestingFramework/Suite/Generators/GroupClassGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Suite/Generators/GroupClassGenerator.php @@ -22,7 +22,7 @@ class GroupClassGenerator const BEFORE_MUSTACHE_KEY = 'before'; const AFTER_MUSTACHE_KEY = 'after'; const ENTITY_NAME_TAG = 'entityName'; - const ENTITY_MERGE_KEY = 'mergeKey'; + const ENTITY_MERGE_KEY = 'stepKey'; const REQUIRED_ENTITY_KEY = 'requiredEntities'; const LAST_REQUIRED_ENTITY_TAG = 'last'; const MUSTACHE_VAR_TAG = 'var'; @@ -103,7 +103,7 @@ private function buildHookMustacheArray($hookObj) foreach ($hookObj->getActions() as $action) { /** @var ActionObject $action */ $entityArray = []; - $entityArray[self::ENTITY_MERGE_KEY] = $action->getMergeKey(); + $entityArray[self::ENTITY_MERGE_KEY] = $action->getStepKey(); $entityArray[self::ENTITY_NAME_TAG] = $action->getCustomActionAttributes()['entity'] ?? $action->getCustomActionAttributes()[TestGenerator::REQUIRED_ENTITY_REFERENCE]; @@ -123,7 +123,7 @@ private function buildHookMustacheArray($hookObj) /** * Function which takes any required entities under a 'createData' tag and transforms data into array to be consumed * by mustache template. - * ( + * ( * - - - - - - - - - - - - - - - - - diff --git a/src/Magento/FunctionalTestingFramework/Suite/views/SuiteClass.mustache b/src/Magento/FunctionalTestingFramework/Suite/views/SuiteClass.mustache index d55d6d0ee..87fd6caf8 100644 --- a/src/Magento/FunctionalTestingFramework/Suite/views/SuiteClass.mustache +++ b/src/Magento/FunctionalTestingFramework/Suite/views/SuiteClass.mustache @@ -21,7 +21,7 @@ class {{suiteName}} extends \Codeception\GroupObject private static $CURRENT_TEST_RUN = 0; {{#var}} - private ${{mergeKey}}; + private ${{stepKey}}; {{/var}} {{#before}} diff --git a/src/Magento/FunctionalTestingFramework/Suite/views/partials/dataPersistence.mustache b/src/Magento/FunctionalTestingFramework/Suite/views/partials/dataPersistence.mustache index 269204602..91602e594 100644 --- a/src/Magento/FunctionalTestingFramework/Suite/views/partials/dataPersistence.mustache +++ b/src/Magento/FunctionalTestingFramework/Suite/views/partials/dataPersistence.mustache @@ -1,7 +1,7 @@ {{#createData}} ${{entityName}} = DataObjectHandler::getInstance()->getObject("{{entityName}}"); -$this->{{mergeKey}} = new DataPersistenceHandler(${{entityName}}, [{{#requiredEntities}}$this->{{entityName}}{{^last}}, {{/last}}{{/requiredEntities}}]); -$this->{{mergeKey}}->createEntity(); +$this->{{stepKey}} = new DataPersistenceHandler(${{entityName}}, [{{#requiredEntities}}$this->{{entityName}}{{^last}}, {{/last}}{{/requiredEntities}}]); +$this->{{stepKey}}->createEntity(); {{/createData}} {{#deleteData}} $this->{{entityName}}->deleteEntity(); diff --git a/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php b/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php index b00aaa6ed..033d4a3a5 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php +++ b/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php @@ -14,6 +14,9 @@ */ class Flat implements ConverterInterface { + const UNIQUE_KEY = 'stepKey'; + const DEPRECATED_UNIQUE_KEY = 'mergeKey'; + /** * Array node configuration. * @@ -85,6 +88,10 @@ public function convertXml(\DOMNode $source, $basePath = '') } $nodeData = $this->convertXml($node, $nodePath); + if (!isset($nodeData[self::UNIQUE_KEY]) && isset($nodeData[self::DEPRECATED_UNIQUE_KEY])) { + $nodeData[self::UNIQUE_KEY] = $nodeData[self::DEPRECATED_UNIQUE_KEY]; + unset($nodeData[self::DEPRECATED_UNIQUE_KEY]); + } if ($isArrayNode) { if ($isNumericArrayNode) { $value[$nodeName][] = $nodeData; diff --git a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionGroupObject.php b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionGroupObject.php index b20b342c0..19f666bc5 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionGroupObject.php +++ b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionGroupObject.php @@ -133,8 +133,8 @@ private function getResolvedActionsWithArgs($arguments, $actionReferenceKey) // we append the action reference key to any linked action and the action's merge key as the user might // use this action group multiple times in the same test. - $resolvedActions[$action->getMergeKey() . $actionReferenceKey] = new ActionObject( - $action->getMergeKey() . $actionReferenceKey, + $resolvedActions[$action->getStepKey() . $actionReferenceKey] = new ActionObject( + $action->getStepKey() . $actionReferenceKey, $action->getType(), array_merge($action->getCustomActionAttributes(), $newActionAttributes), $action->getLinkedAction() == null ? null : $action->getLinkedAction() . $actionReferenceKey, diff --git a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php index 821c06efc..d9420f853 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php +++ b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php @@ -31,9 +31,9 @@ class ActionObject /** * The unique identifier for the action * - * @var string $mergeKey + * @var string $stepKey */ - private $mergeKey; + private $stepKey; /** * The type of action (e.g. fillField, createData, etc) @@ -80,20 +80,20 @@ class ActionObject /** * ActionObject constructor. * - * @param string $mergeKey + * @param string $stepKey * @param string $type * @param array $actionAttributes * @param string|null $linkedAction * @param string $order */ public function __construct( - $mergeKey, + $stepKey, $type, $actionAttributes, $linkedAction = null, $order = ActionObject::MERGE_ACTION_ORDER_BEFORE ) { - $this->mergeKey = $mergeKey; + $this->stepKey = $stepKey; $this->type = $type; $this->actionAttributes = $actionAttributes; $this->linkedAction = $linkedAction; @@ -104,13 +104,13 @@ public function __construct( } /** - * This function returns the string property mergeKey. + * This function returns the string property stepKey. * * @return string */ - public function getMergeKey() + public function getStepKey() { - return $this->mergeKey; + return $this->stepKey; } /** @@ -125,7 +125,7 @@ public function getType() /** * This function returns an array of action attributes mapped by key. For example - * the tag has 3 attributes, + * the tag has 3 attributes, * only 2 of which are specific to the 'seeNumberOfElements' tag. As a result this function would * return the array would return [selector => value1, expected => value2] * The returned array is also the merged result of the resolved and normal actions, giving diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php index e1035a867..8af5e3af0 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionMergeUtil.php @@ -144,10 +144,10 @@ private function insertWaits() if ($step->getTimeout()) { $waitStepAttributes = [self::WAIT_ATTR => $step->getTimeout()]; $waitStep = new ActionObject( - $step->getMergeKey() . self::WAIT_ACTION_SUFFIX, + $step->getStepKey() . self::WAIT_ACTION_SUFFIX, self::WAIT_ACTION_NAME, $waitStepAttributes, - $step->getMergeKey(), + $step->getStepKey(), self::DEFAULT_WAIT_ORDER ); $this->insertStep($waitStep); @@ -167,9 +167,9 @@ private function sortActions($parsedSteps) foreach ($parsedSteps as $parsedStep) { $parsedStep->resolveReferences(); if ($parsedStep->getLinkedAction()) { - $this->stepsToMerge[$parsedStep->getMergeKey()] = $parsedStep; + $this->stepsToMerge[$parsedStep->getStepKey()] = $parsedStep; } else { - $this->orderedSteps[$parsedStep->getMergeKey()] = $parsedStep; + $this->orderedSteps[$parsedStep->getStepKey()] = $parsedStep; } } } @@ -192,7 +192,7 @@ private function mergeAction($stepToMerge) self::STEP_MISSING_ERROR_MSG, $this->type, $this->name, - $stepToMerge->getMergeKey(), + $stepToMerge->getStepKey(), $linkedStep )); } elseif (!array_key_exists($linkedStep, $this->orderedSteps)) { @@ -216,6 +216,6 @@ private function insertStep($stepToMerge) ) + $stepToMerge->getOrderOffset(); $previous_items = array_slice($this->orderedSteps, 0, $position, true); $next_items = array_slice($this->orderedSteps, $position, null, true); - $this->orderedSteps = $previous_items + [$stepToMerge->getMergeKey() => $stepToMerge] + $next_items; + $this->orderedSteps = $previous_items + [$stepToMerge->getStepKey() => $stepToMerge] + $next_items; } } diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionObjectExtractor.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionObjectExtractor.php index b137102e4..cf83dd5c1 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionObjectExtractor.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionObjectExtractor.php @@ -16,7 +16,7 @@ class ActionObjectExtractor extends BaseCestObjectExtractor { const TEST_ACTION_BEFORE = 'before'; const TEST_ACTION_AFTER = 'after'; - const TEST_STEP_MERGE_KEY = 'mergeKey'; + const TEST_STEP_MERGE_KEY = 'stepKey'; const ACTION_GROUP_TAG = 'actionGroup'; const ACTION_GROUP_REF = 'ref'; const ACTION_GROUP_ARGUMENTS = 'arguments'; diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/TestEntityExtractor.php b/src/Magento/FunctionalTestingFramework/Test/Util/TestEntityExtractor.php index d6ce1b7bf..cc1ae54fe 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/TestEntityExtractor.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/TestEntityExtractor.php @@ -28,7 +28,7 @@ public function __construct() /** * Extracts custom entity or data definitions from test actions. - * Returns array of entity data objects indexed by mergeKey, and an array of key-value pairs. + * Returns array of entity data objects indexed by stepKey, and an array of key-value pairs. * @param array $testActions * @return array $entityData */ diff --git a/src/Magento/FunctionalTestingFramework/Test/etc/sampleActionGroup.xml b/src/Magento/FunctionalTestingFramework/Test/etc/sampleActionGroup.xml deleted file mode 100644 index e0be8ca20..000000000 --- a/src/Magento/FunctionalTestingFramework/Test/etc/sampleActionGroup.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Magento/FunctionalTestingFramework/Test/etc/sampleCest.xml b/src/Magento/FunctionalTestingFramework/Test/etc/sampleCest.xml deleted file mode 100644 index c6966af5a..000000000 --- a/src/Magento/FunctionalTestingFramework/Test/etc/sampleCest.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd b/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd index e4c8c4f8e..e229d0c5f 100644 --- a/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd +++ b/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd @@ -252,7 +252,8 @@ - + + @@ -263,6 +264,7 @@ + @@ -275,7 +277,8 @@ - + + @@ -287,7 +290,8 @@ - + + @@ -299,7 +303,8 @@ - + + @@ -312,7 +317,8 @@ - + + @@ -326,7 +332,8 @@ - + + @@ -339,7 +346,8 @@ - + + @@ -349,7 +357,8 @@ - + + @@ -360,7 +369,8 @@ - + + @@ -371,7 +381,8 @@ - + + @@ -385,7 +396,8 @@ - + + @@ -399,7 +411,8 @@ - + + @@ -413,7 +426,8 @@ - + + @@ -423,7 +437,8 @@ - + + @@ -433,7 +448,8 @@ - + + @@ -444,7 +460,8 @@ - + + @@ -457,7 +474,8 @@ - + + @@ -469,7 +487,8 @@ - + + @@ -490,7 +509,8 @@ - + + @@ -501,7 +521,8 @@ - + + @@ -514,7 +535,8 @@ - + + @@ -528,7 +550,8 @@ - + + @@ -539,7 +562,8 @@ - + + @@ -552,7 +576,8 @@ - + + @@ -564,7 +589,8 @@ - + + @@ -576,7 +602,8 @@ - + + @@ -588,7 +615,8 @@ - + + @@ -601,7 +629,8 @@ - + + @@ -613,7 +642,8 @@ - + + @@ -627,7 +657,8 @@ - + + @@ -639,7 +670,8 @@ - + + @@ -651,7 +683,8 @@ - + + @@ -662,7 +695,8 @@ - + + @@ -674,7 +708,8 @@ - + + @@ -684,7 +719,8 @@ - + + @@ -697,7 +733,8 @@ - + + @@ -710,7 +747,8 @@ - + + @@ -721,7 +759,8 @@ - + + @@ -733,7 +772,8 @@ - + + @@ -744,7 +784,8 @@ - + + @@ -755,7 +796,8 @@ - + + @@ -769,7 +811,8 @@ - + + @@ -782,7 +825,8 @@ - + + @@ -796,7 +840,8 @@ - + + @@ -810,7 +855,8 @@ - + + @@ -823,7 +869,8 @@ - + + @@ -837,7 +884,8 @@ - + + @@ -848,7 +896,8 @@ - + + @@ -860,7 +909,8 @@ - + + @@ -873,7 +923,8 @@ - + + @@ -886,7 +937,8 @@ - + + @@ -898,7 +950,8 @@ - + + @@ -910,7 +963,8 @@ - + + @@ -920,7 +974,8 @@ - + + @@ -933,7 +988,8 @@ - + + @@ -943,7 +999,8 @@ - + + @@ -953,7 +1010,8 @@ - + + @@ -963,7 +1021,8 @@ - + + @@ -977,7 +1036,8 @@ - + + @@ -987,7 +1047,8 @@ - + + @@ -999,7 +1060,8 @@ - + + @@ -1009,7 +1071,8 @@ - + + @@ -1021,7 +1084,8 @@ - + + @@ -1035,7 +1099,8 @@ - + + @@ -1045,7 +1110,8 @@ - + + @@ -1058,7 +1124,8 @@ - + + @@ -1070,7 +1137,8 @@ - + + @@ -1082,7 +1150,8 @@ - + + @@ -1096,7 +1165,8 @@ - + + @@ -1106,7 +1176,8 @@ - + + @@ -1120,7 +1191,8 @@ - + + @@ -1134,7 +1206,8 @@ - + + @@ -1145,7 +1218,8 @@ - + + @@ -1158,7 +1232,8 @@ - + + @@ -1170,7 +1245,8 @@ - + + @@ -1182,7 +1258,8 @@ - + + @@ -1195,7 +1272,8 @@ - + + @@ -1207,7 +1285,8 @@ - + + @@ -1219,7 +1298,8 @@ - + + @@ -1233,7 +1313,8 @@ - + + @@ -1245,7 +1326,8 @@ - + + @@ -1256,7 +1338,8 @@ - + + @@ -1268,7 +1351,8 @@ - + + @@ -1279,7 +1363,8 @@ - + + @@ -1291,7 +1376,8 @@ - + + @@ -1304,7 +1390,8 @@ - + + @@ -1318,7 +1405,8 @@ - + + @@ -1331,7 +1419,8 @@ - + + @@ -1345,7 +1434,8 @@ - + + @@ -1358,7 +1448,8 @@ - + + @@ -1371,7 +1462,8 @@ - + + @@ -1384,7 +1476,8 @@ - + + @@ -1396,7 +1489,8 @@ - + + @@ -1408,7 +1502,8 @@ - + + @@ -1420,7 +1515,8 @@ - + + @@ -1432,7 +1528,8 @@ - + + @@ -1443,7 +1540,8 @@ - + + @@ -1457,7 +1555,8 @@ - + + @@ -1468,7 +1567,8 @@ - + + @@ -1479,7 +1579,8 @@ - + + @@ -1492,7 +1593,8 @@ - + + @@ -1504,7 +1606,8 @@ - + + @@ -1516,7 +1619,8 @@ - + + @@ -1528,7 +1632,8 @@ - + + @@ -1540,7 +1645,8 @@ - + + @@ -1550,7 +1656,8 @@ - + + @@ -1561,7 +1668,8 @@ - + + @@ -1575,7 +1683,8 @@ - + + @@ -1590,7 +1699,8 @@ - + + @@ -1605,7 +1715,8 @@ - + + @@ -1621,7 +1732,8 @@ - + + @@ -1636,7 +1748,8 @@ - + + @@ -1651,7 +1764,8 @@ - + + @@ -1664,7 +1778,8 @@ - + + @@ -1680,7 +1795,8 @@ - + + @@ -1693,7 +1809,8 @@ - + + @@ -1706,7 +1823,8 @@ - + + @@ -1719,7 +1837,8 @@ - + + @@ -1734,7 +1853,8 @@ - + + @@ -1749,7 +1869,8 @@ - + + @@ -1764,7 +1885,8 @@ - + + @@ -1779,7 +1901,8 @@ - + + @@ -1794,7 +1917,8 @@ - + + @@ -1807,7 +1931,8 @@ - + + @@ -1822,7 +1947,8 @@ - + + @@ -1837,7 +1963,8 @@ - + + @@ -1852,7 +1979,8 @@ - + + @@ -1867,7 +1995,8 @@ - + + @@ -1880,7 +2009,8 @@ - + + @@ -1896,7 +2026,8 @@ - + + @@ -1911,7 +2042,8 @@ - + + @@ -1924,7 +2056,8 @@ - + + @@ -1939,7 +2072,8 @@ - + + @@ -1954,7 +2088,8 @@ - + + @@ -1967,7 +2102,8 @@ - + + @@ -1982,7 +2118,8 @@ - + + @@ -1997,7 +2134,8 @@ - + + @@ -2012,7 +2150,8 @@ - + + @@ -2027,7 +2166,8 @@ - + + @@ -2040,7 +2180,8 @@ - + + @@ -2054,7 +2195,8 @@ - + + @@ -2065,7 +2207,8 @@ - + + diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index c80e7dc6a..d574913aa 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -514,10 +514,10 @@ private function generateStepsPhp($stepsObject, $stepsData, $hookObject = false) switch ($actionName) { case "createData": $entity = $customActionAttributes['entity']; - $key = $steps->getMergeKey(); + $key = $steps->getStepKey(); //Add an informative statement to help the user debug test runs $testSteps .= sprintf( - "\t\t$%s->amGoingTo(\"create entity that has the mergeKey: %s\");\n", + "\t\t$%s->amGoingTo(\"create entity that has the stepKey: %s\");\n", $actor, $key ); @@ -656,10 +656,10 @@ private function generateStepsPhp($stepsObject, $stepsData, $hookObject = false) break; case "getData": $entity = $customActionAttributes['entity']; - $key = $steps->getMergeKey(); + $key = $steps->getStepKey(); //Add an informative statement to help the user debug test runs $testSteps .= sprintf( - "\t\t$%s->amGoingTo(\"get entity that has the mergeKey: %s\");\n", + "\t\t$%s->amGoingTo(\"get entity that has the stepKey: %s\");\n", $actor, $key ); @@ -1101,7 +1101,7 @@ private function replaceMatchesIntoArg($matches, &$outputArg, $delimiter) if (count($variable) != 2) { throw new \Exception( "Invalid Persisted Entity Reference: {$match}. - Test persisted entity references must follow {$delimiter}entityMergeKey.field{$delimiter} format." + Test persisted entity references must follow {$delimiter}entityStepKey.field{$delimiter} format." ); } if ($delimiter == "$") { @@ -1206,13 +1206,13 @@ private function generateHooksPhp($hookObjects) || ($step->getType() == "getData") ) { $hooks .= "\t/**\n"; - $hooks .= sprintf("\t * @var DataPersistenceHandler $%s;\n", $step->getMergeKey()); + $hooks .= sprintf("\t * @var DataPersistenceHandler $%s;\n", $step->getStepKey()); $hooks .= "\t */\n"; - $hooks .= sprintf("\tprotected $%s;\n\n", $step->getMergeKey()); + $hooks .= sprintf("\tprotected $%s;\n\n", $step->getStepKey()); $createData = true; } elseif ($step->getType() == "entity") { $hooks .= "\t/**\n"; - $hooks .= sprintf("\t * @var EntityDataObject $%s;\n", $step->getMergeKey()); + $hooks .= sprintf("\t * @var EntityDataObject $%s;\n", $step->getStepKey()); $hooks .= "\t */\n"; $hooks .= sprintf("\tprotected $%s;\n\n", $step->getCustomActionAttributes()['name']); } From 9123be82fadaba1dc3d823698d125884a36ab06c Mon Sep 17 00:00:00 2001 From: Kevin Kozan Date: Mon, 4 Dec 2017 14:03:19 -0600 Subject: [PATCH 11/35] MQE-525: Include PHP Mess Detector to required checks for MFTF - updated composer to pull phpmd, ported Magento rulesets to work with phpmd on MFTF - updated static-checks with PHPMD, no changes to devops required - commented Mess Detector Lines out to enable them during MQE-590 --- bin/static-checks | 5 ++ composer.json | 3 +- .../Rule/Design/FinalImplementation.php | 29 +++++++++++ .../resources/rulesets/design.xml | 36 +++++++++++++ .../Magento/CodeMessDetector/ruleset.xml | 50 +++++++++++++++++++ 5 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 dev/tests/static/Magento/CodeMessDetector/Rule/Design/FinalImplementation.php create mode 100644 dev/tests/static/Magento/CodeMessDetector/resources/rulesets/design.xml create mode 100644 dev/tests/static/Magento/CodeMessDetector/ruleset.xml diff --git a/bin/static-checks b/bin/static-checks index c01ad8091..7e5fb4210 100755 --- a/bin/static-checks +++ b/bin/static-checks @@ -9,5 +9,10 @@ vendor/bin/phpcs ./dev/tests/verification --standard=./dev/tests/static/Magento echo "===============================COPY PASTE DETECTOR REPORT===============================" vendor/bin/phpcpd ./src +# Uncomment lines as part of MQE-590 +# echo "===============================PHP MESS DETECTOR REPORT===============================" +# vendor/bin/phpmd ./src text /dev/tests/static/Magento/CodeMessDetector/ruleset.xml --exclude _generated + echo "===============================MAGENTO COPYRIGHT REPORT===============================" bin/copyright-check + diff --git a/composer.json b/composer.json index b98c2ef22..877dc5130 100755 --- a/composer.json +++ b/composer.json @@ -16,7 +16,8 @@ "sebastian/phpcpd": "~3.0", "brainmaestro/composer-git-hooks": "^2.3", "codeception/aspect-mock": "^2.0", - "codacy/coverage": "^1.4" + "codacy/coverage": "^1.4", + "phpmd/phpmd": "^2.6.0" }, "autoload": { "psr-4": { diff --git a/dev/tests/static/Magento/CodeMessDetector/Rule/Design/FinalImplementation.php b/dev/tests/static/Magento/CodeMessDetector/Rule/Design/FinalImplementation.php new file mode 100644 index 000000000..22c008b05 --- /dev/null +++ b/dev/tests/static/Magento/CodeMessDetector/Rule/Design/FinalImplementation.php @@ -0,0 +1,29 @@ +isFinal()) { + $this->addViolation($node, [$node->getType(), $node->getFullQualifiedName()]); + } + } +} diff --git a/dev/tests/static/Magento/CodeMessDetector/resources/rulesets/design.xml b/dev/tests/static/Magento/CodeMessDetector/resources/rulesets/design.xml new file mode 100644 index 000000000..61d4f7b3b --- /dev/null +++ b/dev/tests/static/Magento/CodeMessDetector/resources/rulesets/design.xml @@ -0,0 +1,36 @@ + + + + + + + + 1 + + + + + + diff --git a/dev/tests/static/Magento/CodeMessDetector/ruleset.xml b/dev/tests/static/Magento/CodeMessDetector/ruleset.xml new file mode 100644 index 000000000..34fce51d0 --- /dev/null +++ b/dev/tests/static/Magento/CodeMessDetector/ruleset.xml @@ -0,0 +1,50 @@ + + + + Magento Code Check Rules + ../../../static + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 546f165f5ceb92d94f96d731b6d59a920c4eb49f Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Tue, 5 Dec 2017 09:58:44 -0600 Subject: [PATCH 12/35] MQE-541: changed to use stepKey for test step sequencing. --- .../Resources/MergeFunctionalCest.txt | 3 ++ .../Cest/MergeBaseFunctionalCest.xml | 3 ++ .../TestModule/Cest/MergeInFunctionalCest.xml | 3 ++ .../FunctionalTestingFramework/Config/Dom.php | 8 ++++++ .../Test/Config/Converter/Dom/Flat.php | 12 ++++---- .../Util/GlobalConstants.php | 28 +++++++++++++++++++ 6 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 src/Magento/FunctionalTestingFramework/Util/GlobalConstants.php diff --git a/dev/tests/verification/Resources/MergeFunctionalCest.txt b/dev/tests/verification/Resources/MergeFunctionalCest.txt index 36fc00b80..95d750dcc 100644 --- a/dev/tests/verification/Resources/MergeFunctionalCest.txt +++ b/dev/tests/verification/Resources/MergeFunctionalCest.txt @@ -54,6 +54,9 @@ class MergeFunctionalCest $I->fillField("#bar", "Dane"); $I->searchAndMultiSelectOption("#foo", ["Jane", "Dane"]); $I->see("#element .Jane"); + $I->click("#step10MergedInResult"); + $I->click("#step11MergedInResult"); + $I->click("#step12MergedInResult"); } /** diff --git a/dev/tests/verification/TestModule/Cest/MergeBaseFunctionalCest.xml b/dev/tests/verification/TestModule/Cest/MergeBaseFunctionalCest.xml index 7d5e242bf..d6e33c7dd 100644 --- a/dev/tests/verification/TestModule/Cest/MergeBaseFunctionalCest.xml +++ b/dev/tests/verification/TestModule/Cest/MergeBaseFunctionalCest.xml @@ -27,6 +27,9 @@ + + + diff --git a/dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml b/dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml index a901b46e8..3733ef9a5 100644 --- a/dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml +++ b/dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml @@ -24,6 +24,9 @@ + + + diff --git a/src/Magento/FunctionalTestingFramework/Config/Dom.php b/src/Magento/FunctionalTestingFramework/Config/Dom.php index 49b98675c..4d7634122 100644 --- a/src/Magento/FunctionalTestingFramework/Config/Dom.php +++ b/src/Magento/FunctionalTestingFramework/Config/Dom.php @@ -6,6 +6,8 @@ namespace Magento\FunctionalTestingFramework\Config; +use Magento\FunctionalTestingFramework\Util\GlobalConstants; + /** * Magento configuration XML DOM utility */ @@ -222,6 +224,12 @@ protected function getNodePathByParent(\DOMElement $node, $parentPath) if ($value = $node->getAttribute($idAttributeValue)) { $path .= "[@{$idAttributeValue}='{$value}']"; break; + } elseif (empty($value) && $idAttributeValue === GlobalConstants::TEST_ID_ATTRIBUTE) { + $idAttributeValue = GlobalConstants::DEPRECATED_TEST_ID_ATTRIBUTE; + if ($value = $node->getAttribute($idAttributeValue)) { + $path .= "[@{$idAttributeValue}='{$value}']"; + break; + } } } } diff --git a/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php b/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php index 033d4a3a5..bc9b2b8cd 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php +++ b/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php @@ -8,15 +8,13 @@ use Magento\FunctionalTestingFramework\Config\ConverterInterface; use Magento\FunctionalTestingFramework\Config\Dom\ArrayNodeConfig; +use Magento\FunctionalTestingFramework\Util\GlobalConstants; /** * Universal converter of any XML data to an array representation with no data loss */ class Flat implements ConverterInterface { - const UNIQUE_KEY = 'stepKey'; - const DEPRECATED_UNIQUE_KEY = 'mergeKey'; - /** * Array node configuration. * @@ -88,9 +86,11 @@ public function convertXml(\DOMNode $source, $basePath = '') } $nodeData = $this->convertXml($node, $nodePath); - if (!isset($nodeData[self::UNIQUE_KEY]) && isset($nodeData[self::DEPRECATED_UNIQUE_KEY])) { - $nodeData[self::UNIQUE_KEY] = $nodeData[self::DEPRECATED_UNIQUE_KEY]; - unset($nodeData[self::DEPRECATED_UNIQUE_KEY]); + if (!isset($nodeData[GlobalConstants::TEST_ID_ATTRIBUTE]) + && isset($nodeData[GlobalConstants::DEPRECATED_TEST_ID_ATTRIBUTE])) { + $nodeData[GlobalConstants::TEST_ID_ATTRIBUTE] = + $nodeData[GlobalConstants::DEPRECATED_TEST_ID_ATTRIBUTE]; + unset($nodeData[GlobalConstants::DEPRECATED_TEST_ID_ATTRIBUTE]); } if ($isArrayNode) { if ($isNumericArrayNode) { diff --git a/src/Magento/FunctionalTestingFramework/Util/GlobalConstants.php b/src/Magento/FunctionalTestingFramework/Util/GlobalConstants.php new file mode 100644 index 000000000..6f192e2ea --- /dev/null +++ b/src/Magento/FunctionalTestingFramework/Util/GlobalConstants.php @@ -0,0 +1,28 @@ + Date: Tue, 5 Dec 2017 11:05:30 -0600 Subject: [PATCH 13/35] MQE-541: changed to use stepKey for test step sequencing. --- src/Magento/FunctionalTestingFramework/Config/Dom.php | 2 ++ .../Test/Config/Converter/Dom/Flat.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Magento/FunctionalTestingFramework/Config/Dom.php b/src/Magento/FunctionalTestingFramework/Config/Dom.php index 4d7634122..f635e0f31 100644 --- a/src/Magento/FunctionalTestingFramework/Config/Dom.php +++ b/src/Magento/FunctionalTestingFramework/Config/Dom.php @@ -224,7 +224,9 @@ protected function getNodePathByParent(\DOMElement $node, $parentPath) if ($value = $node->getAttribute($idAttributeValue)) { $path .= "[@{$idAttributeValue}='{$value}']"; break; + // TODO Remove the following elseif block once the 'mergeKey' attribute has been fully deprecated. } elseif (empty($value) && $idAttributeValue === GlobalConstants::TEST_ID_ATTRIBUTE) { + print "use of the 'mergeKey' attribute will be deprecated in the next release.\n"; $idAttributeValue = GlobalConstants::DEPRECATED_TEST_ID_ATTRIBUTE; if ($value = $node->getAttribute($idAttributeValue)) { $path .= "[@{$idAttributeValue}='{$value}']"; diff --git a/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php b/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php index bc9b2b8cd..e21561b9c 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php +++ b/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php @@ -86,6 +86,8 @@ public function convertXml(\DOMNode $source, $basePath = '') } $nodeData = $this->convertXml($node, $nodePath); + + // TODO Remove the following if block once the 'mergeKey' attribute has been fully deprecated. if (!isset($nodeData[GlobalConstants::TEST_ID_ATTRIBUTE]) && isset($nodeData[GlobalConstants::DEPRECATED_TEST_ID_ATTRIBUTE])) { $nodeData[GlobalConstants::TEST_ID_ATTRIBUTE] = From 1b87a6f0cc5f070da206445aa9e04850878434b4 Mon Sep 17 00:00:00 2001 From: Tom Reece Date: Tue, 5 Dec 2017 13:24:12 -0600 Subject: [PATCH 14/35] MQE-591: Bin scripts do not return the correct error code --- bin/phpunit-checks | 14 ++++++++++---- bin/static-checks | 23 ++++++++++++++++++----- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/bin/phpunit-checks b/bin/phpunit-checks index 1fbbb4b19..7c4fd642e 100755 --- a/bin/phpunit-checks +++ b/bin/phpunit-checks @@ -1,8 +1,14 @@ # Copyright © Magento, Inc. All rights reserved. # See COPYING.txt for license details. -echo "===============================UNIT TESTS===============================" -vendor/bin/phpunit --configuration dev/tests/phpunit.xml --testsuite unit --coverage-xml build/coverage-xml +set -e -echo "===============================VERIFICATION TESTS===============================" -vendor/bin/phpunit --configuration dev/tests/phpunit.xml --testsuite verification --coverage-xml build/coverage-xml +echo "===============================" +echo " UNIT TESTS" +echo "===============================" +vendor/bin/phpunit --configuration dev/tests/phpunit.xml --testsuite unit + +echo "===============================" +echo " VERIFICATION TESTS" +echo "===============================" +vendor/bin/phpunit --configuration dev/tests/phpunit.xml --testsuite verification diff --git a/bin/static-checks b/bin/static-checks index 7e5fb4210..b4a6394bc 100755 --- a/bin/static-checks +++ b/bin/static-checks @@ -1,18 +1,31 @@ # Copyright © Magento, Inc. All rights reserved. # See COPYING.txt for license details. -echo "===============================PHP CODE SNIFFER REPORT===============================" +set -e + +echo "===============================" +echo " CODE SNIFFER" +echo "===============================" vendor/bin/phpcs ./src --standard=./dev/tests/static/Magento vendor/bin/phpcs ./dev/tests/unit --standard=./dev/tests/static/Magento vendor/bin/phpcs ./dev/tests/verification --standard=./dev/tests/static/Magento --ignore=dev/tests/verification/_generated +echo "" -echo "===============================COPY PASTE DETECTOR REPORT===============================" +echo "===============================" +echo " COPY PASTE DETECTOR" +echo "===============================" vendor/bin/phpcpd ./src +echo "" # Uncomment lines as part of MQE-590 -# echo "===============================PHP MESS DETECTOR REPORT===============================" +# echo "===============================" +# echo " MAGENTO COPYRIGHT CHECK" +# echo "===============================" # vendor/bin/phpmd ./src text /dev/tests/static/Magento/CodeMessDetector/ruleset.xml --exclude _generated +# echo "" -echo "===============================MAGENTO COPYRIGHT REPORT===============================" +echo "===============================" +echo " MAGENTO COPYRIGHT CHECK" +echo "===============================" bin/copyright-check - +echo "" From 5fcbc02f9d07ed65e8aff774e01b6d5aedb688ae Mon Sep 17 00:00:00 2001 From: Tom Reece Date: Tue, 5 Dec 2017 13:29:32 -0600 Subject: [PATCH 15/35] MQE-591: Bin scripts do not return the correct error code --- bin/static-checks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/static-checks b/bin/static-checks index b4a6394bc..c6526e3be 100755 --- a/bin/static-checks +++ b/bin/static-checks @@ -19,7 +19,7 @@ echo "" # Uncomment lines as part of MQE-590 # echo "===============================" -# echo " MAGENTO COPYRIGHT CHECK" +# echo " MESS DETECTOR" # echo "===============================" # vendor/bin/phpmd ./src text /dev/tests/static/Magento/CodeMessDetector/ruleset.xml --exclude _generated # echo "" From bdb8340ad0db6522f9013693f2ceb5a878656031 Mon Sep 17 00:00:00 2001 From: Kevin Kozan Date: Tue, 5 Dec 2017 14:57:30 -0600 Subject: [PATCH 16/35] MQE-579: waitForLoadingMaskToDisappear fails sometimes when two loading masks match the same selector - Added parenthesis according to the AC. --- .../FunctionalTestingFramework/Module/MagentoWebDriver.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index 26dbe2274..02018852a 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -204,9 +204,13 @@ public function waitForPageLoad($timeout = 15) public function waitForLoadingMaskToDisappear() { foreach( self::$loadingMasksLocators as $maskLocator) { + // Get count of elements found for looping. + // Elements are NOT useful for interaction, as they cannot be fed to codeception actions. $loadingMaskElements = $this->_findElements($maskLocator); for ($i = 1; $i <= count($loadingMaskElements); $i++) { - $this->waitForElementNotVisible("{$maskLocator}[{$i}]", 30); + // Formatting and looping on i as we can't interact elements returned above + // eg. (//div[@data-role="spinner"])[1] + $this->waitForElementNotVisible("({$maskLocator})[{$i}]", 30); } } } From da10983ca876dbdab11b19f160187c5ce06e2ea8 Mon Sep 17 00:00:00 2001 From: Kevin Kozan Date: Tue, 5 Dec 2017 15:06:42 -0600 Subject: [PATCH 17/35] MQE-570: Sanitize MAGENTO_BASE_URL (.env file) and Selenium params - addressed all base AC of issue. - Broke out sanitization into its own method, defined _resetConfig to prevent variables from being overwritten on test startup. - Added step to configure rest URL based on sanitized version of MAGENTO_BASE_URL. --- .../Module/MagentoRestDriver.php | 2 +- .../Module/MagentoWebDriver.php | 90 +++++++++++++++++++ 2 files changed, 91 insertions(+), 1 deletion(-) diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoRestDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoRestDriver.php index 4509a65b5..cd8ae5143 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoRestDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoRestDriver.php @@ -104,10 +104,10 @@ class MagentoRestDriver extends REST public function _beforeSuite($settings = []) { parent::_beforeSuite($settings); - if (empty($this->config['url']) || empty($this->config['username']) || empty($this->config['password'])) { return; } + $this->config['url'] = $_ENV['MAGENTO_BASE_URL'] . "rest/default/V1/"; $this->haveHttpHeader('Content-Type', 'application/json'); $this->sendPOST( diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index 02018852a..c7af3af0b 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -76,6 +76,96 @@ class MagentoWebDriver extends WebDriver LC_MESSAGES => null, ]; + public function _initialize() + { + $this->sanitizeConfig(); + parent::_initialize(); + } + + public function _resetConfig() + { + parent::_resetConfig(); + $this->sanitizeConfig(); + } + + /** + * Sanitizes URL and Selenium Variables, then assigns them to the config array. + * @return void + */ + private function sanitizeConfig() + { + if ($this->config['url'] === "") { + trigger_error("MAGENTO_BASE_URL must be defined in .env", E_USER_ERROR); + } + + //Determine if url sanitize is required + if (!preg_match("/(http|https):\/\/[\w.:]+\//", $this->config['url'])) { + $urlParts = parse_url($this->config['url']); + + if (!isset($urlParts['scheme'])) { + $urlParts['scheme'] = "http"; + } + if (!isset($urlParts['host'])) { + $urlParts['host'] = rtrim($urlParts['path'], "/"); + unset($urlParts['path']); + } + + if (!isset($urlParts['path'])) { + $urlParts['path'] = "/"; + } else { + $urlParts['path'] = rtrim($urlParts['path'], "/") . "/"; + } + + $_ENV['MAGENTO_BASE_URL'] = str_replace("///", "//", $this->build_url($urlParts)); + $this->config['url'] = str_replace("///", "//", $this->build_url($urlParts)); + } + + //Assign default Values to Selenium configs if they are defined + if ($this->config['protocol'] == '%SELENIUM_PROTOCOL%') { + $this->config['protocol'] = "http"; + } + if ($this->config['host'] == '%SELENIUM_HOST%') { + $this->config['host'] = "127.0.0.1"; + } + if ($this->config['port'] == '%SELENIUM_PORT%') { + $this->config['port'] = "4444"; + } + if ($this->config['path'] == '%SELENIUM_PATH%') { + $this->config['path'] = "/wd/hub"; + } + } + + /** + * Returns url from $parts given, used with parse_url output for convenience. + * This only exists because of deprecation of http_build_url, which does the exact same thing as the code below. + * @param array $parts + * @return string + */ + private function build_url(array $parts) { + $get = function ($key) use ($parts) { + return isset($parts[$key]) ? $parts[$key] : null; + }; + + $pass = $get('pass'); + $user = $get('user'); + $userinfo = $pass !== null ? "$user:$pass" : $user; + $port = $get('port'); + $scheme = $get('scheme'); + $query = $get('query'); + $fragment = $get('fragment'); + $authority = + ($userinfo !== null ? "$userinfo@" : '') . + $get('host') . + ($port ? ":$port" : ''); + + return + (strlen($scheme) ? "$scheme:" : '') . + (strlen($authority) ? "//$authority" : '') . + $get('path') . + (strlen($query) ? "?$query" : '') . + (strlen($fragment) ? "#$fragment" : ''); + } + /** * Returns URL of a host. * From 0369375b1bd14d77acece40070aa474b2316c3eb Mon Sep 17 00:00:00 2001 From: Tom Reece Date: Wed, 6 Dec 2017 10:34:13 -0600 Subject: [PATCH 18/35] MQE-549: [Unit Test] ActionMergeUtil.php --- .../Test/Util/ActionMergeUtilTest.php | 90 +++++++++++-------- .../Test/Objects/ActionObject.php | 13 ++- 2 files changed, 64 insertions(+), 39 deletions(-) diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php index bbe88bf54..a83ed8802 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php @@ -16,23 +16,6 @@ class ActionMergeUtilTest extends TestCase { - /** - * Static ActionMergeUtil for all tests. - * - * @var ActionMergeUtil - */ - private static $MERGE_UTIL; - - /** - * Set up method for ActionMergeUtil tests. - * - * @return void - */ - public static function setUpBeforeClass() - { - self::$MERGE_UTIL = new ActionMergeUtil("actionMergeUtilTest", "TestCase"); - } - /** * Test to validate actions are properly ordered during a merge. * @@ -85,7 +68,8 @@ public function testResolveActionStepOrdering() ActionObject::MERGE_ACTION_ORDER_AFTER ); - $orderedActions = self::$MERGE_UTIL->resolveActionSteps($actions); + $mergeUtil = new ActionMergeUtil("actionMergeUtilTest", "TestCase"); + $orderedActions = $mergeUtil->resolveActionSteps($actions); $orderedActionKeys = array_keys($orderedActions); $this->assertEquals($testObjNamePosBeforeFirst, $orderedActionKeys[0]); @@ -94,26 +78,6 @@ public function testResolveActionStepOrdering() $this->assertEquals($testObjNamePosAfterEnd, $orderedActionKeys[$actionsLength + 2]); } - /** - * Test to validate action steps properly resolve section element references. - * - * @return void - */ - public function testResolveActionStepSectionData() - { - $this->markTestIncomplete('TODO'); - } - - /** - * Test to validate action steps properly resolve page references. - * - * @return void - */ - public function testResolveActionStepPageData() - { - $this->markTestIncomplete('TODO'); - } - /** * Test to validate action steps properly resolve entity data references. * @@ -149,4 +113,54 @@ public function testResolveActionStepEntityData() $this->assertEquals($dataFieldValue, $resolvedActions[$actionName]->getCustomActionAttributes()[$userInputKey]); } + + /** + * Verify that an XmlException is thrown when an action references a non-existant action. + * + * @return void + */ + public function testNoActionException() + { + $actionObjects = []; + + $actionObjects[] = new ActionObject('actionKey1', 'bogusType', []); + $actionObjects[] = new ActionObject( + 'actionKey2', + 'bogusType', + [], + 'badActionReference', + ActionObject::MERGE_ACTION_ORDER_BEFORE + ); + + $this->expectException("\Magento\FunctionalTestingFramework\Exceptions\XmlException"); + + $actionMergeUtil = new ActionMergeUtil("actionMergeUtilTest", "TestCase"); + $actionMergeUtil->resolveActionSteps($actionObjects); + } + + /** + * Verify that a action is added after actions that have a wait (timeout property). + * + * @return void + */ + public function testInsertWait() + { + $actionObjectOne = new ActionObject('actionKey1', 'bogusType', []); + $actionObjectOne->setTimeout(42); + $actionObjects = [$actionObjectOne]; + + $actionMergeUtil = new ActionMergeUtil("actionMergeUtilTest", "TestCase"); + $result = $actionMergeUtil->resolveActionSteps($actionObjects); + + $actual = $result['actionKey1WaitForPageLoad']; + $expected = new ActionObject( + 'actionKey1WaitForPageLoad', + 'waitForPageLoad', + ['timeout' => 42], + 'actionKey1', + 0 + ); + $this->assertEquals($expected, $actual); + + } } diff --git a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php index 821c06efc..c95566ad2 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php +++ b/src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php @@ -169,6 +169,17 @@ public function getTimeout() return $this->timeout; } + /** + * Set the timeout value. + * + * @param int $timeout + * @return void + */ + public function setTimeout($timeout) + { + $this->timeout = $timeout; + } + /** * Populate the resolved custom attributes array with lookup values for the following attributes: * selector @@ -332,7 +343,7 @@ private function findAndReplaceReferences($objectHandler, $inputString) // If no Selector is defined, assume element has LocatorFunction $replacement = $obj->getElement($objField)->getSelector() ?: $obj->getElement($objField)->getLocatorFunction(); - $this->timeout = $obj->getElement($objField)->getTimeout(); + $this->setTimeout($obj->getElement($objField)->getTimeout()); break; case (get_class($obj) == EntityDataObject::class): list(,$objField) = $this->stripAndSplitReference($match); From b38bb3e7b644c2c4467674342e0cefc6441732d1 Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Wed, 6 Dec 2017 10:30:44 -0600 Subject: [PATCH 19/35] MQE-574: set proper required attributes in test schema and added attribute rule checks in test generator. --- .../Resources/BasicFunctionalCest.txt | 2 +- .../TestModule/Cest/BasicFunctionalCest.xml | 2 +- .../Test/etc/testSchema.xsd | 356 +++++++++--------- .../Util/TestGenerator.php | 82 ++++ 4 files changed, 261 insertions(+), 181 deletions(-) diff --git a/dev/tests/verification/Resources/BasicFunctionalCest.txt b/dev/tests/verification/Resources/BasicFunctionalCest.txt index b7afc27d9..fdb7b83cc 100644 --- a/dev/tests/verification/Resources/BasicFunctionalCest.txt +++ b/dev/tests/verification/Resources/BasicFunctionalCest.txt @@ -57,7 +57,7 @@ class BasicFunctionalCest $I->clickWithLeftButton(".functionalTestSelector"); $I->clickWithRightButton(".functionalTestSelector"); $I->closeTab(); - $I->conditionalClick(".functionalTestSelector", ".functionalDependentTestSelector"); + $I->conditionalClick(".functionalTestSelector", ".functionalDependentTestSelector", true); $I->dontSee("someInput", ".functionalTestSelector"); $I->dontSeeCheckboxIsChecked(".functionalTestSelector"); $I->dontSeeCookie("someInput"); diff --git a/dev/tests/verification/TestModule/Cest/BasicFunctionalCest.xml b/dev/tests/verification/TestModule/Cest/BasicFunctionalCest.xml index c6cd98374..bace82e49 100644 --- a/dev/tests/verification/TestModule/Cest/BasicFunctionalCest.xml +++ b/dev/tests/verification/TestModule/Cest/BasicFunctionalCest.xml @@ -41,7 +41,7 @@ - + diff --git a/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd b/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd index e229d0c5f..d210d2141 100644 --- a/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd +++ b/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd @@ -314,7 +314,7 @@ - + @@ -328,9 +328,9 @@ - + - + @@ -343,7 +343,7 @@ - + @@ -368,7 +368,7 @@ - + @@ -380,7 +380,7 @@ - + @@ -459,7 +459,7 @@ - + @@ -471,9 +471,9 @@ - - - + + + @@ -520,7 +520,7 @@ - + @@ -561,7 +561,7 @@ - + @@ -613,7 +613,7 @@ - + @@ -626,9 +626,8 @@ - + - @@ -668,8 +667,8 @@ - - + + @@ -694,7 +693,7 @@ - + @@ -744,7 +743,7 @@ - + @@ -758,7 +757,7 @@ - + @@ -770,8 +769,8 @@ - - + + @@ -783,7 +782,7 @@ - + @@ -795,7 +794,7 @@ - + @@ -836,9 +835,9 @@ - + - + @@ -853,7 +852,7 @@ - + @@ -867,7 +866,7 @@ - + @@ -880,9 +879,9 @@ - + - + @@ -895,7 +894,7 @@ - + @@ -907,8 +906,8 @@ - - + + @@ -922,7 +921,7 @@ - + @@ -986,7 +985,7 @@ - + @@ -1082,8 +1081,8 @@ - - + + @@ -1095,7 +1094,7 @@ - + @@ -1135,8 +1134,8 @@ - - + + @@ -1187,9 +1186,8 @@ - - - + + @@ -1217,7 +1215,7 @@ - + @@ -1283,7 +1281,7 @@ - + @@ -1324,8 +1322,8 @@ - - + + @@ -1337,7 +1335,7 @@ - + @@ -1362,7 +1360,7 @@ - + @@ -1401,7 +1399,7 @@ - + @@ -1416,7 +1414,7 @@ - + @@ -1430,7 +1428,7 @@ - + @@ -1445,9 +1443,9 @@ - + - + @@ -1459,8 +1457,8 @@ - - + + @@ -1539,7 +1537,7 @@ - + @@ -1551,7 +1549,7 @@ - + @@ -1590,8 +1588,8 @@ - - + + @@ -1604,7 +1602,7 @@ - + @@ -1617,7 +1615,7 @@ - + @@ -1630,7 +1628,7 @@ - + @@ -1643,7 +1641,7 @@ - + @@ -1694,10 +1692,10 @@ - - - - + + + + @@ -1710,10 +1708,10 @@ - - - - + + + + @@ -1726,10 +1724,10 @@ - - - - + + + + @@ -1743,10 +1741,10 @@ - - - - + + + + @@ -1759,10 +1757,10 @@ - - - - + + + + @@ -1775,8 +1773,8 @@ - - + + @@ -1789,10 +1787,10 @@ - - - - + + + + @@ -1806,8 +1804,8 @@ - - + + @@ -1820,8 +1818,8 @@ - - + + @@ -1834,8 +1832,8 @@ - - + + @@ -1848,10 +1846,10 @@ - - - - + + + + @@ -1864,10 +1862,10 @@ - - - - + + + + @@ -1880,10 +1878,10 @@ - - - - + + + + @@ -1896,10 +1894,10 @@ - - - - + + + + @@ -1912,10 +1910,10 @@ - - - - + + + + @@ -1928,8 +1926,8 @@ - - + + @@ -1942,10 +1940,10 @@ - - - - + + + + @@ -1958,10 +1956,10 @@ - - - - + + + + @@ -1974,10 +1972,10 @@ - - - - + + + + @@ -1990,10 +1988,10 @@ - - - - + + + + @@ -2006,8 +2004,8 @@ - - + + @@ -2020,10 +2018,10 @@ - - - - + + + + @@ -2037,10 +2035,10 @@ - - - - + + + + @@ -2053,8 +2051,8 @@ - - + + @@ -2067,10 +2065,10 @@ - - - - + + + + @@ -2083,10 +2081,10 @@ - - - - + + + + @@ -2099,8 +2097,8 @@ - - + + @@ -2113,10 +2111,10 @@ - - - - + + + + @@ -2129,10 +2127,10 @@ - - - - + + + + @@ -2145,10 +2143,10 @@ - - - - + + + + @@ -2161,10 +2159,10 @@ - - - - + + + + @@ -2177,8 +2175,8 @@ - - + + @@ -2191,10 +2189,10 @@ - - - - + + + + @@ -2206,7 +2204,7 @@ - + diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index d574913aa..ec9c079f6 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -376,6 +376,9 @@ private function generateStepsPhp($stepsObject, $stepsData, $hookObject = false) $assertIsStrict = null; $assertDelta = null; + // Validate action attributes and print notice messages on violation. + $this->validateXmlAttributesMutuallyExclusive($actionName, $customActionAttributes); + if (isset($customActionAttributes['returnVariable'])) { $returnVariable = $customActionAttributes['returnVariable']; } @@ -1536,4 +1539,83 @@ private function stripQuotes($inStr) $unquoted = preg_replace('/^(\'(.*)\'|"(.*)")$/', '$2$3', $inStr); return $unquoted; } + + /** + * Validate action attributes are either not set at all or only one is set for a given rule. + * + * @param string $tagName + * @param array $attributes + * @return void + */ + private function validateXmlAttributesMutuallyExclusive($tagName, $attributes) + { + $rules = [ + [ 'attributes' => [ + 'selector', + 'selectorArray', + ] + ], + [ + 'attributes' => [ + 'url', + 'userInput', + 'variable', + ] + ], + [ + 'attributes' => [ + 'userInput', + 'parameterArray', + 'variable' + ], + 'excludes' => [ + 'dontSeeCookie', + 'grabCookie', + 'resetCookie', + 'seeCookie', + 'setCookie', + ], + ], + ]; + foreach ($rules as $rule) { + if (isset($rule['excludes']) && in_array($tagName, $rule['excludes'])) { + continue; + } + $count = 0; + foreach ($rule['attributes'] as $attribute) { + if (isset($attributes[$attribute])) { + $count++; + } + } + if ($count > 1) { + $this->printRuleErrorToConsole($tagName, $rule['attributes']); + } + } + } + + /** + * Print rule violation message to console. + * + * @param $tagName + * @param $attributes + * @return void + */ + private function printRuleErrorToConsole($tagName, $attributes) + { + if (empty($tagName) || empty($attributes)) { + return; + } + $message = "Only one of the attributes: "; + $first = true; + foreach ($attributes as $attribute) { + if ($first) { + $message .= '"' . $attribute . '"'; + $first = false; + } else { + $message .= ', "' . $attribute . '"'; + } + } + $message .= ' can be use for action: "' . $tagName . "\"\n"; + print $message; + } } From febae80afe38455e55e6ce0329f35de47e3e6b26 Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Wed, 6 Dec 2017 13:15:00 -0600 Subject: [PATCH 20/35] MQE-541: deprecated 'mergeKey' for test schema. --- .../Resources/MergeFunctionalCest.txt | 2 - .../Cest/MergeBaseFunctionalCest.xml | 2 - .../TestModule/Cest/MergeInFunctionalCest.xml | 2 - .../FunctionalTestingFramework/Config/Dom.php | 10 - .../Test/Config/Converter/Dom/Flat.php | 9 - .../Test/Util/ActionObjectExtractor.php | 4 +- .../Test/etc/testSchema.xsd | 430 ++++++------------ .../Util/GlobalConstants.php | 28 -- 8 files changed, 146 insertions(+), 341 deletions(-) delete mode 100644 src/Magento/FunctionalTestingFramework/Util/GlobalConstants.php diff --git a/dev/tests/verification/Resources/MergeFunctionalCest.txt b/dev/tests/verification/Resources/MergeFunctionalCest.txt index 95d750dcc..78a8456f3 100644 --- a/dev/tests/verification/Resources/MergeFunctionalCest.txt +++ b/dev/tests/verification/Resources/MergeFunctionalCest.txt @@ -55,8 +55,6 @@ class MergeFunctionalCest $I->searchAndMultiSelectOption("#foo", ["Jane", "Dane"]); $I->see("#element .Jane"); $I->click("#step10MergedInResult"); - $I->click("#step11MergedInResult"); - $I->click("#step12MergedInResult"); } /** diff --git a/dev/tests/verification/TestModule/Cest/MergeBaseFunctionalCest.xml b/dev/tests/verification/TestModule/Cest/MergeBaseFunctionalCest.xml index d6e33c7dd..592d8541f 100644 --- a/dev/tests/verification/TestModule/Cest/MergeBaseFunctionalCest.xml +++ b/dev/tests/verification/TestModule/Cest/MergeBaseFunctionalCest.xml @@ -28,8 +28,6 @@ - - diff --git a/dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml b/dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml index 3733ef9a5..f57cc0496 100644 --- a/dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml +++ b/dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml @@ -25,8 +25,6 @@ - - diff --git a/src/Magento/FunctionalTestingFramework/Config/Dom.php b/src/Magento/FunctionalTestingFramework/Config/Dom.php index f635e0f31..49b98675c 100644 --- a/src/Magento/FunctionalTestingFramework/Config/Dom.php +++ b/src/Magento/FunctionalTestingFramework/Config/Dom.php @@ -6,8 +6,6 @@ namespace Magento\FunctionalTestingFramework\Config; -use Magento\FunctionalTestingFramework\Util\GlobalConstants; - /** * Magento configuration XML DOM utility */ @@ -224,14 +222,6 @@ protected function getNodePathByParent(\DOMElement $node, $parentPath) if ($value = $node->getAttribute($idAttributeValue)) { $path .= "[@{$idAttributeValue}='{$value}']"; break; - // TODO Remove the following elseif block once the 'mergeKey' attribute has been fully deprecated. - } elseif (empty($value) && $idAttributeValue === GlobalConstants::TEST_ID_ATTRIBUTE) { - print "use of the 'mergeKey' attribute will be deprecated in the next release.\n"; - $idAttributeValue = GlobalConstants::DEPRECATED_TEST_ID_ATTRIBUTE; - if ($value = $node->getAttribute($idAttributeValue)) { - $path .= "[@{$idAttributeValue}='{$value}']"; - break; - } } } } diff --git a/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php b/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php index e21561b9c..b00aaa6ed 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php +++ b/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php @@ -8,7 +8,6 @@ use Magento\FunctionalTestingFramework\Config\ConverterInterface; use Magento\FunctionalTestingFramework\Config\Dom\ArrayNodeConfig; -use Magento\FunctionalTestingFramework\Util\GlobalConstants; /** * Universal converter of any XML data to an array representation with no data loss @@ -86,14 +85,6 @@ public function convertXml(\DOMNode $source, $basePath = '') } $nodeData = $this->convertXml($node, $nodePath); - - // TODO Remove the following if block once the 'mergeKey' attribute has been fully deprecated. - if (!isset($nodeData[GlobalConstants::TEST_ID_ATTRIBUTE]) - && isset($nodeData[GlobalConstants::DEPRECATED_TEST_ID_ATTRIBUTE])) { - $nodeData[GlobalConstants::TEST_ID_ATTRIBUTE] = - $nodeData[GlobalConstants::DEPRECATED_TEST_ID_ATTRIBUTE]; - unset($nodeData[GlobalConstants::DEPRECATED_TEST_ID_ATTRIBUTE]); - } if ($isArrayNode) { if ($isNumericArrayNode) { $value[$nodeName][] = $nodeData; diff --git a/src/Magento/FunctionalTestingFramework/Test/Util/ActionObjectExtractor.php b/src/Magento/FunctionalTestingFramework/Test/Util/ActionObjectExtractor.php index cf83dd5c1..812955df7 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Util/ActionObjectExtractor.php +++ b/src/Magento/FunctionalTestingFramework/Test/Util/ActionObjectExtractor.php @@ -44,7 +44,7 @@ public function extractActions($testActions) $actions = []; foreach ($testActions as $actionName => $actionData) { - $mergeKey = $actionData[self::TEST_STEP_MERGE_KEY]; + $stepKey = $actionData[self::TEST_STEP_MERGE_KEY]; if ($actionData[self::NODE_NAME] === TestEntityExtractor::TEST_STEP_ENTITY_CREATION) { $actionData = $this->stripDataFields($actionData); } @@ -79,7 +79,7 @@ public function extractActions($testActions) }*/ $actions[] = new ActionObject( - $mergeKey, + $stepKey, $actionData[self::NODE_NAME], $actionAttributes, $linkedAction, diff --git a/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd b/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd index e229d0c5f..9bd459c24 100644 --- a/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd +++ b/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd @@ -252,8 +252,7 @@ - - + @@ -264,8 +263,7 @@ - - + @@ -277,8 +275,7 @@ - - + @@ -290,8 +287,7 @@ - - + @@ -303,8 +299,7 @@ - - + @@ -317,8 +312,7 @@ - - + @@ -332,8 +326,7 @@ - - + @@ -346,8 +339,7 @@ - - + @@ -357,8 +349,7 @@ - - + @@ -369,8 +360,7 @@ - - + @@ -381,8 +371,7 @@ - - + @@ -396,8 +385,7 @@ - - + @@ -411,8 +399,7 @@ - - + @@ -426,8 +413,7 @@ - - + @@ -437,8 +423,7 @@ - - + @@ -448,8 +433,7 @@ - - + @@ -460,8 +444,7 @@ - - + @@ -474,8 +457,7 @@ - - + @@ -487,8 +469,7 @@ - - + @@ -509,8 +490,7 @@ - - + @@ -521,8 +501,7 @@ - - + @@ -535,8 +514,7 @@ - - + @@ -550,8 +528,7 @@ - - + @@ -562,8 +539,7 @@ - - + @@ -576,8 +552,7 @@ - - + @@ -589,8 +564,7 @@ - - + @@ -602,8 +576,7 @@ - - + @@ -615,8 +588,7 @@ - - + @@ -629,8 +601,7 @@ - - + @@ -642,8 +613,7 @@ - - + @@ -657,8 +627,7 @@ - - + @@ -670,8 +639,7 @@ - - + @@ -683,8 +651,7 @@ - - + @@ -695,8 +662,7 @@ - - + @@ -708,8 +674,7 @@ - - + @@ -719,8 +684,7 @@ - - + @@ -733,8 +697,7 @@ - - + @@ -747,8 +710,7 @@ - - + @@ -759,8 +721,7 @@ - - + @@ -772,8 +733,7 @@ - - + @@ -784,8 +744,7 @@ - - + @@ -796,8 +755,7 @@ - - + @@ -811,8 +769,7 @@ - - + @@ -825,8 +782,7 @@ - - + @@ -840,8 +796,7 @@ - - + @@ -855,8 +810,7 @@ - - + @@ -869,8 +823,7 @@ - - + @@ -884,8 +837,7 @@ - - + @@ -896,8 +848,7 @@ - - + @@ -909,8 +860,7 @@ - - + @@ -923,8 +873,7 @@ - - + @@ -937,8 +886,7 @@ - - + @@ -950,8 +898,7 @@ - - + @@ -963,8 +910,7 @@ - - + @@ -974,8 +920,7 @@ - - + @@ -988,8 +933,7 @@ - - + @@ -999,8 +943,7 @@ - - + @@ -1010,8 +953,7 @@ - - + @@ -1021,8 +963,7 @@ - - + @@ -1036,8 +977,7 @@ - - + @@ -1047,8 +987,7 @@ - - + @@ -1060,8 +999,7 @@ - - + @@ -1071,8 +1009,7 @@ - - + @@ -1084,8 +1021,7 @@ - - + @@ -1099,8 +1035,7 @@ - - + @@ -1110,8 +1045,7 @@ - - + @@ -1124,8 +1058,7 @@ - - + @@ -1137,8 +1070,7 @@ - - + @@ -1150,8 +1082,7 @@ - - + @@ -1165,8 +1096,7 @@ - - + @@ -1176,8 +1106,7 @@ - - + @@ -1191,8 +1120,7 @@ - - + @@ -1206,8 +1134,7 @@ - - + @@ -1218,8 +1145,7 @@ - - + @@ -1232,8 +1158,7 @@ - - + @@ -1245,8 +1170,7 @@ - - + @@ -1258,8 +1182,7 @@ - - + @@ -1272,8 +1195,7 @@ - - + @@ -1285,8 +1207,7 @@ - - + @@ -1298,8 +1219,7 @@ - - + @@ -1313,8 +1233,7 @@ - - + @@ -1326,8 +1245,7 @@ - - + @@ -1338,8 +1256,7 @@ - - + @@ -1351,8 +1268,7 @@ - - + @@ -1363,8 +1279,7 @@ - - + @@ -1376,8 +1291,7 @@ - - + @@ -1390,8 +1304,7 @@ - - + @@ -1405,8 +1318,7 @@ - - + @@ -1419,8 +1331,7 @@ - - + @@ -1434,8 +1345,7 @@ - - + @@ -1448,8 +1358,7 @@ - - + @@ -1462,8 +1371,7 @@ - - + @@ -1476,8 +1384,7 @@ - - + @@ -1489,8 +1396,7 @@ - - + @@ -1502,8 +1408,7 @@ - - + @@ -1515,8 +1420,7 @@ - - + @@ -1528,8 +1432,7 @@ - - + @@ -1540,8 +1443,7 @@ - - + @@ -1555,8 +1457,7 @@ - - + @@ -1567,8 +1468,7 @@ - - + @@ -1579,8 +1479,7 @@ - - + @@ -1593,8 +1492,7 @@ - - + @@ -1606,8 +1504,7 @@ - - + @@ -1619,8 +1516,7 @@ - - + @@ -1632,8 +1528,7 @@ - - + @@ -1645,8 +1540,7 @@ - - + @@ -1656,8 +1550,7 @@ - - + @@ -1668,8 +1561,7 @@ - - + @@ -1683,8 +1575,7 @@ - - + @@ -1699,8 +1590,7 @@ - - + @@ -1715,8 +1605,7 @@ - - + @@ -1732,8 +1621,7 @@ - - + @@ -1748,8 +1636,7 @@ - - + @@ -1764,8 +1651,7 @@ - - + @@ -1778,8 +1664,7 @@ - - + @@ -1795,8 +1680,7 @@ - - + @@ -1809,8 +1693,7 @@ - - + @@ -1823,8 +1706,7 @@ - - + @@ -1837,8 +1719,7 @@ - - + @@ -1853,8 +1734,7 @@ - - + @@ -1869,8 +1749,7 @@ - - + @@ -1885,8 +1764,7 @@ - - + @@ -1901,8 +1779,7 @@ - - + @@ -1917,8 +1794,7 @@ - - + @@ -1931,8 +1807,7 @@ - - + @@ -1947,8 +1822,8 @@ - - + + @@ -1963,8 +1838,7 @@ - - + @@ -1979,8 +1853,7 @@ - - + @@ -1995,8 +1868,7 @@ - - + @@ -2009,8 +1881,7 @@ - - + @@ -2026,8 +1897,7 @@ - - + @@ -2042,8 +1912,7 @@ - - + @@ -2056,8 +1925,7 @@ - - + @@ -2072,8 +1940,7 @@ - - + @@ -2088,8 +1955,7 @@ - - + @@ -2102,8 +1968,7 @@ - - + @@ -2118,8 +1983,7 @@ - - + @@ -2134,8 +1998,7 @@ - - + @@ -2150,8 +2013,7 @@ - - + @@ -2166,8 +2028,7 @@ - - + @@ -2180,8 +2041,7 @@ - - + @@ -2195,8 +2055,7 @@ - - + @@ -2207,8 +2066,7 @@ - - + diff --git a/src/Magento/FunctionalTestingFramework/Util/GlobalConstants.php b/src/Magento/FunctionalTestingFramework/Util/GlobalConstants.php deleted file mode 100644 index 6f192e2ea..000000000 --- a/src/Magento/FunctionalTestingFramework/Util/GlobalConstants.php +++ /dev/null @@ -1,28 +0,0 @@ - Date: Wed, 6 Dec 2017 14:32:22 -0600 Subject: [PATCH 21/35] MQE-600: Prune README.md in EE repo - Copy readme from tests (magento2) repo - Add extension to license to make opening easier --- LICENSE_APL3 => LICENSE_APL3.txt | 0 README.md | 81 ++++++++++++++++++++++++++------ 2 files changed, 67 insertions(+), 14 deletions(-) rename LICENSE_APL3 => LICENSE_APL3.txt (100%) diff --git a/LICENSE_APL3 b/LICENSE_APL3.txt similarity index 100% rename from LICENSE_APL3 rename to LICENSE_APL3.txt diff --git a/README.md b/README.md index f93325c42..7ad3c262f 100755 --- a/README.md +++ b/README.md @@ -1,17 +1,70 @@ -# Magento2 Functional Testing Framework +# Magento Functional Testing Framework -Customized codeception modules, helpers, page objects and step objects for Magento 2.2.x. This library package can be used as dependency for Magento Acceptance Test projects for Magento 2 Community Edition ([magento/acceptance-test-ce](https://github.com/magento-pangolin/acceptance-test-ce/)) or Magento 2 Enterprise Edition in ([magento/acceptance-test-ee](https://github.com/magento-pangolin/acceptance-test-ee/)) or acceptance test projects for Magento 2 extensions. +---- + +## System Requirements +[Magento Functional Testing Framework system requirements](http://devdocs.magento.com/guides/v2.3/magento-functional-testing-framework/getting-started.html#prepare-environment) ## Installation -Add the package into your acceptance test project composer.json: -``` - { - "require": { - "magento/acceptance-test-framework": "dev-develop" - } - } -``` -Then run: -``` - composer update -``` +To install the Magento Functional Testing Framework, see [Getting Started](http://devdocs.magento.com/guides/v2.3/magento-functional-testing-framework/getting-started.html) + +## Contributing +Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes, optimizations, or just good suggestions. + +To learn about how to make a contribution, click [here][1]. + +To open an issue, click [here][2]. + +To suggest documentation improvements, click [here][3]. + +[1]: +[2]: +[3]: + +### Labels applied by the MFTF team + +Refer to the tables with descriptions of each label below. These labels are applied by the MFTF development team to community contributed issues and pull requests, to communicate status, impact, or which team is working on it. + +### Pull Request Status + +Label| Description +---|--- +**accept**| The pull request has been accepted and will be merged into mainline code. +**reject**| The pull request has been rejected and will not be merged into mainline code. Possible reasons can include but are not limited to: issue has already been fixed in another code contribution, or there is an issue with the code contribution. +**needsUpdate**| The Magento Team needs additional information from the reporter to properly prioritize and process the pull request. + +### Issue Resolution Status + +Label| Description +---|--- +**acknowledged**| The Magento Team has validated the issue and an internal ticket has been created. +**needsUpdate**| The Magento Team needs additional information from the reporter to properly prioritize and process the issue or pull request. +**cannot reproduce**| The Magento Team has not confirmed that this issue contains the minimum required information to reproduce. +**non-issue**| The Magento Team has not recognised any issue according to provided information. + +### Domains Impacted + +Label| Description +---|--- +**PROD**| Affects the Product team (mostly feature requests or business logic change). +**DOC**| Affects Documentation domain. +**TECH**| Affects Architect Group (mostly to make decisions around technology changes). + +### Type + +Label| Description +---|--- +**bugfix**| The issue or pull request relates to bug fixing. +**enhancement**| The issue or pull request that raises the MFTF to a higher degree (for example new features, optimization, refactoring, etc). + +## Reporting security issues + +To report security vulnerabilities in Magento software or web sites, please e-mail security@magento.com. Please do not report security issues using GitHub. Be sure to encrypt your e-mail with our encryption key if it includes sensitive information. Learn more about reporting security issues here. + +Stay up-to-date on the latest security news and patches for Magento by signing up for Security Alert Notifications. + +## License + +Each Magento source file included in this distribution is licensed under APL 3.0 + +Please see LICENSE_APL3.txt for the full text of the APL 3.0 license or contact license@magentocommerce.com for a copy. From eba01dbe534f38c879ecf1dcc422867c39b29185 Mon Sep 17 00:00:00 2001 From: Ian Meron Date: Tue, 5 Dec 2017 13:07:04 -0600 Subject: [PATCH 22/35] MQE-347: Use a remove tag instead of a remove attribute - add new removal action - add new deprecation message for incorrect usage of removal attribute - update verification tests --- .../ActionGroup/MergeFunctionalActionGroup.xml | 2 +- .../TestModule/Cest/MergeInFunctionalCest.xml | 2 +- etc/di.xml | 8 ++++++++ .../Test/Config/Converter/Dom/Flat.php | 17 ++++++++++++++++- .../Test/etc/testSchema.xsd | 10 ++++++++++ 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/dev/tests/verification/TestModule/ActionGroup/MergeFunctionalActionGroup.xml b/dev/tests/verification/TestModule/ActionGroup/MergeFunctionalActionGroup.xml index 37f648f43..f232e36fa 100644 --- a/dev/tests/verification/TestModule/ActionGroup/MergeFunctionalActionGroup.xml +++ b/dev/tests/verification/TestModule/ActionGroup/MergeFunctionalActionGroup.xml @@ -11,6 +11,6 @@ - + diff --git a/dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml b/dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml index 304000252..37310810e 100644 --- a/dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml +++ b/dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml @@ -22,7 +22,7 @@ - + diff --git a/etc/di.xml b/etc/di.xml index f4261b9d8..b0f5aca4c 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -209,6 +209,9 @@ createDataKey createDataKey mergeKey + keyForRemoval + keyForRemoval + keyForRemoval *Cest.xml Cest @@ -221,6 +224,9 @@ mergeKey mergeKey mergeKey + keyForRemoval + keyForRemoval + keyForRemoval name name createDataKey @@ -287,6 +293,7 @@ name name mergeKey + keyForRemoval *ActionGroup.xml ActionGroup @@ -297,6 +304,7 @@ mergeKey + keyForRemoval name name diff --git a/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php b/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php index b00aaa6ed..a08d636eb 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php +++ b/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php @@ -14,6 +14,9 @@ */ class Flat implements ConverterInterface { + const REMOVE_ACTION = 'remove'; + const REMOVE_KEY_ATTRIBUTE = 'keyForRemoval'; + /** * Array node configuration. * @@ -70,10 +73,17 @@ public function convertXml(\DOMNode $source, $basePath = '') $value = []; /** @var \DOMNode $node */ foreach ($source->childNodes as $node) { + // TODO Remove this block once the 'remove' attribute has been full deprecated + if ($node->nodeType == XML_ELEMENT_NODE && $node->getAttribute('remove') != null) { + trigger_error( + "use of the 'remove' attribute will be deprecated in the next release.", + E_USER_DEPRECATED + ); + } + if ($node->nodeType == XML_ELEMENT_NODE && $node->getAttribute('remove') != 'true') { $nodeName = $node->nodeName; $nodePath = $basePath . '/' . $nodeName; - $arrayKeyAttribute = $this->arrayNodeConfig->getAssocArrayKeyAttribute($nodePath); $isNumericArrayNode = $this->arrayNodeConfig->isNumericArray($nodePath); $isArrayNode = $isNumericArrayNode || $arrayKeyAttribute; @@ -84,6 +94,11 @@ public function convertXml(\DOMNode $source, $basePath = '') ); } + if ($nodeName == self::REMOVE_ACTION) { + unset($value[$node->getAttribute(self::REMOVE_KEY_ATTRIBUTE)]); + continue; + } + $nodeData = $this->convertXml($node, $nodePath); if ($isArrayNode) { if ($isNumericArrayNode) { diff --git a/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd b/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd index e4c8c4f8e..fd84e89f4 100644 --- a/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd +++ b/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd @@ -90,6 +90,7 @@ + @@ -260,6 +261,15 @@ + + + + + + + + + From a7121ebc404dcfe1ee7843d729aee4e6c1501dda Mon Sep 17 00:00:00 2001 From: Ian Meron Date: Wed, 6 Dec 2017 11:40:57 -0600 Subject: [PATCH 23/35] MQE-347: Use a remove tag instead of a remove attribute - removing reference to remove attribute --- .../Test/Config/Converter/Dom/Flat.php | 10 +- .../Test/etc/testSchema.xsd | 144 ------------------ 2 files changed, 1 insertion(+), 153 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php b/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php index a08d636eb..ba226919c 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php +++ b/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php @@ -73,15 +73,7 @@ public function convertXml(\DOMNode $source, $basePath = '') $value = []; /** @var \DOMNode $node */ foreach ($source->childNodes as $node) { - // TODO Remove this block once the 'remove' attribute has been full deprecated - if ($node->nodeType == XML_ELEMENT_NODE && $node->getAttribute('remove') != null) { - trigger_error( - "use of the 'remove' attribute will be deprecated in the next release.", - E_USER_DEPRECATED - ); - } - - if ($node->nodeType == XML_ELEMENT_NODE && $node->getAttribute('remove') != 'true') { + if ($node->nodeType == XML_ELEMENT_NODE) { $nodeName = $node->nodeName; $nodePath = $basePath . '/' . $nodeName; $arrayKeyAttribute = $this->arrayNodeConfig->getAssocArrayKeyAttribute($nodePath); diff --git a/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd b/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd index fd84e89f4..2de97ee42 100644 --- a/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd +++ b/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd @@ -254,7 +254,6 @@ - @@ -274,7 +273,6 @@ - @@ -286,7 +284,6 @@ - @@ -298,7 +295,6 @@ - @@ -310,7 +306,6 @@ - @@ -323,7 +318,6 @@ - @@ -337,7 +331,6 @@ - @@ -350,7 +343,6 @@ - @@ -360,7 +352,6 @@ - @@ -371,7 +362,6 @@ - @@ -382,7 +372,6 @@ - @@ -396,7 +385,6 @@ - @@ -410,7 +398,6 @@ - @@ -424,7 +411,6 @@ - @@ -434,7 +420,6 @@ - @@ -444,7 +429,6 @@ - @@ -455,7 +439,6 @@ - @@ -468,7 +451,6 @@ - @@ -480,7 +462,6 @@ - @@ -489,7 +470,6 @@ - @@ -502,7 +482,6 @@ - @@ -512,7 +491,6 @@ - @@ -526,7 +504,6 @@ - @@ -539,7 +516,6 @@ - @@ -550,7 +526,6 @@ - @@ -563,7 +538,6 @@ - @@ -575,7 +549,6 @@ - @@ -587,7 +560,6 @@ - @@ -599,7 +571,6 @@ - @@ -612,7 +583,6 @@ - @@ -624,7 +594,6 @@ - @@ -638,7 +607,6 @@ - @@ -650,7 +618,6 @@ - @@ -662,7 +629,6 @@ - @@ -673,7 +639,6 @@ - @@ -685,7 +650,6 @@ - @@ -695,7 +659,6 @@ - @@ -708,7 +671,6 @@ - @@ -721,7 +683,6 @@ - @@ -732,7 +693,6 @@ - @@ -744,7 +704,6 @@ - @@ -755,7 +714,6 @@ - @@ -766,7 +724,6 @@ - @@ -780,7 +737,6 @@ - @@ -793,7 +749,6 @@ - @@ -807,7 +762,6 @@ - @@ -821,7 +775,6 @@ - @@ -834,7 +787,6 @@ - @@ -848,7 +800,6 @@ - @@ -859,7 +810,6 @@ - @@ -871,7 +821,6 @@ - @@ -884,7 +833,6 @@ - @@ -897,7 +845,6 @@ - @@ -909,7 +856,6 @@ - @@ -921,7 +867,6 @@ - @@ -931,7 +876,6 @@ - @@ -944,7 +888,6 @@ - @@ -954,7 +897,6 @@ - @@ -964,7 +906,6 @@ - @@ -974,7 +915,6 @@ - @@ -988,7 +928,6 @@ - @@ -998,7 +937,6 @@ - @@ -1010,7 +948,6 @@ - @@ -1020,7 +957,6 @@ - @@ -1032,7 +968,6 @@ - @@ -1046,7 +981,6 @@ - @@ -1056,7 +990,6 @@ - @@ -1069,7 +1002,6 @@ - @@ -1081,7 +1013,6 @@ - @@ -1093,7 +1024,6 @@ - @@ -1107,7 +1037,6 @@ - @@ -1117,7 +1046,6 @@ - @@ -1131,7 +1059,6 @@ - @@ -1145,7 +1072,6 @@ - @@ -1156,7 +1082,6 @@ - @@ -1169,7 +1094,6 @@ - @@ -1181,7 +1105,6 @@ - @@ -1193,7 +1116,6 @@ - @@ -1206,7 +1128,6 @@ - @@ -1218,7 +1139,6 @@ - @@ -1230,7 +1150,6 @@ - @@ -1244,7 +1163,6 @@ - @@ -1256,7 +1174,6 @@ - @@ -1267,7 +1184,6 @@ - @@ -1279,7 +1195,6 @@ - @@ -1290,7 +1205,6 @@ - @@ -1302,7 +1216,6 @@ - @@ -1315,7 +1228,6 @@ - @@ -1329,7 +1241,6 @@ - @@ -1342,7 +1253,6 @@ - @@ -1356,7 +1266,6 @@ - @@ -1369,7 +1278,6 @@ - @@ -1382,7 +1290,6 @@ - @@ -1395,7 +1302,6 @@ - @@ -1407,7 +1313,6 @@ - @@ -1419,7 +1324,6 @@ - @@ -1431,7 +1335,6 @@ - @@ -1443,7 +1346,6 @@ - @@ -1454,7 +1356,6 @@ - @@ -1468,7 +1369,6 @@ - @@ -1479,7 +1379,6 @@ - @@ -1490,7 +1389,6 @@ - @@ -1503,7 +1401,6 @@ - @@ -1515,7 +1412,6 @@ - @@ -1527,7 +1423,6 @@ - @@ -1539,7 +1434,6 @@ - @@ -1551,7 +1445,6 @@ - @@ -1561,7 +1454,6 @@ - @@ -1572,7 +1464,6 @@ - @@ -1586,7 +1477,6 @@ - @@ -1601,7 +1491,6 @@ - @@ -1616,7 +1505,6 @@ - @@ -1632,7 +1520,6 @@ - @@ -1647,7 +1534,6 @@ - @@ -1662,7 +1548,6 @@ - @@ -1675,7 +1560,6 @@ - @@ -1691,7 +1575,6 @@ - @@ -1704,7 +1587,6 @@ - @@ -1717,7 +1599,6 @@ - @@ -1730,7 +1611,6 @@ - @@ -1745,7 +1625,6 @@ - @@ -1760,7 +1639,6 @@ - @@ -1775,7 +1653,6 @@ - @@ -1790,7 +1667,6 @@ - @@ -1805,7 +1681,6 @@ - @@ -1818,7 +1693,6 @@ - @@ -1833,7 +1707,6 @@ - @@ -1848,7 +1721,6 @@ - @@ -1863,7 +1735,6 @@ - @@ -1878,7 +1749,6 @@ - @@ -1891,7 +1761,6 @@ - @@ -1907,7 +1776,6 @@ - @@ -1922,7 +1790,6 @@ - @@ -1935,7 +1802,6 @@ - @@ -1950,7 +1816,6 @@ - @@ -1965,7 +1830,6 @@ - @@ -1978,7 +1842,6 @@ - @@ -1993,7 +1856,6 @@ - @@ -2008,7 +1870,6 @@ - @@ -2023,7 +1884,6 @@ - @@ -2038,7 +1898,6 @@ - @@ -2051,7 +1910,6 @@ - @@ -2065,7 +1923,6 @@ - @@ -2076,7 +1933,6 @@ - From 81c8690319e5f56ad56bf2ee29dcc2574ebbf9a0 Mon Sep 17 00:00:00 2001 From: Ian Meron Date: Thu, 7 Dec 2017 12:29:51 -0600 Subject: [PATCH 24/35] MQE-347: Use a remove tag instead of a remove attribute - fix codesniffer error from static check --- .../Test/Config/Converter/Dom/Flat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php b/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php index ba226919c..254cdcc69 100644 --- a/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php +++ b/src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php @@ -73,7 +73,7 @@ public function convertXml(\DOMNode $source, $basePath = '') $value = []; /** @var \DOMNode $node */ foreach ($source->childNodes as $node) { - if ($node->nodeType == XML_ELEMENT_NODE) { + if ($node->nodeType == XML_ELEMENT_NODE) { $nodeName = $node->nodeName; $nodePath = $basePath . '/' . $nodeName; $arrayKeyAttribute = $this->arrayNodeConfig->getAssocArrayKeyAttribute($nodePath); From 1632842b6a035b2a6668a59c5fc6797dc169917e Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Thu, 7 Dec 2017 14:09:49 -0600 Subject: [PATCH 25/35] MQE-574: set proper required attributes in test schema and added attribute rule checks in test generator. --- .../Util/TestGenerator.php | 53 ++++++++----------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index ec9c079f6..8350f1885 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -344,8 +344,9 @@ private function generateStepsPhp($stepsObject, $stepsData, $hookObject = false) foreach ($stepsObject as $steps) { $actor = "I"; $actionName = $steps->getType(); - $attribute = null; + $stepKey = $steps->getStepKey(); $customActionAttributes = $steps->getCustomActionAttributes(); + $attribute = null; $selector = null; $selector1 = null; $selector2 = null; @@ -377,7 +378,7 @@ private function generateStepsPhp($stepsObject, $stepsData, $hookObject = false) $assertDelta = null; // Validate action attributes and print notice messages on violation. - $this->validateXmlAttributesMutuallyExclusive($actionName, $customActionAttributes); + $this->validateXmlAttributesMutuallyExclusive($stepKey, $actionName, $customActionAttributes); if (isset($customActionAttributes['returnVariable'])) { $returnVariable = $customActionAttributes['returnVariable']; @@ -517,12 +518,11 @@ private function generateStepsPhp($stepsObject, $stepsData, $hookObject = false) switch ($actionName) { case "createData": $entity = $customActionAttributes['entity']; - $key = $steps->getStepKey(); //Add an informative statement to help the user debug test runs $testSteps .= sprintf( "\t\t$%s->amGoingTo(\"create entity that has the stepKey: %s\");\n", $actor, - $key + $stepKey ); //Get Entity from Static data. $testSteps .= sprintf( @@ -554,17 +554,17 @@ private function generateStepsPhp($stepsObject, $stepsData, $hookObject = false) } if ($hookObject) { - $createEntityFunctionCall = sprintf("\t\t\$this->%s->createEntity(", $key); + $createEntityFunctionCall = sprintf("\t\t\$this->%s->createEntity(", $stepKey); $dataPersistenceHandlerFunctionCall = sprintf( "\t\t\$this->%s = new DataPersistenceHandler($%s", - $key, + $stepKey, $entity ); } else { - $createEntityFunctionCall = sprintf("\t\t\$%s->createEntity(", $key); + $createEntityFunctionCall = sprintf("\t\t\$%s->createEntity(", $stepKey); $dataPersistenceHandlerFunctionCall = sprintf( "\t\t$%s = new DataPersistenceHandler($%s", - $key, + $stepKey, $entity ); } @@ -659,12 +659,11 @@ private function generateStepsPhp($stepsObject, $stepsData, $hookObject = false) break; case "getData": $entity = $customActionAttributes['entity']; - $key = $steps->getStepKey(); //Add an informative statement to help the user debug test runs $testSteps .= sprintf( "\t\t$%s->amGoingTo(\"get entity that has the stepKey: %s\");\n", $actor, - $key + $stepKey ); //Get Entity from Static data. $testSteps .= sprintf( @@ -696,17 +695,17 @@ private function generateStepsPhp($stepsObject, $stepsData, $hookObject = false) } if ($hookObject) { - $getEntityFunctionCall = sprintf("\t\t\$this->%s->getEntity(", $key); + $getEntityFunctionCall = sprintf("\t\t\$this->%s->getEntity(", $stepKey); $dataPersistenceHandlerFunctionCall = sprintf( "\t\t\$this->%s = new DataPersistenceHandler($%s", - $key, + $stepKey, $entity ); } else { - $getEntityFunctionCall = sprintf("\t\t\$%s->getEntity(", $key); + $getEntityFunctionCall = sprintf("\t\t\$%s->getEntity(", $stepKey); $dataPersistenceHandlerFunctionCall = sprintf( "\t\t$%s = new DataPersistenceHandler($%s", - $key, + $stepKey, $entity ); } @@ -1543,11 +1542,12 @@ private function stripQuotes($inStr) /** * Validate action attributes are either not set at all or only one is set for a given rule. * + * @param string $key * @param string $tagName * @param array $attributes * @return void */ - private function validateXmlAttributesMutuallyExclusive($tagName, $attributes) + private function validateXmlAttributesMutuallyExclusive($key, $tagName, $attributes) { $rules = [ [ 'attributes' => [ @@ -1588,7 +1588,7 @@ private function validateXmlAttributesMutuallyExclusive($tagName, $attributes) } } if ($count > 1) { - $this->printRuleErrorToConsole($tagName, $rule['attributes']); + $this->printRuleErrorToConsole($key, $tagName, $rule['attributes']); } } } @@ -1596,26 +1596,19 @@ private function validateXmlAttributesMutuallyExclusive($tagName, $attributes) /** * Print rule violation message to console. * - * @param $tagName - * @param $attributes + * @param string $key + * @param string $tagName + * @param array $attributes * @return void */ - private function printRuleErrorToConsole($tagName, $attributes) + private function printRuleErrorToConsole($key, $tagName, $attributes) { if (empty($tagName) || empty($attributes)) { return; } - $message = "Only one of the attributes: "; - $first = true; - foreach ($attributes as $attribute) { - if ($first) { - $message .= '"' . $attribute . '"'; - $first = false; - } else { - $message .= ', "' . $attribute . '"'; - } - } - $message .= ' can be use for action: "' . $tagName . "\"\n"; + $message = 'On step with stepKey "' . $key . '", only one of the attributes: "'; + $message .= implode('", "', $attributes); + $message .= '" can be use for action "' . $tagName . "\".\n"; print $message; } } From d1dc19ee0ed1c7e04640240151287e541b9680e9 Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Thu, 7 Dec 2017 14:33:42 -0600 Subject: [PATCH 26/35] MQE-574: set proper required attributes in test schema and added attribute rule checks in test generator. --- .../verification/TestModule/Cest/BasicFunctionalCest.xml | 4 ++-- .../FunctionalTestingFramework/Util/TestGenerator.php | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dev/tests/verification/TestModule/Cest/BasicFunctionalCest.xml b/dev/tests/verification/TestModule/Cest/BasicFunctionalCest.xml index bace82e49..9d0d89035 100644 --- a/dev/tests/verification/TestModule/Cest/BasicFunctionalCest.xml +++ b/dev/tests/verification/TestModule/Cest/BasicFunctionalCest.xml @@ -33,7 +33,7 @@ - + @@ -50,7 +50,7 @@ - + diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index 8350f1885..4a2b2c829 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -1560,7 +1560,11 @@ private function validateXmlAttributesMutuallyExclusive($key, $tagName, $attribu 'url', 'userInput', 'variable', - ] + ], + 'excludes' => [ + 'dontSeeLink', + 'seeLink', + ], ], [ 'attributes' => [ From 46a9e9b555bbd2de6ed99a85438849d7768c3f3b Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Thu, 7 Dec 2017 12:27:56 -0600 Subject: [PATCH 27/35] MQE-583: set licensing in composer.json. --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 877dc5130..2d53f10fa 100755 --- a/composer.json +++ b/composer.json @@ -2,6 +2,7 @@ "name": "magento/magento2-functional-testing-framework", "type": "library", "description": "Magento2 Functional Testing Framework", + "license": "AGPL-3.0", "keywords": ["magento", "automation", "functional", "testing"], "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", From 8aac939e6ed986fe44b45821a80b6bd66137878e Mon Sep 17 00:00:00 2001 From: Tom Erskine Date: Thu, 7 Dec 2017 15:05:35 -0600 Subject: [PATCH 28/35] MQE-606: adding changelog.md file --- changelog.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 changelog.md diff --git a/changelog.md b/changelog.md new file mode 100644 index 000000000..579b23850 --- /dev/null +++ b/changelog.md @@ -0,0 +1,20 @@ +MFTF Version 1.0 - Changelog + +Core Features: + +Supported Systems: +OS + Windows 10 + OSX (Sierra) + +Browser + Chrome (Latest) with ChromeDriver Latest + + +Known Issues: +*Support for Firefox is curently incomplete. This will be resolved to support Firefox 57 (Quantum) and latest Gecko driver in next minor release. + + + + + From a50014a47866f0ff71cb0854714e6467652bcda3 Mon Sep 17 00:00:00 2001 From: Tom Reece Date: Thu, 7 Dec 2017 15:59:27 -0600 Subject: [PATCH 29/35] MQE-607: Replace license file --- LICENSE_APL3.txt => LICENSE_AGPL3.txt | 0 README.md | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename LICENSE_APL3.txt => LICENSE_AGPL3.txt (100%) diff --git a/LICENSE_APL3.txt b/LICENSE_AGPL3.txt similarity index 100% rename from LICENSE_APL3.txt rename to LICENSE_AGPL3.txt diff --git a/README.md b/README.md index 7ad3c262f..906a4b01f 100755 --- a/README.md +++ b/README.md @@ -65,6 +65,6 @@ Stay up-to-date on the latest security news and patches for Magento by signing u ## License -Each Magento source file included in this distribution is licensed under APL 3.0 +Each Magento source file included in this distribution is licensed under AGPL 3.0 -Please see LICENSE_APL3.txt for the full text of the APL 3.0 license or contact license@magentocommerce.com for a copy. +Please see LICENSE_AGPL3.txt for the full text of the AGPL 3.0 license or contact license@magentocommerce.com for a copy. From d76e7ae6bf87f7b96073f98158dce7fac9862bd5 Mon Sep 17 00:00:00 2001 From: Ian Meron Date: Tue, 5 Dec 2017 10:27:59 -0600 Subject: [PATCH 30/35] MQE-386: MFTF Compatibility with Windows Machine - replace hardcoded dir references with DIRECTORY_SEPARATOR constant --- .../Config/FileResolver/Mask.php | 2 +- .../Config/FileResolver/Primary.php | 19 ++++++++++--------- .../Config/SchemaLocator.php | 8 ++++---- .../Handlers/DataObjectHandler.php | 2 +- .../Module/MagentoSequence.php | 2 +- .../ObjectManager/Config/SchemaLocator.php | 3 ++- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Config/FileResolver/Mask.php b/src/Magento/FunctionalTestingFramework/Config/FileResolver/Mask.php index b708ee052..e3f29f954 100644 --- a/src/Magento/FunctionalTestingFramework/Config/FileResolver/Mask.php +++ b/src/Magento/FunctionalTestingFramework/Config/FileResolver/Mask.php @@ -64,7 +64,7 @@ protected function getFileCollection($filename, $scope) $modulesPath = $this->moduleResolver->getModulesPath(); foreach ($modulesPath as $modulePath) { - $path = $modulePath . '/' . $scope . '/'; + $path = $modulePath . DIRECTORY_SEPARATOR . $scope . DIRECTORY_SEPARATOR; if (is_readable($path)) { $directoryIterator = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator( diff --git a/src/Magento/FunctionalTestingFramework/Config/FileResolver/Primary.php b/src/Magento/FunctionalTestingFramework/Config/FileResolver/Primary.php index 14643b32e..2376b3cf1 100644 --- a/src/Magento/FunctionalTestingFramework/Config/FileResolver/Primary.php +++ b/src/Magento/FunctionalTestingFramework/Config/FileResolver/Primary.php @@ -28,7 +28,7 @@ public function get($filename, $scope) if (!$filename) { return []; } - $scope = str_replace('\\', '/', $scope); + $scope = str_replace('\\', DIRECTORY_SEPARATOR, $scope); return new File($this->getFilePaths($filename, $scope)); } @@ -59,19 +59,20 @@ private function getPathPatterns($filename, $scope) { if (substr($scope, 0, strlen(FW_BP)) === FW_BP) { $patterns = [ - $scope . '/' . $filename, - $scope . '/*/' . $filename + $scope . DIRECTORY_SEPARATOR . $filename, + $scope . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . $filename ]; } else { $defaultPath = dirname(dirname(dirname(dirname(__DIR__)))); - $defaultPath = str_replace('\\', '/', $defaultPath); + $defaultPath = str_replace('\\', DIRECTORY_SEPARATOR, $defaultPath); $patterns = [ - $defaultPath . '/' . $scope . '/' . $filename, - $defaultPath . '/' . $scope . '/*/' . $filename, - FW_BP . '/' . $scope . '/' . $filename, - FW_BP . '/' . $scope . '/*/' . $filename + $defaultPath . DIRECTORY_SEPARATOR . $scope . DIRECTORY_SEPARATOR . $filename, + $defaultPath . DIRECTORY_SEPARATOR . $scope . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR + . $filename, + FW_BP . DIRECTORY_SEPARATOR . $scope . DIRECTORY_SEPARATOR . $filename, + FW_BP . DIRECTORY_SEPARATOR . $scope . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . $filename ]; } - return str_replace('/', DIRECTORY_SEPARATOR, $patterns); + return str_replace(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, $patterns); } } diff --git a/src/Magento/FunctionalTestingFramework/Config/SchemaLocator.php b/src/Magento/FunctionalTestingFramework/Config/SchemaLocator.php index 628d7c674..1ff647161 100644 --- a/src/Magento/FunctionalTestingFramework/Config/SchemaLocator.php +++ b/src/Magento/FunctionalTestingFramework/Config/SchemaLocator.php @@ -25,12 +25,12 @@ class SchemaLocator implements \Magento\FunctionalTestingFramework\Config\Schema */ public function __construct($schemaPath) { - if (constant('FW_BP') && file_exists(FW_BP . '/' . $schemaPath)) { - $this->schemaPath = FW_BP . '/' . $schemaPath; + if (constant('FW_BP') && file_exists(FW_BP . DIRECTORY_SEPARATOR . $schemaPath)) { + $this->schemaPath = FW_BP . DIRECTORY_SEPARATOR . $schemaPath; } else { $path = dirname(dirname(dirname(__DIR__))); - $path = str_replace('\\', '/', $path); - $this->schemaPath = $path . '/' . $schemaPath; + $path = str_replace('\\', DIRECTORY_SEPARATOR, $path); + $this->schemaPath = $path . DIRECTORY_SEPARATOR . $schemaPath; } } diff --git a/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/DataObjectHandler.php b/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/DataObjectHandler.php index bac2342a2..f970d580e 100644 --- a/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/DataObjectHandler.php +++ b/src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/DataObjectHandler.php @@ -132,7 +132,7 @@ private function initDataObjects() */ private function parseEnvVariables() { - $envFilename = PROJECT_ROOT . '/.env'; + $envFilename = PROJECT_ROOT . DIRECTORY_SEPARATOR . '.env'; if (file_exists($envFilename)) { $envData = []; $envFile = file($envFilename); diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoSequence.php b/src/Magento/FunctionalTestingFramework/Module/MagentoSequence.php index 6689e6b45..df59a62ec 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoSequence.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoSequence.php @@ -20,7 +20,7 @@ class MagentoSequence extends Sequence } if (!function_exists('msq') && !function_exists('msqs')) { - require_once __DIR__ . '/../Util/msq.php'; + require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Util' . DIRECTORY_SEPARATOR . 'msq.php'; } else { throw new ModuleException('Magento\FunctionalTestingFramework\Module\MagentoSequence', "function 'msq' and 'msqs' already defined"); } diff --git a/src/Magento/FunctionalTestingFramework/ObjectManager/Config/SchemaLocator.php b/src/Magento/FunctionalTestingFramework/ObjectManager/Config/SchemaLocator.php index fd4f92b17..aabf0e8f6 100644 --- a/src/Magento/FunctionalTestingFramework/ObjectManager/Config/SchemaLocator.php +++ b/src/Magento/FunctionalTestingFramework/ObjectManager/Config/SchemaLocator.php @@ -22,7 +22,8 @@ class SchemaLocator implements SchemaLocatorInterface */ public function getSchema() { - return realpath(__DIR__ . '/../etc/') . DIRECTORY_SEPARATOR . 'config.xsd'; + return realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'etc' . DIRECTORY_SEPARATOR) + . DIRECTORY_SEPARATOR . 'config.xsd'; } /** From 3b84770f4fb4236950bec27062eca598c84ebcda Mon Sep 17 00:00:00 2001 From: imeron2433 Date: Thu, 7 Dec 2017 23:07:31 +0200 Subject: [PATCH 31/35] MQE-386: MFTF Compatability with Windows Machine - changes to test suite in order to account for os pathing in verification tests - add .gitattributes to the mftf --- .gitattributes | 3 ++ bin/phpunit-checks.bat | 10 ++++++ bin/static-checks.bat | 20 +++++++++++ .../Resources/TestSuiteGeneration1.txt | 4 --- .../Tests/SuiteGenerationTest.php | 35 +++++++++++++++---- 5 files changed, 62 insertions(+), 10 deletions(-) create mode 100644 .gitattributes create mode 100644 bin/phpunit-checks.bat create mode 100644 bin/static-checks.bat delete mode 100644 dev/tests/verification/Resources/TestSuiteGeneration1.txt diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..601e7f62d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +# Declare files that will always have LF line endings on checkout. +dev/tests/verification/Resources/TestSuiteGeneration1.txt text=auto !eol +dev/tests/verification/Resources/*.txt text eol=lf \ No newline at end of file diff --git a/bin/phpunit-checks.bat b/bin/phpunit-checks.bat new file mode 100644 index 000000000..de5cebdef --- /dev/null +++ b/bin/phpunit-checks.bat @@ -0,0 +1,10 @@ +:: Copyright © Magento, Inc. All rights reserved. +:: See COPYING.txt for license details. + +@echo ===============================UNIT TESTS=============================== +@echo off +call vendor\bin\phpunit --configuration dev\tests\phpunit.xml --testsuite unit --coverage-xml build\coverage-xml + +@echo off +@echo ===============================VERIFICATION TESTS=============================== +call vendor\bin\phpunit --configuration dev\tests\phpunit.xml --testsuite verification --coverage-xml build\coverage-xml \ No newline at end of file diff --git a/bin/static-checks.bat b/bin/static-checks.bat new file mode 100644 index 000000000..7614c7846 --- /dev/null +++ b/bin/static-checks.bat @@ -0,0 +1,20 @@ +:: Copyright © Magento, Inc. All rights reserved. +:: See COPYING.txt for license details. + +@echo off +@echo ===============================PHP CODE SNIFFER REPORT=============================== +call vendor\bin\phpcs .\src --standard=.\dev\tests\static\Magento +call vendor\bin\phpcs .\dev\tests\unit --standard=.\dev\tests\static\Magento +call vendor\bin\phpcs .\dev\tests\verification --standard=.\dev\tests\static\Magento --ignore=dev\tests\verification\_generated + +@echo ===============================COPY PASTE DETECTOR REPORT=============================== +call vendor\bin\phpcpd .\src + +:: Uncomment lines as part of MQE-590 +:: @echo "===============================PHP MESS DETECTOR REPORT=============================== +:: vendor\bin\phpmd .\src text \dev\tests\static\Magento\CodeMessDetector\ruleset.xml --exclude _generated + +@echo ===============================MAGENTO COPYRIGHT REPORT=============================== +echo msgbox "INFO:Copyright check currently not run as part of .bat implementation" > "%temp%\popup.vbs" +wscript.exe "%temp%\popup.vbs" +::bin\copyright-check \ No newline at end of file diff --git a/dev/tests/verification/Resources/TestSuiteGeneration1.txt b/dev/tests/verification/Resources/TestSuiteGeneration1.txt deleted file mode 100644 index 620dacd7e..000000000 --- a/dev/tests/verification/Resources/TestSuiteGeneration1.txt +++ /dev/null @@ -1,4 +0,0 @@ -dev/tests/verification/_generated/functionalSuite1/SampleSuite3Cest.php:IncludeTest -dev/tests/verification/_generated/functionalSuite1/SampleSuite5Cest.php:additionalTest -dev/tests/verification/_generated/functionalSuite1/SampleSuiteCest.php:IncludeTest -dev/tests/verification/_generated/functionalSuite1/SampleSuite4Cest.php:IncludeTest diff --git a/dev/tests/verification/Tests/SuiteGenerationTest.php b/dev/tests/verification/Tests/SuiteGenerationTest.php index 947069ad9..709d4da20 100644 --- a/dev/tests/verification/Tests/SuiteGenerationTest.php +++ b/dev/tests/verification/Tests/SuiteGenerationTest.php @@ -16,6 +16,13 @@ class SuiteGenerationTest extends TestCase const RESOURCES_DIR = TESTS_BP . DIRECTORY_SEPARATOR . 'verification' . DIRECTORY_SEPARATOR . 'Resources'; const CONFIG_YML_FILE = FW_BP . DIRECTORY_SEPARATOR . SuiteGenerator::YAML_CODECEPTION_CONFIG_FILENAME; + const MANIFEST_RESULTS = [ + 'SampleSuite3Cest.php:IncludeTest', + 'SampleSuite5Cest.php:additionalTest', + 'SampleSuiteCest.php:IncludeTest', + 'SampleSuite4Cest.php:IncludeTest' + ]; + private static $YML_EXISTS_FLAG = false; private static $TEST_GROUPS = []; @@ -45,18 +52,34 @@ public function testSuiteGeneration1() $yml = Yaml::parse(file_get_contents(self::CONFIG_YML_FILE)); $this->assertArrayHasKey($groupName, $yml['groups']); - // Validate test manifest contents - $actualManifest = TESTS_BP . + $suiteResultBaseDir = TESTS_BP . DIRECTORY_SEPARATOR . "verification" . DIRECTORY_SEPARATOR . "_generated" . DIRECTORY_SEPARATOR . $groupName . - DIRECTORY_SEPARATOR . - TestManifest::TEST_MANIFEST_FILENAME; - $expectedManifest = self::RESOURCES_DIR . DIRECTORY_SEPARATOR . "TestSuiteGeneration1.txt"; - $this->assertFileEquals($expectedManifest, $actualManifest, '', true, true); + DIRECTORY_SEPARATOR; + + // Validate test manifest contents + $actualManifest = $suiteResultBaseDir . TestManifest::TEST_MANIFEST_FILENAME; + $actualTestReferences = explode(PHP_EOL, file_get_contents($actualManifest)); + + for ($i = 0; $i < count($actualTestReferences); $i++) { + if (empty($actualTestReferences[$i])) { + continue; + } + + $this->assertStringEndsWith(self::MANIFEST_RESULTS[$i], $actualTestReferences[$i]); + $this->assertNotFalse(strpos($actualTestReferences[$i], $groupName)); + } + + // Validate expected php files exist + foreach (self::MANIFEST_RESULTS as $expectedTestReference) { + $cestName = explode(":", $expectedTestReference, 2); + $this->assertFileExists($suiteResultBaseDir . $cestName[0]); + } + } public static function tearDownAfterClass() From dddf351e0c6b101dab3525daa4ed12a48fec4b51 Mon Sep 17 00:00:00 2001 From: John Stennett Date: Thu, 7 Dec 2017 09:33:41 -0600 Subject: [PATCH 32/35] MQE-592: Test Case Audit - Adding a call to the "closeAdminNotification" function, because Admin notifications randomly appear after some tests due to Cache Management. --- .../FunctionalTestingFramework/Module/MagentoWebDriver.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index c7af3af0b..6967df30d 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -286,6 +286,7 @@ public function waitForPageLoad($timeout = 15) $this->waitForJS('return document.readyState == "complete"', $timeout); $this->waitForAjaxLoad($timeout); $this->waitForLoadingMaskToDisappear(); + $this->closeAdminNotification(); } /** From 8c36bcefee9e689f7d493536ef6442c6344dea37 Mon Sep 17 00:00:00 2001 From: John Stennett Date: Thu, 7 Dec 2017 10:52:59 -0600 Subject: [PATCH 33/35] MQE-592: Test Case Audit - Removing the PhantomJS yml file because the PhantomJS project is not maintained. --- etc/_envs/phantomjs.yml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 etc/_envs/phantomjs.yml diff --git a/etc/_envs/phantomjs.yml b/etc/_envs/phantomjs.yml deleted file mode 100644 index b26042a8c..000000000 --- a/etc/_envs/phantomjs.yml +++ /dev/null @@ -1,8 +0,0 @@ -# `phantomjs` environment config goes here -modules: - enabled: - - \Magento\FunctionalTestingFramework\Module\MagentoWebDriver - - \Magento\FunctionalTestingFramework\Helper\Acceptance - config: - \Magento\FunctionalTestingFramework\Module\MagentoWebDriver: - browser: 'phantomjs' \ No newline at end of file From c57f9e0312049efc382f6807f8bf2891dd7cd643 Mon Sep 17 00:00:00 2001 From: imeron2433 Date: Thu, 7 Dec 2017 21:39:39 +0200 Subject: [PATCH 34/35] MQE-592: Audit Test Cases on Firefox/Chrome on Windows/OSX - add changes for MagentoWebDriver wait and pageload timeout settings --- .../Module/MagentoWebDriver.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index 6967df30d..7c7f52667 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -17,6 +17,7 @@ use Codeception\Exception\ModuleException; use Codeception\Util\Uri; use Codeception\Util\ActionSequence; +use Magento\Setup\Exception; use Yandex\Allure\Adapter\Support\AttachmentSupport; /** @@ -270,9 +271,16 @@ public function searchAndMultiSelectOption($select, array $options, $requireActi * * @param int $timeout */ - public function waitForAjaxLoad($timeout = 15) + public function waitForAjaxLoad($timeout = null) { - $this->waitForJS('return !!window.jQuery && window.jQuery.active == 0;', $timeout); + $timeout = $timeout ?? $this->_getConfig()['pageload_timeout']; + + try { + $this->waitForJS('return !!window.jQuery && window.jQuery.active == 0;', $timeout); + } catch (\Exception $exceptione) { + $this->debug("js never executed, performing {$timeout} second wait."); + $this->wait($timeout); + } $this->wait(1); } @@ -281,8 +289,10 @@ public function waitForAjaxLoad($timeout = 15) * * @param int $timeout */ - public function waitForPageLoad($timeout = 15) + public function waitForPageLoad($timeout = null) { + $timeout = $timeout ?? $this->_getConfig()['pageload_timeout']; + $this->waitForJS('return document.readyState == "complete"', $timeout); $this->waitForAjaxLoad($timeout); $this->waitForLoadingMaskToDisappear(); @@ -350,7 +360,7 @@ public function parseFloat($floatString){ /** * @param int $category * @param string $locale - */ + */ public function mSetLocale(int $category, $locale) { if (self::$localeAll[$category] == $locale) { From 5d5e1db188316e5d0e3740ca380707b1a12a2544 Mon Sep 17 00:00:00 2001 From: Alex Kolesnyk Date: Fri, 8 Dec 2017 16:49:44 +0200 Subject: [PATCH 35/35] MQE-599: Move composer.json, README, etc from EE to CE --- composer.json | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 2d53f10fa..8f6a8dd86 100755 --- a/composer.json +++ b/composer.json @@ -1,16 +1,20 @@ { "name": "magento/magento2-functional-testing-framework", - "type": "library", "description": "Magento2 Functional Testing Framework", + "type": "library", + "version": "1.0.0", "license": "AGPL-3.0", "keywords": ["magento", "automation", "functional", "testing"], + "config": { + "sort-packages": true + }, "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", "codeception/codeception": "~2.3.4", + "epfremme/swagger-php": "^2.0", "flow/jsonpath": ">0.2", "fzaninotto/faker": "^1.6", - "mustache/mustache": "~2.5", - "epfremme/swagger-php": "^2.0" + "mustache/mustache": "~2.5" }, "require-dev": { "squizlabs/php_codesniffer": "1.5.3", @@ -22,12 +26,12 @@ }, "autoload": { "psr-4": { - "Magento\\FunctionalTestingFramework\\": ["src/Magento/FunctionalTestingFramework"] + "Magento\\FunctionalTestingFramework\\": "src/Magento/FunctionalTestingFramework" } }, "autoload-dev": { "psr-4": { - "tests\\unit\\Magento\\FunctionalTestingFramework\\": ["dev/tests/unit/Magento/FunctionalTestingFramework"] + "tests\\unit\\Magento\\FunctionalTestingFramework\\": "dev/tests/unit/Magento/FunctionalTestingFramework" } }, "extra": {