Skip to content

Latest commit

 

History

History
327 lines (249 loc) · 7.59 KB

File metadata and controls

327 lines (249 loc) · 7.59 KB

Pattern Weaver - Integration Test Guide

Overview

This document describes how to manually test the Pattern Weaver RPG vertical slice.

Vertical Slice: Hub → Combat → Victory → Hub


Test Setup

  1. Start Dev Server:

    cd C:\Users\decro\pattern-weaver
    npm run dev
  2. Open Browser:


Test Case 1: Hub Scene Loads

Steps:

  1. Game loads
  2. LoadingScene appears briefly with "Pattern Weaver - Loading..."
  3. Transitions to HubScene automatically

Expected Result:

  • ✓ Dark blue background (#1a1a2e)
  • ✓ Title text "Welcome to Ravensholm" at top center
  • ✓ 4 colored buildings visible:
    • Inn (blue, top-left)
    • Shop (red, top-right)
    • Battle Gate (purple, bottom-left)
    • Quest Board (green, bottom-right)
  • ✓ Each building has label text below it

Success Criteria:

  • All 4 buildings render
  • No console errors
  • Buildings respond to hover (scale up, darken)

Test Case 2: Navigate to Combat

Steps:

  1. Hover over "Battle Gate" (purple building, bottom-left)
  2. Click "Battle Gate"

Expected Result:

  • ✓ Fade transition (300ms)
  • ✓ CombatScene loads
  • ✓ Console shows: CombatScene: Initializing combat with enemy type: slime

Success Criteria:

  • Scene transition is smooth
  • No visual glitches
  • Console log confirms enemy type

Test Case 3: Combat Scene Renders

Steps:

  1. Observe CombatScene layout after transition

Expected Result:

Left Side (Player):

  • ✓ Blue square (40x40 pixels)
  • ✓ "Player" label
  • ✓ Green health bar showing "HP: 100/100"
  • ✓ Blue mana bar showing "MP: 50/50"
  • ✓ Text showing "Level 1 | XP: 0/100"

Right Side (Enemy):

  • ✓ Green circle (30px diameter)
  • ✓ "Slime" label
  • ✓ Red health bar showing "HP: 30/30"

Bottom Bar:

  • ✓ Dark panel (1280x80)
  • ✓ Three purple buttons: "Attack", "Defend", "Flee"

Success Criteria:

  • All UI elements render correctly
  • Health/mana bars show correct values
  • Buttons are clickable (cursor changes on hover)

Test Case 4: Attack Action

Steps:

  1. Click "Attack" button

Expected Result:

  • ✓ Damage number appears above enemy (e.g., "-8")
  • ✓ Enemy health bar decreases (e.g., 30 → 22)
  • ✓ Enemy health label updates (e.g., "HP: 22/30")
  • ✓ Short delay (~500ms)
  • ✓ Enemy counter-attacks
  • ✓ Damage number appears above player (e.g., "-3")
  • ✓ Player health bar decreases
  • ✓ Console shows combat log:
    Turn 1: You attack Slime for 8 damage!
    Turn 1: Slime attacks you for 3 damage!
    

Success Criteria:

  • Damage numbers appear and fade out (1 second)
  • Health bars animate smoothly (300ms)
  • Turn completes without errors
  • Buttons re-enable after turn

Test Case 5: Defend Action

Steps:

  1. Click "Defend" button

Expected Result:

  • ✓ Console shows: Turn X: You defend! Defense increased.
  • ✓ Enemy attacks
  • ✓ Reduced damage taken (defense boost active)
  • ✓ Health bar updates

Success Criteria:

  • Defend reduces incoming damage
  • Turn completes successfully

Test Case 6: Combat to Victory

Steps:

  1. Click "Attack" repeatedly until enemy HP reaches 0
  2. Observe what happens when enemy dies

Expected Result:

  • ✓ Enemy health reaches 0
  • ✓ All combat UI elements fade out or hide
  • ✓ Large text appears: "Victory!"
  • ✓ Text appears: "You gained 10 XP!"
  • ✓ Console shows: Combat won! XP reward: 10
  • ✓ After 2.5 seconds, fade transition to HubScene
  • ✓ Player XP increased (check console: Player XP: 10/100)

Success Criteria:

  • Victory screen displays correctly
  • XP is awarded
  • Auto-return to Hub after delay
  • Player XP persists (if level not gained)

Test Case 7: Flee Action

Steps:

  1. Start new combat (click Battle Gate)
  2. Click "Flee" button

Expected Result:

  • ✓ 50% chance to escape
  • ✓ If success:
    • Text appears: "You escaped!"
    • Return to Hub after 2 seconds
  • ✓ If fail:
    • Text appears: "Couldn't escape!"
    • Enemy attacks
    • Combat continues

Success Criteria:

  • Flee has random chance
  • Successful flee returns to Hub
  • Failed flee continues combat

Test Case 8: Combat to Defeat

Steps:

  1. Start new combat
  2. Click "Defend" or do nothing
  3. Let enemy reduce player HP to 0

Expected Result:

  • ✓ Player health reaches 0
  • ✓ Text appears: "Defeat..."
  • ✓ Text appears: "You were defeated by Slime"
  • ✓ Return to Hub after 2.5 seconds
  • ✓ Console shows: Combat lost!

Success Criteria:

  • Defeat screen displays
  • Return to Hub occurs
  • No crashes or errors

Test Case 9: Multiple Combats

Steps:

  1. Win a combat (gain 10 XP)
  2. Return to Hub
  3. Click Battle Gate again
  4. Win another combat

Expected Result:

  • ✓ Player retains HP/MP/XP between combats
  • ✓ XP accumulates (10 → 20 → 30, etc.)
  • ✓ At 100 XP, player levels up:
    • Level increases (1 → 2)
    • HP increases (+10)
    • MP increases (+5)
    • Attack increases (+2)
    • Defense increases (+1)
    • Console shows: Level up! Now level 2

Success Criteria:

  • Player state persists
  • XP accumulates correctly
  • Level up triggers at 100 XP
  • Stats increase as expected

Performance Checks

During all tests, verify:

  • ✓ No console errors
  • ✓ Smooth 60 FPS (no lag or stutter)
  • ✓ Transitions are smooth
  • ✓ UI responds immediately to clicks
  • ✓ Memory usage stable (no leaks)

Known Issues / Limitations

Current vertical slice limitations:

  • Only one enemy type (Slime) available from Hub
    • To test Wolf/Goblin: Edit HubScene.js line 109, change 'slime' to 'wolf' or 'goblin'
  • Player state resets on page refresh (no save system yet)
  • No sound effects
  • No animations beyond damage numbers and health bars
  • No inventory interaction during combat
  • No loot drops

Future enhancements:

  • Enemy selection menu
  • Critical hits (orange damage numbers ready)
  • Combat log display
  • Animation shake on hit
  • Particle effects
  • Save/load system

Files Involved in Vertical Slice

Scenes:

  • src/scenes/HubScene.js - Hub navigation
  • src/scenes/CombatScene.js - Combat UI and integration
  • src/scenes/SceneManager.js - Scene transitions

Systems:

  • src/systems/CombatSystem.js - Turn-based combat logic

Entities:

  • src/entities/Player.js - Player stats and methods
  • src/entities/Enemy.js - Enemy types and stats

UI Components:

  • src/ui/Button.js - Interactive buttons
  • src/ui/HealthBar.js - Animated health bars
  • src/ui/ManaBar.js - Animated mana bars

Data:

  • data/enemies.json - Enemy definitions
  • data/abilities.json - Attack data (future use)
  • data/progression.json - Level/XP table

Services:

  • src/services/DataLoader.js - JSON data loading

Success Criteria Summary

Vertical slice is successful if:

  1. ✓ Hub loads without errors
  2. ✓ Can navigate to Combat scene
  3. ✓ Combat renders correctly (player, enemy, UI)
  4. ✓ Can attack and see damage/health updates
  5. ✓ Combat ends with victory or defeat
  6. ✓ Returns to Hub after combat
  7. ✓ Can repeat combat flow
  8. ✓ No crashes or console errors

Test Completion Checklist

  • Test Case 1: Hub Scene Loads
  • Test Case 2: Navigate to Combat
  • Test Case 3: Combat Scene Renders
  • Test Case 4: Attack Action
  • Test Case 5: Defend Action
  • Test Case 6: Combat to Victory
  • Test Case 7: Flee Action
  • Test Case 8: Combat to Defeat
  • Test Case 9: Multiple Combats
  • Performance Checks (no errors, smooth FPS)

Last Updated: 2026-04-22 Version: 1.0 (Vertical Slice) Status: Ready for Testing