How to use the browsertime.logging function in browsertime

To help you get started, we’ve selected a few browsertime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sitespeedio / sitespeed.io / bin / browsertimeWebPageReplay.js View on Github external
connectivity: {
      profile: 'native',
      downstreamKbps: undefined,
      upstreamKbps: undefined,
      latency: undefined,
      engine: 'external'
    },
    viewPort: '1366x708',
    delay: 0,
    video: false,
    visualMetrics: false,
    resultDir: '/tmp/browsertime'
  };

  const btOptions = merge({}, parsed.argv.browsertime, defaultConfig);
  browsertime.logging.configure(parsed.argv);

  // We have a special hack in sitespeed.io when you set --mobile
  if (parsed.argv.mobile) {
    btOptions.viewPort = '360x640';
    btOptions['view-port'] = '360x640';
    if (btOptions.browser === 'chrome') {
      const emulation = get(
        btOptions,
        'chrome.mobileEmulation.deviceName',
        'iPhone 6'
      );
      btOptions.chrome.mobileEmulation = {
        deviceName: emulation
      };
    } else {
      btOptions.userAgent = iphone6UserAgent;
github sitespeedio / sitespeed.io / lib / plugins / browsertime / index.js View on Github external
open(context, options) {
    this.make = context.messageMaker('browsertime').make;
    this.useAxe = options.axe && options.axe.enable;
    this.options = merge({}, defaultConfig, options.browsertime);
    this.allOptions = options;
    merge(this.options, { verbose: options.verbose });
    this.firstParty = options.firstParty;
    this.options.mobile = options.mobile;
    this.storageManager = context.storageManager;
    this.resultUrls = context.resultUrls;
    this.postChromeTrace = options.postChromeTrace;
    this.pluginScripts = [];
    this.pluginAsyncScripts = [];
    browsertime.logging.configure(options);
    this.screenshotType = get(
      options,
      'browsertime.screenshotParams.type',
      defaultConfig.screenshotParams.type
    );
    this.scriptOrMultiple = options.multi;

    // hack for disabling viewport on Android that's not supported
    if (
      this.options.chrome &&
      this.options.chrome.android &&
      this.options.chrome.android.package
    ) {
      this.options.viewPort = undefined;
    }
github sitespeedio / coach / test / help / browsertimeSingleScript.js View on Github external
start: function(browser) {
    bt.logging.configure({});
    runner = new bt.SeleniumRunner({
      browser: browser,
      'timeouts': {
        'browserStart': 20000
      }
    });
    return runner.start();
  },
  stop: function() {
github sitespeedio / coach / test / help / browsertime.js View on Github external
start: function(browser) {
    bt.logging.configure({});
    runner = new bt.SeleniumRunner({
      browser: browser,
      'timeouts': {
        'browserStart': 20000
      }
    });
    return runner.start();
  },
  stop: function() {
github sitespeedio / coach / test / help / browsertimeRunner.js View on Github external
'use strict';

let Promise = require('bluebird'),
  browsertime = require('browsertime'),
  urlParser = require('url'),
  fs = require('fs'),
  webserver = require('./webserver'),
  path = require('path');

Promise.promisifyAll(fs);

browsertime.logging.configure({});

function getScript(ruleFileName, category) {
  const domPath = path.resolve(__dirname, '..', '..', 'lib', 'dom'),
    utilPath = path.resolve(domPath, 'util.js'),
    utilScript = fs.readFileAsync(utilPath, 'utf8'),
    rulePath = path.resolve(domPath, category, ruleFileName),
    ruleScript = fs.readFileAsync(rulePath, 'utf8');

  return Promise.join(
    utilScript,
    ruleScript,
    (utilScript, ruleScript) => utilScript + ' return ' + ruleScript
  );
}

module.exports = {
github sitespeedio / coach / lib / index.js View on Github external
async function runBrowsertime(url, script, options) {
  function browsertimeify(script) {
    return {
      coach: {
        domAdvice: script
      }
    };
  }

  browsertime.logging.configure(options);
  options.resultDir = process.cwd();

  const engine = new browsertime.Engine(options);
  const scripts = await browsertimeify(script);
  await engine.start();
  try {
    return engine.run(url, scripts);
  } finally {
    engine.stop();
  }
}

browsertime

Get performance metrics from your web page using Browsertime.

Apache-2.0
Latest version published 2 days ago

Package Health Score

81 / 100
Full package analysis

Similar packages