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:

  1. Add a comment action step
  2. 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 timezonerf_vm_command: set_timezone timezone="…" e.g rf_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 regionrf_vm_command: set_region region="…" e.g rf_vm_command: set_region region="United States"
    • To see a full list go to settings > regions from within the virtual machine
  • Downloading a Filerf_vm_command: download url="…" destination="..." headers="{'Accept': '...', 'Authorization': '...'}"
    • Only url is required for this action. Both destination and headers don’t need to be passed.
    • If destination is not passed it defaults to the Downloads folder.
    • The headers option is similar to HTTP headers and was only added for cases where the URL for downloading requires some authorization.
  • Downloading and Opening a Filerf_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 to true to allow opening the file automatically.
    • Both destination and headers don’t need to be passed.
  • 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].