Quickstart
Install CLI
npm i -g testronaut
Initialize a project
npx testronaut --init
creates: missions/, testronaut-config.js, .testronaut/
run the welcome mission:
npx 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.js
Each file exports a mission string or function and invokes runMissions.
✍️ 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");
}
Pass in credentials using an .env file. The .env file should also include your Open AI API key (permissions to the completions endpoint required):
OPENAI_API_KEY=sk-proj-############
URL=https://example.com/login
USERNAME=example@example.com
PASSWORD=********
Run it
npx testronaut login.mission.js
You’ll get a runId and missions/mission_reports/run_<runId>.json
(and HTML).
Next: write real flows → Write Missions.