@mablhq/mabl-cli
The official mabl command line interface tool
Last updated 4 days ago by mikebart .
SEE LICENSE IN LICENSE.txt · Original npm · Tarball · package.json
$ cnpm install @mablhq/mabl-cli 
SYNC missed versions from official npm registry.

mabl helps you improve the speed and quality of your release pipeline. Now you can test every release, at scale, on a single platform, with no infrastructure to manage.

mabl CLI

Description

The mabl CLI allows users to work with mabl from the command line to manage their tests.

Note: The mabl CLI is still in early development

Supported Features

  • Deployments triggered from your local machine or inside your CI/CD container
  • Export and download all screenshots for a test run to as a zip file
  • list and describe mabl resources (i.e. workspaces, applications, etc.)
  • Create, Edit, and Run mabl tests locally
  • Export tests to Selenium IDE
  • List and Describe mabl entities (i.e. branches, applications, workspaces, environments, tests, etc.)
  • More coming soon!

Help Documentation

mabl CLI Help Documentation

Installation

Note: Node 10+ is required to run the mabl CLI

Stable version:

npm i -g @mablhq/mabl-cli

To upgrade to the latest stable version:

npm i -g @mablhq/mabl-cli@latest

Usage

Authenticate

User Authentication

mabl auth login

Authenticate in the launched browser window

Machine User Authentication

Machine users can add the --api-key <key> flag, and supply the API key from the mabl app Settings > APIs page. Alternatively, you can authenticate with an API key by running:

mabl auth activate-key <MABL_API_KEY>

This key will be used in subsequent commands.

Deployments

All mabl deployment commands can be found under the mabl deployments commands.

Create a new mabl deployment

mabl deployments create --environment-id <environment-id> --application-id <application-id>

Use --await-completion to block until all tests complete.

Note: the CLI will return non-zero exit codes on test failure.

mabl deployments create --environment-id <environment-id> --application-id <application-id> --await-completion

Add --fast-failure to trigger CLI return after the first plan in your test suite fails. This allows you to fail build quickly, rather than waiting for all tests to complete. This is advantageous in CD pipelines, to start rolling pack a deployment immediately.

Note: when using the fast failure option, any incomplete tests will continue to run, event after the CLI returns.

Extra headers can be added to test browser requests using the --http-headers flag, followed by the SPACE delimited headers.

mabl deployments create --environment-id <environment-id> --application-id <application-id> --http-headers "x-foo:bar" "x-no-captcha:true"

JSON output can be returned using the --output json flag. Note, when using this flag, no console output will be generated until the operation has completed, similar to if --silent had been passed. If execution results are available and the deployment is successfully created, results will be returned in the payload consistent with the Execution Results API.

mabl deployments create --environment-id <environment-id> --application-id <application-id> --output json

List mabl deployments

To see a list of mabl deployments for a workspace:

mabl deployments list --workspace-id <workspace-id>

Describe a mabl deployment

To see details for a specific mabl deployment:

mabl deployments describe <deployment-id>

Working with mabl tests

Creating a mabl test

The mabl tests create command allows for creating a new mabl training session directly from the CLI. Upon running this command you will be presented with a fresh Chrome window, a preconfigured mabl Trainer extension, and the familiar 'OK train me' button.

To create a mabl test:

mabl tests create <url> '<test-name>' '<test-description>'

Use the:

  • --mabl-branch flag to specify a mabl branch to create the test for.
  • --auto-branch flag to automatically create the specified branch if it doesn't exist already
  • --width and --height flags to specify the viewport sizes of the browser
  • --desc flag to supply a test description
  • -w or --workspace-id flag to specify the workspace to use, Defaults to the configured workspace or user default

Editing a mabl test

The mabl tests edit command allows for editing a mabl test directly from the CLI. Upon running this command you will be presented with a fresh Chrome window, a preconfigured mabl Trainer extension, and the familiar 'OK edit test' button.

To edit a mabl test:

mabl tests edit --id <test-id>

or use a test run id to edit a test with the same config (environment, credentials, etc.) as a cloud run.

mabl tests edit --run-id <test-run-id>

