Autify Command Line Interface (CLI)
  • 09 Jun 2022
  • 7 Minutes to read
  • Contributors
  • Dark
    Light

Autify Command Line Interface (CLI)

  • Dark
    Light

Autify Command Line Interface (CLI) is a software application used to communicate with Autify services via text based command line. You can interact with Autify without opening a browser so that automated integrations such as CI/CD integration can easily be done by using Autify CLI.

This document explains about Autify CLI from the basics to a comprehensive list of commands as well as the future plan.

Getting started

Summary

Autify CLI brings you yet another way to interface with the Autify system instead of the browser UI. The text based command line interface enables you to easily automate integration with Autify.

To use Autify CLI, first you need to install the Autify CLI onto your platform. Then, you can login to the CLI using your personal access token for Autify and run advanced commands provided by Autify CLI such as "Run a test scenaio and wait until it finishes." Let's go through this process in the next few sections.

Install

You can install Autify CLI via Homebrew (Linux/macOS), shell installer (Linux/macOS) or native installer (macOS/Windows). You can also install from the tarball directly.

Note: We'll provide more installation methods in the near future. See Future plans.

Homebrew

For Linux and macOS platforms, you can use Homebrew to install autify-cli using our tap:

brew install autifyhq/tap/autify-cli

or

brew tap autifyhq/tap
brew install autify-cli

An example output:

$ brew install autifyhq/tap/autify-cli
==> Tapping autifyhq/tap
Cloning into '/usr/local/Homebrew/Library/Taps/autifyhq/homebrew-tap'...
remote: Enumerating objects: 19, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 19 (delta 1), reused 19 (delta 1), pack-reused 0
Receiving objects: 100% (19/19), done.
Resolving deltas: 100% (1/1), done.
Tapped 1 formula (16 files, 12.9KB).
==> Cloning https://github.com/autifyhq/autify-cli
Cloning into '/Users/runner/Library/Caches/Homebrew/autify-cli--git'...
==> Checking out revision b03bec6
HEAD is now at b03bec6 Release 0.2.0
==> Installing autify-cli from autifyhq/tap
==> curl https://autify-cli-assets.s3.amazonaws.com/autify-cli/versions/0.2.0/b03bec6/autify-v0.2.0-b03bec6-darwin-arm64.tar.gz | tar xz
🍺  /usr/local/Cellar/autify-cli/0.2.0: 10,082 files, 98.7MB, built in 29 seconds

Shell installer

For Linux and macOS platforms, you can use the shell installer via the command below:

curl https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/stable/install-standalone.sh | sh

An example output:

$ curl https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/stable/install-standalone.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2049  100  2049    0     0  10784      0 --:--:-- --:--:-- --:--:-- 10784
This script requires superuser access.
You will be prompted for your password by sudo.
Installing CLI from https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/stable/autify-linux-x64.tar.xz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 21.9M  100 21.9M    0     0  2157k      0  0:00:10  0:00:10 --:--:-- 2588k
v16.15.0
autify installed to /usr/local/bin/autify
autify-cli/0.1.0 linux-x64 node-v16.15.0

Native installer

For macOS and Windows, we provide native installers.

Note: They are not signed properly yet. Therefore, you'll get some warnings when installing. We'll sign them properly in the near future.

OS Architecture Package type Download Link Note
macOS Intel 64bit Installer stable Not properly signed yet.
macOS Arm 64bit Installer stable Not properly signed yet.
Windows Intel 64bit Installer stable Not properly signed yet.
Windows Intel 32bit Installer stable Not properly signed yet.

Tarball

We provide the tarballs below:

OS Architecture Package type Download Link Note
Linux Intel 64bit tar.gz stable
Linux Intel 64bit tar.xz stable
Linux Arm 32bit tar.gz stable
Linux Arm 32bit tar.xz stable
macOS Intel 64bit tar.gz stable
macOS Intel 64bit tar.xz stable
macOS Arm 64bit tar.gz stable
macOS Arm 64bit tar.xz stable
Windows Intel 64bit tar.gz stable
Windows Intel 64bit tar.xz stable
Windows Intel 32bit tar.gz stable
Windows Intel 32bit tar.xz stable

Here is an example command to download and extract a tar.gz file for Linux (Intel 64bit):

$ curl -O https://autify-cli-assets.s3.us-west-2.amazonaws.com/autify-cli/channels/stable/autify-linux-x64.tar.gz

$ tar -xzf ./autify-linux-x64.tar.gz

$ ./autify/bin/autify --version
autify-cli/0.1.0 linux-x64 node-v16.15.0

We recommend to link /path/to/autify/bin/autify to one of your PATH environment variables like below:

$ sudo ln -s /path/to/autify/bin/autify /usr/local/bin/autify

Note: /path/to/autify/bin includes a node executable. Therefore, if you add /path/to/autify/bin to your PATH environment variable, it might be prioritized over your existing node executable. That's the reason why we recommend to link only /path/to/autify/bin/autify and this is exactly what the shell installer does.

Usage

First, you need to generate a personal access token on Autify for Web. See this document about how to issue a personal access token.

Then, you can login to Autify CLI. Run the command below and enter your personal access token:

$ autify web auth login
? Enter Access Token **********

