feat: add happy-path Playwright test for earth-gear crafting workflow #232

Closed
opened 2026-05-31 10:49:59 +02:00 by Anexim · 2 comments
Owner

Goal

Create a Playwright "happy path" E2E test that exercises the full Fabricator earth-gear crafting workflow from a fresh game:

  1. Open a fresh game
  2. Open the Debug tab and:
    • Unlock the Fabricator attunement
    • Unlock earth elemental mana
    • Fill earth mana to max
    • Give the player enough raw mana for crafting costs
    • Add the required materials (manaCrystalDust, earthShard) via store manipulation
    • Add enough XP to the study-fabricator-recipes discipline to unlock earth recipes (needs 50 XP)
  3. Switch to the Crafting tab → Fabricator sub-tab and craft:
    • Earthen Helm (head, 200 mana, 3h)
    • Stonegreaves (feet, 150 mana, 2h)
    • Oak Staff (main hand, 200 mana, 3h)
  4. Switch to the Equipment tab and equip each crafted item from inventory to the correct slot
  5. Verify the equipped gear shows the expected names and rarity colors

Materials needed per recipe

Recipe manaCrystalDust earthShard elementalCore Mana Cost
Earthen Helm 4 2 0 200
Stonegreaves 3 1 0 150
Oak Staff 5 2 0 200
Total 12 5 0 550

Discipline unlock requirements

  • study-fabricator-recipes at 50 XP → unlocks earth recipes (earthHelm, earthBoots)
  • study-wizard-branch at 50 XP → unlocks oakStaff
  • Total: 100 XP across two disciplines

Technical Notes

  • The game ticks every 200ms, advancing 0.04h of crafting per tick. Earthen Helm (3h) = 75 ticks ≈ 15 seconds wall-clock.
  • The test should use page.evaluate() to directly set store state (materials, mana, discipline XP) since there is no debug UI for adding materials.
  • After giving materials and setting discipline XP via page.evaluate(), the test clicks the "Craft" button and waits for the crafting progress to complete by polling equipmentCraftingProgress going null.
  • The equip step: navigate to Equipment tab, find the item in the inventory list, click "Equip" button.

Acceptance Criteria

  • Test file created at e2e/fabricator-happy-path.spec.ts
  • Test passes end-to-end against the deployed production URL
  • Test covers all 6 steps: debug setup → craft helm → craft greaves → craft staff → equip helm → equip greaves → equip staff
  • No React console errors during the test run
  • Test follows existing patterns from e2e/playtest.spec.ts (baseURL, helpers, describe blocks)

Affected Files

  • e2e/fabricator-happy-path.spec.ts — NEW
  • No production code changes needed

Priority

Medium — this is a test-only change that establishes a regression-testing foundation for the Fabricator crafting system.

## Goal Create a Playwright "happy path" E2E test that exercises the full Fabricator earth-gear crafting workflow from a fresh game: 1. Open a fresh game 2. Open the **Debug tab** and: - Unlock the **Fabricator** attunement - Unlock **earth** elemental mana - Fill earth mana to max - Give the player enough **raw mana** for crafting costs - Add the required **materials** (manaCrystalDust, earthShard) via store manipulation - Add enough **XP to the `study-fabricator-recipes` discipline** to unlock earth recipes (needs 50 XP) 3. Switch to the **Crafting tab** → Fabricator sub-tab and craft: - ✅ **Earthen Helm** (head, 200 mana, 3h) - ✅ **Stonegreaves** (feet, 150 mana, 2h) - ✅ **Oak Staff** (main hand, 200 mana, 3h) 4. Switch to the **Equipment tab** and equip each crafted item from inventory to the correct slot 5. Verify the equipped gear shows the expected names and rarity colors ## Materials needed per recipe | Recipe | manaCrystalDust | earthShard | elementalCore | Mana Cost | |--------|----------------|------------|---------------|-----------| | Earthen Helm | 4 | 2 | 0 | 200 | | Stonegreaves | 3 | 1 | 0 | 150 | | Oak Staff | 5 | 2 | 0 | 200 | | **Total** | **12** | **5** | **0** | **550** | ## Discipline unlock requirements - `study-fabricator-recipes` at **50 XP** → unlocks earth recipes (earthHelm, earthBoots) - `study-wizard-branch` at **50 XP** → unlocks oakStaff - **Total: 100 XP** across two disciplines ## Technical Notes - The game ticks every 200ms, advancing 0.04h of crafting per tick. Earthen Helm (3h) = 75 ticks ≈ 15 seconds wall-clock. - The test should use `page.evaluate()` to directly set store state (materials, mana, discipline XP) since there is no debug UI for adding materials. - After giving materials and setting discipline XP via `page.evaluate()`, the test clicks the "Craft" button and waits for the crafting progress to complete by polling `equipmentCraftingProgress` going null. - The equip step: navigate to Equipment tab, find the item in the inventory list, click "Equip" button. ## Acceptance Criteria - [ ] Test file created at `e2e/fabricator-happy-path.spec.ts` - [ ] Test passes end-to-end against the deployed production URL - [ ] Test covers all 6 steps: debug setup → craft helm → craft greaves → craft staff → equip helm → equip greaves → equip staff - [ ] No React console errors during the test run - [ ] Test follows existing patterns from `e2e/playtest.spec.ts` (baseURL, helpers, describe blocks) ## Affected Files - `e2e/fabricator-happy-path.spec.ts` — NEW - No production code changes needed ## Priority Medium — this is a test-only change that establishes a regression-testing foundation for the Fabricator crafting system.
Anexim added the ai:todo label 2026-05-31 10:49:59 +02:00
n8n-gitea was assigned by Anexim 2026-05-31 10:49:59 +02:00
Author
Owner

Closing — this issue incorrectly assumed materials would be injected via debug store manipulation. Correct approach: the test should actually craft the required materials through the Fabricator (mana crystal → earth crystal → earth shard). See replacement issue #233.

Closing — this issue incorrectly assumed materials would be injected via debug store manipulation. Correct approach: the test should actually craft the required materials through the Fabricator (mana crystal → earth crystal → earth shard). See replacement issue #233.
Author
Owner

Closing — incorrect approach. Materials should be crafted through the Fabricator, not injected via debug. See replacement issue.

Closing — incorrect approach. Materials should be crafted through the Fabricator, not injected via debug. See replacement issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#232