Skip to content

Commit 5024162

Browse files
authored
Merge branch 'develop' into MQE-1224
2 parents 4155652 + ee5d3f7 commit 5024162

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+14231
-135
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# CODEOWNERS file for /docs/ folder.
2+
# Forces a review from other writers for anything within /docs/.
3+
/docs/ @magento/devdocs-admins

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Label| Description
160160
[create issue]: https://help.github.com/articles/creating-an-issue/
161161
[create pr]: https://help.github.com/articles/creating-a-pull-request/
162162
[Definition of Done]: https://devdocs.magento.com/guides/v2.2/contributor-guide/contributing_dod.html
163-
[devdocs]: https://github.com/magento/devdocs/blob/master/.github/CONTRIBUTING.md
163+
[devdocs]: https://github.com/magento/devdocs/blob/master/.github/CONTRIBUTING.html
164164
[existing issues]: https://github.com/magento/magento2-functional-testing-framework/issues?q=is%3Aopen+is%3Aissue
165165
[existing PRs]: https://github.com/magento/magento2-functional-testing-framework/pulls?q=is%3Aopen+is%3Apr
166166
[GitHub documentation]: https://help.github.com/articles/syncing-a-fork

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ php:
33
- 7.0
44
- 7.1
55
- 7.2
6+
- 7.3
67
install: composer install --no-interaction --prefer-source
78
env:
89
matrix:

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
## Installation
88

