gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchf2-api-bugs26117255|||PR apps API: review comments on files with spaces in their namemref2-api-bugs/tests/cleanup-offline.mjs

1.8 KB

  1. // Run only against the isolated offline-shell fixture in the existing lisbeth Chrome.
  2. import { launchBrowser } from './cdp.mjs';
  3. import { writeFileSync } from 'node:fs';
  4. const out=process.argv[2], url=process.argv[3]||'http://w60-offline.localhost:8731/';
  5. let browser,page;const results=[];
  6. const targets=async()=>await(await fetch('http://127.0.0.1:9223/json/list')).json();
  7. writeFileSync(out+'-before-targets.json',JSON.stringify(await targets(),null,2));
  8. try {
  9. browser=await launchBrowser();page=await browser.newPage();writeFileSync(out+'-owned-target.txt',page.targetId);await browser.conn.send('Target.activateTarget',{targetId:page.targetId});
  10. for(const width of [390,1280]){
  11. await page.send('Emulation.setDeviceMetricsOverride',{width,height:width===390?844:900,deviceScaleFactor:1,mobile:width<600});await page.goto(url);await page.waitFor(`!!document.querySelector('#route')&&!!window.__hl&&window.__hl.socket?.readyState===1`,{timeout:30000});
  12. const state=()=>page.evaluate(`({navigatorOnline:navigator.onLine,shellOnline:!!document.querySelector('#online'),shellOffline:!!document.querySelector('#offline'),routeOnline:!!document.querySelector('#route-online')})`);
  13. const online=await state();await page.setOffline(true);await new Promise(r=>setTimeout(r,1500));const offline=await state();const {data}=await page.send('Page.captureScreenshot',{format:'png'});writeFileSync(out+'-'+width+'-offline.png',Buffer.from(data,'base64'));await page.setOffline(false);await new Promise(r=>setTimeout(r,1500));const restored=await state();results.push({width,online,offline,restored});console.log(JSON.stringify(results.at(-1)));
  14. }
  15. } finally {try{if(page){await page.setOffline(false);await page.close();}}finally{if(browser)browser.conn.close();}writeFileSync(out+'-results.json',JSON.stringify(results,null,2));writeFileSync(out+'-after-targets.json',JSON.stringify(await targets(),null,2));}

Branches

Latest commits

  • 26117255|||PR apps API: review comments on files with spaces in their namemre
  • b8796cecMerge branch 'f1-broken-json' into mainGitoria
  • 2f2959c5|||PR apps API: broken JSON body gives 400 invalid_json, not 500mre
  • f7c6ca07Merge branch 'ident-chooser-selector' into mainGitoria
  • 691abb8e|||PR tests: find ident identity choice without the removed .choose classmre
  • 16a3530fMerge branch 'heap-revert' into mainGitoria
  • 220a80e0|||PR Remove temporary /__heap route and heap helper; logmre
  • 13f0c342Merge branch 'hl25-records' into mainGitoria
  • a002ecb7|||PR records: HL25 report, heap helper, logmre
  • 2492a55cTemporary keyed /__heap route for the live memory snapshotmre
  • fefaedd2log: tracker PR-only, HL25 startedmre
  • 21aa57calog: parkmre
  • e9f950a8reports: G25c soakmre
  • a7783686log: deploy 9f41ffcmre
  • 9f41ffc1log: W30b mergedmre
  • bef635c1Merge branch 'w30b'mre
  • 15b996a5Org list: keyed rows by @id, newest first, concat instead of hand loopmre
  • c4f6d9e3reports: G25c growth huntmre
  • b88e39f1log: privacy cleanup donemre
  • bfd7826ddocs: neutral example organisation namemre