gitoria

layouts

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitc36b7595c36b7595list rows (notes, mail) stack their parts full width: the date no longer a one-letter column beside the titlemrec36b7595/tests/taps.mjs

4.4 KB

  1. // tests/taps.mjs — mission 006 audit: every showcase page at 390 px, tap targets < 44 px, inputs < 16 px, elements wider than 390,
  2. // plus the open states (sidebar overlay, user menu, search). Standalone: starts its own server.
  3. // TAPS_PORT=8762 TAPS_CHROME=8763-8764 node tests/taps.mjs [--json]
  4. import { spawn } from 'node:child_process';
  5. import { existsSync } from 'node:fs';
  6. import { dirname, join, resolve } from 'node:path';
  7. import { fileURLToPath } from 'node:url';
  8. import { launchBrowser } from './cdp.mjs';
  9. import { AUDIT } from './taps-audit.mjs';
  10. if (!process.env.HL_CHROME && existsSync('/opt/google/chrome/chrome')) process.env.HL_CHROME = '/opt/google/chrome/chrome';
  11. const APP = resolve(dirname(fileURLToPath(import.meta.url)), '..');
  12. const PORT = Number(process.env.TAPS_PORT || 8762);
  13. const [CH_FROM, CH_TO] = (process.env.TAPS_CHROME || '8763-8764').split('-').map(Number);
  14. const BASE = `http://127.0.0.1:${PORT}`;
  15. const sleep = (ms) => new Promise(r => setTimeout(r, ms));
  16. 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'];
  17. let server = null, browser = null, log = '';
  18. try {
  19. server = spawn(join(APP, 'bin/hybriel'), ['project.hl'], { cwd: APP, env: { ...process.env, LAYOUTS_PORT: String(PORT), LAYOUTS_WATCH: '0' }, stdio: ['ignore', 'pipe', 'pipe'] });
  20. server.stdout.on('data', d => log += d); server.stderr.on('data', d => log += d);
  21. 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); }
  22. browser = await launchBrowser({ debugPortRange: [CH_FROM, CH_TO] });
  23. const page = await browser.newPage();
  24. await page.send('Emulation.setDeviceMetricsOverride', { width: 390, height: 844, deviceScaleFactor: 1, mobile: true });
  25. 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); };
  26. const rows = [];
  27. const record = async (name) => { const a = await page.evaluate(AUDIT); rows.push({ name, ...a }); };
  28. for (const r of routes) {
  29. await open(r);
  30. await record(r);
  31. // open states: only on the first of a shell family to keep it short, but every page that has the toggles
  32. for (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']]) {
  33. const has = await page.evaluate(`(() => { const t = document.querySelector(${JSON.stringify(toggle)}); return !!t && getComputedStyle(t).display !== 'none' && !!document.querySelector(${JSON.stringify(pop)}); })()`);
  34. if (!has) continue;
  35. await page.click(toggle);
  36. try { await page.waitFor(`document.querySelector(${JSON.stringify(pop)}).matches(':popover-open')`, { timeout: 3000, label }); } catch { continue; }
  37. await sleep(150);
  38. await record(r + ' [' + label + ' open]');
  39. await page.evaluate(`document.querySelector(${JSON.stringify(pop)}).hidePopover()`);
  40. }
  41. }
  42. if (process.argv.includes('--json')) console.log(JSON.stringify(rows));
  43. let T = 0, TI = 0, W = 0, IN = 0;
  44. for (const r of rows) {
  45. const hard = r.taps.filter(t => !t.inline), inl = r.taps.filter(t => t.inline);
  46. T += hard.length; TI += inl.length; W += r.nwide; IN += r.inputs.length;
  47. 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}`);
  48. for (const t of hard.slice(0, 8)) console.log(` ${t.w}x${t.h} ${t.sel} "${t.text}"`);
  49. for (const t of r.wide.slice(0, 3)) console.log(` wide→${t.r} ${t.sel}`);
  50. for (const t of r.inputs.slice(0, 3)) console.log(` input ${t.px}px ${t.sel}`);
  51. }
  52. console.log(`TOTAL taps<44: ${T} (+${TI} inline-in-text) wide: ${W} inputs<16: ${IN} over ${rows.length} audits`);
  53. } finally {
  54. if (browser) { try { await browser.close(); } catch {} }
  55. if (server) { try { server.kill('SIGTERM'); } catch {} }
  56. }

Branches

Latest commits

  • c36b7595list rows (notes, mail) stack their parts full width: the date no longer a one-letter column beside the titlemre
  • 02aa74aasync components.hybriel 134b4e3: MdEditor builds an editor put into the page at once, redraws a surface put in anew (F5, hybriel#211)mre
  • 268b1c87sync components.hybriel 6b0936a: the 'edited' foldable drops the theme's border and marginmre
  • c51d039fsync components.hybriel 8d79ff7: bubble hugs its content, quiet 'edited' label; gate checksmre
  • f4ad7eecsync components 9a: shared Icon (icons/icons.hl), md-editor toolbar icons + single focus ring (components f4-icons ba96735)mre
  • db258c11sync-components: copy icons/icons.hl + README (F4); testsmre
  • badc1879md-editor.hl: verbatim copy of components f3-mdvalue (an older text handed back is kept)mre
  • 867a8375md-editor.hl: verbatim copy of components f3-mdvalue (an outside value change is shown by the editor)mre
  • 5d8d2c67tests: wait for hydration before real clicks after a navigation (H2)mre
  • 99db79f0re-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
  • 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