Use the:

  • --mabl-branch flag to specify a mabl branch to edit the test for.
  • -e, or --environment-id flag to specify the mabl environment to edit the test under. Specifying the environment allows mabl to use the appropriate environment variables and learned find information when editing the test
  • --auto-branch flag to automatically create the specified branch if it doesn't exist already
  • --width and --height flags to specify the viewport sizes of the browser
  • --creds or --credentials flag to specify a testing credential set to use during edit (mabl credentials list to see available ones)

Note: required IDs can be found by using the CLI list commands or on the test details or test output pages inside the mabl web app

Running a mabl test locally

The mabl tests run command allows for running mabl tests locally in a fresh Chrome browser window.

mabl tests run --id <test-id>

or use a test run id to run a test with the same config (environment, credentials, etc.) as a cloud run

mabl tests run --run-id <test-run-id>

Note: required IDs can be found by using the CLI list commands or on the test details or test output pages inside the mabl web app

Use the:

  • -e, or --environment-id flag to specify the mabl environment to run the test under. Specifying the environment allows mabl to use the appropriate environment variables and learned find information when running the test
  • -u or --url flag to specify a particular URL to run the test against
  • --mabl-branch flag to specify a mabl branch to run the test under.
  • --creds or --credentials flag to specify a testing credential set to use during the local run (mabl credentials list to see available ones)

[ALPHA] Running a mabl test locally in Headless mode

The mabl tests run-alpha command allows for running mabl tests in our new, faster, local test runner which has support for headless mode. When running in headless mode the test will execute in the background without launching a visible Chrome window.

The new alpha run command supports all the same arguments as the mabl tests run command listed above with the addition of a new headless flag and labels support.

  • --headless when supplied the test will run in headless mode. Flag should be supplied with no argument.
  • --labels run tests that match any label.
  • --exclude-labels exclude tests that match any label.

Example:

mabl tests run-alpha --run-id <test-run-id> --headless

List mabl tests

The mabl tests list command allows for listing all mabl tests in a workspace.

mabl tests list

Use the -l or --limit flag to specify the number of tests to list

Exporting mabl tests

The mabl tests export command allows users to export tests into various formats: ["json", "yaml", "csv", "side"]. Using the "json", "yaml", and "csv" options will export a tests step descriptions, annotations, and notes in the specified format.

mabl tests export --format <[json, yaml, csv, side]>

Use the --mabl-branch to specify the exporting of a mabl branch

Export to Selenium IDE

Using the side format with the mabl tests export command will export the test into a Selenium IDE compatible format and can then be imported into the Selenium IDE extension. Please see the mabl help docs for more information.

Export mabl Data

Export all screenshots for a test run by supplying the test run id from the mabl webapp View Output URL.

e.g. in the URL .../journey-runs/n3k23bavavba-jrn3k23bavavba-jr is the id

All screenshots will be bundled into a zip file and downloaded to your computer. Specify the --file foo.zip to download the results to an alternative location.

mabl test-runs export <test-run-id>

To see all export options run:

mabl test-runs export --help

Note: for very large test runs, this may take minutes and result in files 100MiB or larger.

Configuration

The list subcommand allows you to view your current configuration values:

# view current configuration values
mabl config list

Proxy

To use a proxy, set the http.proxy configuration value to the URL for your proxy server. The URL can contain basic authentication credentials and port information.

# add a proxy with no credentials on port 3128
mabl config set http.proxy http://proxy.mycompany.com:3128

# add a proxy using credentials on port 3128
mabl config set http.proxy http://username:password@proxy.mycompany.com:3128

# delete the current proxy setting
mabl config delete http.proxy

SSL Verification

The default behavior is to validate SSL certificates. To disable SSL certificate verification, you can set http.sslVerify to false.

# disable SSL verification
mabl config set http.sslVerify false

# delete the current ssl verification setting to use the default
mabl config delete http.sslVerify

Installation Troubleshooting

If you receive the following error message, you need to ensure you have Node 10+ installed.

