gitoria

notes

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchmainc028ac61Merge branch 'notes-pr7-kunibert' into mainAtlasmain/tests/shots.mjs

2.4 KB

  1. // tests/shots.mjs — pixel-compare shots of every page of notes at 390 and 1280 px (styles move, ST-notes).
  2. // node tests/shots.mjs <port> <outdir> <sessions-dir-of-a-storage-copy>
  3. // Signed out: /, /login/failed. Signed in (a copied session of a storage COPY): /, the first note, the delete question, /login/failed.
  4. import { mkdirSync, writeFileSync, readdirSync, readFileSync } from 'node:fs';
  5. import { join } from 'node:path';
  6. import { launchBrowser } from './cdp.mjs';
  7. if (!process.env.HL_CHROME) process.env.HL_CHROME = '/opt/google/chrome/chrome';
  8. const [port, out, sdir] = process.argv.slice(2);
  9. mkdirSync(out, { recursive: true });
  10. const BASE = `http://127.0.0.1:${port}`;
  11. const sleep = (ms) => new Promise(r => setTimeout(r, ms));
  12. let sid = null;
  13. 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 {} }
  14. if (!sid) throw new Error('no signed-in session in the copy');
  15. const b = await launchBrowser({ debugPortRange: [8721, 8728] });
  16. try {
  17. for (const signed of [false, true]) {
  18. const p = await b.newPage();
  19. try {
  20. if (signed) await p.send('Network.setCookie', { name: 'notessid', value: sid, url: BASE });
  21. for (const w of [390, 1280]) {
  22. await p.send('Emulation.setDeviceMetricsOverride', { width: w, height: 900, deviceScaleFactor: 1, mobile: w < 600 });
  23. const shot = async (name) => {
  24. await sleep(1200);
  25. const { data } = await p.send('Page.captureScreenshot', { format: 'png', captureBeyondViewport: true });
  26. writeFileSync(join(out, `${signed ? 'in' : 'out'}-${name}-${w}.png`), Buffer.from(data, 'base64'));
  27. };
  28. await p.goto(BASE + '/'); await p.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1'); await shot('home');
  29. if (signed) {
  30. const href = await p.evaluate(`document.querySelector('#notes a').getAttribute('href')`);
  31. await p.goto(BASE + href); await p.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1');
  32. await p.waitFor(`!!document.querySelector('#notetext md-editor article > *')`); await shot('note');
  33. await p.click('#delete'); await p.waitFor(`!!document.querySelector('p.ask[open]')`); await shot('ask');
  34. }
  35. await p.goto(BASE + '/login/failed'); await shot('failed');
  36. }
  37. } finally { await p.close(); }
  38. }
  39. } finally { await b.close(); }

Branches

Latest commits

  • 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
  • 23758cd6Re-vendor complete Hybriel plugins and runtime to day44mre
  • 5d7cc700Backup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
  • 3e07b1cfVendor complete Hybriel day39 plugin sources and librariesmre