🚀 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");
}
⚙️ 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...
# Mission variables
URL=https://example.com/login
USERNAME=example@example.com
PASSWORD=********
🚀 Run Your Mission
npx testronaut login.mission.js
You’ll get a run ID and a report in:
missions/mission_reports/run_<runId>.json
and an accompanying HTML summary.
✅ Next: Write your own flows and expand your missions. See Write Missions for deeper examples.