Skip to content

Commit f11b3f5

Browse files
committed
MQE-2141: MFTF BIC Documentation
1 parent 545a266 commit f11b3f5

File tree

1 file changed

+151
-0
lines changed

1 file changed

+151
-0
lines changed

docs/backward-incompatible-changes.md

+151
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# MFTF 3.0.0 backward incompatible changes
2+
3+
This page highlights backward incompatible changes between releases that have a major impact and require detailed explanation and special instructions to ensure third-party tests continue working with Magento core tests.
4+
5+
## Version requirement changes
6+
7+
We changed the minimum PHP version requirement from 7.0 to 7.3. Because of the PHP version requirement change, this MFTF version supports only Magento 2.4 or later.
8+
9+
## Folder structure changes
10+
11+
We removed support to read test modules from deprecated path `dev/tests/acceptance/tests/functional/Magento/FunctionalTest`. If there are test modules in this path, they would need to be moved to `dev/tests/acceptance/tests/functional/Magento`.
12+
13+
## XSD schema changes
14+
15+
- Files under test modules `ActionGroup`, `Page`, `Section`, `Test` and `Suite` support only a single entity per file.
16+
17+
- `file` attribute from `<module>` has been removed from suite schema. `<module file=""/>` is no longer supported in suites.
18+
19+
- Metadata filename format changed to ***`*Meta.xml`***.
20+
21+
- Only nested assertion syntax will be supported. [See assertions page for details](./docs/test/assertions.md). Here is an example of a nested assertion syntax.
22+
```xml
23+
<assertEquals stepKey="assertAddressOrderPage">
24+
<actualResult type="const">$billingAddressOrderPage</actualResult>
25+
<expectedResult type="const">$shippingAddressOrderPage</expectedResult>
26+
</assertEquals>
27+
```
28+
### Upgrading tests to new schema
29+
30+
The following table lists the upgrade scripts that are available to upgrade tests to the new schema.
31+
32+
| Script name | Description |
33+
|-----------------------|-----------------------------------------------------------------------------------------------------------|
34+
|`splitMultipleEntitiesFiles`| Splits files that have multiple entities into multiple files with one entity per file. |
35+
|`upgradeAssertionSchema`| Updates assert actions that use old assertion syntax to new nested syntax.|
36+
|`renameMetadataFiles`| Renames Metadata filenames to `*Meta.xml`.|
37+
|`removeModuleFileInSuiteFiles`| Removes occurrences of `<module file=""/>` from all `<suite>`s.|
38+
|`removeUnusedArguments`| Removes unused arguments from action groups.|
39+
|`upgradeTestSchema`| Replaces relative schema paths to URN in test files.|
40+
41+
Here's how you can upgrade tests:
42+
43+
- Run `bin/mftf reset --hard` to remove old generated configurations.
44+
- Run `bin/mftf build:project` to generate new configurations.
45+
- Run `bin/mftf upgrade:tests`. [See command page for details](./docs/commands/mftf.md#upgradetests).
46+
- Lastly, try to generate all tests. Tests should all be generated as a result of the upgrades. If not, the most likely issue will be a changed XML schema. Check error messaging and search your codebase for the attributes listed.
47+
48+
## MFTF commands
49+
50+
`--debug` option `NONE` removed for strict schema validation. Ensure there are no schema validation errors in test modules before running MFTF commands.
51+
52+
## MFTF actions
53+
54+
###`executeInSelenium` and `performOn` removed
55+
56+
**Action**: Deprecated actions `executeInSelenium` and `performOn` are removed in favor of new action `helper`.
57+
58+
**Reason**: `executeInSelenium` and `performOn` allowed custom PHP code to be written inline inside of XML files which was difficult to maintain, troubleshoot, and modify.
59+
60+
**Details**: `helper` will allow test writers to solve advanced requirements beyond what MFTF offers out of the box.[See custom-helpers](./docs/custom-helpers.md) for more information on the usage.
61+
62+
Here's an example of using `helper` instead of `executeSelenium` to achieve same workflow.
63+
64+
Old usage:
65+
```xml
66+
<executeInSelenium function="function ($webdriver) use ($I) {
67+
$heading = $webdriver->findElement(\Facebook\WebDriver\WebDriverBy::xpath('//div[contains(@class, \'inline-wysiwyg\')]//h2'));
68+
$actions = new \Facebook\WebDriver\Interactions\WebDriverActions($webdriver);
69+
$actions->moveToElement($heading, {{TinyMCEPartialHeadingSelection.startX}}, {{TinyMCEPartialHeadingSelection.startY}})
70+
->clickAndHold()
71+
->moveToElement($heading, {{TinyMCEPartialHeadingSelection.endX}}, {{TinyMCEPartialHeadingSelection.endY}})
72+
->release()
73+
->perform();
74+
}" stepKey="selectHeadingTextInTinyMCE"/>
75+
```
76+
77+
New usage:
78+
```xml
79+
<helper class="\Magento\PageBuilder\Test\Mftf\Helper\SelectText" method="selectText" stepKey="selectHeadingTextInTinyMCE">
80+
<argument name="context">//div[contains(@class, 'inline-wysiwyg')]//h2</argument>
81+
<argument name="startX">{{TinyMCEPartialHeadingSelection.startX}}</argument>
82+
<argument name="startY">{{TinyMCEPartialHeadingSelection.startY}}</argument>
83+
<argument name="endX">{{TinyMCEPartialHeadingSelection.endX}}</argument>
84+
<argument name="endY">{{TinyMCEPartialHeadingSelection.endY}}</argument>
85+
</helper>
86+
```
87+
### `pauseExecution` removed
88+
89+
**Action**: `pauseExecution` is removed in favor of `pause`.
90+
91+
**Reason**: `[WebDriver]pauseExecution` is removed in Codeception 3 in favor of `I->pause()`.
92+
93+
**Description**: [See actions page for details](./docs/test/actions.md#pause). Here's a usage example.
94+
```xml
95+
<pause stepKey="pauseExecutionKey"/>
96+
```
97+
98+
### Removed assert actions
99+
100+
**Action**: Assert actions `assertInternalType`, `assertNotInternalType` and `assertArraySubset` are removed.
101+
102+
**Reason**: PHPUnit 9 has dropped support for these assertions.
103+
104+
### Updated assert actions
105+
106+
**Action**: `delta` attribute has been removed from `assertEquals` and `assertNotEquals`. Instead, below assert actions have been introduced:
107+
- `assertEqualsWithDelta`
108+
- `assertNotEqualsWithDelta`
109+
- `assertEqualsCanonicalizing`
110+
- `assertNotEqualsCanonicalizing`
111+
- `assertEqualsIgnoringCase`
112+
- `assertNotEqualsIgnoringCase`
113+
114+
**Reason**: PHPUnit 9 has dropped support for optional parameters for `assertEquals` and `assertNotEquals` and has introduced these new assertions.
115+
116+
**Description**: Usages of `assertEquals` or `assertNotEquals` with `delta` specified, should be replaced with appropriate assertion from above list.
117+
118+
### `assertContains` supports only iterable haystacks
119+
120+
**Action**: `assertContains` and `assertNotContains` now support only iterable haystacks. Below assert actions have been added to work with string haystacks:
121+
- `assertStringContainsString`
122+
- `assertStringNotContainsString`
123+
- `assertStringContainsStringIgnoringCase`
124+
- `assertStringNotContainsStringIgnoringCase`
125+
126+
**Reason**: With PHPUnit 9, `assertContains` and `assertNotContains` only allows iterable haystacks. New assertions have been introduced to support string haystacks.
127+
128+
**Description**: Usages of `assertContains` and `assertNotContains` with string haystacks should be replaced with appropriate assertion from above list.
129+
130+
Usage example for string haystacks:
131+
```xml
132+
<assertStringContainsString stepKey="assertDiscountOnPrice2">
133+
<actualResult type="const">$grabSimpleProdPrice2</actualResult>
134+
<expectedResult type="string">$110.70</expectedResult>
135+
</assertStringContainsString>
136+
```
137+
138+
### `formatMoney` removed
139+
140+
**Action**: `formatMoney` has been removed in favor of `formatCurrency`.
141+
142+
**Reason**: PHP 7.4 has deprecated use of `formatMoney`.
143+
144+
**Description**: Format input to specified currency according to the locale specified.
145+
146+
Usage example:
147+
```xml
148+
<formatCurrency userInput="1234.56789000" locale="de_DE" currency="USD" stepKey="usdInDE"/>
149+
```
150+
151+

0 commit comments

Comments
 (0)