In addition to writing Custom Validations and Actions scripts (which execute in the browser run-time environment), you can also create custom Node.js scripts that will be executed in your CLI environment.

These scripts will be executed from inside a test context just like a standard custom action and opens the gateway for some very advanced actions such as database validation and manipulation, image and PDF validations, and many more (see usage examples below).

Creating a CLI action

You can create a CLI action step just like you would create a normal Custom action and validation (see here for more details).

Running CLI action steps locally

When running locally (as opposed to running from the CLI) we need to provide the CLI action steps a Node.js environment in which to execute the code in. 

When you try to locally run a test which contains a CLI action step, you will be asked to provide this runtime environment. To do this, simple execute the following command from your shell:

npm i -g @testim/testim-cli && testim --agent

Adding node packages

Executing Node.js scripts from inside the context of a test is great, but the real power of CLI actions comes from the ability to add any node package directly from npm (or any other source) and have those packages scoped to the CLI action step during test execution.

We support all the standard methods for defining packages dependencies. Visit this page for more information about the various options and syntax.

Note : 

This is and advanced feature, to enable it please reach out via our chat or contact your CSM.

Did this answer your question?