Update browsertime 17.0.0 beta (#3747)

This commit is contained in:
Peter Hedenskog 2022-10-31 21:58:11 +01:00 committed by GitHub
parent 91e99f03e0
commit 84a3498d50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 756 additions and 514 deletions

View File

@ -4,4 +4,7 @@ assets/*
sitespeed-result/*
lib/plugins/yslow/scripts/*
lib/plugins/html/assets/js/*
lib/plugins/browsertime/index.js
lib/plugins/browsertime/analyzer.js
bin/browsertimeWebPageReplay.js
test/data/*

View File

@ -5,7 +5,7 @@
"es6": true
},
"parserOptions": {
"ecmaVersion": 8
"ecmaVersion": 2018
},
"plugins": ["prettier"],
"extends": "eslint:recommended",

View File

@ -1,4 +1,4 @@
FROM sitespeedio/webbrowsers:chrome-106.0-firefox-106.0-edge-106.0
FROM sitespeedio/webbrowsers:chrome-107.0-firefox-106.0-edge-106.0-b
ARG TARGETPLATFORM=linux/amd64

View File

@ -3,7 +3,6 @@
'use strict';
const yargs = require('yargs');
const browsertime = require('browsertime');
const merge = require('lodash.merge');
const getURLs = require('../lib/cli/util').getURLs;
const get = require('lodash.get');
@ -140,8 +139,15 @@ async function runBrowsertime() {
}
};
const {BrowsertimeEngine, configureLogging} = await import ('browsertime');
const btOptions = merge({}, parsed.argv.browsertime, defaultConfig);
browsertime.logging.configure(parsed.argv);
// hack to keep backward compability to --android
if (parsed.argv.android[0] === true) {
set(btOptions, 'android.enabled', true);
}
configureLogging(parsed.argv);
// We have a special hack in sitespeed.io when you set --mobile
if (parsed.argv.mobile) {
@ -171,7 +177,7 @@ async function runBrowsertime() {
);
}
}
const engine = new browsertime.Engine(btOptions);
const engine = new BrowsertimeEngine(btOptions);
const urls = getURLs(parsed.argv._);
try {

View File

@ -276,13 +276,13 @@ module.exports.parseCommandLine = function parseCommandLine() {
describe: 'Send only limited metrics from one run to the datasource.',
group: 'Browser'
})
.option('browsertime.gnirehtet', {
alias: 'gnirehtet',
.option('browsertime.android.gnirehtet', {
alias: ['gnirehtet', 'browsertime.gnirehtet'],
type: 'boolean',
default: false,
describe:
'Start gnirehtet and reverse tethering the traffic from your Android phone.',
group: 'Browser'
group: 'Android'
})
.option('browsertime.connectivity.profile', {
alias: 'c',
@ -811,32 +811,42 @@ module.exports.parseCommandLine = function parseCommandLine() {
describe:
'Short key to use Android. Will automatically use com.android.chrome for Chrome and stable Firefox. If you want to use another Chrome version, use --chrome.android.package'
})
.option('browsertime.androidRooted', {
alias: 'androidRooted',
.option('browsertime.android.rooted', {
alias: ['androidRooted', 'browsertime.androidRooted'],
type: 'boolean',
default: false,
describe:
'If your phone is rooted you can use this to set it up following Mozillas best practice for stable metrics.'
'If your phone is rooted you can use this to set it up following Mozillas best practice for stable metrics.',
group: 'Android'
})
.option('browsertime.androidBatteryTemperatureLimit', {
alias: 'androidBatteryTemperatureLimit',
.option('browsertime.android.batteryTemperatureLimit', {
alias: [
'androidBatteryTemperatureLimit',
'browsertime.androidBatteryTemperatureLimit'
],
type: 'integer',
describe:
'Do the battery temperature need to be below a specific limit before we start the test?'
'Do the battery temperature need to be below a specific limit before we start the test?',
group: 'Android'
})
.option('browsertime.androidBatteryTemperatureWaitTimeInSeconds', {
alias: 'androidBatteryTemperatureWaitTimeInSeconds',
.option('browsertime.android.batteryTemperatureWaitTimeInSeconds', {
alias: [
'androidBatteryTemperatureWaitTimeInSeconds',
'browsertime.androidBatteryTemperatureWaitTimeInSeconds'
],
type: 'integer',
default: 120,
describe:
'How long time to wait (in seconds) if the androidBatteryTemperatureWaitTimeInSeconds is not met before the next try'
'How long time to wait (in seconds) if the androidBatteryTemperatureWaitTimeInSeconds is not met before the next try',
group: 'Android'
})
.option('browsertime.androidVerifyNetwork', {
alias: 'androidVerifyNetwork',
.option('browsertime.android.verifyNetwork', {
alias: ['androidVerifyNetwork', 'browsertime.androidVerifyNetwork'],
type: 'boolean',
default: false,
describe:
'Before a test start, verify that the device has a Internet connection by pinging 8.8.8.8 (or a configurable domain with --androidPingAddress)'
'Before a test start, verify that the device has a Internet connection by pinging 8.8.8.8 (or a configurable domain with --androidPingAddress)',
group: 'Android'
})
.option('browsertime.chrome.android.deviceSerial', {
alias: 'chrome.android.deviceSerial',
@ -1669,6 +1679,10 @@ module.exports.parseCommandLine = function parseCommandLine() {
const aliases = parsed.getOptions().alias,
argv = parsed.argv;
// hack to keep backward compability to --android
if (argv.android[0] === true) {
set(argv, 'browsertime,android.enabled', true);
}
// aliases are long options -> short option
const aliasLookup = reduce(
aliases,

View File

@ -3,14 +3,11 @@
const merge = require('lodash.merge');
const forEach = require('lodash.foreach');
const path = require('path');
const browsertime = require('browsertime');
const set = require('lodash.set');
const get = require('lodash.get');
const coach = require('coach-core');
const log = require('intel').getLogger('plugin.browsertime');
const browserScripts = browsertime.browserScripts;
const defaultBrowsertimeOptions = {
statistics: true
};
@ -55,7 +52,8 @@ async function preWarmServer(urls, options, scriptOrMultiple) {
}
}
const engine = new browsertime.Engine(preWarmOptions);
const {BrowsertimeEngine} = await import ('browsertime');
const engine = new BrowsertimEngine(preWarmOptions);
await engine.start();
log.info('Start pre-testing/warming' + urls);
@ -70,6 +68,7 @@ async function preWarmServer(urls, options, scriptOrMultiple) {
}
async function parseUserScripts(scripts) {
const {browserScripts} = await import ('browsertime');
if (!Array.isArray(scripts)) scripts = [scripts];
const allUserScripts = {};
for (let script of scripts) {
@ -142,7 +141,8 @@ module.exports = {
btOptions.userAgent = iphone6UserAgent;
}
}
const scriptCategories = await browserScripts.allScriptCategories;
const {BrowsertimeEngine, browserScripts } = await import ('browsertime');
const scriptCategories = await browserScripts.allScriptCategories();
let scriptsByCategory = await browserScripts.getScriptsForCategories(
scriptCategories
);
@ -161,7 +161,7 @@ module.exports = {
await preWarmServer(url, btOptions, scriptOrMultiple);
}
const engine = new browsertime.Engine(btOptions);
const engine = new BrowsertimeEngine(btOptions);
const asyncScript =
pluginAsyncScripts.length > 0

View File

@ -1,6 +1,5 @@
'use strict';
const browsertime = require('browsertime');
const aggregator = require('./aggregator');
const api = require('coach-core');
const log = require('intel').getLogger('plugin.browsertime');
@ -38,7 +37,6 @@ module.exports = {
this.postChromeTrace = options.postChromeTrace;
this.pluginScripts = [];
this.pluginAsyncScripts = [];
browsertime.logging.configure(options);
this.screenshotType = get(
options,
'browsertime.screenshotParams.type',
@ -73,6 +71,8 @@ module.exports = {
this.axeAggregatorTotal = new AxeAggregator(this.options);
},
async processMessage(message, queue) {
const {configureLogging} = await import ('browsertime');
configureLogging(this.options);
const make = this.make;
const options = this.options;
switch (message.type) {

1189
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -80,7 +80,7 @@
"@tgwf/co2": "0.11.3",
"aws-sdk": "2.1121.0",
"axe-core": "4.4.3",
"browsertime": "16.17.0",
"browsertime": "17.0.0-beta.2",
"coach-core": "7.1.2",
"cli-color": "2.0.2",
"concurrent-queue": "7.0.2",