Write Missions
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';
import { loginMission } from './login.mission.js';
export const logoutMission = `
Ensure you are already logged in, if not, log in.
Locate the Logout button, you may need to expand the menu.
Take a screenshot.
Click the logout button.
Figure out if the logout worked.
Take a screenshot.
If successful, report SUCCESS stating the reason why.
Otherwise, report FAILURE stating the reason why.
`
export async function executeMission() {
return await runMissions({
preMission: loginMission,
mission: logoutMission
}, "logout 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=********
Tips:
Screenshots are flexible and can be added to the prompt language on demand.
Keep secrets in env vars.
Let missions fail loudly. You may specify assertions for success (such as expected elements or content on resulting page), or request that the LLM self determine mission success (It will base success criteria on the mission context as well as the resulting DOM).