Skip to content

Commit 48b4b2e

Browse files
authored
Merge pull request #716 from magento/MQE-2141
MQE-2141: MFTF BIC Documentation
2 parents 64e7788 + 482d2b0 commit 48b4b2e

File tree

1 file changed

+163
-0
lines changed

1 file changed

+163
-0
lines changed

docs/backward-incompatible-changes.md

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

0 commit comments

Comments
 (0)