tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

perftest_http3_cloudflareblog.js (1687B)


      1 // This Source Code Form is subject to the terms of the Mozilla Public
      2 // License, v. 2.0. If a copy of the MPL was not distributed with this
      3 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
      4 /* eslint-env node */
      5 
      6 /*
      7 Ensure the `--firefox.preference=network.http.http3.enable:true` is
      8 set for this test.
      9 */
     10 
     11 async function test(context, commands) {
     12  let rootUrl = "https://blog.cloudflare.com/";
     13  let waitTime = 1000;
     14 
     15  if (
     16    (typeof context.options.browsertime !== "undefined") &
     17    (typeof context.options.browsertime.waitTime !== "undefined")
     18  ) {
     19    waitTime = context.options.browsertime.waitTime;
     20  }
     21 
     22  // Make firefox learn of HTTP/3 server
     23  // XXX: Need to build an HTTP/3-specific conditioned profile
     24  // to handle these pre-navigations.
     25  await commands.navigate(rootUrl);
     26 
     27  let cycles = 1;
     28  for (let cycle = 0; cycle < cycles; cycle++) {
     29    // Measure initial pageload
     30    await commands.measure.start("pageload");
     31    await commands.navigate(rootUrl);
     32    await commands.measure.stop();
     33    commands.measure.result[0].browserScripts.pageinfo.url =
     34      "Cloudflare Blog - Main";
     35 
     36    // Wait for X seconds
     37    await commands.wait.byTime(waitTime);
     38 
     39    // Measure navigation pageload
     40    await commands.measure.start("pageload");
     41    await commands.click.byJsAndWait(`
     42      document.querySelectorAll("article")[0].querySelector("a")
     43    `);
     44    await commands.measure.stop();
     45    commands.measure.result[1].browserScripts.pageinfo.url =
     46      "Cloudflare Blog - Article";
     47  }
     48 }
     49 
     50 module.exports = {
     51  test,
     52  owner: "Network Team",
     53  name: "cloudflare",
     54  component: "netwerk",
     55  description: "User-journey live site test for Cloudflare blog.",
     56 };