layouts
All repositories: gitoria
4.4 KB
// tests/taps.mjs — mission 006 audit: every showcase page at 390 px, tap targets < 44 px, inputs < 16 px, elements wider than 390,// plus the open states (sidebar overlay, user menu, search). Standalone: starts its own server.// TAPS_PORT=8762 TAPS_CHROME=8763-8764 node tests/taps.mjs [--json]import { spawn } from 'node:child_process';import { existsSync } from 'node:fs';import { dirname, join, resolve } from 'node:path';import { fileURLToPath } from 'node:url';import { launchBrowser } from './cdp.mjs';import { AUDIT } from './taps-audit.mjs';if (!process.env.HL_CHROME && existsSync('/opt/google/chrome/chrome')) process.env.HL_CHROME = '/opt/google/chrome/chrome';const APP = resolve(dirname(fileURLToPath(import.meta.url)), '..');const PORT = Number(process.env.TAPS_PORT || 8762);const [CH_FROM, CH_TO] = (process.env.TAPS_CHROME || '8763-8764').split('-').map(Number);const BASE = `http://127.0.0.1:${PORT}`;const sleep = (ms) => new Promise(r => setTimeout(r, ms));const routes = ['/', '/elements', '/components', '/shells', '/docs', '/components/month-view', '/components/date-picker', '/components/range-picker', '/components/pagination', '/components/md-editor', '/components/code-editor', '/components/file-upload', '/components/modal', '/components/comments', '/components/files-upload', '/components/files-upload-pick', '/shells/content-first', '/shells/content-first/movie', '/shells/list-first', '/shells/list-first/trip', '/shells/three-pane', '/shells/three-pane/m2', '/search/modal'];let server = null, browser = null, log = '';try {server = spawn(join(APP, 'bin/hybriel'), ['project.hl'], { cwd: APP, env: { ...process.env, LAYOUTS_PORT: String(PORT), LAYOUTS_WATCH: '0' }, stdio: ['ignore', 'pipe', 'pipe'] });server.stdout.on('data', d => log += d); server.stderr.on('data', d => log += d);for (let i = 0; ; i++) { try { if ((await fetch(BASE + '/')).ok) break; } catch {} if (i > 1600) throw new Error('no server\n' + log); await sleep(250); }browser = await launchBrowser({ debugPortRange: [CH_FROM, CH_TO] });const page = await browser.newPage();await page.send('Emulation.setDeviceMetricsOverride', { width: 390, height: 844, deviceScaleFactor: 1, mobile: true });const open = async (path) => { await page.goto(BASE + path, { timeout: 45000 }); await page.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1', { timeout: 30000, label: path }); await sleep(300); };const rows = [];const record = async (name) => { const a = await page.evaluate(AUDIT); rows.push({ name, ...a }); };for (const r of routes) {await open(r);await record(r);// open states: only on the first of a shell family to keep it short, but every page that has the togglesfor (const [label, toggle, pop] of [['sidebar', 'application-header .menu-toggle', '#sidebar'], ['user-menu', 'user-menu .user-toggle', '#user-menu'], ['search', 'application-header .search-toggle', '#app-search']]) {const has = await page.evaluate(`(() => { const t = document.querySelector(${JSON.stringify(toggle)}); return !!t && getComputedStyle(t).display !== 'none' && !!document.querySelector(${JSON.stringify(pop)}); })()`);if (!has) continue;await page.click(toggle);try { await page.waitFor(`document.querySelector(${JSON.stringify(pop)}).matches(':popover-open')`, { timeout: 3000, label }); } catch { continue; }await sleep(150);await record(r + ' [' + label + ' open]');await page.evaluate(`document.querySelector(${JSON.stringify(pop)}).hidePopover()`);}}if (process.argv.includes('--json')) console.log(JSON.stringify(rows));let T = 0, TI = 0, W = 0, IN = 0;for (const r of rows) {const hard = r.taps.filter(t => !t.inline), inl = r.taps.filter(t => t.inline);T += hard.length; TI += inl.length; W += r.nwide; IN += r.inputs.length;console.log(`${r.name.padEnd(48)} scrollW ${r.sw} taps<44 ${String(hard.length).padStart(3)}/${r.n} (+${inl.length} inline-in-text) wide>390 ${r.nwide} inputs<16px ${r.inputs.length}`);for (const t of hard.slice(0, 8)) console.log(` ${t.w}x${t.h} ${t.sel} "${t.text}"`);for (const t of r.wide.slice(0, 3)) console.log(` wide→${t.r} ${t.sel}`);for (const t of r.inputs.slice(0, 3)) console.log(` input ${t.px}px ${t.sel}`);}console.log(`TOTAL taps<44: ${T} (+${TI} inline-in-text) wide: ${W} inputs<16: ${IN} over ${rows.length} audits`);} finally {if (browser) { try { await browser.close(); } catch {} }if (server) { try { server.kill('SIGTERM'); } catch {} }}
Branches
Latest commits
- 30353f60tests: e2e-md-showcase Chrome range from LAYOUTS_GATE_CHROME_MD, default unchangedmre
- 16a7878cre-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
- 6af559e8docker-compose: nofile 65536 (Hybriel int 6+ boot opened >1024 files in the tracker)mre
- 5599cf56deploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
- 0bcc6294Mission 011: e2e-197, brief, report, LOGmre
- 137303c5MainMenu marks the current page from the route (hybriel#197, server-rendered); current prop/item.current stay as fallback; tracker demo drops current; gate: SSR marker; docsmre
- 9325b403Re-vendor Hybriel to master 7f13a82f (hl:web batch 2: #190 #193 #197 #194 named regions); plugins whole, bin/hybriel static build (git-ignored)mre
- b31dc74dusage: calendar (theme 76f99f6-era ContentFirst, user menu, ☰ menu) and tracker (theme 76f99f6, modal + pagination current, own current marker until hybriel#197) rowsmre
- 8a3d5d40Mission 010: brief, report, LOG, STATUSmre
- a56abf1fSync components to components.hybriel 3794c59 (MdEditor real-key fixes); showcase real-key check on the md-editor pagemre
- 76f99f64E2E in lisbeth's Chrome for the menu's current page (mission 009): tests/e2e-menu-current.mjs, reportmre
- 159b1d53MainMenu/Sidebar: current page marked beyond colour, count badge, item current flag; gate 300/0 (mission 009)mre
- 0573eed3usage: notes + tickets on MdEditor (md-editor.js retired), gitoria on theme dbe3de7, tracker theme oldermre
- 78478f6eSync showcase to components.hybriel 1442e58: pick-mode page, comments attach, md-editor rows/files off; gates 285/0mre
- dbe3de79Display bugs from a real Chrome walk (mission 007): Settings page and in-shell doc reader instead of raw .md links, closed phone search hidden whatever a page says, /elements form rules scoped, three-pane danger contrast; display audit gate (132 -> 244 checks), walk + Settings e2e toolsmre
- 1875a051Theme: 44 px tap targets mobile first (layoutTap), 16 px fields, desktop denser only in @media 60rem; 390 px tap audit + gate checks (mission 006)mre
- 3d4f8e19Sync showcase to components.hybriel 9db927d: comments and files-upload pages, pagination onPage, md-editor readonly, gate 99 checksmre
- 64d635acmission brief 005mre
- 0d0fef25paths: projects moved into /media/STORAGE/projects/WorldAPI/mre
- 2dbe0df5Re-vendor Hybriel to the shared static build 0f396652 (plugins; bin/ is git-ignored), compose cache volume + tmpfs /tmp, gate wait 120 s, report 004mre