Now, let’s run a test scenario you have already created. Copy the URL of the test scenario you want to start (it will be something like https://app.autify.com/projects/000/scenarios/00000). Then, execute the command below:

autify web test run --wait <YOUR TEST SCENARIO URL>

An example output:

$ autify web test run --wait https://app.autify.com/projects/000/scenarios/00000
✅ Successfully started: https://app.autify.com/projects/000/results/000000 (Capability is Linux Chrome 101.0)
🕐 Waiting for the test result: https://app.autify.com/projects/000/results/000000
  ✔ Waiting... (timeout: 300 s)
✅ Test passed!: https://app.autify.com/projects/000/results/000000

$ echo $?
0

This command will execute the test scenario with the default capabilities (Linux/Chrome) and wait until it finishes up to the timeout (default 5 minutes). If the test passes, the command will exit with the exit code 0; otherwise, the exit code will be non-0. You can see the result as the output of $? above.

Update

Autify CLI uses the channel release for updating to avoid reinstalling everytime. By default, the stable channel is used and you can update your Autify CLI to the latest stable channel by running:

$ autify update
autify-cli: Updating CLI from 0.0.0-aaaaaa to 0.1.0-bbbbbb... done

Note: Homebrew users shouldn't use this command and should let Homebrew update instead. All stable releases will be shipped to our tap automatically, so this command should be sufficient to update to the latest version:

$ brew upgrade autify-cli

Note: There is a beta channel and release candidate channels for previewing the pre-release versions, but in most of the cases, the stable channel should be sufficient.

Configuration

The config file is stored at ~/.config/autify/config.env (macOS or Linux) / %LOCALAPPDATA%\autify\config.env (Windows) by default. You can override the configuration base directory via the XDG_CONFIG_HOME environment variable.

All configurations are formed as environment variables so that you can always override them at runtime by providing the same name of the environment variable such as AUTIFY_WEB_ACCESS_TOKEN=mytoken autify web test run ....

There are 4 configurations available:

AUTIFY_WEB_ACCESS_TOKEN

A personal access token to authenticate with Autify for Web.

AUTIFY_WEB_BASE_PATH

API base path to communicate with Autify for Web. Default is https://app.autify.com/api/v1.

AUTIFY_MOBILE_ACCESS_TOKEN

A personal access token to authenticate with Autify for Mobile.

AUTIFY_MOBILE_BASE_PATH

API base path to communicate with Autify for Mobile. Default is https://mobile-app.autify.com/api/v1.

Commands

Here is the list of commands. These commands are designed to be easy to use so that you don't need prior knowledge of our API specifications. They should cover most of the use cases and we’ll keep improving them by adding more commands/features. Feel free to request a new command for your specific use cases at GitHub Issues.

Autify for Web

autify web auth login

This command lets CLI login to Autify for Web interactively or non-interactivelly.

See GitHub for more details.

autify web test run

This command runs an existing test scenario or test plan with various options like capabilities or url replacements. It also supports the --wait option to wait until the test finishes.

See GitHub for more details.

autify web test wait

This command waits a test scenario or test plan that is already requested until it finishes. However, in most cases, you would use autify web test run --wait instead.

See GitHub for more details.

Autify for Mobile

autify mobile auth login

This command lets CLI login to Autify for Mobile interactively or non-interactively.

See GitHub for more details.

API commands

The commands under api namespace (autify web api and autify mobile api) are not listed here intentionally because they are auto-generated commands from our API specs. See GitHub if you're interested in them. When you see a great use case to combine multiple APIs by api commands, we're happy to implement that in the use case specific command like autify web test run so that anyone can use the same logic easily. Please share your ideas at GitHub Issues.

Integrations

By using Autify CLI, you can integrate other services with Autify easily. We're working hard to publish official integrations with some other services on top of Autify CLI. See Future plans as well.

Until then, we are providing the simple examples below to run and wait a test scenario via GitHub Actions and CircleCI. You can apply the same idea to your integrations as well.

GitHub Actions

Set AUTIFY_WEB_ACCESS_TOKEN secrets in the repository setting.

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - run: curl https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/stable/install-standalone.sh | sh
      - run: autify web test run -v --wait https://app.autify.com/projects/000/scenarios/00000
        env:
          AUTIFY_WEB_ACCESS_TOKEN: ${{ secrets.AUTIFY_WEB_ACCESS_TOKEN }}

CircleCI

Set AUTIFY_WEB_ACCESS_TOKEN environment variable in the project setting.

jobs:
  run-test-and-wait:
    docker:
      - image: cimg/base:stable
    steps:
      - run: curl https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/stable/install-standalone.sh | sh
      - run: autify web test run -v --wait https://app.autify.com/projects/000/scenarios/00000

workflows:
  autify-cli-example:
    jobs:
      - run-test-and-wait

Contribution

Autify CLI is open source software hosted at GitHub. We’re planning to provide guidance for code contribution soon.

Future plans

We are planning some improvements in the near future:

  • More installation methods
    • npm package
    • Signed installer for macOS/Windows
    • apt repository for Debian/Ubuntu
    • docker container image
  • Integrations powered by Autify CLI
    • GitHub Actions
    • CircleCI
    • AWS CodePipeline
    • Jenkins
    • Netlify
    • Vercel
    • AWS Amplify
    • etc.
  • More commands
    • autify mobile test run with uploading a build
    • Support Autify's new features
  • Contribution guide

First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.