Files
IGP-Fan-Reference/docs/AI Gen Docs/test-multi-context-entity-comparison.md
2026-05-31 14:33:58 -04:00

54 lines
2.6 KiB
Markdown

---
type: Task
status: AI Gen TODO
category: QA
isAgentGenerated: "true"
---
# Test: Database Entity Consistency Across Pages
## Description
Verify that entity data (name, health, damage, faction, hotkey) displayed on the Database entity-detail page matches the same entity's data shown in the Build Calculator's hotkey viewer and timeline.
## Rationale
Entity stats are defined in `Model/Entity/Data/EntityData.*.cs` and consumed by both the Database page (full entity detail) and the Build Calculator (hotkey viewer tooltips, timeline entries). If someone edits the source data and changes a name or stat, it must update consistently across all views. No existing test cross-references entity data between the two pages.
## Playwright Feature
This test uses **multiple `page` objects within the same `browserContext`** — one navigating the Database page and another navigating the Build Calculator. Playwright fixtures provide a fresh `page` per test by default, but you can open additional pages manually with `await context.newPage()`.
### Approach
1. Open the Database single-entity page for "Acropolis" (e.g. `pageA.goto('/database/acropolis')`).
2. Extract displayed values: name, faction, health, armor type, hotkey.
3. Open the Build Calculator (`pageB.goto('/build-calculator')`).
4. Select Q'Rath/Orzum filter.
5. Find the Q hotkey button, read its entity name (Acropolis).
6. Click the entity name / button, read the EntityClickView name.
7. Click the entity in the timeline, read the same detail fields.
8. Assert all values match across the three views.
### What This Catches
- A typo in `EntityInfoModel.Name` that differs from the label used in the hotkey viewer.
- A missing `EntityFactionModel` part that causes an entity to disappear from one view.
- A hotkey assignment that renders differently in the Database vs. the Build Calculator.
- Entity requirements or costs that display inconsistently between the tooltip and the entity detail page.
### Example Assertion Flow
```
pageA (Database) pageB (Build Calculator)
───────────────── ────────────────────────
Name: "Acropolis" → Q button shows "Acropolis"
Faction: "Q'Rath" → Only visible with Q'Rath filter
Health: 2300 → EntityClickView shows correct health
Hotkey: "Q" → Entity appears on Q button (group C)
```
### Future Enhancement
Parameterize by entity type — run the same cross-page comparison for army units (`Sipari`, `Xacal`), research (`Greaves of Ahqar`), and immortals (`Orzum`, `Mala`) to validate every available entity.