feat: adopt 1920x1080 baseline
This commit is contained in:
@@ -6,7 +6,7 @@ import { chromium } from 'playwright';
|
||||
|
||||
const cliOptions = parseCliOptions(process.argv.slice(2));
|
||||
const defaultQaPort = process.env.QA_PORT ?? '41737';
|
||||
const targetUrl = process.env.QA_URL ?? `http://127.0.0.1:${defaultQaPort}/`;
|
||||
const targetUrl = withCanvasRenderer(process.env.QA_URL ?? `http://127.0.0.1:${defaultQaPort}/`);
|
||||
const headless = process.env.QA_HEADLESS !== '0';
|
||||
const maxRounds = Number(process.env.QA_MAX_ROUNDS ?? 80);
|
||||
const cumulativeMode = process.env.QA_CUMULATIVE === '1';
|
||||
@@ -15,12 +15,41 @@ const campaignStorageKey = 'heros-web:campaign-state';
|
||||
const campaignSlotStorageKey = 'heros-web:campaign-state:slot-1';
|
||||
const campaignSnapshotPath = process.env.QA_CAMPAIGN_SNAPSHOT_PATH;
|
||||
const resumeCampaignSnapshot = process.env.QA_RESUME_CAMPAIGN_SNAPSHOT === '1';
|
||||
const baselineViewport = { width: 1920, height: 1080 };
|
||||
|
||||
function withCanvasRenderer(url) {
|
||||
const parsed = new URL(url);
|
||||
parsed.searchParams.set('renderer', 'canvas');
|
||||
return parsed.toString();
|
||||
}
|
||||
const supplyLabels = {
|
||||
bean: '\uCF69',
|
||||
salve: '\uC0C1\uCC98\uC57D',
|
||||
wine: '\uD0C1\uC8FC'
|
||||
};
|
||||
|
||||
async function clickBattleDeploymentStart(page) {
|
||||
const point = await page.evaluate(() => {
|
||||
const scene = window.__HEROS_GAME__?.scene.getScene('BattleScene');
|
||||
const layout = scene?.layout;
|
||||
const canvas = document.querySelector('canvas');
|
||||
const bounds = canvas?.getBoundingClientRect();
|
||||
if (!scene || !layout || !canvas || !bounds) {
|
||||
return null;
|
||||
}
|
||||
const logicalX = layout.panelX + 24 + (layout.panelWidth - 48) / 2;
|
||||
const logicalY = layout.panelY + layout.panelHeight - 76 + 17;
|
||||
return {
|
||||
x: bounds.left + logicalX * bounds.width / scene.scale.width,
|
||||
y: bounds.top + logicalY * bounds.height / scene.scale.height
|
||||
};
|
||||
});
|
||||
if (!point || !Number.isFinite(point.x) || !Number.isFinite(point.y)) {
|
||||
throw new Error(`Expected a runtime deployment start point: ${JSON.stringify(point)}`);
|
||||
}
|
||||
await page.mouse.click(point.x, point.y);
|
||||
}
|
||||
|
||||
const coreBrothers = ['liu-bei', 'guan-yu', 'zhang-fei'];
|
||||
const xuzhouFullSortie = ['liu-bei', 'guan-yu', 'zhang-fei', 'jian-yong', 'mi-zhu'];
|
||||
const caoRefugeSortie = ['liu-bei', 'guan-yu', 'zhang-fei', 'jian-yong', 'mi-zhu'];
|
||||
@@ -1148,7 +1177,7 @@ try {
|
||||
const browser = await chromium.launch({ headless });
|
||||
|
||||
try {
|
||||
const page = await browser.newPage({ viewport: { width: 1280, height: 720 } });
|
||||
const page = await browser.newPage({ viewport: baselineViewport });
|
||||
const results = [];
|
||||
|
||||
for (const battle of representativeBattles) {
|
||||
@@ -1511,7 +1540,7 @@ async function startDeploymentIfNeeded(page, battleId) {
|
||||
return;
|
||||
}
|
||||
|
||||
await page.mouse.click(1085, 637);
|
||||
await clickBattleDeploymentStart(page);
|
||||
await page.waitForFunction(
|
||||
(expectedBattleId) => {
|
||||
const battle = window.__HEROS_DEBUG__?.battle();
|
||||
|
||||
Reference in New Issue
Block a user