- Custom Action
- Custom Validation
- Custom Wait-for
- Custom Condition
There are 2 types of parameters:
- HTML: Allows you to refer to HTML Elements in your app.
Custom Action example
In this example, we'll create a custom action that will click a button to demonstrate the use of the HTML parameter
- Go to https://www.testim.io/ in the browser and start a new test.
- Scroll the page down until the Twitter buttons appear.
- Go to Testim editor.
- Use ‘+’ menu ⇒ 'Add Custom Action'.
- In the properties click under 'Shared Step Name' and rename it from 'Untitled validation' to 'Click'.
Adding HTML param
- Click on the '+' icon to the left under Params and choose HTML:
2. Select the Twitter icon at the bottom of our website.
3. The icon is now added to the list of Params.
4. Double-click on the name and change it to "element".
The name of every parameter is just above it.
5. Now type under the function on the left:
6. Go back to the test and run it.
7. You can see that the element was clicked.
Note: in order do use Jquery in your custom validations and actions, your site needs to have Jquery installed.
Reuse and pass different parameters
We made a step in our test that clicks on the Twitter icon.
Next, let's reuse this step in another page and this time we will click on the LinkedIn button. Do we need to make another custom action? No!
- Use ‘+’ menu ⇒ choose 'Click'. This action is the action we created before.
- In the Params section click on the 'Assign now' and then 'HTML'.
- Choose the LinkedIn icon.
- Run the test and see that both buttons were clicked.
We will mainly use those when we want to forward values to a group or to other reusable steps.
You can find examples for using JS params here.