Using Code-based Actions
Overview
Some testing scenarios may require additional setup on the virtual machine before you’re able to test your application or website (e.g., changing the time zone or downloading files). You can use code-based actions to simplify these steps to a single executable action.
Code-based actions are only available on Windows virtual machines
How to add a code-based action
To add a code-based action to your test:
- Add a comment action step
- Enter the desired command in the comment section
All commands have a leading rf_vm_command:
, followed by the code-based action and its setting. (Starting with rf_vm_command:
is how we know it’s a code-based action and not a normal comment.)
Supported actions
The following commands are the only supported action types:
- Setting timezone:
rf_vm_command: set_timezone timezone="…"
e.grf_vm_command: set_timezone timezone="Eastern Standard Time"
- For example: Eastern Standard Time, Central Standard Time, Pacific Standard Time
- Time zones need to be supported by Microsoft and written out fully. For a list of supported time zones and formatting, please refer to the timezone column here.
- Setting region:
rf_vm_command: set_region region="…"
e.grf_vm_command: set_region region="United States"
- To see a full list go to settings > regions from within the virtual machine
- Downloading a File:
rf_vm_command: download url="…" destination="..." headers="{'Accept': '...', 'Authorization': '...'}"
- Only
url
is required for this action. Bothdestination
andheaders
don’t need to be passed. - If
destination
is not passed it defaults to theDownloads
folder. - The
headers
option is similar to HTTP headers and was only added for cases where the URL for downloading requires some authorization.
- Only
- Downloading and Opening a File:
rf_vm_command: download url="…" destination="..." headers="{'Accept': '...', 'Authorization': '...'}" open=true
- This action is the same as downloading a file, but the option
open
is set totrue
to allow opening the file automatically. - Both
destination
andheaders
don’t need to be passed.
- This action is the same as downloading a file, but the option
- Installing a Chrome extension:
rf_vm_command: install_chrome_extension url="…" headers="{'Accept': '...', 'Authorization': '...'}"
- This action downloads a zipped Chrome extension from a given URL (with optional headers).
- Note: This step will restart Chrome, which might affect the state of your existing tabs.
If you have any questions or suggestions for additional commands, reach out to us at [email protected].
Updated 10 days ago