npm WARN notsup Unsupported engine for @mablhq/mabl-cli@0.1.13: wanted: {"node":">= 10.0.0"} (current: {"node":"8.15.1","npm":"6.13.4"})
npm WARN notsup Not compatible with your version of node/npm: @mablhq/mabl-cli@0.1.13

Current Tags

  • 0.6.41-beta                                ...           beta (4 days ago)
  • 0.6.41-beta                                ...           latest (4 days ago)

64 Versions

  • 0.6.41-beta                                ...           4 days ago
  • 0.6.39-beta                                ...           4 days ago
  • 0.6.38-beta                                ...           7 days ago
  • 0.6.36-beta                                ...           14 days ago
  • 0.6.34-beta                                ...           16 days ago
  • 0.6.33-beta                                ...           17 days ago
  • 0.6.28-beta                                ...           a month ago
  • 0.6.27-beta                                ...           a month ago
  • 0.6.25-beta                                ...           a month ago
  • 0.6.24-beta                                ...           a month ago
  • 0.6.22-beta                                ...           a month ago
  • 0.6.19-beta                                ...           a month ago
  • 0.6.18-beta                                ...           a month ago
  • 0.6.17-beta                                ...           2 months ago
  • 0.6.16-beta                                ...           2 months ago
  • 0.6.15-beta                                ...           2 months ago
  • 0.6.13-beta                                ...           2 months ago
  • 0.6.12-beta                                ...           2 months ago
  • 0.6.11-beta                                ...           2 months ago
  • 0.6.10-beta                                ...           2 months ago
  • 0.6.8-beta                                ...           2 months ago
  • 0.6.7-beta                                ...           2 months ago
  • 0.6.6-beta                                ...           2 months ago
  • 0.6.5-beta                                ...           2 months ago
  • 0.6.4-beta                                ...           2 months ago
  • 0.6.3-beta                                ...           2 months ago
  • 0.5.26-beta                                ...           3 months ago
  • 0.5.25-beta                                ...           3 months ago
  • 0.5.23-beta                                ...           3 months ago
  • 0.5.22-beta                                ...           3 months ago
  • 0.5.19-beta                                ...           3 months ago
  • 0.5.7-beta                                ...           4 months ago
  • 0.5.2-beta                                ...           4 months ago
  • 0.4.2-beta                                ...           4 months ago
  • 0.3.6-beta                                ...           4 months ago
  • 0.3.4-beta                                ...           4 months ago
  • 0.3.2-beta                                ...           5 months ago
  • 0.3.1-beta                                ...           5 months ago
  • 0.3.0-beta                                ...           5 months ago
  • 0.2.13-beta                                ...           5 months ago
  • 0.2.12-beta                                ...           5 months ago
  • 0.2.11-beta                                ...           5 months ago
  • 0.2.9-beta                                ...           5 months ago
  • 0.2.8-beta                                ...           5 months ago
  • 0.2.7-beta                                ...           5 months ago
  • 0.2.5-beta                                ...           5 months ago
  • 0.2.4-beta                                ...           5 months ago
  • 0.2.3-beta                                ...           5 months ago
  • 0.1.14-beta                                ...           5 months ago
  • 0.1.13-beta                                ...           6 months ago
  • 0.1.12-beta                                ...           6 months ago
  • 0.1.11-beta                                ...           6 months ago
  • 0.1.10-beta                                ...           6 months ago
  • 0.1.9-beta                                ...           6 months ago
  • 0.1.7-beta                                ...           6 months ago
  • 0.1.6-beta                                ...           7 months ago
  • 0.1.5-beta                                ...           7 months ago
  • 0.1.4-beta                                ...           7 months ago
  • 0.1.2-beta                                ...           7 months ago
  • 0.1.1-beta                                ...           7 months ago
  • 0.1.0-beta                                ...           7 months ago
  • 0.0.1-beta.9                                ...           7 months ago
  • 0.0.1-beta.8                                ...           7 months ago
  • 0.0.1-beta.6                                ...           7 months ago
Maintainers (2)
Downloads
Today 0
This Week 20
This Month 20
Last Day 0
Last Week 10
Last Month 112
Dependencies (39)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |