Created
January 14, 2020 22:06
-
-
Save ncalexan/9b9efe3572a489c98727682f1af45d08 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = async function(context, commands) { | |
"use strict"; | |
// This violates all sorts of abstraction boundaries, but I don't see supported APIs for "just | |
// waiting" nor for allowing navigation scripts to produce measurements. | |
const delay = ms => new Promise(res => setTimeout(res, ms)); | |
await commands.measure.start(); | |
await commands.measure.browser.wait(commands.measure.pageCompleteCheck); | |
await commands.measure.stop(); | |
const browserScripts = commands.measure.result[commands.measure.numberOfMeasuredPages - 1].browserScripts; | |
const navigationTiming = browserScripts.timings.navigationTiming; | |
const processTimeShift = browserScripts.pageinfo.navigationStartTime - browserScripts.browser.processStartTime; | |
browserScripts.timings.applinkTiming = Object.assign({}, ...Object.keys(navigationTiming).map(k => ({[k]: navigationTiming[k] + processTimeShift}))); | |
return true; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment