1
0
Fork 0
polaris-task-force/tests/e2e/bomperator-mobile.e2e.spec.ts
Z8MB1E ce682becec feat(minigames): touch controls and responsive board for Bomperator
- Extract pressDir/releaseDir/stopAll edge callbacks; keyboard, D-pad and
  swipes all feed the same held-stack path (prediction, keepalives and the
  pending ledger stay input-source agnostic)
- BomperatorTouchControls: 4-way pad + stop center + plant button on coarse
  pointers, per-button pointer capture for hold-and-plant multi-touch
- Board gestures: dominant-axis swipe sets direction, quick tap stops
- Canvas scales via CSS (w-full h-auto, fixed internal buffer), so prediction
  is viewport-independent; touch-action/overscroll guards on the board
- Harness: backgrounded-tab scenario (4s rAF freeze under prod trace replay)
  proves resume never teleports (teleports=0, maxJump 0.43)
- E2E smoke at 390x844 hasTouch: page loads without horizontal overflow
2026-10-19 10:11:30 -04:00

37 lines
1.4 KiB
TypeScript

import { expect, test } from "@playwright/test";
/**
* Mobile layout smoke for Ordnance Disposal (touch-controls feature).
*
* Guards the responsive shell at phone size: login works on a coarse-pointer
* viewport, the game page renders, and nothing overflows horizontally. Real
* touch interaction (D-pad, swipes, multi-touch planting) is verified by
* manual playtest with a phone and desktop in one live match; automating the
* canvas itself would only re-test the engine, which the integration suite
* already covers deterministically.
*/
test.describe("Bomperator mobile layout", () => {
test.use({
viewport: { width: 390, height: 844 },
hasTouch: true,
isMobile: true,
});
test("game page loads at phone width without horizontal overflow", async ({ page }) => {
await page.goto("/login");
await page.getByLabel("Username").fill("dev");
await page.getByLabel("Password").fill("Test123");
await page.getByRole("button", { name: "Log in" }).click();
await page.waitForURL((url) => !url.pathname.startsWith("/login"), { timeout: 30_000 });
await page.goto("/minigames/bomperator");
await expect(
page.getByRole("heading", { name: /ordnance disposal/i }).first(),
).toBeVisible({ timeout: 60_000 });
const overflow = await page.evaluate(
() => document.documentElement.scrollWidth - document.documentElement.clientWidth,
);
expect(overflow).toBeLessThanOrEqual(1);
});
});