Skip to content

feat(e2e): add Playwright E2E testing infrastructure - #218

Closed
NicoRuedaA wants to merge 30 commits into
OpenLeagueManager:developfrom
NicoRuedaA:feat/e2e-tests
Closed

feat(e2e): add Playwright E2E testing infrastructure#218
NicoRuedaA wants to merge 30 commits into
OpenLeagueManager:developfrom
NicoRuedaA:feat/e2e-tests

Conversation

@NicoRuedaA

@NicoRuedaA NicoRuedaA commented May 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds end-to-end testing infrastructure using Playwright with a mocked Tauri backend, targeting the Vite dev server.

Changes

Infrastructure

  • Playwright with Chromium configured as test runner
  • e2e/playwright.config.ts with auto-starting Vite dev server
  • e2e/mocks/tauri.js — full mock for window.__TAURI_INTERNALS__ handling 30+ invoke commands and 25+ window plugin methods
  • npm scripts: test:e2e (headless), test:e2e:ui (interactive)

Test Coverage

The complete game flow test covers the full user journey (25.7s runtime):

  1. Onboarding: MainMenu → fill manager form → select league → TeamSelection → pick Fnatic → Dashboard
  2. Squad tab: Navigate → verify player Bwipo is visible
  3. Inbox tab: Navigate and verify rendering
  4. News tab: Navigate and verify rendering
  5. Schedule tab: Navigate and verify rendering
  6. Training tab: Navigate and verify rendering
  7. Players tab: Navigate and verify rendering
  8. Teams tab: Navigate and verify rendering
  9. Settings tab: Navigate and verify rendering

Key Fixes Discovered

  • getCurrentWindow() from @tauri-apps/api/window requires window.__TAURI_INTERNALS__.metadata (was causing React unmount → blank page)
  • Squad roster filters players by team.manager_id === managerId — teams must have manager_id set
  • All sidebar aria-labels use Spanish translations (default app locale)

Testing

npm run test:e2e

Closes #217

NicoRuedaA added 29 commits May 8, 2026 15:38
Eliminate 52 football remnants from the OFM-to-OLManager migration across
3 phases: critical domain changes, medium i18n/cleanup, low deprecations.

Phase A - Critical:
  - Rename StandingEntry: goals_for/against -> maps_won/lost, kill_difference()
  - Remove formation from Team (struct + V53 migration)
  - Remove clean_sheets, footedness, yellow_cards/red_cards, draws
  - #[deprecated] on Position enum (use LolRole instead)
  - Replace CompactTeamMatchStatsData with LoL stats
  - Rewrite SquadTab.helpers.ts: buildPitchRows -> buildLaneRows
  - PlayStyle -> DraftStrategy (backend + frontend + V54 migration)
  - Remove football_nation from WorldEditorTab, store types, scripts

Phase B - Medium:
  - Rename i18n keys: footballHerald->lolEsports, pitchInteractionHint->riftInteractionHint
  - Rename footballTermGuard.ts -> guard.ts
  - Rename FOOTBALL_IDENTITIES -> LEGACY_NATIONAL_IDENTITIES
  - Remove openfootlogo.svg references
  - Migrate test data from 4-4-2 to LoL 5-role rosters

Phase C - Low:
  - Clean up Rust/frontend comments (football -> legacy/LoL)
  - Remove offsides from test fixtures
  - Archive migration proposals to docs/legacy/archived-proposals/
  - Update lec_world.json description from OpenFootManager to OLManager

Fixes:
  - Add missing locale argument to finish_live_match_internal (blocked game load)

Stadium/arena rename excluded by user request.
- Add missing getStandingKillsFor and getStandingKillsAgainst wrappers in types.ts
- Fix TournamentsTab test: Fixtures -> Matches (post i18n rename)
- Game now loads correctly, all 646 frontend tests pass
- Replace openfootlogo.svg with olmanager-logo.svg
- Restore img tag in MainMenu.tsx pointing to new logo
- New SVG logo with shield crest + Open League Manager text
Renamed 5 player attributes and removed 3 dead goalkeeper fields:
- pace -> reaction_speed
- strength -> durability
- passing -> coordination
- tackling -> interception
- defending -> positional_defense
- REMOVED: handling, reflexes, aerial (dead code, unused)

