gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit4b59c03d4b59c03dHM50 mission: doc pathmre4b59c03d/tests/repro-t38.mjs

1.7 KB

  1. // repro for tracker#38: real clicks on the pager, logs URL + first tile + current page after each
  2. import { launchBrowser, sleep } from './cdp.mjs';
  3. const BASE = process.argv[2] || 'https://tracker.worldapi.org';
  4. const width = Number(process.argv[3] || 1280);
  5. const b = await launchBrowser({ debugPortRange: (process.env.REPRO_CHROME || '8736-8739').split('-').map(Number) });
  6. const p = await b.newPage();
  7. if (width < 600) await p.send('Emulation.setDeviceMetricsOverride', { width, height: 800, deviceScaleFactor: 2, mobile: true });
  8. await p.goto(BASE + '/movies');
  9. await sleep(2500);
  10. const state = () => p.evaluate(`JSON.stringify({ url: location.pathname, first: (document.querySelector('a.tile tile-title')||{}).textContent, cur: (document.querySelector('pagination li.current')||{}).textContent, items: Array.from(document.querySelectorAll('pagination li')).map(l=>l.textContent.trim()).join(' '), n: document.querySelectorAll('pagination').length })`);
  11. console.log('start', await state());
  12. for (const step of ['2', '3', 'Next', 'Previous', '10', 'BACK', 'FORWARD']) {
  13. if (step === 'BACK') await p.evaluate('history.back()');
  14. else if (step === 'FORWARD') await p.evaluate('history.forward()');
  15. else {
  16. const ok = await p.evaluate(`(() => { document.querySelectorAll('[data-t38]').forEach(e => e.removeAttribute('data-t38')); const bt = Array.from(document.querySelectorAll('pagination button')).find(b => b.textContent.trim() === ${JSON.stringify(step)}); if (!bt) return false; bt.setAttribute('data-t38', '1'); return true; })()`);
  17. if (!ok) { console.log(step, 'NO BUTTON'); continue; }
  18. await p.click('[data-t38]');
  19. }
  20. await sleep(2500);
  21. console.log(step.padEnd(8), await state());
  22. }
  23. console.log('problems', JSON.stringify(p.problems().slice(0, 5)));
  24. await b.close();

Branches

Latest commits

  • 4b59c03dHM50 mission: doc pathmre
  • ed526d67HM50 missionmre
  • 2f986ca3Log: RT50 passmre
  • 1c4715a4RT50 mission: day50 repro retestmre
  • 57d1c0dcLog: day50 retest requestmre
  • 60b1f419Log: Anton #336 result, wake checkmre
  • 919a18aalog: scratchmre
  • 6b504440status tidymre
  • 9332bd10log: DP70 livemre
  • be11daa0DP70 brief fixmre
  • 886a7028DP70 brief, HM67 mergedmre
  • b41cdd6dMerge hm67-searchids: packed search IDsmre
  • 385904eaReport HM67 matched heap measurements and gate proofmre
  • e5c9b659Pack retained search IDs into UTF-8 bytesmre
  • 62a5f6c7HM67 brief, HM66 mergedmre
  • b32b8440Merge hm66-catalogindex: packed catalog indexmre
  • 2db0f7adReport HM66 heap measurements and validationmre
  • 6ce15623Pack catalog lists and membership maps in UTF-8 bytesmre
  • 71134e21HM66 briefmre
  • ed4cbab2status timemre