diff --git a/CHANGELOG.md b/CHANGELOG.md index 54189d745..c8c4ca9b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,51 @@ Magento Functional Testing Framework Changelog ================================================ +2.5.4 +----- +[Demo Video](https://www.youtube.com/watch?v=tguvkw1HWKg) +* Traceability + * Introduced new `mftf doctor` command + * Command verifies and troubleshoots some configuration steps required for running tests + * Please see DevDocs for more details + * `<*Data>` actions now contain `API Endpoint` and `Request Header` artifacts. + * Introduced new `.env` configurations `ENABLE_BROWSER_LOG` and `BROWSER_LOG_BLACKLIST` + * Configuration enables allure artifacts for browser log entries if they are present after the step. + * Blacklist filters out logs from specific sources. +* Customizability + * Introduced `timeout=""` to `magentoCLI` actions. + +### GitHub Issues/Pull requests: +* [#317](https://github.com/magento/magento2-functional-testing-framework/pull/317) -- RetrieveEntityField generation does not consider ActionGroup as part of namespace +* [#433](https://github.com/magento/magento2-functional-testing-framework/pull/433) -- Add possibility to include multiple non primitive types in an array + +### Fixes +* A test now contains attachments for every exception encountered in the test (fix for a test `` exception overriding all test exceptions). +* Fixed hard requirement for `MAGENTO_BASE_URL` to contain a leading `/`. +* `magentoCLI` actions for `config:sensitive:set` no longer obscure CLI output. +* `WAIT_TIMEOUT` in the `.env` now correctly sets `pageload_timeout` configuration. +* Fixed an issue where `run:group` could not consolidate a `group` that had tests in and out of ``s. + +2.5.3 +----- + +### Fixes +* Fixed an issue where `createData` actions would cause an exception when used in `` hooks. + +2.5.2 +----- + +* Traceability + * Allure report enhanced to display file path of tests. +* Maintainability + * Added support to read MFTF test entities from `dev/tests/acceptance/tests/functional///*` + * Removed path deprecation warning from `ModuleResolver`. + * Refactored problem methods to reduce cyclomatic complexity. + +### Fixes +* Fixed issue with builds due to absence of AcceptanceTester class. + +### GitHub Issues/Pull requests: +* [#348](https://github.com/magento/magento2-functional-testing-framework/pull/348) -- executeInSelenium command fixed to prevent escaping double quotes. 2.5.1 ----- diff --git a/bin/mftf b/bin/mftf index b978d99ee..7a9ca1cf2 100755 --- a/bin/mftf +++ b/bin/mftf @@ -27,9 +27,11 @@ try { try { + $version = json_decode(file_get_contents(FW_BP . DIRECTORY_SEPARATOR . 'composer.json'), true); + $version = $version['version']; $application = new Symfony\Component\Console\Application(); $application->setName('Magento Functional Testing Framework CLI'); - $application->setVersion('2.5.1'); + $application->setVersion($version); /** @var \Magento\FunctionalTestingFramework\Console\CommandListInterface $commandList */ $commandList = new \Magento\FunctionalTestingFramework\Console\CommandList; foreach ($commandList->getCommands() as $command) { diff --git a/composer.json b/composer.json index 3e3b0ab42..158287fbf 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "magento/magento2-functional-testing-framework", "description": "Magento2 Functional Testing Framework", "type": "library", - "version": "2.5.1", + "version": "2.5.4", "license": "AGPL-3.0", "keywords": ["magento", "automation", "functional", "testing"], "config": { @@ -13,7 +13,7 @@ "ext-curl": "*", "allure-framework/allure-codeception": "~1.3.0", "codeception/codeception": "~2.4.5", - "composer/composer": "^1.6", + "composer/composer": "^1.4", "consolidation/robo": "^1.0.0", "csharpru/vault-php": "~3.5.3", "csharpru/vault-php-guzzle6-transport": "^2.0", diff --git a/composer.lock b/composer.lock index 5c2ba8c2d..8f2fcb8e9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1b0ef9b803188c23577751eba2a3d966", + "content-hash": "59e95cc1ae6311e93111bd7ced180d29", "packages": [ { "name": "allure-framework/allure-codeception", @@ -486,16 +486,16 @@ }, { "name": "composer/composer", - "version": "1.9.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "314aa57fdcfc942065996f59fb73a8b3f74f3fa5" + "reference": "bb01f2180df87ce7992b8331a68904f80439dd2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/314aa57fdcfc942065996f59fb73a8b3f74f3fa5", - "reference": "314aa57fdcfc942065996f59fb73a8b3f74f3fa5", + "url": "https://api.github.com/repos/composer/composer/zipball/bb01f2180df87ce7992b8331a68904f80439dd2f", + "reference": "bb01f2180df87ce7992b8331a68904f80439dd2f", "shasum": "" }, "require": { @@ -562,7 +562,7 @@ "dependency", "package" ], - "time": "2019-08-02T18:55:33+00:00" + "time": "2019-11-01T16:20:17+00:00" }, { "name": "composer/semver", @@ -1101,6 +1101,7 @@ ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", "homepage": "https://github.com/container-interop/container-interop", + "abandoned": "psr/container", "time": "2017-02-14T19:40:03+00:00" }, { @@ -2203,23 +2204,23 @@ }, { "name": "justinrainbow/json-schema", - "version": "5.2.8", + "version": "5.2.9", "source": { "type": "git", "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4" + "reference": "44c6787311242a979fa15c704327c20e7221a0e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/dcb6e1006bb5fd1e392b4daa68932880f37550d4", - "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/44c6787311242a979fa15c704327c20e7221a0e4", + "reference": "44c6787311242a979fa15c704327c20e7221a0e4", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2.2.20", + "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", "json-schema/json-schema-test-suite": "1.2.0", "phpunit/phpunit": "^4.8.35" }, @@ -2265,7 +2266,7 @@ "json", "schema" ], - "time": "2019-01-14T23:55:14+00:00" + "time": "2019-09-25T14:49:45+00:00" }, { "name": "league/container", diff --git a/docs/commands/mftf.md b/docs/commands/mftf.md index a71b8a02c..2440428f9 100644 --- a/docs/commands/mftf.md +++ b/docs/commands/mftf.md @@ -39,7 +39,7 @@ vendor/bin/mftf generate:tests ### Generate tests by test name ```bash -vendor/bin/mftf generate:tests LoginAsAdminTest LoginAsCustomerTest +vendor/bin/mftf generate:tests AdminLoginTest StorefrontPersistedCustomerLoginTest ``` ### Generate and run the tests for a specified group @@ -53,7 +53,7 @@ This command cleans up the previously generated tests; generates and runs tests ### Generate and run particular tests ```bash -vendor/bin/mftf run:test LoginAsAdminTest LoginAsCustomerTest -r +vendor/bin/mftf run:test AdminLoginTest StorefrontPersistedCustomerLoginTest -r ``` This command cleans up the previously generated tests; generates and runs the `LoginAsAdminTest` and `LoginAsCustomerTest` tests. @@ -144,12 +144,12 @@ vendor/bin/mftf generate:tests [option] [] [] [--remove] | Option | Description| | ---| --- | -| `--config=[ or or ]` | Creates a single manifest file with a list of all tests. The default location is `tests/functional/Magento/FunctionalTest/_generated/testManifest.txt`.
You can split the list into multiple groups using `--config=parallel`; the groups will be generated in `_generated/groups/` like `_generated/groups/group1.txt, group2.txt, ...`.
Available values: `default` (default), `singleRun`(same as `default`), and `parallel`.
Example: `generate:tests --config=parallel`. | +| `--config=[ or or ]` | Creates a single manifest file with a list of all tests. The default location is `tests/functional/Magento/FunctionalTest/_generated/testManifest.txt`.
You can split the list into multiple groups using `--config=parallel`; the groups will be generated in `_generated/groups/` like `_generated/groups/group1.txt, group2.txt, ...`.
Available values: `default` (default), `singleRun`(same as `default`), and `parallel`.
Example: `generate:tests --config=parallel`. | | `--force` | Forces test generation, regardless of the module merge order defined in the Magento instance. Example: `generate:tests --force`. | | `-i,--time` | Set time in minutes to determine the group size when `--config=parallel` is used. The __default value__ is `10`. Example: `generate:tests --config=parallel --time=15`| | `--tests` | Defines the test configuration as a JSON string.| | `--allow-skipped` | Allows MFTF to generate and run tests marked with `.`| -| `--debug or --debug=[]`| Performs schema validations on XML files.
DEFAULT: `generate:tests` implicitly performs schema validation on merged files. It does not indicate the file name where the error is encountered.
DEVELOPER: `--debug` performs per-file validation and returns additional debug information (such as the filename where an error occurred) when test generation fails because of an invalid XML schema. This option takes extra processing time. Use it after test generation has failed once.

NONE: `--debug=none` skips debugging during test generation. Added for backward compatibility, it will be removed in the next MAJOR release.
| +| `--debug or --debug=[]`| Performs schema validations on XML files.
DEFAULT: `generate:tests` implicitly performs schema validation on merged files. It does not indicate the file name where the error is encountered.
DEVELOPER: `--debug` performs per-file validation and returns additional debug information (such as the filename where an error occurred) when test generation fails because of an invalid XML schema. This option takes extra processing time. Use it after test generation has failed once.
NONE: `--debug=none` skips debugging during test generation. Added for backward compatibility, it will be removed in the next MAJOR release.
| | `-r,--remove`| Removes the existing generated suites and tests cleaning up the `_generated` directory before the actual run. For example, `generate:tests SampleTest --remove` cleans up the entire `_generated` directory and generates `SampleTest` only.| #### Examples of the JSON configuration @@ -447,9 +447,9 @@ vendor/bin/mftf setup:env The example parameters are taken from the `etc/config/.env.example` file. -### `static:checks` +### `static-checks` -Runs all MFTF static:checks on the test codebase that MFTF is currently attached to. +Runs all MFTF static-checks on the test codebase that MFTF is currently attached to. #### Existing static checks @@ -458,7 +458,7 @@ Runs all MFTF static:checks on the test codebase that MFTF is currently attached #### Usage ```bash -vendor/bin/mftf static:checks +vendor/bin/mftf static-checks ``` ### `upgrade:tests` diff --git a/docs/getting-started.md b/docs/getting-started.md index 8f024b90d..a6706769d 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -2,8 +2,8 @@
[Find your MFTF version][] of the MFTF. -The latest Magento 2.3 release supports MFTF 2.3.13. -The latest Magento 2.2 release supports MFTF 2.3.8. +The latest Magento 2.3.x release supports MFTF 2.4.5. +The latest Magento 2.2.x release supports MFTF 2.4.5.
## Prepare environment {#prepare-environment} @@ -97,6 +97,10 @@ bin/magento config:set admin/security/admin_account_sharing 1 bin/magento config:set admin/security/use_form_key 0 ``` +### Webserver configuration {#web-server-configuration} + +The MFTF does not support executing CLI commands if your web server points to `/pub` directory as recommended in the [Installation Guide][Installation Guide docroot]. For the MFTF to execute the CLI commands, the web server must point to the Magento root directory. + ### Nginx settings {#nginx-settings} If Nginx Web server is used on your development environment then **Use Web Server Rewrites** setting in **Stores** > Settings > **Configuration** > **Web** > **Search Engine Optimization** must be set to **Yes**. @@ -340,3 +344,4 @@ allure serve dev/tests/_output/allure-results/ [Set up a standalone MFTF]: #set-up-a-standalone-mftf [test suite]: suite.html [Find your MFTF version]: introduction.html#find-your-mftf-version +[Installation Guide docroot]: https://devdocs.magento.com/guides/v2.3/install-gde/tutorials/change-docroot-to-pub.html diff --git a/docs/guides/git-vs-composer-install.md b/docs/guides/git-vs-composer-install.md new file mode 100644 index 000000000..3a45e3a68 --- /dev/null +++ b/docs/guides/git-vs-composer-install.md @@ -0,0 +1,80 @@ +# Git vs Composer installation of Magento with MFTF + +Depending on how you plan to use Magnto code, there are different options for installing Magento. + +## GitHub Installation + +If you are contributing a pull request to the Magento 2 codebase, download Magento 2 from our GitHub repository. Contribution to the codebase is done using the 'fork and pull' model where contributors maintain their own fork of the repo. This repo is then used to submit a pull request to the base repo. + +Install guide: [GitHub Installation][] + +## Composer based Installation + +A Composer install downloads released packages of Magento 2 from the composer repo [https://repo.magento.com](https://repo.magento.com). + +All Magento modules and their MFTF tests are put under `` directory, for convenience of 3rd party developers. With this setup, you can keep your custom modules separate from core modules. You can also develop modules in a separate VCS repository and add them to your `composer.json` which installs them into the `vendor` directory. + +Install guide: [Composer based Installation][] + +## MFTF Installation + +After installing your Magento project in either of the above ways, the composer dependency `magento/magento2-functional-testing-framework` downloads and installs MFTF. MFTF is embedded in your Magento 2 installation and will cover your project with functional tests. + +If you want to contribute a pull request into MFTF codebase, you will need to install MFTF in the [Standalone][] mode. + +## Managing modules - Composer vs GitHub + +### Via GitHub + +Cloning the Magento 2 git repository is a way of installing where you do not have to worry about matching your codebase with production. Your version control system generally holds and manages your `app/code` folder and you can do manual, ad-hoc development here. + +### Via Composer + +Magento advocates the use of composer for managing modules. When you install a module through composer, it is added to `vendor//`. + +When developing your own module or adding MFTF tests to a module, you should not edit in `vendor` because a composer update could overwrite your changes. Instead, overwrite a module under `vendor` by adding files or cloning your module-specific Git repo to `app/code//`. + +To distribute the module and its tests, you can initialize a git repo and create a [composer package][]. In this way others will be able to download and install your module and access your tests as a composer package, in their `` folder. + +## MFTF test materials location + +- For GitHub installations, MFTF test materials are located in `/app/code///Test/Mftf/`. This is the directory for new tests or to maintain existing ones. +- For Composer-based installations, MFTF test materials are located at `/vendor///Test/Mftf/`. This is the directory to run tests fetched by Composer. + +The file structure under both paths is the same: + +```tree + +├── ActionGroup +│   └── ... +├── Data +│   └── ... +├── Metadata +│   └── ... +├── Page +│   └── ... +├── Section +│   └── ... +└── Test + └── ... +``` + +## How ModuleResolver reads modules + +With either type of installation, all tests and test data are read and merged by MFTF's ModuleResolver in this order: + +1. `/app/code///Test/Mftf/` +1. `/vendor///Test/Mftf/` + +## Conclusion + +There is no difference between having the test materials in `app/code` or in `/vendor`: it works the same. Composer-based installs may benefit teams when there is a need to match file systems in `development` and `production`. + +If you are a contributing developer with an understanding of Git and Composer commands, you can choose the GitHub installation method instead. + + + +[Composer based Installation]: https://devdocs.magento.com/guides/v2.3/install-gde/composer.html +[GitHub Installation]: https://devdocs.magento.com/guides/v2.3/install-gde/prereq/dev_install.html +[Standalone]: ../getting-started.html#set-up-a-standalone-mftf +[composer package]: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/package/package_module.html diff --git a/docs/merge_points/extend-data.md b/docs/merge_points/extend-data.md index 344d11935..ebac16108 100644 --- a/docs/merge_points/extend-data.md +++ b/docs/merge_points/extend-data.md @@ -1,8 +1,8 @@ # Extend data entities -Extending an action group doesn't affect the existing action group. +Extending a data entity does not affect the existing data entity. -In this example we add a `` command to check the checkbox that our extension added with a new action group for the simple product creation form. +In this example we update the quantity to 1001 and add a new piece of data relevant to our extension. Unlike merging, this will _not_ affect any other tests that use this data entity. ## Starting entity @@ -67,4 +67,4 @@ Note that there are now two data entities below. CustomAttributeCategoryIds dataHere -``` \ No newline at end of file +``` diff --git a/docs/merge_points/extend-tests.md b/docs/merge_points/extend-tests.md index 7398e273d..6aab50764 100644 --- a/docs/merge_points/extend-tests.md +++ b/docs/merge_points/extend-tests.md @@ -1,6 +1,6 @@ # Extend tests -Data objects can be merged to cover the needs of your extension. +Tests can be extended to cover the needs of your extension. In this example, we add an action group to a new copy of the original test for our extension. @@ -142,4 +142,4 @@ Note that there are now two tests below.
-``` \ No newline at end of file +``` diff --git a/docs/suite.md b/docs/suite.md index 3d737ece5..38e54926f 100644 --- a/docs/suite.md +++ b/docs/suite.md @@ -1,7 +1,7 @@ # Suites -Suites are essentially groups of tests that run in the specific conditions (preconditions and postconditions). -They enable you including, excluding, and grouping tests for a customized test run when you need it. +Suites are essentially groups of tests that run in specific conditions (preconditions and postconditions). +They enable including, excluding, and grouping tests for a customized test run. You can form suites using separate tests, groups, and modules. Each suite must be defined in the `//Test/Mftf/Suite` directory. @@ -19,7 +19,6 @@ The format of a suite: ```xml - @@ -43,12 +42,14 @@ The format of a suite: ## Principles - A suite name: - - must not match any existing group value. + + - must not match any existing group value. For example, the suite `` will fail during test run if any test contains in annotations ``. - - must not be `default` or `skip`. Tests that are not in any suite are generated under the `default` suite. - The suite name `skip` is synonymous to including a test in the ``, which will be deprecated in MFTF 3.0.0. - - can contain letters, numbers, and underscores. - - should be upper camel case. + - must not be `default` or `skip`. Tests that are not in any suite are generated under the `default` suite. + The suite name `skip` is synonymous to including a test in the ``, which will be deprecated in MFTF 3.0.0. + - can contain letters, numbers, and underscores. + - should be upper camel case. + - A suite must contain at least one ``, or one ``, or both. - Using `` in a suite, you must add the corresponding `` to restore the initial state of your testing instance. @@ -133,7 +134,7 @@ It performs the following steps: *After* the testing, the suite returns the Magento instance to the initial state disabling WYSIWYG: 1. Log back in. -2. Disable **WYSIWYG** so that +2. Disable **WYSIWYG** in the Magento instance. This suite includes all tests that contain the `` annotation. @@ -242,11 +243,11 @@ The element can contain [``], [``], and [``]. A set of filters that you can use to specify which tests to exclude in the test suite. -There two types of behavior: +There are two types of behavior: 1. Applying filters to the included tests when the suite contains [``] filters. The MFTF will exclude tests from the previously included set and generate the remaining tests in the suite. -2. Applying filter to all tests when the suite does not contain [``] filters. +2. Applying filters to all tests when the suite does not contain [``] filters. The MFTF will generate all existing tests except the excluded. In this case, the custom suite will contain all generated tests except excluded, and the _default_ suite will contain the excluded tests only. diff --git a/etc/config/.env.example b/etc/config/.env.example index e290c7815..7320d8b8b 100644 --- a/etc/config/.env.example +++ b/etc/config/.env.example @@ -5,7 +5,7 @@ MAGENTO_BASE_URL=http://devdocs.magento.com/ #*** Uncomment if you are running Admin Panel on separate domain (used with MAGENTO_BACKEND_NAME) ***# -# MAGENTO_BACKEND_BASE_HOST=http://admin.example.com/ +# MAGENTO_BACKEND_BASE_URL=http://admin.example.com/ #*** Set the Admin Username and Password for your Magento instance ***# MAGENTO_BACKEND_NAME=admin diff --git a/src/Magento/FunctionalTestingFramework/Allure/AllureHelper.php b/src/Magento/FunctionalTestingFramework/Allure/AllureHelper.php index e1d871781..58bbc55b8 100644 --- a/src/Magento/FunctionalTestingFramework/Allure/AllureHelper.php +++ b/src/Magento/FunctionalTestingFramework/Allure/AllureHelper.php @@ -35,6 +35,11 @@ public static function addAttachmentToLastStep($data, $caption) $rootStep = Allure::lifecycle()->getStepStorage()->getLast(); $trueLastStep = array_last($rootStep->getSteps()); + if ($trueLastStep == null) { + // Nothing to attach to; do not fire off allure event + return; + } + $attachmentEvent = new AddUniqueAttachmentEvent($data, $caption); $attachmentEvent->process($trueLastStep); } diff --git a/src/Magento/FunctionalTestingFramework/Console/DoctorCommand.php b/src/Magento/FunctionalTestingFramework/Console/DoctorCommand.php index 4bd05b836..6fc9afa55 100644 --- a/src/Magento/FunctionalTestingFramework/Console/DoctorCommand.php +++ b/src/Magento/FunctionalTestingFramework/Console/DoctorCommand.php @@ -8,6 +8,7 @@ namespace Magento\FunctionalTestingFramework\Console; use Codeception\Configuration; +use Magento\FunctionalTestingFramework\Util\Path\UrlFormatter; use Symfony\Component\EventDispatcher\EventDispatcher; use Codeception\SuiteManager; use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig; @@ -128,9 +129,14 @@ private function checkAuthenticationToMagentoAdmin() $this->ioStyle->success('Successful'); $result = true; } catch (TestFrameworkException $e) { + if (getenv('MAGENTO_BACKEND_BASE_URL')) { + $urlVar = 'MAGENTO_BACKEND_BASE_URL'; + } else { + $urlVar = 'MAGENTO_BASE_URL'; + } $this->ioStyle->error( - $e->getMessage() - . "\nPlease verify MAGENTO_ADMIN_USERNAME and MAGENTO_ADMIN_PASSWORD in .env." + $e->getMessage() . "\nPlease verify if " . $urlVar . ", " + . "MAGENTO_ADMIN_USERNAME and MAGENTO_ADMIN_PASSWORD in .env are valid." ); } return $result; diff --git a/src/Magento/FunctionalTestingFramework/Extension/TestContextExtension.php b/src/Magento/FunctionalTestingFramework/Extension/TestContextExtension.php index 07153040c..c50156f08 100644 --- a/src/Magento/FunctionalTestingFramework/Extension/TestContextExtension.php +++ b/src/Magento/FunctionalTestingFramework/Extension/TestContextExtension.php @@ -182,7 +182,7 @@ public function beforeStep(\Codeception\Event\StepEvent $e) public function afterStep(\Codeception\Event\StepEvent $e) { $browserLog = $this->getDriver()->webDriver->manage()->getLog("browser"); - if (getenv('ENABLE_BROWSER_LOG')) { + if (getenv('ENABLE_BROWSER_LOG') === 'true') { foreach (explode(',', getenv('BROWSER_LOG_BLACKLIST')) as $source) { $browserLog = BrowserLogUtil::filterLogsOfType($browserLog, $source); } diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriverDoctor.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriverDoctor.php index 98eb8bd4f..1407c957b 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriverDoctor.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriverDoctor.php @@ -15,7 +15,7 @@ */ class MagentoWebDriverDoctor extends MagentoWebDriver { - const MAGENTO_CLI_COMMAND = 'list'; + const MAGENTO_CLI_COMMAND = 'info:currency:list'; const EXCEPTION_CONTEXT_SELENIUM = 'selenium'; const EXCEPTION_CONTEXT_ADMIN = 'admin'; const EXCEPTION_CONTEXT_STOREFRONT = 'store'; @@ -150,18 +150,19 @@ private function loadPageAtUrl($url) private function runMagentoCLI() { try { - $regex = '~^.*(?Magento CLI).*[\r\n]+(?Usage:).*~'; + $regex = '~^.*[\r\n]+.*(?Currency).*(?Code).*~'; $output = parent::magentoCLI(self::MAGENTO_CLI_COMMAND); preg_match($regex, $output, $matches); - if (isset($matches['name']) && isset($matches['usage'])) { + if (isset($matches['name']) && isset($matches['code'])) { return; } } catch (\Exception $e) { - throw new TestFrameworkException( - "Failed to run Magento CLI command\n" - . "Please reference Magento DevDoc to setup command.php and .htaccess files." - ); } + + throw new TestFrameworkException( + "Failed to run Magento CLI command\n" + . "Please reference Magento DevDoc to setup command.php and .htaccess files." + ); } } diff --git a/src/Magento/FunctionalTestingFramework/StaticCheck/TestDependencyCheck.php b/src/Magento/FunctionalTestingFramework/StaticCheck/TestDependencyCheck.php index 6cfa4e9a8..19725dc18 100644 --- a/src/Magento/FunctionalTestingFramework/StaticCheck/TestDependencyCheck.php +++ b/src/Magento/FunctionalTestingFramework/StaticCheck/TestDependencyCheck.php @@ -66,7 +66,7 @@ class TestDependencyCheck implements StaticCheckInterface * Array containing all errors found after running the execute() function. * @var array */ - private $errors; + private $errors = []; /** * String representing the output summary found after running the execute() function.