feat: adopt 1920x1080 baseline

This commit is contained in:
2026-07-12 11:45:01 +09:00
parent c8e8ee4b3a
commit 3daad2861b
14 changed files with 1231 additions and 729 deletions

View File

@@ -1,7 +1,15 @@
import { spawn } from 'node:child_process';
import { chromium } from 'playwright';
const targetUrl = process.env.VERIFY_URL ?? 'http://localhost:5173/';
const targetUrl = withCanvasRenderer(process.env.VERIFY_URL ?? 'http://localhost:5173/');
const baselineViewport = { width: 1920, height: 1080 };
const legacyUiScale = 1.5;
function withCanvasRenderer(url) {
const parsed = new URL(url);
parsed.searchParams.set('renderer', 'canvas');
return parsed.toString();
}
let serverProcess;
let browser;
@@ -10,7 +18,7 @@ try {
serverProcess = await ensureLocalServer(targetUrl);
browser = await chromium.launch({ headless: true });
const page = await browser.newPage({ viewport: { width: 1280, height: 720 } });
const page = await browser.newPage({ viewport: baselineViewport });
await page.goto(targetUrl, { waitUntil: 'domcontentloaded' });
await page.evaluate(() => window.localStorage.clear());
@@ -48,7 +56,7 @@ try {
throw new Error(`Expected defeat to save retry-ready first battle state: ${JSON.stringify(defeatSave.current)}`);
}
await page.mouse.click(884, 642);
await clickLegacyUi(page, 884, 642);
await waitForBattleReady(page, 'first-battle-zhuo-commandery');
const retriedBattle = await page.evaluate(() => window.__HEROS_DEBUG__?.battle());
const retriedLiuBei = retriedBattle?.units?.find((unit) => unit.id === 'liu-bei');
@@ -71,7 +79,7 @@ try {
await waitForBattleOutcome(page, 'victory');
await page.screenshot({ path: 'dist/verification-save-victory-result.png', fullPage: true });
await page.mouse.click(738, 642);
await clickLegacyUi(page, 738, 642);
await advanceUntilCamp(page);
await page.screenshot({ path: 'dist/verification-save-victory-camp.png', fullPage: true });
@@ -191,7 +199,7 @@ async function advanceUntilCamp(page) {
}
if (state.activeScenes.includes('BattleScene') && state.battle?.battleOutcome === 'victory' && state.battle?.resultVisible) {
await page.mouse.click(738, 642);
await clickLegacyUi(page, 738, 642);
} else {
await page.keyboard.press('Space');
}
@@ -263,3 +271,7 @@ async function canReach(url) {
function delay(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
async function clickLegacyUi(page, x, y, options) {
await page.mouse.click(x * legacyUiScale, y * legacyUiScale, options);
}