From 962189419a8c943a22a50a18c8d3ea4198eb76ae Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 10 Oct 2026 18:07:21 +0000 Subject: [PATCH] e2e: add tablet and foldable viewports to the layout matrix Z Fold cover/inner (portrait-ish and landscape-ish), Pixel Fold inner, half-folded flex posture (841x400), dual-screen spanned, iPad Air and iPad Pro 12.9. All pass the reachability assertions; the dead-band limit now scales with screen height. MATRIX_ONLY="WxH,WxH" runs a subset. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Tb8pW2KAN4oFkh1aK1BfD8 --- e2e/scenarios/05-layout-matrix.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/e2e/scenarios/05-layout-matrix.js b/e2e/scenarios/05-layout-matrix.js index 4092251..5573d04 100644 --- a/e2e/scenarios/05-layout-matrix.js +++ b/e2e/scenarios/05-layout-matrix.js @@ -14,6 +14,23 @@ for (const [w, h] of [[320, 568], [360, 640], [375, 667], [390, 844], [414, 896] } SIZES.push([1280, 720, 'mouse', 10], [1024, 768, 'mouse', 10], [800, 600, 'mouse', 10], [640, 400, 'mouse', 10]); // desktop windows (incl. 200% zoom of 1280x800) SIZES.push([320, 568, 'touch', 6], [667, 375, 'touch', 6], [390, 844, 'touch', 6], [1280, 720, 'mouse', 6]); // the palette as it ships today +// tablets and foldables (CSS px). Near-square unfolded screens sit right on the portrait/landscape switch; the half-folded +// "flex" posture is a very short wide viewport; the cover screen is a narrow tall phone. +SIZES.push( + [344, 800, 'touch', 6], // Galaxy Z Fold cover screen + [690, 830, 'touch', 6], // Galaxy Z Fold inner screen, portrait-ish + [830, 690, 'touch', 6], // ... and landscape-ish + [701, 841, 'touch', 6], [841, 701, 'touch', 6], // Pixel Fold inner screen + [841, 400, 'touch', 6], // half-folded flex posture + [1114, 705, 'touch', 6], // dual-screen device spanned across both panels + [820, 1180, 'touch', 6], [1180, 820, 'touch', 6], // iPad Air + [1024, 1366, 'touch', 6], [1366, 1024, 'touch', 6], // iPad Pro 12.9 +); +// MATRIX_ONLY="344x800,690x830" runs just those sizes (quick local runs) +if (process.env.MATRIX_ONLY) { + const only = process.env.MATRIX_ONLY.split(','); + for (let i = SIZES.length - 1; i >= 0; i--) if (!only.includes(SIZES[i][0] + 'x' + SIZES[i][1])) SIZES.splice(i, 1); +} // pretend the game ships 10 towers and 8 maps (the sim is untouched: clones of existing definitions) function stressContent() { @@ -140,7 +157,7 @@ module.exports = async function ({ browser, url: URL, out: OUT }) { check(!hud.tbOver && !hud.clipped, 'top bar content overflows or is cut off'); // stacked (portrait) layout: the stage hugs the board (no dead band above/below it, touch-4 / visual-10) and the cells are not smaller than before const lay = await page.evaluate(() => { const st = document.getElementById('stage').getBoundingClientRect(), r = NW.app.renderer, b = r.board, rot = r.rot > 0; return { stacked: matchMedia('(orientation: portrait), (max-width: 760px) and (min-height: 521px)').matches, deadY: st.height - (rot ? b.cols : b.rows) * r.cellSizePx(), cell: r.cellSizePx() }; }); - if (lay.stacked) check(lay.deadY <= 26, `stage has ${Math.round(lay.deadY)}px of dead band above/below the board`); + if (lay.stacked) check(lay.deadY <= Math.max(26, h * 0.025), `stage has ${Math.round(lay.deadY)}px of dead band above/below the board`); // 26px on phones, 2.5% of the height on big tablets const minCell = { '320x568': 11.5, '360x640': 14.3, '375x667': 15, '390x844': 19.5, '414x896': 21, '768x1024': 27 }[`${w}x${h}`]; if (minCell && touch) check(lay.cell >= minCell, `board cells are ${lay.cell.toFixed(1)}px, expected at least ${minCell}px`); if (touch) console.log(` ${w}x${h} cell ${lay.cell.toFixed(1)}px, stage dead band ${Math.round(lay.deadY)}px`);