fix: refactor enchanter and fabricator e2e tests
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m21s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m21s
Enchanter test: - Use data-testid selectors for debug buttons - Add waitForBridge pattern - Switch baseURL to localhost:3000 Fabricator test: - Use data-testid selectors for all debug buttons (attunements, elements, disciplines, materials) - Activate discipline via toggle button before adding XP - Unlock recipes via discipline XP + store unlockRecipes - Replace waitForTimeout with runTicks for crafting (instant tick-based waiting) - Add ticksForHours helper for deterministic craft completion - Verify each craft completed via store check instead of currentAction polling - Remove direct store manipulation for attunement/element unlock (use debug UI buttons)
This commit is contained in:
@@ -44,7 +44,7 @@ export function AttunementDebugSection() {
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-3">
|
||||
<Button size="sm" variant="outline" onClick={handleUnlockAll}>
|
||||
<Button size="sm" variant="outline" onClick={handleUnlockAll} data-testid="debug-attunement-unlock-all">
|
||||
<Unlock className="w-3 h-3 mr-1" /> Unlock All
|
||||
</Button>
|
||||
{Object.entries(ATTUNEMENTS_DEF).map(([id, def]) => {
|
||||
@@ -53,7 +53,7 @@ export function AttunementDebugSection() {
|
||||
const xp = attunements?.[id]?.experience || 0;
|
||||
|
||||
return (
|
||||
<div key={id} className="flex items-center justify-between p-2 bg-gray-800/50 rounded">
|
||||
<div key={id} data-testid={`debug-attunement-row-${id}`} className="flex items-center justify-between p-2 bg-gray-800/50 rounded">
|
||||
<div className="flex items-center gap-2">
|
||||
<span>{def.icon}</span>
|
||||
<div>
|
||||
@@ -68,6 +68,7 @@ export function AttunementDebugSection() {
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => handleUnlockAttunement(id)}
|
||||
data-testid={`debug-attunement-unlock-${id}`}
|
||||
>
|
||||
<Unlock className="w-3 h-3 mr-1" /> Unlock
|
||||
</Button>
|
||||
@@ -75,6 +76,7 @@ export function AttunementDebugSection() {
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => handleAddAttunementXP(id, 100)}
|
||||
data-testid={`debug-attunement-add100-${id}`}
|
||||
>
|
||||
+100 XP
|
||||
</Button>
|
||||
|
||||
@@ -40,7 +40,7 @@ export function ElementDebugSection() {
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="mb-3">
|
||||
<Button size="sm" variant="outline" onClick={handleUnlockAll}>
|
||||
<Button size="sm" variant="outline" onClick={handleUnlockAll} data-testid="debug-elements-unlock-all">
|
||||
<Lock className="w-3 h-3 mr-1" /> Unlock All Elements
|
||||
</Button>
|
||||
</div>
|
||||
@@ -68,6 +68,7 @@ export function ElementDebugSection() {
|
||||
variant="outline"
|
||||
className="mt-2"
|
||||
onClick={() => handleUnlockElement(id)}
|
||||
data-testid={`debug-element-unlock-${id}`}
|
||||
>
|
||||
<Lock className="w-3 h-3 mr-1" /> Unlock
|
||||
</Button>
|
||||
@@ -78,6 +79,7 @@ export function ElementDebugSection() {
|
||||
variant="outline"
|
||||
className="mt-2"
|
||||
onClick={() => handleAddElementalMana(id, 10)}
|
||||
data-testid={`debug-element-add10-${id}`}
|
||||
>
|
||||
+10
|
||||
</Button>
|
||||
|
||||
@@ -181,10 +181,10 @@ function QuickActionsSection({ onUnlockBase, onAddStarterMaterials }: {
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="flex gap-2 flex-wrap">
|
||||
<Button size="sm" variant="outline" onClick={onUnlockBase}>
|
||||
<Button size="sm" variant="outline" onClick={onUnlockBase} data-testid="debug-quick-unlock-base">
|
||||
Unlock All Base Elements
|
||||
</Button>
|
||||
<Button size="sm" variant="outline" onClick={onAddStarterMaterials}>
|
||||
<Button size="sm" variant="outline" onClick={onAddStarterMaterials} data-testid="debug-quick-add-materials">
|
||||
Add Starter Materials
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user