Skip to content

Commit 76a4c58

Browse files
committed
Add files.
1 parent 537ffe8 commit 76a4c58

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

docs/merge_points/introduction.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Merge Points for testing extensions in MFTF
2+
3+
The Magento Functional Testing Framework (MFTF) allows great flexibility when writing XML tests for extensions.
4+
All parts of tests can be used, reused, and merged to best suit your needs and cut down on needless duplication.
5+
6+
Extension developers can utilitze these merge points to leverage existing tests and modify just the parts needed to test their extension. For instance, if your extension adds a form field to a Catalog admin page, you can modify the existing Catalog tests and add actions, data, etc as needed to test the custom field.
7+
This topic shows how to merge and reuse test elements when testing extensions.
8+
9+
Follow the links below for an example of how to merge:
10+
11+
- Action Groups
12+
- Data
13+
- Pages
14+
- Sections
15+
- Tests
16+
17+
and how to extend:
18+
19+
- Action Groups
20+
- Data
21+
- Tests
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Merging Action Groups
2+
3+
An action group is a set of individual actions working together as a group.
4+
These action groups can be shared between tests and they also be modified to your needs.
5+
6+
## Starting Test
7+
8+
```xml
9+
<actionGroup name="FillAdminSimpleProductForm">
10+
<arguments>
11+
<argument name="category"/>
12+
<argument name="simpleProduct"/>
13+
</arguments>
14+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
15+
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/>
16+
<click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/>
17+
<fillField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/>
18+
<fillField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/>
19+
<fillField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/>
20+
<fillField userInput="{{simpleProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/>
21+
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{category.name}}]" stepKey="searchAndSelectCategory"/>
22+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
23+
<fillField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/>
24+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/>
25+
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveMessageSuccess"/>
26+
<seeInField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="assertFieldName"/>
27+
<seeInField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="assertFieldSku"/>
28+
<seeInField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="assertFieldPrice"/>
29+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSectionAssert"/>
30+
<seeInField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="assertFieldUrlKey"/>
31+
</actionGroup>
32+
```
33+
34+
## File to merge
35+
36+
```xml
37+
<actionGroup name="FillAdminSimpleProductForm">
38+
<!-- This will be added after the step "fillQuantity" in the above test. -->
39+
<click selector="{{MyExtensionSection.myCheckbox}}" stepKey="clickMyCheckbox" after="fillQuantity"/>
40+
</actionGroup>
41+
```
42+
43+
## Resultant file
44+
45+
```xml
46+
<actionGroup name="FillAdminSimpleProductForm">
47+
<arguments>
48+
<argument name="category"/>
49+
<argument name="simpleProduct"/>
50+
</arguments>
51+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
52+
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/>
53+
<click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/>
54+
<fillField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/>
55+
<fillField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/>
56+
<fillField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/>
57+
<fillField userInput="{{simpleProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/>
58+
<!-- Merged line here -->
59+
<click selector="{{MyExtensionSection.myCheckbox}}" stepKey="clickMyCheckbox"/>
60+
61+
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{category.name}}]" stepKey="searchAndSelectCategory"/>
62+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
63+
<fillField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/>
64+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/>
65+
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveMessageSuccess"/>
66+
<seeInField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="assertFieldName"/>
67+
<seeInField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="assertFieldSku"/>
68+
<seeInField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="assertFieldPrice"/>
69+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSectionAssert"/>
70+
<seeInField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="assertFieldUrlKey"/>
71+
</actionGroup>
72+
```

0 commit comments

Comments
 (0)