Skip to main content

Basic Test Structure

Tests use a simple API similar to Jest:

Your First Test

Create src/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 bot
  • server - Server control interface

Player Actions

Assertions

Utilities

The framework provides several exported utilities for advanced waiting and polling:

Best Practices

  1. Keep tests isolated - Each test gets a fresh bot
  2. Use descriptive names - Make test failures easy to understand
  3. Wait for conditions - Use assertions that auto-retry
  4. Test one thing - Each test should verify one behavior
  5. Check server logs - They appear in console during test runs
  6. 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