Bound E2E movement by server progress and diagnose gathering failures
This commit is contained in:
+22
-3
@@ -36,10 +36,29 @@ test('desktop renders models, moves authoritatively, gathers, and reconnects', a
|
||||
await page.setViewportSize({ width: 1440, height: 900 });
|
||||
await enter(page);
|
||||
const before = await page.evaluate(() => (window as any).__aeternalis.snapshot.self.entity.position);
|
||||
await page.keyboard.down('d'); await page.waitForTimeout(1000); await page.keyboard.up('d');
|
||||
await expect.poll(() => page.evaluate(() => (window as any).__aeternalis.snapshot.self.entity.position.x)).toBeGreaterThan(before.x + 3);
|
||||
// Stop on authoritative progress instead of assuming a one-second browser
|
||||
// sleep produces a bounded walk on a software-rendered CI worker. Overshooting
|
||||
// the arrival clearing changes which resource the Gather button selects.
|
||||
await page.keyboard.down('d');
|
||||
try {
|
||||
await expect.poll(() => page.evaluate(() => (window as any).__aeternalis.snapshot.self.entity.position.x), { timeout: 15000 }).toBeGreaterThan(before.x + 3);
|
||||
} finally {
|
||||
await page.keyboard.up('d');
|
||||
}
|
||||
await page.getByRole('button', { name: 'Gather', exact: true }).click();
|
||||
await expect.poll(() => page.evaluate(() => Object.values((window as any).__aeternalis.snapshot.self.skills).reduce((sum: number, n: any) => sum + n, 0)), { timeout: 15000 }).toBeGreaterThan(0);
|
||||
await expect.poll(() => page.evaluate(() => {
|
||||
const s = (window as any).__aeternalis.snapshot;
|
||||
return {
|
||||
gainedXP: Object.values(s.self.gathering).some((skill: any) => skill.xp > 0),
|
||||
attempt: s.self.gatherAttempt,
|
||||
position: s.self.entity.position,
|
||||
movementFactor: s.self.movementFactor,
|
||||
ack: s.self.ack,
|
||||
message: s.message,
|
||||
target: document.querySelector('#target')?.textContent,
|
||||
notice: document.querySelector('#notice')?.textContent,
|
||||
};
|
||||
}), { timeout: 15000, message: 'Gather must award profession XP; failure output includes the attempt, target, position and server response' }).toMatchObject({ gainedXP: true });
|
||||
await page.getByRole('button', { name: 'Inventory and crafting' }).click();
|
||||
await expect(page.locator('#inventory')).toBeVisible();
|
||||
await expect(page.locator('#inventory-items')).toContainText('Knife');
|
||||
|
||||
Reference in New Issue
Block a user