GP di Fortezza: la presentazione dei piloti a tutto schermo (i comandi arrivano col semaforo); nella guida semplice il pulsante Gas si tiene premuto, più alto e con la scritta fissa (sul telefono prendeva male) (Andrea)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiECd9KMfjthRUnujCGSzZ
This commit is contained in:
2026-10-29 11:18:46 +01:00
co-authored by Claude Opus 5.5
parent c244424af9
commit 88f0439f79
4 changed files with 41 additions and 8 deletions
+15 -4
View File
@@ -29,19 +29,30 @@ try {
const { settle } = await import('/tests/helpers.mjs');
settle(game); game.run({ closeup: 'gara', level }); settle(game);
}, level);
await page.waitForSelector('#bocce-controls:not([hidden])');
// La presentazione dei piloti a tutto schermo: niente comandi finché non c'è il semaforo.
await page.waitForFunction(() => game.closeup?.step === 'intro');
await page.waitForTimeout(300);
assert.equal(await page.locator('#bocce-controls').isVisible(), false, `${name}: comandi nascosti nella presentazione`);
assert.equal(await page.locator('#side').isVisible(), false, `${name}: la scena da sola`);
await page.screenshot({ path: `${out}/${name}-presentazione.png` });
// Salta la presentazione dei piloti e aspetta il via.
await page.evaluate(async () => { const g = await import('/src/engine/gara.js'); while (game.closeup.step === 'intro') g.press(game.closeup); });
await page.waitForFunction(() => game.closeup.step === 'race', null, { timeout: 15000 });
await page.waitForSelector('#bocce-controls:not([hidden])');
const easy = level !== 'male';
for (const id of ['#bocce-left', '#bocce-right', '#gara-brake', '#gara-pad'])
assert.equal(await page.locator(id).isVisible(), !easy, `${name}: ${id} ${easy ? 'nascosto' : 'visibile'}`);
assert.equal(await page.locator('#bocce-power').isVisible(), !easy, 'la sensibilità solo con lo sterzo vero');
// Il pulsante Gas accende il gas; un altro tocco lo spegne e nella guida semplice si frena.
if (mobile) await page.locator('#bocce-throw').tap(); else await page.locator('#bocce-throw').click();
// Nella guida semplice il pulsante Gas si tiene premuto (giù gas, su freno) e la scritta non cambia; con lo
// sterzo vero un tocco accende il gas e un altro lo spegne.
const gas = page.locator('#bocce-throw');
if (easy) await gas.dispatchEvent('pointerdown', { pointerId: 5, pointerType: mobile ? 'touch' : 'mouse', isPrimary: true });
else await gas.click();
await page.waitForFunction(() => game.closeup.riders.find(r => r.id === 'andrea').v > 40, null, { timeout: 15000 });
assert.equal(await gas.textContent(), easy ? 'Gas' : 'Molla');
await page.screenshot({ path: `${out}/${name}-${level}.png` });
if (mobile) await page.locator('#bocce-throw').tap(); else await page.locator('#bocce-throw').click();
if (easy) await gas.dispatchEvent('pointerup', { pointerId: 5, pointerType: mobile ? 'touch' : 'mouse', isPrimary: true });
else await gas.click();
const v = await page.evaluate(() => game.closeup.riders.find(r => r.id === 'andrea').v);
await page.waitForTimeout(300);
const after = await page.evaluate(() => game.closeup.riders.find(r => r.id === 'andrea').v);