aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/jade/lib/nodes/index.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-01-25 11:09:13 -0800
committerAdam Soltys <[email protected]>2023-01-25 11:10:53 -0800
commitb933716cc1fc4a2a785796fb91ed2e3a43c2557c (patch)
treeada5ee54736ed3f6790047df4dc8960c14cb2248 /node_modules/jade/lib/nodes/index.js
parentadf35d736de2cd870e363abc28a0989158ea0b5b (diff)
downloadcoinos-server-b933716cc1fc4a2a785796fb91ed2e3a43c2557c.tar.gz
coinos-server-b933716cc1fc4a2a785796fb91ed2e3a43c2557c.zip
sample config
Diffstat (limited to 'node_modules/jade/lib/nodes/index.js')
0 files changed, 0 insertions, 0 deletions
.Exception */ .highlight .nf { color: #06B; font-weight: bold } /* Name.Function */ .highlight .nl { color: #369; font-style: italic } /* Name.Label */ .highlight .nn { color: #B06; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #369; font-weight: bold } /* Name.Property */ .highlight .nt { color: #B06; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #369 } /* Name.Variable */ .highlight .ow { color: #080 } /* Operator.Word */ .highlight .w { color: #BBB } /* Text.Whitespace */ .highlight .mb { color: #00D; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #00D; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #00D; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #00D; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #00D; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #D20; background-color: #FFF0F0 } /* Literal.String.Affix */ .highlight .sb { color: #D20; background-color: #FFF0F0 } /* Literal.String.Backtick */ .highlight .sc { color: #D20; background-color: #FFF0F0 } /* Literal.String.Char */ .highlight .dl { color: #D20; background-color: #FFF0F0 } /* Literal.String.Delimiter */ .highlight .sd { color: #D20; background-color: #FFF0F0 } /* Literal.String.Doc */ .highlight .s2 { color: #D20; background-color: #FFF0F0 } /* Literal.String.Double */ .highlight .se { color: #04D; background-color: #FFF0F0 } /* Literal.String.Escape */ .highlight .sh { color: #D20; background-color: #FFF0F0 } /* Literal.String.Heredoc */ .highlight .si { color: #33B; background-color: #FFF0F0 } /* Literal.String.Interpol */ .highlight .sx { color: #2B2; background-color: #F0FFF0 } /* Literal.String.Other */ .highlight .sr { color: #080; background-color: #FFF0FF } /* Literal.String.Regex */ .highlight .s1 { color: #D20; background-color: #FFF0F0 } /* Literal.String.Single */ .highlight .ss { color: #A60; background-color: #FFF0F0 } /* Literal.String.Symbol */ .highlight .bp { color: #038 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #06B; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #369 } /* Name.Variable.Class */ .highlight .vg { color: #D70 } /* Name.Variable.Global */ .highlight .vi { color: #33B } /* Name.Variable.Instance */ .highlight .vm { color: #369 } /* Name.Variable.Magic */ .highlight .il { color: #00D; font-weight: bold } /* Literal.Number.Integer.Long */
// The wizard's "Choose your look" step: a cover sits behind the avatar,
// defaulting to this pubkey's own, and its arrows (or a swipe) cycle the
// twelve nature covers with a counter; the preview copies are what load.
// Run: bun run build && bun tools/onboard-cover-test.js [screenshot.png]
import assert from 'node:assert/strict';
import puppeteer from './puppeteer.js';
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const server = Bun.serve({ port: 0, async fetch(req) {
  const p = new URL(req.url).pathname;
  const f = Bun.file('dist' + (p === '/' ? '/index.html' : p));
  return (await f.exists()) ? new Response(f) : new Response(Bun.file('dist/index.html'), { headers: { 'content-type': 'text/html' } });
} });
const browser = await puppeteer.launch({ executablePath: '/usr/bin/google-chrome', headless: true, args: ['--no-sandbox'] });
try {
  const page = await browser.newPage();
  const errors = [];
  page.on('pageerror', (e) => errors.push(String(e)));
  await page.setViewport({ width: 390, height: 844, deviceScaleFactor: 2 });
  await page.goto(server.url.href);
  await page.evaluate(() => localStorage.setItem('btc-wallet-network', 'regtest'));
  await page.reload(); await sleep(1200);
  const click = (x) => page.evaluate((x) => { const e = [...document.querySelectorAll('button')].find((n) => n.textContent.trim().toLowerCase().includes(x)); e?.click(); return !!e; }, x);
  await click('create a new wallet'); await sleep(1500);
  await click('skip verification'); await sleep(1500);
  await page.evaluate(() => localStorage.setItem('btc-wallet-onb-step', 'avatar'));
  await page.reload();
  await page.waitForSelector('.onb-cover', { timeout: 10000 });
  const state = () => page.evaluate(() => {
    const c = document.querySelector('.onb-cover');
    return { count: document.querySelector('.onb-cover-count').textContent, bg: c.style.backgroundImage };
  });
  const first = await state();
  assert.match(first.count, /^\d+ \/ 12$/, 'a default cover is chosen: ' + first.count);
  assert.match(first.bg, /covers-sm\/\d+\.webp/);
  const n = Number(first.count.split(' ')[0]);
  await page.click('.onb-cover-nav.next'); await sleep(100);
  assert.equal((await state()).count, `${n % 12 + 1} / 12`, 'next moves on, wrapping at twelve');
  await page.click('.onb-cover-nav.prev'); await page.click('.onb-cover-nav.prev'); await sleep(100);
  assert.equal((await state()).count, `${((n - 2 + 12) % 12) + 1} / 12`, 'previous goes back, wrapping');
  // a swipe left is "next"
  const box = await (await page.$('.onb-cover')).boundingBox();
  const before = Number((await state()).count.split(' ')[0]);
  // across the cover's open upper part (the avatar covers the lower middle)
  const y = box.y + box.height * 0.3;
  await page.mouse.move(box.x + box.width * 0.6, y);
  await page.mouse.down(); await page.mouse.move(box.x + box.width * 0.3, y, { steps: 5 }); await page.mouse.up();
  await sleep(100);
  assert.equal((await state()).count, `${before % 12 + 1} / 12`, 'a swipe left shows the next cover');
  // the cover image itself really loads, and the avatar sits over its bottom edge
  const loaded = await page.evaluate(async () => {
    const url = document.querySelector('.onb-cover').style.backgroundImage.match(/url\("?(.*?)"?\)/)[1];
    const im = new Image(); im.src = url; await im.decode(); return im.naturalWidth;
  });
  assert.equal(loaded, 750);
  const overlap = await page.evaluate(() => {
    const c = document.querySelector('.onb-cover').getBoundingClientRect(), a = document.querySelector('.onb-avatar').getBoundingClientRect();
    return a.top < c.bottom && a.bottom > c.bottom;
  });
  assert(overlap, 'the avatar overlaps the cover\'s bottom edge');
  if (process.argv[2]) await page.screenshot({ path: process.argv[2] });
  assert.deepEqual(errors, []);
  console.log('✓ the look step: default cover, arrows and swipe cycle twelve covers, avatar over the cover');
} finally { await browser.close(); server.stop(true); }
process.exit(0);