Basic Test Structure
Tests use a simple API similar to Jest:Your First Test
Createsrc/test/e2e/first.spec.js:
Common Test Patterns
Testing Commands
Testing Economy
Testing Inventory
Server Operations
API Reference
Test Context
Each test receives a context object with:player- The PlayerWrapper instance managing the botserver- Server control interface
Player Actions
Assertions
Utilities
The framework provides several exported utilities for advanced waiting and polling:Best Practices
- Keep tests isolated - Each test gets a fresh bot
- Use descriptive names - Make test failures easy to understand
- Wait for conditions - Use assertions that auto-retry
- Test one thing - Each test should verify one behavior
- Check server logs - They appear in console during test runs
- Add delays when needed - Use the built-in
sleep()utility for timing-dependent tests
Tips
- Tests run sequentially, not in parallel
- Server starts fresh for each test run
- Bot automatically connects to the server
- Server logs are visible in the console output