Make sure to propagate settings to WebPageReplay (#2825)

This commit is contained in:
Peter Hedenskog 2019-12-16 07:30:14 +01:00 committed by GitHub
parent fbfbd6861d
commit 84e6766633
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 35 additions and 2 deletions

View File

@ -46,12 +46,43 @@ async function runBrowsertime() {
default: false,
type: 'boolean'
})
.option('browsertime.chrome.mobileEmulation.deviceName', {
.option('browsertime.pageCompleteCheckPollTimeout', {
alias: 'pageCompleteCheckPollTimeout',
type: 'number',
default: 200,
describe:
"Name of device to emulate. Works only standalone (see list in Chrome DevTools, but add phone like 'iPhone 6'). This will override your userAgent string.",
'The time in ms to wait for running the page complete check the next time.'
})
.option('browsertime.pageCompleteCheckStartWait', {
alias: 'pageCompleteCheckStartWait',
type: 'number',
default: 500,
describe:
'The time in ms to wait for running the page complete check for the first time. Use this when you have a pageLoadStrategy set to none'
})
.option('browsertime.pageLoadStrategy', {
alias: 'pageLoadStrategy',
type: 'string',
default: 'normal',
choices: ['eager', 'none', 'normal'],
describe:
'Set the strategy to waiting for document readiness after a navigation event. After the strategy is ready, your pageCompleteCheck will start runninhg. This only for Firefox and Chrome and please check which value each browser implements.'
})
.option('browsertime.cpu', {
alias: 'cpu',
type: 'boolean',
describe: 'Easy way to enable both chrome.timeline and CPU long tasks.',
group: 'chrome'
})
.option('browsertime.chrome.CPUThrottlingRate', {
alias: 'chrome.CPUThrottlingRate',
type: 'number',
describe:
'Enables CPU throttling to emulate slow CPUs. Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc)',
group: 'chrome'
})
.option('browsertime.viewPort', {
alias: 'viewPort',
default: browsertimeConfig.viewPort,
describe: 'The browser view port size WidthxHeight like 400x300',
group: 'Browser'
@ -76,8 +107,10 @@ async function runBrowsertime() {
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,