All renamed fields have #[serde(alias)] for backward compat.
- TeamData: play_style -> draft_strategy
- EngineTeamData: play_style -> draft_strategy
- LeagueStandingSnapshot: removed drawn, goals_for->maps_won, goals_against->maps_lost
- Fixed 80+ test files with outdated field references
- Removed draws/drawn/formation from test data
Covers Team, Player, and Staff attributes with their in-game effects,
usage locations, and multiplier formulas. Includes LolStaffEffects
output chain (coaching→8 multipliers) and full match flow diagram.
- Removed deprecated Position enum (17 football variants) and all references
- Removed CoachingSpecialization enum (7 variants, 3 unused) and specialization field
- Removed shared.rs from engine (dead code: PlayerSnap, TraitContext, DraftStrategyPhase, etc.)
- Removed default_engine_attr helper
- Updated tests, DB queries, staff effects, and training mappings accordingly
- Added logo_url: Option<String> to Team struct
- Populated from team name slug on world load
- Removed FALLBACK_TEAM_LOGOS hardcoded mapping
- Renamed resolveExampleTeamLogo → resolveTeamLogo with optional logoUrl param
… paths

- Rename lec_world.json to world.json, generate-lec-world.mjs to generate-world.mjs
- Rename lec-default to default in Rust and frontend
- Add logo_url to each team in world.json (local /teams-icons/slug.webp)
- Fix Movistar KOI slug from mad-lions to movistar-koi
- Move team shields to public/teams-icons/ as WebP
- Remove shifters external lolesports URL (local shield now)
- Update Rust fallback path from /team-logos/ to /teams-icons/
…ibutes

- Fix Rust world_source check from lec-default to default
- Fix attrsFor() to merge 16 old attrs into 9 new LoL attrs
- Remove weak_foot from generated player data
- Regenerate world.json with 9-attribute format
- Install @playwright/test with chromium
- Create e2e/playwright.config.ts
- Create e2e/tests/new-game.spec.ts with full onboarding flow
- Add test:e2e and test:e2e:ui npm scripts
- Create e2e/mocks/tauri.js with mock invoke responses
- Mock covers start_new_game, get_team_selection_data, select_team
- Team/player data generated inline with realistic LoL attrs
- Update playwright.config to use webServer (npm run dev)
- Update test to inject mock before each test via addInitScript
…r path

- Add click on 'Nueva Partida' to switch menuState from 'main' to 'create'
- Change HTML reporter output to e2e-report to avoid clash with test output
- Clean up old test-results directory
- DatePicker is 3 separate inputs (day/month/year), not native type=date
- Select month via dropdown, first day, year via numeric inputs
- Handle nationality button dropdown with search
- Use button[type=submit] instead of locale-specific text for start
- Use Dirigir text for manage button (Spanish locale)
- Simplify DatePicker selectors
- Handle nationality dropdown with waitFor before click
…e-load tests

- Expand tauri.js mock to handle 40+ invoke commands
- Add 6 new test files covering core gameplay flows
- All tests share onboarding fixture via beforeEach
- Mock returns realistic game state with advancing week counter
…avigation tests

- Add get_active_game, get_champions, save_game handlers to mock
- Add Squad, Training, Schedule tab navigation tests
- Fix viewport issue with browser.newContext
- Consolidate tests into new-game.spec.ts (stable execution order)
- Add waitUntil: networkidle for first page load
- Change Squad/Training/Schedule selectors to Spanish (Plantilla/Entrenamiento/Calendario)
- Settings default language is es (Spanish)
- Sidebar uses translated labels for aria-label
- Dashboard sidebar club items conditional on !isUnemployed
- Spanish translations confirmed from es.json
- Fix getCurrentWindow crash: add metadata to __TAURI_INTERNALS__ mock
- Add plugin:window handlers for 25+ window methods
- Fix squad roster: set manager_id on Fnatic team for proper team lookup
- Verify all sidebar tabs: Dashboard, Squad, Inbox, News, Schedule,
  Training, Players, Teams, Settings
- All 9 navigation flows tested in 25.6 seconds
@NicoRuedaA
NicoRuedaA changed the base branch from main to develop May 10, 2026 06:36
@NicoRuedaA
NicoRuedaA marked this pull request as ready for review May 11, 2026 19:33
@NicoRuedaA NicoRuedaA closed this May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(e2e): add end-to-end tests with Playwright

1 participant