Skip to main content

πŸš€ Quickstart

Install CLI​

npm i -g testronaut

Initialize a project​

testronaut --init

creates: missions/, testronaut-config.json, and the configured report directory

run the welcome mission:

testronaut welcome.mission.js

πŸ“ Directory Structure Your project should include a missions/ folder with mission files like:

missions/
β”œβ”€β”€ login.mission.js
β”œβ”€β”€ logout.mission.js
└── dashboard.mission.ts

Each file exports an executeMission function and invokes runMissions. Both .js and .ts missions support standard import/export syntax without requiring "type": "module" in package.json.

✍️ Writing a Mission File​

Create a file in your missions/ directory, e.g. missions/login.mission.js:

import { runMissions } from 'testronaut';

export const loginMission = `
Visit ${process.env.URL}.
Fill the username field with ${process.env.USERNAME}.
Fill the password field with ${process.env.PASSWORD}.
Take a screenshot.
Submit the form.
Wait for the dashboard to appear.
Take another screenshot.
Report SUCCESS if the dashboard is loaded, otherwise report FAILURE.
`;

export async function executeMission() {
await runMissions({
mission: loginMission
}, "Login Mission");
}

βš™οΈ Environment Variables​

Testronaut reads your .env file for credentials and API access keys. Depending on your selected LLM provider, you’ll include the appropriate key:

# Example: OpenAI
OPENAI_API_KEY=sk-...

# or Gemini
GEMINI_API_KEY=AIza...

# or Anthropic Claude
ANTHROPIC_API_KEY=sk-ant-...

# Mission variables
URL=https://example.com/login
USERNAME=example@example.com
PASSWORD=********

πŸš€ Run Your Mission​

testronaut login.mission.js
testronaut missions/login.mission.js # direct paths support tab completion

Inspect discovery and tags without starting a browser:

testronaut list
testronaut --dry-run
testronaut config

You’ll get a run ID and a report in:

<outputDir>/run_<runId>.json

Screenshots are stored under <outputDir>/screenshots/run_<runId>/. Reports include the CLI version plus each mission's display name and source filename.

βœ… Next: Write your own missions, or upload a report and explore Mission Control.