// Every button and drop-down a rich game shows, as the page would send it: [act, args]. Runs in a jsdom page of the // game (tests/harness.js load()) on whatever network it holds: city panels and their tabs, link panels, the left // lists, every dashboard tab, the bank, the sheets the big buttons open, the link window, the windows that move a // customer to another path, and armed two-click buttons. // Used by the envelope check (tests/mp-sim-contract.test.js) and the engine's timer audit and gate // (tests/mp-sim-determinism.test.js), which send them to a server realm. 'use strict'; function crawl(ev) { ev(`window.__btns=[];window.__grab=()=>{for(const el of document.querySelectorAll('[data-act],[data-chg]')){const act=el.dataset.act||el.dataset.chg;let a={};try{a=el.dataset.args?JSON.parse(el.dataset.args):{};}catch(e){a={bad:el.dataset.args};} if(el.dataset.chg){a={...a,v:el.value}}__btns.push([act,a]);}};`); const views = [ "for(const c of ['fra','ams','nyc','sin','syd']){for(const tab of ['cust','up','peer','infra','links']){UI.sel={type:'city',id:c};UI.tab=tab;renderPanel();__grab();}}", "for(const l of S.links.slice(0,40)){UI.sel={type:'link',id:l.id};renderPanel();__grab();}", "UI.leftOpen=true;for(const k of ['goals','deals','noc','nets']){UI.left=k;renderLeft();__grab();}", "$('dash').hidden=false;for(const k of DTABS){UI.dtab=k;renderDash();__grab();}$('dash').hidden=true;", 'ACT.bank();__grab();ACT.bankClose();', "for(const [a,x] of [['opsOpen',{}],['utilities',{city:'fra'}],['bstdOpen',{}],['pniAllOpen',{net:null}],['pniAllOpen',{net:'cog'}],['salesOpen',{}],['routingOpen',{}],['ip4Open',{}],['models',{}],['decomOpen',{}],['teEdit',{}]]){try{ACT[a](x);}catch(e){}__grab();closeModal();}", "openLinkModal('fra','nyc');__grab();closeModal();openLinkModal('fra','ams');__grab();closeModal();", // Moving a customer to another path (3.3.0): its buttons are only in that window. 'for(const b of S.biz.filter(b=>pathKind(b)).slice(0,6)){ACT.pathOpen({id:b.id});__grab();closeModal();}', "UI.confirm=null;for(const t of S.transit.slice(0,3)){UI.sel={type:'city',id:t.city};UI.tab='up';UI.confirm=t.id;renderPanel();__grab();}UI.confirm=null;", ]; for (const v of views) ev(v); return JSON.parse(ev('JSON.stringify(__btns)')); } module.exports = { crawl };