notes
All repositories: gitoria
2.4 KB
// tests/shots.mjs — pixel-compare shots of every page of notes at 390 and 1280 px (styles move, ST-notes).// node tests/shots.mjs <port> <outdir> <sessions-dir-of-a-storage-copy>// Signed out: /, /login/failed. Signed in (a copied session of a storage COPY): /, the first note, the delete question, /login/failed.import { mkdirSync, writeFileSync, readdirSync, readFileSync } from 'node:fs';import { join } from 'node:path';import { launchBrowser } from './cdp.mjs';if (!process.env.HL_CHROME) process.env.HL_CHROME = '/opt/google/chrome/chrome';const [port, out, sdir] = process.argv.slice(2);mkdirSync(out, { recursive: true });const BASE = `http://127.0.0.1:${port}`;const sleep = (ms) => new Promise(r => setTimeout(r, ms));let sid = null;for (const f of readdirSync(sdir)) { try { const j = JSON.parse(readFileSync(join(sdir, f), 'utf8')); if (j.user && j.user.id) { sid = j.id; break; } } catch {} }if (!sid) throw new Error('no signed-in session in the copy');const b = await launchBrowser({ debugPortRange: [8721, 8728] });try {for (const signed of [false, true]) {const p = await b.newPage();try {if (signed) await p.send('Network.setCookie', { name: 'notessid', value: sid, url: BASE });for (const w of [390, 1280]) {await p.send('Emulation.setDeviceMetricsOverride', { width: w, height: 900, deviceScaleFactor: 1, mobile: w < 600 });const shot = async (name) => {await sleep(1200);const { data } = await p.send('Page.captureScreenshot', { format: 'png', captureBeyondViewport: true });writeFileSync(join(out, `${signed ? 'in' : 'out'}-${name}-${w}.png`), Buffer.from(data, 'base64'));};await p.goto(BASE + '/'); await p.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1'); await shot('home');if (signed) {const href = await p.evaluate(`document.querySelector('#notes a').getAttribute('href')`);await p.goto(BASE + href); await p.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1');await p.waitFor(`!!document.querySelector('#notetext md-editor article > *')`); await shot('note');await p.click('#delete'); await p.waitFor(`!!document.querySelector('p.ask[open]')`); await shot('ask');}await p.goto(BASE + '/login/failed'); await shot('failed');}} finally { await p.close(); }}} finally { await b.close(); }
Branches
Latest commits
- 1f0457a5|||PR make provisional rejected-draft setup deterministicAtlas
- 996768bf|||PR WIP sequence note creation before provisional-id adoptionAtlas
- c49ce093|||PR WIP remove notes polling and use framework reachabilityAtlas
- c028ac61Merge branch 'notes-pr7-kunibert' into mainAtlas
- 9cc92bdfKeep conflict and history fixes while awaiting queued save supportAtlas
- a5c27cb6Allow real edits back to earlier text and honor configured identAtlas
- 15c46ced|||PR Preserve note edits, conflict bases and visible historyAtlas
- 4c6e0bf6Merge branch 'notes13-day61' into mainAtlas
- eb51864f|||PR Back/Forward via navigate, server drafts, Hybriel day61Atlas
- 3537cf7eMerge branch 'vendor-day59' into mainAtlas
- c13d188b|||PR Vendor Hybriel day59Atlas
- 24c95433Merge branch 'notes17-ghost-note' into mainAtlas
- ae1075b2Preserve rejected drafts during note ID adoptionAtlas
- 383cce23|||PR Prevent saved local edits from restoring deleted notesAtlas
- 99ca1cf6Merge branch 'vendor-day56' into mainAtlas
- 649cef37|||PR Vendor Hybriel day56Atlas
- aadd0abcMerge branch 'hl-standard-2' into mainAtlas
- 52ffac9f|||PR Keyboard and reload checks for the notes gate (HL-STANDARD F21, F5)Atlas
- 617ee8c0Merge branch 'hl-standard' into mainAtlas
- 452458ee|||PR Type the function parameters of notes' own .hl files (HL-STANDARD L10)Atlas