- 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.
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 ⇒ Actions tab ⇒ 'Add Custom Action'.
- In the properties click under 'Shared Step Name' and rename it from 'Untitled validation' to 'Click'.
- Press Confirm to create the custom step.
- Click on the '+' icon to the left next to Params and choose HTML:
- Select the Twitter icon at the bottom of our website.
- The icon is now added to the list of Params.
- Double-click on the name and change it to "element".
The name of every parameter is just above it.
- Now type under the function on the left:
- Go back to the test and run it.
- 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.
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 ⇒ Actions tab ⇒ 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.
Updated about a year ago