|
| 1 | +# End-to-end (in-game) tests — plugwright spike |
| 2 | + |
| 3 | +This is a spike using [plugwright](https://github.com/Drownek/plugwright) to verify Challenges |
| 4 | +**in a real running server** — something the JUnit/MockBukkit unit tests can't do. Plugwright boots |
| 5 | +a real Paper server, loads the plugins, and drives a headless [Mineflayer](https://github.com/PrismarineJS/mineflayer) |
| 6 | +bot that runs commands and clicks GUIs, then asserts on what the bot sees. |
| 7 | + |
| 8 | +It is a **separate Gradle sidecar** — it does not touch the Maven build. It deploys *prebuilt* jars: |
| 9 | + |
| 10 | +- **BentoBox 3.14.0** and **BSkyBlock 1.20.0** are downloaded (cached in `.deps/`). |
| 11 | +- The **Challenges** jar is taken from `../target/` (build it first with `mvn -DskipTests package`). |
| 12 | + |
| 13 | +> **Gotcha that cost most of the spike:** BentoBox *addons* (BSkyBlock, Challenges) must be staged |
| 14 | +> into `plugins/BentoBox/addons/`, **not** `plugins/`. In `plugins/` they load as bare Paper plugins |
| 15 | +> and never register as gamemodes, so no `bskyblock_world` is created and every `/island`, |
| 16 | +> `/bsbadmin`, `/challenges` command comes back "Unknown". See `build.gradle.kts`. |
| 17 | +
|
| 18 | +## Running locally |
| 19 | + |
| 20 | +```bash |
| 21 | +# 1. Build the Challenges jar (Maven) |
| 22 | +mvn -DskipTests package |
| 23 | + |
| 24 | +# 2. Run the E2E tests (needs Java 21, Node 18+) |
| 25 | +cd e2e |
| 26 | +JAVA_HOME=/path/to/jdk-21 ./gradlew plugwrightTest |
| 27 | + |
| 28 | +# add PLUGWRIGHT_DEBUG=1 to see every message the bot receives |
| 29 | +``` |
| 30 | + |
| 31 | +First run downloads Paper 1.21.11 (~50 MB) and the plugin jars; later runs reuse them |
| 32 | +(`run/server.jar`, `.deps/`). A full run is ~30–40s (server boot + world gen dominate). |
| 33 | + |
| 34 | +## What the tests cover (`src/test/e2e/challenges.spec.ts`) |
| 35 | + |
| 36 | +- **`bot can interact with the server`** — smoke test: bot joins Paper 1.21.11, ops, runs a command, |
| 37 | + receives the reply. Proves the whole stack (BentoBox 3.14.0 + BSkyBlock + Challenges 1.8.0) loads |
| 38 | + and is drivable. |
| 39 | +- **`confirmation prompts tell the player how to answer (#329)`** — opens the Challenges admin GUI, |
| 40 | + clicks "Challenge Wipe", and asserts the bot receives the confirmation instruction line |
| 41 | + ("Type 'confirm' ... or 'cancel' ...") added in #415. A real in-game validation of a 1.8.0 feature. |
| 42 | + |
| 43 | +## Notes / next steps |
| 44 | + |
| 45 | +- Tests requiring an **island** (block/biome/completion flows) still need island bootstrap — either |
| 46 | + a bot-driven `/island create` (blueprint GUI) or a pre-staged world via `writeFiles`. |
| 47 | +- In CI this runs via `.github/workflows/e2e.yml` (manual `workflow_dispatch` for now — advisory, |
| 48 | + not a required check). |
0 commit comments