Skip to content

Commit ca23a75

Browse files
authored
Merge branch 'develop' into db_version_table
2 parents 645eb05 + 958e9c3 commit ca23a75

25 files changed

+222
-99
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
11
Magento Functional Testing Framework Changelog
22
================================================
33

4+
2.4.0
5+
-----
6+
### Enhancements
7+
* Maintainability
8+
* Added new `mftf static-checks` command to run new static checks against the attached test codebase
9+
* See DevDocs for details
10+
* Added new `mftf generate:docs` command that generates documentation about attached test codebase
11+
* See DevDocs for details
12+
* Traceability
13+
* Allure reports for tests now contain collapsible sections for `actionGroup`s used in execution.
14+
15+
### Fixes
16+
* Fixed an issue where `magentoCli` would treat `argument="0"` as a null value.
17+
* Fixed an issue where `amOnPage` and `waitForPwaElementVisible` would not utilize the `timeout` attribute correctly when MagentoPwaWebDriver is enabled.
18+
* Fixed an issue where invalid XML characters would cause Allure to throw an exception without a resulting report.
19+
* Fixed `codeception.dist.yml` configuration for keeping previous test run results.
20+
* PHP Notices are no longer thrown when XML is missing non-necessary attributes.
21+
* Removed unusable `fillSecretField` action from schema.
22+
23+
### GitHub Issues/Pull requests:
24+
* [#338](https://github.com/magento/magento2-functional-testing-framework/pull/338) -- Return exit codes of process started by 'run:test', 'run:group' or 'run:failed' command
25+
* [#333](https://github.com/magento/magento2-functional-testing-framework/pull/333) -- Added Nginx specific settings to getting started doc
26+
* [#332](https://github.com/magento/magento2-functional-testing-framework/pull/332) -- executeInSelenium action does not generate proper code
27+
* [#318](https://github.com/magento/magento2-functional-testing-framework/pull/318) -- Reduce cyclomatic complexity in Problem Methods
28+
* [#287](https://github.com/magento/magento2-functional-testing-framework/pull/287) -- Update requirements to include php7.3 support
29+
430
2.3.14
531
-----
632
### Enhancements

bin/mftf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ try {
2929
try {
3030
$application = new Symfony\Component\Console\Application();
3131
$application->setName('Magento Functional Testing Framework CLI');
32-
$application->setVersion('2.3.14');
32+
$application->setVersion('2.4.0');
3333
/** @var \Magento\FunctionalTestingFramework\Console\CommandListInterface $commandList */
3434
$commandList = new \Magento\FunctionalTestingFramework\Console\CommandList;
3535
foreach ($commandList->getCommands() as $command) {

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/magento2-functional-testing-framework",
33
"description": "Magento2 Functional Testing Framework",
44
"type": "library",
5-
"version": "2.3.14",
5+
"version": "2.4.0",
66
"license": "AGPL-3.0",
77
"keywords": ["magento", "automation", "functional", "testing"],
88
"config": {

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/tests/_bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
true,
3333
\Magento\FunctionalTestingFramework\Config\MftfApplicationConfig::UNIT_TEST_PHASE,
3434
true,
35-
false
35+
\Magento\FunctionalTestingFramework\Config\MftfApplicationConfig::LEVEL_NONE
3636
);
3737

3838
// Load needed framework env params

dev/tests/verification/Resources/BasicFunctionalTest.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ class BasicFunctionalTestCest
6060
{
6161
$I->comment("");
6262
$I->comment("");
63-
$I->skipReadinessCheck(true);
64-
$I->comment("skipReadiness");
65-
$I->skipReadinessCheck(false);
63+
$I->comment("seeComment");
6664
$someVarDefinition = $I->grabValueFrom();
6765
$I->acceptPopup();
6866
$I->amOnPage("/test/url");

dev/tests/verification/TestModule/ActionGroup/BasicActionGroup.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@
115115
<see selector=".selector" userInput="{{sameStepKeyAsArg}}" stepKey="arg1" />
116116
</actionGroup>
117117

118-
<actionGroup name="actionGroupWithSkipReadinessActions">
119-
<comment userInput="ActionGroupSkipReadiness" stepKey="skip" skipReadiness="true"/>
120-
</actionGroup>
121-
122118
<actionGroup name="actionGroupWithSectionAndData">
123119
<arguments>
124120
<argument name="content" type="string"/>

dev/tests/verification/TestModule/Test/BasicFunctionalTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</after>
2525
<comment stepKey="basicCommentWithNoData" userInput="{{emptyData.noData}}"/>
2626
<comment stepKey="basicCommentWithDefinitelyNoData" userInput="{{emptyData.definitelyNoData}}"/>
27-
<comment stepKey="ReadinessCheckSkipped" userInput="skipReadiness" skipReadiness="true"/>
27+
<comment stepKey="basicCommentWithData" userInput="seeComment"/>
2828
<grabValueFrom stepKey="someVarDefinition"/>
2929
<acceptPopup stepKey="acceptPopupKey1"/>
3030
<amOnPage stepKey="amOnPageKey1" url="/test/url"/>

dev/tests/verification/Tests/ActionGroupGenerationTest.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,6 @@ public function testActionGroupWithArgContainingStepKey()
185185
$this->generateAndCompareTest('ActionGroupContainsStepKeyInArgText');
186186
}
187187

188-
/**
189-
* Test an action group with an arg containing stepKey text
190-
*
191-
* @throws \Exception
192-
* @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
193-
*/
194-
public function testActionGroupWithSkipReadiness()
195-
{
196-
$this->generateAndCompareTest('ActionGroupSkipReadiness');
197-
}
198-
199188
/**
200189
* Test an action group with an arg containing stepKey text
201190
*

dev/tests/verification/Tests/SchemaValidationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class SchemaValidationTest extends MftfTestCase
1919
*/
2020
public function testInvalidTestSchema()
2121
{
22-
AspectMock::double(MftfApplicationConfig::class, ['debugEnabled' => true]);
22+
AspectMock::double(MftfApplicationConfig::class, ['getDebugLevel' => MftfApplicationConfig::LEVEL_DEVELOPER]);
2323
$testFile = ['testFile.xml' => "<tests><test name='testName'><annotations>a</annotations></test></tests>"];
2424
$expectedError = TESTS_MODULE_PATH .
2525
DIRECTORY_SEPARATOR .

docs/commands/mftf.md

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ This command cleans up the previously generated tests; generates and runs the te
6868
For more details about `failed`, refer to [Reporting][].
6969

7070
### Generate documentation for action groups
71+
7172
```bash
7273
vendor/bin/mftf generate:docs
7374
```
@@ -115,14 +116,14 @@ vendor/bin/mftf generate:tests [option] [<test name>] [<test name>] [--remove]
115116

116117
#### Options
117118

118-
| Option | Description |
119-
| --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
120-
| `--config=[<default>|<singleRun>|<parallel>]` | Creates a single manifest file with a list of all tests. The default location is `tests/functional/Magento/FunctionalTest/_generated/testManifest.txt`.<br/> 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, ...`.</br> Available values: `default` (default), `singleRun`(same as `default`), and `parallel`.</br> Example: `generate:tests --config=parallel`. |
121-
| `--force` | Forces test generation, regardless of the module merge order defined in the Magento instance. Example: `generate:tests --force`. |
122-
| `-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` |
123-
| `--tests` | Defines the test configuration as a JSON string. |
124-
| `--debug` | Returns additional debug information (such as the filename where an error occurred) when test generation fails because of an invalid XML schema. This parameter takes extra processing time. Use it after test generation has failed once. |
125-
| `-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. |
119+
| Option | Description|
120+
| ---| --- |
121+
| `--config=[<default> or <singleRun> or <parallel>]` | Creates a single manifest file with a list of all tests. The default location is `tests/functional/Magento/FunctionalTest/_generated/testManifest.txt`.<br/> 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, ...`.</br> Available values: `default` (default), `singleRun`(same as `default`), and `parallel`.</br> Example: `generate:tests --config=parallel`. |
122+
| `--force` | Forces test generation, regardless of the module merge order defined in the Magento instance. Example: `generate:tests --force`. |
123+
| `-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`|
124+
| `--tests` | Defines the test configuration as a JSON string.|
125+
| `--debug` | Returns additional debug information (such as the filename where an error occurred) when test generation fails because of an invalid XML schema. This parameter takes extra processing time. Use it after test generation has failed once. |
126+
| `-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.|
126127

127128
#### Examples of the JSON configuration
128129

@@ -131,7 +132,7 @@ The configuration to generate a single test with no suites:
131132
```json
132133
{
133134
"tests":[
134-
"general_test1" //Generate the "general_test1" test.
135+
"general_test1" //Generate the "general_test1" test.
135136
],
136137
"suites": null
137138
}
@@ -141,10 +142,10 @@ The configuration to generate a single test in the suite:
141142

142143
```json
143144
{
144-
"tests": null, // No tests outside the suite configuration will be generated.
145+
"tests": null, // No tests outside the suite configuration will be generated.
145146
"suites":{
146-
"sample":[ // The suite that contains the test.
147-
"suite_test1" // The test to be generated.
147+
"sample":[ // The suite that contains the test.
148+
"suite_test1" // The test to be generated.
148149
]
149150
}
150151
}
@@ -159,11 +160,11 @@ Complex configuration to generate a few non-suite tests, a single test in a suit
159160
"general_test2",
160161
"general_test3"
161162
],
162-
"suites":{ //Go to suites.
163-
"sample":[ //Go to the "sample" suite.
164-
"suite_test1" //Generate the "suite_test1" test.
163+
"suites":{ //Go to suites.
164+
"sample":[ //Go to the "sample" suite.
165+
"suite_test1" //Generate the "suite_test1" test.
165166
],
166-
"sample2":[] //Generate all tests in the "sample2" suite.
167+
"sample2":[] //Generate all tests in the "sample2" suite.
167168
}
168169
}
169170
```
@@ -190,8 +191,8 @@ vendor/bin/mftf generate:suite <suite name> [<suite name>] [--remove]
190191

191192
#### Options
192193

193-
| Option | Description |
194-
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
194+
| Option | Description |
195+
| --- | --- |
195196
| `-r,--remove` | Removes the existing generated suites and tests cleaning up the `_generated` directory before the actual run. For example, `vendor/bin/mftf generate:suite WYSIWYG --remove` cleans up the entire `_generated` directory and generates `WYSIWYG` only. |
196197

197198
#### Example
@@ -253,7 +254,6 @@ vendor/bin/mftf generate:docs [--clean] [--output=/path/to/alternate/dir]
253254
vendor/bin/mftf generate:docs --clean
254255
```
255256

256-
257257
### `reset`
258258

259259
#### Description
@@ -389,6 +389,20 @@ vendor/bin/mftf setup:env
389389

390390
The example parameters are taken from the `etc/config/.env.example` file.
391391

392+
### `static:checks`
393+
394+
Runs all MFTF static:checks on the test codebase that MFTF is currently attached to.
395+
396+
#### Existing static checks
397+
398+
* Test Dependency: Checks that test dependencies do not violate Magento module's composer dependencies.
399+
400+
#### Usage
401+
402+
```bash
403+
vendor/bin/mftf static:checks
404+
```
405+
392406
### `upgrade:tests`
393407

394408
Applies all the MFTF major version upgrade scripts to test components in the given path (`test.xml`, `data.xml`, etc).

docs/tips-tricks.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,27 @@ Use numbers within `stepKeys` when order is important, such as with testing sort
283283

284284
## Selectors
285285

286+
### Use contains() around text()
287+
288+
When possible, use `contains(text(), 'someTextHere')` rather than `text()='someTextHere'`.
289+
`contains()` ignores whitespace while `text()` accounts for it.
290+
291+
**Why?**
292+
If you are comparing text within a selector and have an unexpected space, or a blank line above or below the string, `text()` will fail while the `contains(text())` format will catch it.
293+
In this scenario `text()` is more exacting. Use it when you need to be very precise about what is getting compared.
294+
295+
<span style="color:green">
296+
GOOD:
297+
</span>
298+
299+
`//span[contains(text(), 'SomeTextHere')]`
300+
301+
<span style="color:red">
302+
BAD:
303+
</span>
304+
305+
`//span[text()='SomeTextHere']`
306+
286307
### Build selectors in proper order
287308

288309
When building selectors for form elements, start with the parent context of the form element.
@@ -353,6 +374,31 @@ BAD:
353374

354375
## General tips
355376

377+
### Use data references to avoid hardcoded values
378+
379+
If you need to run a command such as `<magentoCLI command="config:set" />`, do not hardcode paths and values to the command.
380+
Rather, create an appropriate `ConfigData.xml` file, which contains the required parameters for running the command.
381+
It will simplify the future maintanence of tests.
382+
383+
<span style="color:green">
384+
GOOD:
385+
</span>
386+
387+
```xml
388+
<magentoCLI command="config:set {{StorefrontCustomerCaptchaLength3ConfigData.path}} {{StorefrontCustomerCaptchaLength3ConfigData.value}}" stepKey="setCaptchaLength" />
389+
```
390+
391+
<span style="color:red">
392+
BAD:
393+
</span>
394+
395+
```xml
396+
<magentoCLI command="config:set customer/captcha/length 3" stepKey="setCaptchaLength" />
397+
```
398+
399+
For example:
400+
[This test][] refers to this [Data file][].
401+
356402
### Use descriptive variable names
357403

358404
Use descriptive variable names to increase readability.
@@ -398,3 +444,7 @@ BAD:
398444
```
399445

400446
<!--{% endraw %}-->
447+
448+
<!-- Link Definitions -->
449+
[This test]: https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Captcha/Test/Mftf/Test/StorefrontCaptchaRegisterNewCustomerTest.xml#L24
450+
[Data file]: https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Captcha/Test/Mftf/Data/CaptchaConfigData.xml

etc/config/codeception.dist.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extensions:
1616
- Magento\FunctionalTestingFramework\Allure\Adapter\MagentoAllureAdapter
1717
config:
1818
Magento\FunctionalTestingFramework\Allure\Adapter\MagentoAllureAdapter:
19-
deletePreviousResults: true
19+
deletePreviousResults: false
2020
outputDirectory: allure-results
2121
ignoredAnnotations:
2222
- env

0 commit comments

Comments
 (0)