End-to-end testing framework for Paper/Spigot Minecraft plugins. Supports JavaScript and TypeScript.
๐ Setup โ Automated server lifecycle management with Paper server downloads.
๐ฎ Bot Testing โ Powered by Mineflayer. Bots join, move, chat, and click GUIs like real players.
๐ญ Playwright-inspired API โ Live handles and locators for scripting player interactions.
๐งช Type-Safe โ Native JavaScript and TypeScript with full type safety.
๐ Automatic Retries โ Built-in retry logic to handle flaky tests.
๐ Rich Assertions โ Custom matchers built for Minecraft mechanics.
๐ง Gradle Integration โ Run your entire suite with a single command.
Prerequisites: Java 17+, Gradle 7+, Node.js 16+, and a Paper/Spigot plugin project.
1. Add the plugin to your build.gradle.kts:
plugins {
id("io.github.drownek.paperwright") version "1.3.3"
}
paperwright {
minecraftVersion.set("1.19.4")
testsDir.set(file("src/test/e2e"))
acceptEula.set(true)
}2. Initialize the test folder:
./gradlew paperwrightInit3. Run your tests:
./gradlew paperwrightTestSee the Getting Started guide for setup details.
๐ก Want to see a working example? Check out the example_plugin directory in this repository.
| Paperwright | MockBukkit | |
|---|---|---|
| Approach | End-to-end โ runs a real Paper server with real player bots | Unit testing โ mocks the Bukkit API in-process |
| Server | Real Paper server with actual game logic | No server โ simulated API stubs |
| Player interaction | Real Mineflayer bots that join, move, chat, and click GUIs | Mocked Player objects with simulated method calls |
| NMS / internals | โ Full support โ real server means real NMS | โ Breaks on NMS / reflection / internals |
| Plugin compatibility | Tests the plugin exactly as players experience it | May miss bugs caused by mock/real behavior mismatch |
| Multi-plugin testing | โ All plugins load together naturally | Limited โ each mock is isolated |
| GUI testing | โ First-class support with locators and click simulation | Partial โ inventory content mocks supported; click/drag simulation limited |
| Speed | Slower (server startup ~10-20s, then fast) | Very fast (milliseconds per test) |
| Best for | Integration & E2E tests, NMS-heavy plugins, GUI testing | Fast unit tests for pure Bukkit API logic |
๐ก Tip: Paperwright and MockBukkit work well together. MockBukkit for fast unit tests; Paperwright for end-to-end tests that verify behavior on a real server.
import { expect, test } from '@drownek/paperwright';
test('help displays message', async ({ player }) => {
player.chat('/help');
await expect(player).toHaveReceivedMessage('Help');
});test('admin can interact with gui', async ({ player }) => {
await player.makeOp();
player.chat('/example gui-settings');
const gui = await player.gui({ title: 'guiSettings' });
await gui.locator(item => item.getDisplayName().includes('guiItemInfo')).click();
await expect(player).toHaveReceivedMessage('You clicked on item');
});test('multi-bot teleportation', async ({ player, createPlayer }) => {
await player.makeOp();
const friend = await createPlayer({ username: 'FriendBot' });
await friend.teleport(100, 100, 100);
player.chat(`/tp ${player.username} ${friend.username}`);
await expect(player).toBeNear(100, 100, 100, { tolerance: 2 });
});test('teleport player', async ({ player }) => {
await player.teleport(123, 100, 321);
expect(player.bot.entity.position).toMatchObject({ x: 123.5, z: 321.5 });
});
test('give item to player', async ({ player }) => {
await player.giveItem('emerald', 5);
await expect(player).toContainItem('emerald', { count: 5 });
});See Writing Tests for more patterns and the full Matchers Reference.
Setting up CI takes less than 5 minutes. Use the official paperwright-action to run your entire test suite.
Just create a .github/workflows/e2e.yml file with the following content:
name: E2E Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: drownek/paperwright-action@v1See the GitHub Wiki:
- Getting Started - Installation and setup
- Writing Tests - Test examples and patterns
- Matchers Reference - All available assertions
- GUI Testing - Testing inventory GUIs
- Configuration - Gradle plugin options
- Test Filtering - Running specific tests
MIT