Smart triggers

Frontend Robot can be easily integrated with most build systems or CI/CD platform thanks to smart triggers. A Smart trigger is a URL that can be called from an external system to start the execution of a test suite.

Why are they called smart you may ask? That’s because they are able to detect the platform that is invoking the trigger and automatically extract some extra information to run the suite or integrate with other platforms. An example is the Netlify integration where the smart trigger can parse the Github commit hash passed by Netlify allowing Frontend Robot to attach the test results to the commit on Github.

Generating the smart trigger URL

To get the smart trigger for a test suite, navigate to that suite and then go to the Settings tab:

Go to the suite's Settings
Go to the suite's Settings

Scroll down to the Smart Trigger section and click Generate Smart Trigger URL:

Generating a smart trigger
Generating a smart trigger

The URL that will appear is the smart trigger for the test suite. You can also click on the cRUL tab to get a cURL command you can copy/paste in your build script to trigger the test suite run at the end of your deployments.

The smart trigger is ready
The smart trigger is ready

Passing variables through the smart trigger

Smart Triggers allow you to pass variables to the test suite, overriding or complementing any existing test suite variables.

To pass a set of variables, simply specify the variables query parameter or the variables request body property. In both cases the variables must be specified using a valid JSON array having the following structure:

[{
  "name": "variable_name",
  "value": "any valid JSON primitive"
}]

Example using the request body (variables passed is todo_text=Hello):

curl -d '{"variables": [{"name": "todo_text", "value": "Hello"}]}' -H "Content-Type: application/json" -X POST "https://api.frontendrobot.com/v1/webhooks/runSuite?t=xxxxxxxxxx"

Example using query parameters (variables passed is todo_text=Hello):

curl -X POST "https://api.frontendrobot.com/v1/webhooks/runSuite?t=xxxxxxxxxx&variables=%5B%7B%22name%22%3A%20%22todo_text%22%2C%20%22value%22%3A%20%22Hello%22%7D%5D"

Note: Remember to encode the JSON string when using query parameters to pass variables, as shown above.

Note: The variables specified in the query will be appended to the variables specified in the request body. This means that the variables in the query will override those in the body if they have the same name.

Questions?

We're always happy to help with test creation or other questions you might have! Search our documentation, contact support by email or on chat, or connect with our sales team.