ident
All repositories: gitoria
25.6 KB
// tests/signin.mjs — THE GATE OF ident#31: signing in to ident INSIDE the identity selector's panel. Real headless Chrome (tests/cdp.mjs).// A signed-out visitor opens the selector on an app's page: the panel holds ident's /embed/signin in an iframe (email → code → identity,// "This signs you in to ident."); choosing an identity takes the whole page to the app's return URL with ident_code and the app logs// the user in. A NEW address is sent on to ident in the same tab (/signin/<rid>/welcome), names/picks its identity there and is sent back.// Framing is allowed for the app's registered origins only. Own servers (NEVER the dev server, NEVER real mail):// ident :8700 (IDENT_MAIL_SINK), test app A :8701 (registered), an unregistered origin :8702 that frames the sign-in page// Chrome debug ports 8710-8719. Storage .scratch/signin-gate (wiped at start). Shots .scratch/signin-*.png (390 and 1280 px).// Run: node tests/signin.mjs (SIGNIN_GATE_APP=<other checkout> runs the same checks against that code, e.g. main: they must fail)import { spawn } from 'node:child_process';import { createServer } from 'node:http';import { readFileSync, writeFileSync, rmSync, mkdirSync, existsSync } from 'node:fs';import { dirname, join } from 'node:path';import { fileURLToPath } from 'node:url';import { launchBrowser, sleep } from './cdp.mjs';if (!process.env.HL_CHROME && existsSync('/opt/google/chrome/chrome')) process.env.HL_CHROME = '/opt/google/chrome/chrome';const APP = process.env.SIGNIN_GATE_APP || join(dirname(fileURLToPath(import.meta.url)), '..');const G = join(APP, '.scratch/signin-gate');const SHOTS = process.env.SIGNIN_SHOTS || join(APP, '.scratch');mkdirSync(SHOTS, { recursive: true });const P0 = Number(process.env.SIGNIN_GATE_PORT || 8700);const ID = 'http://127.0.0.1:' + P0, TA = 'http://127.0.0.1:' + (P0 + 1), EVIL = 'http://127.0.0.1:' + (P0 + 2);const CHROME_PORTS = (process.env.SIGNIN_GATE_CHROME || '8710-8719').split('-').map(Number);const J = JSON.stringify;let passed = 0, failed = 0;const check = (name, ok, detail = '') => { if (ok) { passed++; console.log(' ok ' + name); } else { failed++; console.log(' FAIL ' + name + (detail ? ' — ' + detail : '')); } };const procs = [];function start(cwd, env, log) {const p = spawn(join(APP, 'bin/hybriel'), ['project.hl'], { cwd, env: { ...process.env, SMTP_HOST: '', SMTP_USER: '', SMTP_PASSWORD: '', ...env }, stdio: ['ignore', 'pipe', 'pipe'] });let out = ''; p.stdout.on('data', d => { out += d; }); p.stderr.on('data', d => { out += d; });p.on('exit', () => writeFileSync(join(G, log), out));p.getOut = () => out; p.logName = log;procs.push(p); return p;}async function up(url) {for (const end = Date.now() + Number(process.env.IDENT_COLD_MS || 120000); Date.now() < end;) { try { await fetch(url + '/', { redirect: 'manual' }); return; } catch {} await sleep(250); }throw new Error('server did not come up: ' + url);}rmSync(G, { recursive: true, force: true });mkdirSync(join(G, 'main'), { recursive: true });start(APP, { IDENT_PORT: String(P0), IDENT_STORAGE: join(G, 'main', 'ident'), IDENT_SESSIONS: join(G, 'main', 'sess') + '/', IDENT_MAIL_SINK: join(G, 'main', 'mail.txt'), IDENT_IP_LIMIT: '1000', IDENT_IP_DAY_LIMIT: '1000' }, 'ident.log');start(join(APP, 'testapp'), { TESTAPP_PORT: String(P0 + 1), TESTAPP_URL: TA, IDENT_URL: ID, TESTAPP_STORE: join(G, 'testapp-a.json') }, 'testapp.log');let evilKey = '';const evil = createServer((req, res) => {res.writeHead(200, { 'content-type': 'text/html; charset=utf-8' });res.end(`<!doctype html><html><head><meta charset="utf-8"><title>not registered</title></head><body style="background:#222"><iframe id="f" width="360" height="400" src="${ID}/embed/signin?key=${evilKey}&return=${encodeURIComponent(TA + '/callback')}"></iframe></body></html>`);});await new Promise(r => evil.listen(P0 + 2, '127.0.0.1', r));await Promise.all([up(ID), up(TA)]);const lastCode = (email) => {const lines = readFileSync(join(G, 'main', 'mail.txt'), 'utf8').trim().split('\n').filter(l => l.startsWith(email + ' '));return lines.length ? lines[lines.length - 1].split(' ')[1] : null;};const sh = (hostSel, expr) => `(() => { const h = document.querySelector(${J(hostSel)}); const r = h && h.shadowRoot; if (!r) return null; return (${expr}); })()`;async function ready(p) { await p.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1', { label: 'hydrated' }); }async function viewport(p, w) { await p.send('Emulation.setDeviceMetricsOverride', { width: w, height: w < 500 ? 844 : 900, deviceScaleFactor: 1, mobile: w < 500 }); }// ---- driving the IFRAME: its JS worlds come from Runtime.executionContextCreated, its pointer input is the top page's -------------const worlds = new Map(); // sessionId → Map(frameId → contextId of the page's main world)function trackWorlds(p) {const m = new Map(); worlds.set(p, m);p.conn.onEvent((msg) => {if (msg.sessionId !== p.sessionId) return;const c = msg.params && msg.params.context;if (msg.method === 'Runtime.executionContextCreated' && c && c.auxData && c.auxData.isDefault) m.set(c.auxData.frameId, c.id);if (msg.method === 'Runtime.executionContextDestroyed') for (const [f, id] of m) if (id === msg.params.executionContextId) m.delete(f);if (msg.method === 'Runtime.executionContextsCleared') m.clear();});return p.send('Runtime.enable');}async function childFrame(p) {const t = await p.send('Page.getFrameTree');const c = (t.frameTree.childFrames || [])[0];return c ? c.frame : null;}async function fEval(p, expr) {const f = await childFrame(p);if (!f) throw new Error('no frame');const id = worlds.get(p).get(f.id);if (!id) throw new Error('no context for the frame');const r = await p.send('Runtime.evaluate', { contextId: id, expression: expr, returnByValue: true, awaitPromise: true });if (r.exceptionDetails) throw new Error('frame evaluate threw: ' + ((r.exceptionDetails.exception && r.exceptionDetails.exception.description) || r.exceptionDetails.text));return r.result.value;}async function fWait(p, expr, { timeout = 15000, label = '' } = {}) {const end = Date.now() + timeout; let last;while (Date.now() < end) { try { last = await fEval(p, expr); if (last) return last; } catch (e) { last = e.message; } await sleep(80); }let t = ''; try { t = await fEval(p, "document.body.innerText + ' || code=' + ((document.querySelector('#code') || {}).value)"); } catch {}throw new Error('frame waitFor timed out: ' + (label || expr.slice(0, 100)) + ' (' + last + ') frame text: ' + t);}const fReady = async (p) => {try { return await fWait(p, `!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1`, { label: 'frame hydrated' }); }catch (e) { throw new Error(e.message + ' :: ' + await fEval(p, `location.href + ' | ' + typeof window.__hl + ' | ' + (window.__hl && window.__hl.socket && window.__hl.socket.readyState) + ' | ' + [...document.scripts].map(s => s.type + ':' + (s.src || s.text.length)).join(',') + ' | seed ' + !!document.getElementById('hl-seed') + ' | ' + document.body.innerHTML.slice(-200)`)); }};async function frameOffset(p) { // the iframe's top-left in the top viewportreturn p.evaluate(sh('#selector', `(() => { const b = r.querySelector('iframe#signin').getBoundingClientRect(); return { x: b.left, y: b.top, w: b.width, h: b.height }; })()`));}async function fBox(p, sel) {const b = await fEval(p, `(() => { const el = document.querySelector(${J(sel)}); if (!el) return null; el.scrollIntoView({ block: 'center' }); const r = el.getBoundingClientRect(); return r.width ? { x: r.left + r.width / 2, y: r.top + r.height / 2, w: r.width, h: r.height } : null; })()`);if (!b) throw new Error('no box for ' + sel);return b;}async function fClick(p, sel) {await fWait(p, `!!document.querySelector(${J(sel)})`, { label: sel });const b = await fBox(p, sel), o = await frameOffset(p);const base = { x: Math.round(o.x + b.x), y: Math.round(o.y + b.y), button: 'left', clickCount: 1 };await p.send('Input.dispatchMouseEvent', { type: 'mouseMoved', ...base, buttons: 0 });await p.send('Input.dispatchMouseEvent', { type: 'mousePressed', ...base, buttons: 1 });await p.send('Input.dispatchMouseEvent', { type: 'mouseReleased', ...base, buttons: 0 });}async function fType(p, sel, text) {await fClick(p, sel);for (const ch of text) {await p.send('Input.dispatchKeyEvent', { type: 'keyDown', text: ch, unmodifiedText: ch, key: ch });await p.send('Input.dispatchKeyEvent', { type: 'keyUp', key: ch });}}async function shClick(p, inner) {const box = await p.waitFor(sh('#selector', `(() => { const el = r.querySelector(${J(inner)}); if (!el) return null; el.scrollIntoView({ block: 'center' }); const b = el.getBoundingClientRect(); return b.width ? { x: b.left + b.width / 2, y: b.top + b.height / 2 } : null; })()`), { label: 'shadow ' + inner });const base = { x: Math.round(box.x), y: Math.round(box.y), button: 'left', clickCount: 1 };await p.send('Input.dispatchMouseEvent', { type: 'mouseMoved', ...base, buttons: 0 });await p.send('Input.dispatchMouseEvent', { type: 'mousePressed', ...base, buttons: 1 });await p.send('Input.dispatchMouseEvent', { type: 'mouseReleased', ...base, buttons: 0 });}async function shot(p, name) {for (const w of [390, 1280]) {await viewport(p, w); await sleep(300);const over = await p.evaluate('document.documentElement.scrollWidth > window.innerWidth');check(`${name} @${w}px: the page does not overflow sideways`, !over);const { data } = await p.send('Page.captureScreenshot', { format: 'png', captureBeyondViewport: true });writeFileSync(join(SHOTS, `signin-${name}-${w}.png`), Buffer.from(data, 'base64'));}await viewport(p, 1280);}// every control of the frame: at least 44 px tall (taps) and inside the frame's widthasync function controlsOk(p, label) {const rows = await fEval(p, `[...document.querySelectorAll('input, button, a.button, #chooselist a')].filter(e => e.getBoundingClientRect().width).map(e => { const r = e.getBoundingClientRect(); return { id: e.id || e.className || e.tagName, h: Math.round(r.height), w: Math.round(r.width), right: Math.round(r.right), vw: innerWidth }; })`);const bad = rows.filter(r => r.h < 44 || r.right > r.vw);check(`${label}: every control is at least 44 px tall and inside the frame`, rows.length > 0 && bad.length === 0, J(bad.length ? bad : rows));}// the frame is exactly as tall as the current step (ident#31 follow-up SC): the page reports its height to the selector (postMessage), the// selector sets the frame height. At each width every step's content height is recorded together with the frame's height;// fitCheck() compares them per step after the last one (content + the card's own 8 px padding, no empty space below)const FIT = { 390: [], 1280: [] };async function fitRecord(p, label) {const w0 = await p.evaluate('innerWidth');for (const w of [390, 1280]) {await viewport(p, w); await sleep(1600);const content = await fEval(p, `Math.ceil(Math.max(...[...document.querySelectorAll('main *')].filter(e => e.getBoundingClientRect().height && e.tagName !== 'EMBED-CARD' && e.tagName !== 'MAIN' && e.id !== 'message').map(e => e.getBoundingClientRect().bottom)) + scrollY)`);const frame = await p.evaluate(sh('#selector', `r.querySelector('iframe').offsetHeight`));FIT[w].push({ label, content, frame });}await viewport(p, w0 > 500 ? 1280 : 390);}function fitCheck() {for (const w of [390, 1280]) {for (const r of FIT[w]) check(`@${w}px ${r.label} step: the frame (${r.frame} px) is as tall as its content (${r.content} px) plus the 8 px card padding, no empty space below`, r.frame >= r.content && r.frame <= r.content + 12, J(r));}}let browser1, browser2, browser3, browser4;const pages = [];try {for (const k of [1, 2, 3, 4]) {const b = await launchBrowser({ debugPortRange: CHROME_PORTS });if (k === 1) browser1 = b; if (k === 2) browser2 = b; if (k === 3) browser3 = b; if (k === 4) browser4 = b;}const mk = async (b) => { const pg = await b.newPage(); pages.push(pg); await trackWorlds(pg); await viewport(pg, 1280); return pg; };const p = await mk(browser1);// ==== setup: alice's account (signed in on ident), the app, the test app =============console.log('# setup');const ALICE = '[email protected]', BOB = '[email protected]';await p.goto(ID + '/'); await p.waitForSelector('#email'); await ready(p);await p.type('#email', ALICE); await p.click('#sendcode');await p.waitFor('/\\/code$/.test(location.pathname) && !!document.querySelector("#code")'); await ready(p);await p.type('#code', lastCode(ALICE)); await p.click('#verify');await p.waitForSelector('#skip'); await p.click('#skip');await p.waitFor('!document.querySelector("#identityform")');await p.click('#newidentity'); await p.waitForSelector('#identityform');await p.type('#fidentityname', 'Work'); await p.click('#saveidentity');await p.waitFor('document.querySelectorAll("#identities li").length === 2');await p.goto(ID + '/apps'); await p.waitForSelector('#newapp'); await ready(p);await p.click('#newapp'); await p.waitForSelector('#appform');await p.type('#fappname', 'Signin app'); await p.type('#forigins', TA);await p.click('#saveapp'); await p.waitForSelector('#secret');const secret = (await p.text('#secret')).trim();const key = await p.evaluate('[...document.querySelectorAll("#apps app-key code")].map(e => e.textContent.trim()).pop()');await p.click('#secretdone');check('app registered', /^pk_[0-9a-f]{32}$/.test(key), key);evilKey = key;await p.goto(TA + '/');await p.type('#key', key, { clear: true }); await p.type('#secret', secret, { clear: true });await p.evaluate('window.__old = 1'); await p.click('#savesetup');await p.waitFor('!window.__old && document.readyState === "complete" && !!document.querySelector("#setupkey")');// ==== the headers of the frame page ====================================================console.log('# who may frame the page');const ret = encodeURIComponent(TA + '/callback');const fr = await fetch(`${ID}/embed/signin?key=${key}&return=${ret}`);const csp = fr.headers.get('content-security-policy') || '';check('/embed/signin answers 200 and may be framed by the app\'s origin only', fr.status === 200 && new RegExp('frame-ancestors http://127\\.0\\.0\\.1:' + (P0 + 1) + '(;|$)').test(csp) && !fr.headers.get('x-frame-options'), `${fr.status} ${csp} xfo=${fr.headers.get('x-frame-options')}`);const badRet = await fetch(`${ID}/embed/signin?key=${key}&return=${encodeURIComponent(EVIL + '/x')}`);check('a return URL outside the app\'s origins: 400 error page, never framed', badRet.status === 400 && /frame-ancestors 'none'/.test(badRet.headers.get('content-security-policy') || ''), String(badRet.status));const badKey = await fetch(`${ID}/embed/signin?key=pk_${'0'.repeat(32)}&return=${ret}`);check('an unknown key: 400', badKey.status === 400);const post = await fetch(`${ID}/embed/signin?key=${key}&return=${ret}`, { method: 'POST' });check('POST: 405', post.status === 405);// ==== the scripts reach browsers at once after a deploy: revalidate every load, 304 when unchanged ====console.log('# cache headers of the widget script');for (const path of ['/selector.js']) {const r1 = await fetch(ID + path);const cc = r1.headers.get('cache-control') || '', et = r1.headers.get('etag') || r1.headers.get('last-modified') || '';check(`${path}: Cache-Control has no-cache (and no max-age) and there is a validator`, /no-cache/.test(cc) && !/max-age=[1-9]/.test(cc) && et !== '', cc + ' | ' + et);const r2 = await fetch(ID + path, { headers: r1.headers.get('etag') ? { 'If-None-Match': r1.headers.get('etag') } : { 'If-Modified-Since': r1.headers.get('last-modified') || '' } });check(`${path}: a repeat request with the validator answers 304 with no body`, r2.status === 304 && (await r2.text()) === '', String(r2.status));}const avatarScript = await fetch(ID + '/avatar.js');check('avatar script was removed: /avatar.js answers 404', avatarScript.status === 404);const homeHtml = await (await fetch(ID + '/')).text();check('the shell loads no hand-written avatar script', !homeHtml.includes('/avatar.js'));// ==== A. a known address, signed out: email → code → identity → signed in on the app ======console.log('# A: known address, all in the selector panel');const q = await mk(browser2);await q.goto(TA + '/');await q.waitFor('!!customElements.get("ident-selector") && !!document.querySelector("#selector").shadowRoot');await shClick(q, '#choose');await q.waitFor(sh('#selector', `!!r.querySelector('iframe#signin') || !!r.querySelector('#message')`), { label: 'the signed-out panel' });await sleep(1500);await shot(q, 'step0-panel');check('signed out: the panel holds ident\'s sign-in frame and no new-tab link', await q.evaluate(sh('#selector', `!r.querySelector('a[target=_blank]') && r.querySelector('iframe#signin').src.startsWith(${J(ID + '/embed/signin?key=' + key)})`)));await fReady(q); await fWait(q, '!!document.querySelector("#email")');check('the frame says it signs the user in to ident', /This signs you in to ident\./.test(await fEval(q, 'document.body.innerText')));await shot(q, 'step1-email');await controlsOk(q, 'email step');await fitRecord(q, 'email');const h0 = await q.evaluate(sh('#selector', `r.querySelector('iframe').offsetHeight`));await q.evaluate(`postMessage({ identFrameHeight: 2500 }, '*')`); await sleep(500);check('a height message from another window (not ident\'s frame) is ignored', (await q.evaluate(sh('#selector', `r.querySelector('iframe').offsetHeight`))) === h0, String(h0));await fType(q, '#email', ALICE);await fClick(q, '#sendcode');await fWait(q, '!!document.querySelector("#code")', { label: 'code field' });check('code step: the same page, the address shown', /alice@example\.org/.test(await fEval(q, 'document.body.innerText')));await shot(q, 'step2-code');await controlsOk(q, 'code step');await fitRecord(q, 'code');await fType(q, '#code', lastCode(ALICE));await fClick(q, '#verify');await fWait(q, 'document.querySelectorAll("#chooselist li").length === 2 || /wrong|expired|error|refused/.test(document.body.innerText)', { label: 'identity list in the frame' });check('the right code lists both identities', (await fEval(q, 'document.querySelectorAll("#chooselist li").length')) === 2, await fEval(q, 'document.body.innerText'));const labels = await fEval(q, '[...document.querySelectorAll("#chooselist :is(a, button)")].map(a => a.tagName + "|" + a.target + "|" + a.querySelectorAll("identity-label").length).join(",")');check('identity step: each identity is one plain target=_top link holding its own label, no extra button (C31, ident#47)', labels === 'A|_top|1,A|_top|1', labels);check('identity step: no "Continue" anywhere in the frame (C31, ident#47)', !/continue/i.test(await fEval(q, 'document.body.innerText')), await fEval(q, 'document.body.innerText'));await shot(q, 'step3-identity');await controlsOk(q, 'identity step');await fitRecord(q, 'identity');await q.evaluate('window.__still = 1');check('app tests hook: every identity in the frame has #chooselist li .choose (ident#34, docs/IDENT.md)', (await fEval(q, 'document.querySelectorAll("#chooselist li .choose").length')) === 2);await fClick(q, '#chooselist li:nth-child(2) .choose');await q.waitFor(`location.href.startsWith(${J(TA + '/callback')}) && !!document.querySelector("#identity")`, { label: 'back on the app, signed in' });check('the whole app page went to its return URL and the app logged the user in', /^[2-9a-hj-km-np-z]{5}$/.test((await q.text('#identity')).trim()) && (await q.text('#userstate')) === 'new user');const idWork = (await q.text('#identity')).trim();check('the cookie of ident was set by the frame (a second visit lists the identities in the selector, no frame)', await (async () => {await q.goto(TA + '/');await q.waitFor('!!customElements.get("ident-selector") && !!document.querySelector("#selector").shadowRoot');await q.evaluate('document.querySelector("#selector").loggedIn = false; document.querySelector("#logout") && document.querySelector("#logout").click()');await q.goto(TA + '/');await q.waitFor('!!customElements.get("ident-selector") && !!document.querySelector("#selector").shadowRoot');await shClick(q, '#choose');return q.waitFor(sh('#selector', `r.querySelectorAll('[part~="identity"]').length === 2 && !r.querySelector('iframe')`), { label: 'list' });})());// a wrong code stays in the frameconsole.log('# wrong code, other address');const w = await mk(browser3);await w.goto(TA + '/'); await w.waitFor('!!customElements.get("ident-selector") && !!document.querySelector("#selector").shadowRoot');await shClick(w, '#choose'); await w.waitFor(sh('#selector', `!!r.querySelector('iframe#signin')`));await fReady(w); await fWait(w, '!!document.querySelector("#email")');await fType(w, '#email', ALICE); await fClick(w, '#sendcode'); await fWait(w, '!!document.querySelector("#code")');await fType(w, '#code', '000000'); await fClick(w, '#verify');await fWait(w, '/wrong code/.test(document.querySelector("#message").textContent)', { label: 'wrong code message' });check('a wrong code: the message in the frame, still signed out', true);await fClick(w, '#back');await fWait(w, '!!document.querySelector("#email")', { label: 'back to the email step' });check('"Other address" goes back to the email field in the frame', true);// ==== B. an unknown address: sent to ident in the same tab, back on the app ================console.log('# B: unknown address → ident → back signed in');const b = await mk(browser4);await b.goto(TA + '/'); await b.waitFor('!!customElements.get("ident-selector") && !!document.querySelector("#selector").shadowRoot');await shClick(b, '#choose'); await b.waitFor(sh('#selector', `!!r.querySelector('iframe#signin')`));await fReady(b); await fWait(b, '!!document.querySelector("#email")');await fType(b, '#email', BOB); await fClick(b, '#sendcode'); await fWait(b, '!!document.querySelector("#code")');await fType(b, '#code', lastCode(BOB)); await fClick(b, '#verify');await fWait(b, '!!document.querySelector("#gonew")', { label: 'new-address step' });check('a new address: the frame says it needs an identity on ident and links the top window there', (await fEval(b, 'document.querySelector("#gonew").target + "|" + document.querySelector("#gonew").getAttribute("href")')).startsWith('_top|/signin/'));await shot(b, 'step3-new');await controlsOk(b, 'new-address step');await fitRecord(b, 'new');await fClick(b, '#gonew');await b.waitFor(`location.origin === ${J(ID)} && /\\/signin\\/[0-9a-f]{32}\\/welcome$/.test(location.pathname) && !!document.querySelector("#identityform")`, { label: 'ident welcome form in the top window' });await ready(b);check('the same tab is on ident, the default identity\'s name form is open', await b.evaluate('!!document.querySelector("#welcome") && !!document.querySelector("#skip")'));await b.type('#fidentityname', 'Bob');await b.click('#saveidentity');await b.waitForSelector('#chooselist');check('then the identity choice for the app', (await b.text('#appname')).trim() === 'Signin app' && (await b.evaluate('document.querySelectorAll("#chooselist li").length')) === 1);check('app tests hook: the identity choice on ident has #chooselist li .choose (ident#34, docs/IDENT.md)', (await b.evaluate('document.querySelectorAll("#chooselist li .choose").length')) === 1);await b.click('#chooselist li .choose');await b.waitFor(`location.href.startsWith(${J(TA + '/callback')}) && !!document.querySelector("#identity")`, { label: 'back on the app' });check('sent back to the app, signed in as a new user', (await b.text('#userstate')) === 'new user' && /^[2-9a-hj-km-np-z]{5}$/.test((await b.text('#identity')).trim()));// ==== C. a page of an unregistered origin cannot frame it ===================================console.log('# C: unregistered origin');const e = await mk(browser3);await e.goto(EVIL + '/');await sleep(1500);const ef = await childFrame(e);const loaded = ef ? await (async () => { try { const id = worlds.get(e).get(ef.id); if (!id) return false; const r = await e.send('Runtime.evaluate', { contextId: id, expression: '!!document.querySelector("#email")', returnByValue: true }); return r.result.value === true; } catch { return false; } })() : false;check('the framed sign-in page does not load on an unregistered origin (no email field, the browser blocks it)', !loaded, ef ? ef.url : 'no frame');await sleep(100);const log = e.messages.map(m => m.text).join('\n');check('the browser reported the frame-ancestors refusal', /frame-ancestors|Refused to frame/.test(log) || ef == null || /chrome-error/.test(ef.url || ''), log.slice(0, 200));// ==== D. console ==========================================================================const probs = pages.flatMap(pg => pg.problems().map(m => m.text)).filter(t => !/Refused to frame|frame-ancestors|ERR_BLOCKED|Failed to load resource/.test(t));check('no console errors', probs.length === 0, probs.slice(0, 3).join(' | '));} catch (err) {failed++; console.log(' FAIL gate crashed — ' + (err && err.stack || err));for (const pg of pages) console.log(' console: ' + pg.messages.map(m => m.level + ' ' + m.text).join(' || ').slice(0, 1500));} finally {for (const b of [browser1, browser2, browser3, browser4]) { try { await b.close(); } catch {} }for (const p of procs) { try { writeFileSync(join(G, p.logName), p.getOut()); p.kill(); } catch {} }evil.close();}fitCheck();console.log(`\n${passed} passed, ${failed} failed`);process.exit(failed ? 1 : 0);
Branches
Latest commits
- 0f6d1592Merge branch 'f18b-shell-session' into mainIdent
- 19868218|||PR ident#39 shell reads its session member instead of a cross-file emitmre
- 5d1b3fedMerge branch 'v61-day61' into mainIdent
- 83faeb15|||PR ident: vendor Hybriel day61mre
- b2572b34Merge branch 'v59-day59' into mainIdent
- 67cf016d|||PR ident: vendor Hybriel day59mre
- 600c043dMerge branch 'v58-day58' into mainIdent
- 365f8c80|||PR ident: vendor Hybriel day58mre
- 585126e5Merge branch 'f16-setf' into mainIdent
- 953bf03a|||PR ident setF mirror dropped (hybriel#370)mre
- a1419d9cMerge branch 'f15-navigate' into mainIdent
- 3b3e451f|||PR ident#36 navigate to the app instead of location.assignmre
- e36f4516Merge branch 'f14-online' into mainIdent
- 2c5eac91|||PR ident#38 online state without probe timermre
- bf1980f2Merge branch 'v56-day56' into mainIdent
- 62ae0adf|||PR ident: vendor Hybriel day56mre
- 0d18abc4Merge branch 'f13-avatar' into mainIdent
- 2a99730a|||PR ident#37 avatar in hlmre
- fa4ed25bMerge branch 'f11-upsert' into mainIdent
- 8f3d9bc9|||PR ident#42 keyed upsert and removemre