fix: improve combat-happy-path e2e test reliability and speed
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m24s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m24s
- Add data-testid attributes to debug tab buttons (Fill Mana, +10K, +1K, discipline rows) - Add runTicks(n) to debugBridge for fast-forwarding game ticks in E2E tests - Fix Step 2: use data-testid selectors instead of fragile DOM traversal for discipline buttons - Fix Step 4: replace 120s waitForTimeout with runTicks(6000) for deterministic combat - Fix Step 5: replace 60s waitForTimeout with runTicks(3000) - Fix Step 6: verify floor decrements after each Climb Down click using waitForFunction - Fix Step 7: verify Exit Spire button visibility is gated on floor 1 - Remove leftover debug logging (btnInfo DOM inspection)
This commit is contained in:
@@ -93,6 +93,7 @@ export function DisciplineDebugSection() {
|
||||
return (
|
||||
<div
|
||||
key={def.id}
|
||||
data-testid={`debug-discipline-row-${def.id}`}
|
||||
className="flex items-center justify-between p-2 bg-gray-800/50 rounded"
|
||||
>
|
||||
<div>
|
||||
@@ -106,6 +107,7 @@ export function DisciplineDebugSection() {
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => handleAddXP(def.id, 100)}
|
||||
data-testid={`debug-discipline-add100-${def.id}`}
|
||||
>
|
||||
<Plus className="w-3 h-3 mr-1" /> +100
|
||||
</Button>
|
||||
@@ -113,6 +115,7 @@ export function DisciplineDebugSection() {
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => handleAddXP(def.id, 1000)}
|
||||
data-testid={`debug-discipline-add1k-${def.id}`}
|
||||
>
|
||||
+1K
|
||||
</Button>
|
||||
@@ -126,6 +129,7 @@ export function DisciplineDebugSection() {
|
||||
activate(def.id, { elements });
|
||||
}
|
||||
}}
|
||||
data-testid={`debug-discipline-toggle-${def.id}`}
|
||||
>
|
||||
{isActive ? (
|
||||
<Pause className="w-3 h-3" />
|
||||
|
||||
@@ -104,22 +104,22 @@ function ManaDebugSection({ rawMana, maxMana, onAddMana, onFillMana }: {
|
||||
Current: {rawMana} / {maxMana || '?'}
|
||||
</div>
|
||||
<div className="flex gap-2 flex-wrap">
|
||||
<Button size="sm" variant="outline" onClick={() => onAddMana(10)}>
|
||||
<Button size="sm" variant="outline" onClick={() => onAddMana(10)} data-testid="debug-mana-add-10">
|
||||
<Zap className="w-3 h-3 mr-1" /> +10
|
||||
</Button>
|
||||
<Button size="sm" variant="outline" onClick={() => onAddMana(100)}>
|
||||
<Button size="sm" variant="outline" onClick={() => onAddMana(100)} data-testid="debug-mana-add-100">
|
||||
<Zap className="w-3 h-3 mr-1" /> +100
|
||||
</Button>
|
||||
<Button size="sm" variant="outline" onClick={() => onAddMana(1000)}>
|
||||
<Button size="sm" variant="outline" onClick={() => onAddMana(1000)} data-testid="debug-mana-add-1k">
|
||||
<Zap className="w-3 h-3 mr-1" /> +1K
|
||||
</Button>
|
||||
<Button size="sm" variant="outline" onClick={() => onAddMana(10000)}>
|
||||
<Button size="sm" variant="outline" onClick={() => onAddMana(10000)} data-testid="debug-mana-add-10k">
|
||||
<Zap className="w-3 h-3 mr-1" /> +10K
|
||||
</Button>
|
||||
</div>
|
||||
<Separator className="bg-gray-700" />
|
||||
<div className="text-xs text-gray-400 mb-2">Fill to max:</div>
|
||||
<Button size="sm" className="w-full bg-blue-600 hover:bg-blue-700" onClick={onFillMana}>
|
||||
<Button size="sm" className="w-full bg-blue-600 hover:bg-blue-700" onClick={onFillMana} data-testid="debug-mana-fill">
|
||||
Fill Mana
|
||||
</Button>
|
||||
</CardContent>
|
||||
|
||||
@@ -22,5 +22,17 @@ if (typeof window !== 'undefined') {
|
||||
usePrestigeStore,
|
||||
useDisciplineStore,
|
||||
useUIStore,
|
||||
/**
|
||||
* Run n game ticks synchronously.
|
||||
* Each tick advances the game by HOURS_PER_TICK hours.
|
||||
* 50 ticks ≈ 1 in-game hour, 1200 ticks ≈ 1 in-game day.
|
||||
* Use this in E2E tests instead of waitForTimeout to speed up time-dependent assertions.
|
||||
*/
|
||||
runTicks: (n: number) => {
|
||||
const store = useGameStore.getState();
|
||||
for (let i = 0; i < n; i++) {
|
||||
store.tick();
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user