Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

test(poki): sample button focus and retain failed gameplay state

yhh224faec3dcfd
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index 70c207533..b7646a04f 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -28,6 +28,8 @@ export const NOTES_FLOOR = 'v0.65.0';
* the reader recognises anyway.
*/
export const NOTED = {
+ 'test(poki): sample button focus and retain failed gameplay state':
+ { internal: 'Poki acceptance holds pointer presses across animation frames, acknowledges each actual hit and preserves failed gameplay state and hashed screenshots. Existing phase and hit deadlines remain enforced; the old CI export fails this stronger focus regression control.' },
'fix(example): return training keyboard focus when play resumes':
{ note: 'Training resumes with gameplay keyboard focus.' },
'fix(editor): refresh tile collision previews from live metadata':
diff --git a/tools/tests/poki-training.e2e.mjs b/tools/tests/poki-training.e2e.mjs
index 9fb41a3a5..e737d1c93 100644
--- a/tools/tests/poki-training.e2e.mjs
+++ b/tools/tests/poki-training.e2e.mjs
@@ -98,7 +98,10 @@ try {
const box = await page.evaluate(n => window.__estellaCooked.probe([n]).at[n], name);
assert(box, `Missing button ${name}`);
const scale = Math.min(surface.width / 800, surface.height / 450);
- await page.mouse.click(surface.width / 2 + box.x * scale, surface.height / 2 - box.y * scale);
+ await page.mouse.move(surface.width / 2 + box.x * scale, surface.height / 2 - box.y * scale);
+ await page.mouse.down();
+ await page.evaluate(() => new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve))));
+ await page.mouse.up();
await page.waitForTimeout(100);
};
const phase = expected => page.waitForFunction(prefix => window.__estellaCooked.probe(['DeviceStatus']).at.DeviceStatus.text.startsWith(prefix), expected.toUpperCase(), { timeout: 5000 });
@@ -172,7 +175,10 @@ try {
await page.keyboard.down(horizontal);
await page.waitForFunction(() => { const p=__estellaCooked.probe(['Player','Target']).at;return Math.hypot(p.Player.x-p.Target.x,p.Player.y-p.Target.y)<60; }, {}, { timeout: 6000 });
await page.keyboard.up(horizontal);
- for (let hit=0;hit<3;hit++) { await page.keyboard.press('Space', { delay: 80 }); await page.waitForTimeout(80); }
+ for (let hit=0;hit<3;hit++) {
+ await page.keyboard.press('Space', { delay: 80 });
+ await page.waitForFunction(expected => __estellaCooked.probe(['DeviceStatus']).at.DeviceStatus.text.includes(`Round: ${expected} / 3 hits`), hit + 1, { timeout: 5000 });
+ }
expected.push('stop'); await phase('finished'); await trace(); assert.match(await status(page), /Round: 3 \/ 3 hits/);
await snapshot('finished');
await click('TrainingReward'); expected.push('rewarded'); await phase('ad'); await trace();
@@ -204,7 +210,13 @@ try {
events: window.__events ?? [], audioStates: (window.__audioContexts ?? []).map(c => c.state),
audioOperations: window.__audioOperations ?? [],
status: window.__estellaCooked?.probe(['DeviceStatus']).at.DeviceStatus?.text,
- }));
+ probe: window.__estellaCooked?.probe(['DeviceStatus', 'Player', 'Target']),
+ visibility: document.visibilityState,
+ })).catch(diagnosticError => ({ unavailable: String(diagnosticError) }));
+ const file = `${mode}-${viewport.width}x${viewport.height}-failed.png`;
+ await page.screenshot({ path: path.join(out, file), timeout: 5000 }).then(() => {
+ observation.screenshots.push({ file, sha256: sha(path.join(out, file)) });
+ }).catch(captureError => { observation.captureError = String(captureError); });
throw error;
}
finally { await context.close(); }