Skip to content

Commit d392d54

Browse files
committed
MQE-2034: Document Custom Helper functionality
1 parent f53bd53 commit d392d54

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

docs/custom-helpers.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Custom Helpers
22

3-
Custom Helpers allow test writers to write custom test actions to solve for their advanced requirements beyond what MFTF offers out of the box.
3+
Custom Helpers allow test writers to write custom test actions to solve for advanced requirements beyond what MFTF offers out of the box.
44

55
In MFTF version 3.0.0, we removed the following test actions:
66

@@ -20,9 +20,9 @@ Custom Helpers are implemented in PHP files that must be placed in this director
2020

2121
Let's take a look at one. This Custom Helper selects text on the page by this approach:
2222

23-
1. Move to a very specific X,Y starting value
23+
1. Move to a very specific X,Y starting position
2424
2. Click and hold the mouse button down
25-
3. Move to another specific X,Y value
25+
3. Move to another specific X,Y position
2626
4. Release the mouse button
2727

2828
This functionality is used to select text on the page and cannot be accomplished using built-in test actions.
@@ -75,13 +75,13 @@ class SelectText extends Helper
7575
}
7676
```
7777

78-
### Important Notes About The PHP File
78+
### Notes About The PHP File
7979

8080
The following details are important about the file above:
8181
1. The `namespace` must match the file location like `namespace Magento\PageBuilder\Test\Mftf\Helper;`
8282
2. The class must `extends Helper` and have the corresponding `use` statement to match
8383
3. You can get access to the WebDriver object via `$this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver')`
84-
4. You can implement multiple methods in the same class.
84+
4. You can implement multiple related methods in the same class.
8585

8686
You should follow the same patterns in any Custom Helpers that you write yourself. But you can implement any logic or iteration that you need to solve for your use case.
8787

@@ -99,7 +99,7 @@ Once you have implemented something like the above PHP file. You can then refere
9999
</helper>
100100
```
101101

102-
### Important Notes About The XML
102+
### Notes About The XML
103103

104104
1. Specify an argument value for every argument that matches our PHP implementation. This allows us to pass other test data to the Custom Helper.
105105
2. The `class` attribute matches the namespace we specified in the PHP file
@@ -110,6 +110,12 @@ Once you have implemented something like the above PHP file. You can then refere
110110

111111
Custom Helpers allow you to solve for complex use cases such as conditional logic, iteration, or complex WebDriver usage.
112112

113+
With access to the WebDriver object, you have a lot of flexibility available to you. See the [Codeception WebDriver](https://github.com/Codeception/module-webdriver/blob/master/src/Codeception/Module/WebDriver.php) for technical details and functionality available for use.
114+
113115
A Custom Helper is written in a PHP file and then referenced in test XML like other actions.
114116

115117
Due to complexity, you should only use these as a last resort after trying to implement your test using built-in actions.
118+
119+
## References
120+
121+
[Codeception WebDriver source code](https://github.com/Codeception/module-webdriver/blob/master/src/Codeception/Module/WebDriver.php) - Reference for using the WebDriver Object

0 commit comments

Comments
 (0)