9-
For the installation guidelines and system requirements, refer to [Getting Started](https://devdocs.magento.com/mftf/2.3/getting-started.html).
9+
For the installation guidelines and system requirements, refer to [Getting Started][].
1010

1111
## Contributing
1212

1313
We would appreciate your contributions to new components or new features, changes to the existing features, tests, documentation, specifications, bug fixes, optimizations, or just good suggestions.
1414
Report about an issue or request features opening a GitHub issue.
15-
Learn more about contributing in our [Contribution Guidelines](.github/CONTRIBUTING.md).
15+
Learn more about contributing in our [Contribution Guidelines][].
1616

17-
If you want to participate in the documentation work, see [DevDocs Contributing](https://github.com/magento/devdocs/blob/master/.github/CONTRIBUTING.md).
17+
If you want to participate in the documentation work, see [DevDocs Contributing][].
1818

1919
### Labels applied by the MFTF team
2020

@@ -55,15 +55,26 @@ These labels are applied by the MFTF development team to community contributed i
5555

5656
## Reporting security issues
5757

58-
To report security vulnerabilities and other security issues in the Magento software or web sites, send an email with the report at [[email protected]](mailto:[email protected]).
58+
To report security vulnerabilities and other security issues in the Magento software or web sites, send an email with the report at [[email protected]][].
5959
Do not report security issues using GitHub.
60-
Be sure to encrypt your e-mail with our [encryption key](https://info2.magento.com/rs/magentoenterprise/images/security_at_magento.asc) if it includes sensitive information.
61-
Learn more about reporting security issues [here](https://magento.com/security/reporting-magento-security-issue).
60+
Be sure to encrypt your e-mail with our [encryption key][] if it includes sensitive information.
61+
Learn more about reporting security issues [here][].
6262

63-
Stay up-to-date on the latest security news and patches for Magento by signing up for [Security Alert Notifications](https://magento.com/security/sign-up).
63+
Stay up-to-date on the latest security news and patches for Magento by signing up for [Security Alert Notifications][].
6464

6565
## License
6666

6767
Each Magento source file included in this distribution is licensed under AGPL 3.0.
6868

69-
See the license [here](LICENSE_AGPL3.txt) or contact [[email protected]](mailto:[email protected]) for a copy.
69+
See the license [here][] or contact [[email protected]][] for a copy.
70+
71+
<!-- Link Definitions -->
72+
[Getting Started]: docs/getting-started.md
73+
[Contribution Guidelines]: .github/CONTRIBUTING.html
74+
[DevDocs Contributing]: https://github.com/magento/devdocs/blob/master/.github/CONTRIBUTING.md
75+
76+
[encryption key]: https://info2.magento.com/rs/magentoenterprise/images/security_at_magento.asc
77+
[here]: https://magento.com/security/reporting-magento-security-issue
78+
[Security Alert Notifications]: https://magento.com/security/sign-up
79+
[here]: LICENSE_AGPL3.txt
80+

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"sort-packages": true
1010
},
1111
"require": {
12-
"php": "7.0.2|7.0.4|~7.0.6|~7.1.0|~7.2.0",
12+
"php": "7.0.2||7.0.4||~7.0.6||~7.1.0||~7.2.0||~7.3.0",
1313
"allure-framework/allure-codeception": "~1.3.0",
1414
"ext-curl": "*",
1515
"codeception/codeception": "~2.3.4 || ~2.4.0 ",
@@ -25,7 +25,7 @@
2525
"require-dev": {
2626
"squizlabs/php_codesniffer": "~3.2",
2727
"sebastian/phpcpd": "~3.0 || ~4.0",
28-
"brainmaestro/composer-git-hooks": "^2.3",
28+
"brainmaestro/composer-git-hooks": "^2.3.1",
2929
"doctrine/cache": "<1.7.0",
3030
"codeception/aspect-mock": "^3.0",
3131
"goaop/framework": "2.2.0",

composer.lock

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/best-practices.md

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# Best practices
2+
3+
Check out our best practices below to ensure you are getting the absolute most out of the Magento Functional Testing Framework.
4+
5+
## Action group
6+
7+
1. [Action group] names should be sufficiently descriptive to inform a test writer of what the action group does and when it should be used.
8+
Add additional explanation in comments if needed.
9+
2. Provide default values for the arguments that apply to your most common case scenarios.
10+
11+
## `actionGroups` vs `extends`
12+
13+
Use an action group to wraps a set of actions to reuse them multiple times.
14+
15+
Use an [extension] when a test or action group needs to be repeated with the exception of a few steps.
16+
17+
### When to use `extends`
18+
19+
Use `extends` in your new test or action group when at least one of the following conditions is applicable to your case:
20+
21+
1. You want to keep the original test without any modifications.
22+
2. You want to create a new test that follows the same path as the original test.
23+
3. You want a new action group that behaves similarly to the existing action group, but you do not want to change the functionality of the original action group.
24+
25+
### When to avoid `extends`
26+
27+
Do not use `extends` in the following conditions:
28+
29+
1. You want to change the functionality of the test or action group and do not need to run the original version.
30+
2. You plan to merge the base test or action group.
31+
32+
The following pattern is used when merging with `extends`:
33+
34+
1. The original test is merged.
35+
2. The extended test is created from the merged original test.
36+
3. The extended test is merged.
37+
38+
## Annotation
39+
40+
1. Use [annotations] in a test.
41+
2. Update your annotations correspondingly when updating tests.
42+
43+
## Data entity
44+
45+
1. Keep your testing instance clean.
46+
Remove data after the test if the test required creating any data.
47+
Use a corresponding [`<deleteData>`] test step in your [`<after>`] block when using a [`<createData>`] action in a [`<before>`] block.
48+
2. Make specific data entries under test to be unique.
49+
Enable data uniqueness where data values are required to be unique in a database by test design.
50+
Use `unique=”suffix”` or `unique=”prefix”` to append or prepend a unique value to the [entity] attribute.
51+
This ensures that tests using the entity can be repeated.
52+
3. Do not modify existing data entity fields or merge additional data fields without complete understanding and verifying the usage of existing data in tests.
53+
Create a new data entity for your test if you are not sure.
54+
55+
## Naming conventions
56+
57+
### File names
58+
59+
Name files according to the following patterns to make searching in future more easy:
60+
61+
#### Test file name
62+
63+
Format: {_Admin_ or _Storefront_}{Functionality}_Test.xml_, where Functionality briefly describes the testing functionality.
64+
65+
Example: _StorefrontCreateCustomerTest.xml_.
66+
67+
#### Section file name
68+
69+
Format: {_Admin_ or _Storefront_}{UI Description}_Section.xml_, where UI Description briefly describes the testing UI.
70+
71+
Example: _AdminNavbarSection.xml_.
72+
73+
#### Data file name
74+
75+
Format: {Type}_Data.xml_, where Type represents the entity type.
76+
77+
Example: _ProductData.xml_.
78+
79+
### Object names
80+
81+
Use the _Foo.camelCase_ naming convention, which is similar to _Classes_ and _classProperties_ in PHP.
82+
83+
#### Upper case
84+
85+
Use an upper case first letter for:
86+
87+
- File names. Example: _StorefrontCreateCustomerTest.xml_
88+
- Test name attributes. Example: `<test name="TestAllTheThingsTest">`.
89+
- Data entity names. Example: `<entity name="OutOfStockProduct">`.
90+
- Page name. Example: `<page name="AdminLoginPage">`.
91+
- Section name. Example: `<section name="AdminCategorySidebarActionSection">`.
92+
- Action group name. Example: `<actionGroup name="LoginToAdminActionGroup">`.
93+
94+
#### Lower case
95+
96+
Use a lower case first letter for:
97+
98+
- Data keys. Example: `<data key="firstName">`.
99+
- Element names. Examples: `<element name="confirmDeleteButton"/>`.
100+
101+
## Page object
102+
103+
Use [parameterized selectors] for constructing a selector when test specific or runtime generated information is needed.
104+
Do not use them for static elements.
105+
106+
<span class="color:red">
107+
BAD:
108+
</span>
109+
110+
<!-- {% raw %} -->
111+
112+
``` xml
113+
<element name="relatedProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='{{productType}}']" parameterized="true"/>
114+
```
115+
116+
<!-- {% endraw %} -->
117+
118+
<span class="color:green">
119+
GOOD:
120+
</span>
121+
122+
Define these three elements and reference them by name in the tests.
123+
124+
``` xml
125+
<element name="relatedProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='related']"/>
126+
<element name="upSellProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='upsell']"/>
127+
<element name="crossSellProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='crosssell']"/>
128+
```
129+
130+
## Test
131+
132+
1. Use actions such as [`<waitForElementVisible>`], [`<waitForLoadingMaskToDisappear>`], and [`<waitForElement>`] to wait the exact time required for the test step.
133+
Try to avoid using the [`<wait>`] action, because it forces the test to wait for the time you specify. You may not need to wait so long to proceed.
134+
1. Keep your tests short and granular for target testing, easier reviews, and easier merge conflict resolution.
135+
It also helps you to identify the cause of test failure.
136+
1. Use comments to keep tests readable and maintainable:
137+
- Keep the inline `<!-- XML comments -->` and [`<comment>`] tags up to date.
138+
It helps to inform the reader of what you are testing and to yield a more descriptive Allure report.
139+
- Explain in comments unclear or tricky test steps.
140+
1. Refer to [sections] instead of writing selectors.
141+
142+
## Test step merging order
143+
144+
When setting a [merging] order for a test step, do not depend on steps from Magento modules that could be disabled by an application.
145+
146+
For example, when you write a test step to create a gift card product, set your test step **after** simple product creation and let the MFTF handle the merge order.
147+
Since the configurable product module could be disabled, this approach is more reliable than setting the test step **before** creating a configurable product.
148+
149+
<!-- Link definitions -->
150+
151+
[`<after>`]: test/actions.html#before-and-after
152+
[`<before>`]: test/actions.html#before-and-after
153+
[`<comment>`]: test/actions.html#comment
154+
[`<createData>`]: test/actions.html#createdata
155+
[`<deleteData>`]: test/actions.html#deletedata
156+
[`<wait>`]: test/actions.html#wait
157+
[`<waitForElement>`]: test/actions.html#waitforelement
158+
[`<waitForElementVisible>`]: test/actions.html#waitforelementvisible
159+
[`<waitForLoadingMaskToDisappear>`]: test/actions.html#waitforloadingmasktodisappear
160+
[Action group]: test/action-groups.html
161+
[annotations]: test/annotations.html
162+
[entity]: data.html
163+
[extension]: extending.html
164+
[merging]: merging.html
165+
[parameterized selectors]: section/parameterized-selectors.html
166+
[sections]: section.html

0 commit comments

Comments
 (0)