Skip to main content

Running the CDK from the command line

The CDK can be run from the command line with optional parameters, which is useful for automated testing. To do this, you'll need to install a .zip build of the CDK (as opposed to the .dmg or .exe builds) and set it up as described below.

Setting up the CDK

  1. Download the CDK .zip for your platform from here: https://appshell.dev.salespreso.com/3.4.7/

    Or use one of these links:

  2. Extract the contents of the zip

  3. Get/have a node interpreter e.g. https://nodejs.org/

  4. Use the ci.js file in the directory to run the CDK (see below)

Using the ci.js file to run the CDK

The ci.js file can be used to easily run the CDK from the command line.

Running it with --help will show the usage of the file and its optional parameters:

CDK ci.js

USAGE
$ node ci.js --project=path/to/project.yaml

OPTIONS
--help show help
--project=projectPath path to project.yaml file
--quiet hide all cdk output

The benefits of using it include controlled output (through the --quiet parameter) and a valid exit code when the application closes.

Parameters

  • No parameters - the CDK opens normally, all logging is output to the terminal.
  • --help - The file information is shown in the terminal. The CDK is not opened.
  • --quiet - The CDK opens. No logging is output to the terminal unless the CDK closes with an error, in which case the error will be logged.
  • --project=projectPath - The CDK will open and will attempt to load the deck for the project file at the path provided. If the project file cannot be found or the deck cannot be loaded, the CDK will close again. An error message will be shown in the terminal and the process will end with a non-zero exit code.

Running the ci.js on different platforms

Linux & Mac:

To run the ci.js file on a Linux-based system:

  • run node ci.js
  • or make the file executable with chmod +x ci.js then run ./ci.js

Windows:

The easiest option may be to use PowerShell.

Take the path to your node executable and use & (the call operator) to run the node executable against the file, e.g.:

& "C:\Program Files\nodejs\node.exe" cdk-as-release-3.4.7-win64/ci.js

Running the CDK in headless mode

Setting up the CDK as described above will allow for continuous integration like automated testing.

This is one method to run the CDK in headless mode in a linux-based system:

  • Install xvfb
    apt install xvfb
  • Run ci.js with xvfb e.g.
    xvfb-run node ci.js --project=/path/to/deck/project.yaml
  • Once the CDK has loaded sucessfully with the provided deck path, the deck can be accessed in a browser.

The available modes are: