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");
}
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=********
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).