Stably supports creating tests on localhost. This is useful if you want to test your application in a local environment.

Setting Up with Stably CLI

To create tests for your localhost application, you can use the Stably CLI to create a secure tunnel that makes your local server accessible to Stably. Follow these steps:

Installation

First, install the Stably CLI globally:
npm install -g stably
Or use it directly with npx:
npx stably

Authentication

Before using the CLI, authenticate with your Stably API key:
stably auth
The CLI will prompt you for your API key, or you can provide it directly:
stably auth --api-key YOUR_API_KEY

Creating the Tunnel

  1. Start your local application server (make sure it’s running on your desired port, e.g., 3000)
  2. Run the Stably development server command:
# Start development server on default port (3000)
stably dev
Or specify a custom port if your application runs on a different port:
# Specify a custom port
stably dev --port 8080
  1. The CLI will:
    • Start a development server on the specified port
    • Create a secure tunnel to expose your local environment
    • Provide you with a public URL where your local environment is accessible
  2. Use the provided tunnel URL in the Stably App to point your tests to your local environment.
The tunnel will remain active as long as the CLI process is running. To stop the tunnel, press Ctrl+C in your terminal.