Use Browsertime 4.0 (alpha) (#2236)

* Use Browsertime 4.0 (alpha)

With support for testing multiple pages.
This commit is contained in:
Peter Hedenskog 2018-12-30 15:57:55 +01:00 committed by GitHub
parent 091f3c7437
commit b62d93194a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 923 additions and 335 deletions

View File

@ -30,17 +30,19 @@ script:
- bin/sitespeed.js --useHash -n 1 https://www.sitespeed.io/#heybaberia
- bin/sitespeed.js --useAlias start --mobile -n 1 --utc https://www.sitespeed.io/
- bin/sitespeed.js -b firefox --metrics.list --mobile -n 1 https://www.sitespeed.io/
- bin/sitespeed.js -b chrome -n 2 https://www.sitespeed.io/ --preScript test/prepostscripts/preSample.js
--postScript test/prepostscripts/postSample.js
- bin/sitespeed.js --multi -b chrome -n 1 test/prepostscripts/preSample.js https://www.sitespeed.io/documentation/ test/prepostscripts/postSample.js
- 'if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then bin/sitespeed.js -b chrome -n 2 --summaryDetail --browsertime.chrome.timeline https://www.sitespeed.io/ --webpagetest.key $WPTKEY; fi'
- node test/runWithoutCli.js
- bin/sitespeed.js --multi -n 1 https://www.sitespeed.io/ https://www.sitespeed.io/documentation/
- bin/sitespeed.js --multi -n 3 test/prepostscripts/multi.js
env:
global:
- CXX=g++-4.8
- secure: ZCqHD+/PhHNVFWoqir66Xd9YeJRcTHDJYvNL9j4+GTKDEI1h94twhAjQ7Z9DhlCnXwL1lsfEcIjvNCWd3ir/FNy2oZsUzu6kMpFF/niugurFbS551moJ2ObNEfOdj93/sTo4UWH2MZouC9eYeuj1vNYbAev6wBIptL95X/ArldQ=
- secure: ZmEirO6J+rY+6T6eQWRNxqiqRNOYJktqQWaeUDR6WvzoR80oPdgKoNRS012dk4aCGr2+Dxf/KP6Iu2qbDE3YP3QD7PhoexicTVB6MTl81hZfX/eN0lt4lZknTYtjnAAWQB/aWAM6OVLjh8rAzq9PTBzl5EtAeMMJWmnhz6r+cLc=
notifications:
slack:
slack:
on_success: change
on_failure: always
secure: 3Ca5MzTVkgeZDKk7xuiXnGnl0u4UgBXQtn72xIBwb1nked0JSdwZ4MVgNTVRTlIvwbTdTaYcTo7Pm4+rSrfFx2T1juawq3TkUStJ4AmZHH2gGrAr46snEauWCovHmgo3mMAOwz3fJknz8VfIu7WmtiCH/GO9h20aNmjE1UT3pTE=

View File

@ -8,6 +8,7 @@ let yargs = require('yargs'),
cliUtil = require('./util'),
fs = require('fs'),
set = require('lodash.set'),
urlValidator = require('valid-url'),
toArray = require('../support/util').toArray,
grafanaConfig = require('../plugins/grafana/index').config,
graphiteConfig = require('../plugins/graphite/index').config,
@ -42,6 +43,25 @@ function validateInput(argv) {
return 'You have a miss match between number of alias and URLs.';
}
// validate URLs/files
const urlOrFiles = argv._;
for (let urlOrFile of urlOrFiles) {
if (urlOrFile.startsWith('http')) {
if (!urlValidator.isWebUri(urlOrFile)) {
return (
urlOrFile + 'is not a valid url (e.g. http://www.browsertime.net)'
);
}
} else {
// is existing file?
try {
fs.statSync(urlOrFile);
} catch (e) {
return urlOrFile + 'does not exist, is the path to the file correct?';
}
}
}
return true;
}
@ -49,7 +69,7 @@ module.exports.parseCommandLine = function parseCommandLine() {
let parsed = yargs
.env('SITESPEED_IO')
.usage('$0 [options] <url>/<file>')
.require(1, 'urlOrFile')
.require(1, 'One or multiple URLs or scripts')
.version(() => `${packageInfo.version}`)
.option('debug', {
default: false,
@ -170,18 +190,6 @@ module.exports.parseCommandLine = function parseCommandLine() {
'A URL that will be accessed first by the browser before the URL that you wanna analyze. Use it to fill the cache.',
group: 'Browser'
})
.option('browsertime.preScript', {
alias: 'preScript',
describe:
'Selenium script(s) to run before you test your URL (use it for login, warm the cache, etc). Note that --preScript can be passed multiple times.',
group: 'Browser'
})
.option('browsertime.postScript', {
alias: 'postScript',
describe:
'Selenium script(s) to run after you test your URL (use it for logout etc). Note that --postScript can be passed multiple times.',
group: 'Browser'
})
.option('browsertime.delay', {
alias: 'delay',
describe:
@ -876,6 +884,12 @@ module.exports.parseCommandLine = function parseCommandLine() {
default: false,
type: 'boolean'
})
.option('multi', {
describe:
'Test multiple URLs within the same browser session (same cache etc). Use this if you want to test multiple pages (use journey) or want to test multiple pages with scripts. You can mix URLs and scripts (the order will matter): login.js https://www.sitespeed.io/ logout.js ',
default: false,
type: 'boolean'
})
.help('h')
.alias('help', 'h')
.config('config')
@ -983,7 +997,7 @@ module.exports.parseCommandLine = function parseCommandLine() {
}
return {
urls: cliUtil.getURLs(argv._),
urls: argv.multi ? argv._ : cliUtil.getURLs(argv._),
urlsMetaData: cliUtil.getAliases(argv._, argv.urlAlias),
options: argv,
explicitOptions: explicitOptions

15
lib/core/script-source.js Normal file
View File

@ -0,0 +1,15 @@
'use strict';
const messageMaker = require('../support/messageMaker');
const make = messageMaker('scrtipt-reader').make;
module.exports = {
open(context, options) {
this.options = options;
},
findUrls(queue) {
queue.postMessage(
make('browsertime.navigationScripts', {}, { url: this.options.urls })
);
}
};

View File

@ -1,8 +1,7 @@
'use strict';
const urlParser = require('url'),
messageMaker = require('../support/messageMaker');
const urlParser = require('url');
const messageMaker = require('../support/messageMaker');
const make = messageMaker('url-reader').make;
module.exports = {

View File

@ -4,7 +4,6 @@ const merge = require('lodash.merge');
const forEach = require('lodash.foreach');
const path = require('path');
const browsertime = require('browsertime');
const log = require('intel').getLogger('sitespeedio.plugin.browsertime');
const set = require('lodash.set');
const get = require('lodash.get');
const coach = require('webcoach');
@ -64,7 +63,13 @@ function setupAsynScripts(asyncScripts) {
}
module.exports = {
async analyzeUrl(url, options, pluginScripts, pluginAsyncScripts) {
async analyzeUrl(
url,
scriptOrMultiple,
pluginScripts,
pluginAsyncScripts,
options
) {
const btOptions = merge({}, defaultBrowsertimeOptions, options);
// set mobile options
@ -98,12 +103,6 @@ module.exports = {
}
scriptsByCategory = await addExtraScripts(scriptsByCategory, pluginScripts);
const engine = new browsertime.Engine(btOptions);
log.info(
'Starting %s for analysing %s %s time(s)',
btOptions.browser,
url,
btOptions.iterations
);
const asyncScript =
pluginAsyncScripts.length > 0
@ -112,8 +111,11 @@ module.exports = {
try {
await engine.start();
const result = await engine.run(url, scriptsByCategory, asyncScript);
return result;
if (scriptOrMultiple) {
return engine.runMultiple(url, scriptsByCategory, asyncScript);
} else {
return engine.run(url, scriptsByCategory, asyncScript);
}
} finally {
await engine.stop();
}

View File

@ -10,7 +10,7 @@ const dayjs = require('dayjs-ext');
const isEmpty = require('lodash.isempty');
const get = require('lodash.get');
const defaultConfig = require('./default/config');
const visitedUrls = new Set();
const urlParser = require('url');
const TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
const DEFAULT_METRICS_PAGE_SUMMARY = require('./default/metricsPageSummary');
const DEFAULT_METRICS_SUMMARY = require('./default/metricsSummary');
@ -36,6 +36,7 @@ module.exports = {
'browsertime.screenshotParams.type',
defaultConfig.screenshotParams.type
);
this.scriptOrMultiple = options.multi;
// hack for disabling viewport on Android that's not supported
if (
@ -111,193 +112,197 @@ module.exports = {
break;
}
// We got a URL that we want to test
case 'browsertime.navigationScripts':
case 'url': {
const url = message.url;
const group = message.group;
visitedUrls.add(url);
let url = message.url;
let group = message.group;
// manually set the resultBaseDir
// it's used in BT when we record a video
options.resultDir = await this.storageManager.createDirForUrl(
message.url,
'data'
);
options.resultDir = await this.storageManager.getBaseDir();
const consoleLogAggregator = new ConsoleLogAggregator(options);
const result = await analyzer.analyzeUrl(
url,
options,
this.scriptOrMultiple,
this.pluginScripts,
this.pluginAsyncScripts
this.pluginAsyncScripts,
options
);
log.verbose('Result from Browsertime for %s with %:2j', url, result);
let runIndex = 0;
for (let run of result.browserScripts) {
if (result.har) {
// Add meta data to be used when we compare multiple HARs
// the meta field is added in Browsertime
const _meta = result.har.log.pages[runIndex]._meta;
// add the defintion for first party/third party
if (this.firstParty) {
_meta.firstParty = this.firstParty;
}
if (this.resultUrls.hasBaseUrl()) {
const base = this.resultUrls.absoluteSummaryPagePath(url);
_meta.screenshot = `${base}data/screenshots/${runIndex + 1}.${
this.screenshotType
}`;
_meta.result = `${base}${runIndex + 1}.html`;
if (options.video) {
_meta.video = `${base}data/video/${runIndex + 1}.mp4`;
}
}
run.har = api.pickAPage(result.har, runIndex);
}
// Kind of ugly way to add visualMetrics to a run
// it's outside of browserScripts today
// we could instead pass browsertime.visualMetrics maybe
if (result.visualMetrics) {
run.visualMetrics = result.visualMetrics[runIndex];
}
if (result.cpu) {
run.cpu = result.cpu[runIndex];
}
run.timestamp = dayjs(result.timestamps[runIndex]).format(
TIME_FORMAT
);
queue.postMessage(
make('browsertime.run', run, {
url,
group,
runIndex,
iteration: runIndex + 1
})
);
if (options.chrome && options.chrome.collectConsoleLog) {
try {
const consoleData = await consoleLogAggregator.addStats(
runIndex + 1
);
queue.postMessage(
make('browsertime.console', consoleData, {
url,
group,
runIndex,
iteration: runIndex + 1
})
);
} catch (e) {
// This could happen if the run failed somehow
log.error('Could not fetch the console log');
}
}
// In Browsertime 2.x the tracelog was part of the result but since 3.x
// it is stored to disk. If you want it passed around in the queue, just add
// --postChromeTrace
if (
options.chrome &&
options.chrome.timeline &&
this.postChromeTrace
) {
const traceData = await getGzippedFileAsJson(
options.resultDir,
`trace-${runIndex + 1}.json.gz`
);
queue.postMessage(
make('browsertime.chrometrace', traceData, {
url,
group,
name: `trace-${runIndex + 1}.json`, // backward compatible to 2.x
runIndex
})
);
}
// If the coach is turned on, collect the coach result
if (options.coach) {
const coachAdvice = run.coach.coachAdvice;
// check if the coach has error(s)
if (!isEmpty(coachAdvice.errors)) {
log.error(
'%s generated the following errors in the coach %:2j',
url,
coachAdvice.errors
);
queue.postMessage(
make(
'error',
'The coach got the following errors: ' +
JSON.stringify(coachAdvice.errors),
{
url,
runIndex,
iteration: runIndex + 1
}
)
);
}
let advice = coachAdvice;
// If we run without HAR
for (let resultIndex = 0; resultIndex < result.length; resultIndex++) {
url = result[resultIndex].info.url;
group = urlParser.parse(url).hostname;
let runIndex = 0;
for (let run of result[resultIndex].browserScripts) {
let harIndex = runIndex * result.length;
harIndex += resultIndex;
if (result.har) {
// make sure to get the right run in the HAR
const myHar = api.pickAPage(result.har, runIndex);
const harResult = await api.runHarAdvice(myHar);
advice = api.merge(coachAdvice, harResult);
// Add meta data to be used when we compare multiple HARs
// the meta field is added in Browsertime
const _meta = result.har.log.pages[harIndex]._meta;
// add the defintion for first party/third party
if (this.firstParty) {
_meta.firstParty = this.firstParty;
}
if (this.resultUrls.hasBaseUrl()) {
const base = this.resultUrls.absoluteSummaryPagePath(url);
_meta.screenshot = `${base}data/screenshots/${runIndex + 1}.${
this.screenshotType
}`;
_meta.result = `${base}${runIndex + 1}.html`;
if (options.video) {
_meta.video = `${base}data/video/${runIndex + 1}.mp4`;
}
}
run.har = api.pickAPage(result.har, harIndex);
}
// Kind of ugly way to add visualMetrics to a run
// it's outside of browserScripts today
// we could instead pass browsertime.visualMetrics maybe
if (result[resultIndex].visualMetrics) {
run.visualMetrics = result[resultIndex].visualMetrics[runIndex];
}
if (result[resultIndex].cpu) {
run.cpu = result[resultIndex].cpu[runIndex];
}
run.timestamp = dayjs(
result[resultIndex].timestamps[runIndex]
).format(TIME_FORMAT);
queue.postMessage(
make('coach.run', advice, {
make('browsertime.run', run, {
url,
group,
runIndex,
iteration: runIndex + 1
})
);
if (options.chrome && options.chrome.collectConsoleLog) {
try {
const consoleData = await consoleLogAggregator.addStats(
runIndex + 1
);
queue.postMessage(
make('browsertime.console', consoleData, {
url,
group,
runIndex,
iteration: runIndex + 1
})
);
} catch (e) {
// This could happen if the run failed somehow
log.error('Could not fetch the console log');
}
}
// In Browsertime 2.x the tracelog was part of the result but since 3.x
// it is stored to disk. If you want it passed around in the queue, just add
// --postChromeTrace
if (
options.chrome &&
options.chrome.timeline &&
this.postChromeTrace
) {
const traceData = await getGzippedFileAsJson(
options.resultDir,
`trace-${runIndex + 1}.json.gz`
);
queue.postMessage(
make('browsertime.chrometrace', traceData, {
url,
group,
name: `trace-${runIndex + 1}.json`, // backward compatible to 2.x
runIndex
})
);
}
// If the coach is turned on, collect the coach result
if (options.coach) {
const coachAdvice = run.coach.coachAdvice;
// check if the coach has error(s)
if (!isEmpty(coachAdvice.errors)) {
log.error(
'%s generated the following errors in the coach %:2j',
url,
coachAdvice.errors
);
queue.postMessage(
make(
'error',
'The coach got the following errors: ' +
JSON.stringify(coachAdvice.errors),
{
url,
runIndex,
iteration: runIndex + 1
}
)
);
}
let advice = coachAdvice;
// If we run without HAR
if (result.har) {
// make sure to get the right run in the HAR
const myHar = api.pickAPage(result.har, harIndex);
const harResult = await api.runHarAdvice(myHar);
advice = api.merge(coachAdvice, harResult);
}
queue.postMessage(
make('coach.run', advice, {
url,
group,
runIndex,
iteration: runIndex + 1
})
);
}
aggregator.addToAggregate(run, group);
runIndex++;
}
aggregator.addToAggregate(run, group);
runIndex++;
}
// Let take the first runs timestamp and use that as the summary timestamp
result.timestamp = dayjs(result[resultIndex].timestamps[0]).format(
TIME_FORMAT
);
// Let take the first runs timestamp and use that as the summary timestamp
result.timestamp = dayjs(result.timestamps[0]).format(TIME_FORMAT);
if (options.chrome && options.chrome.collectConsoleLog) {
result.statistics.console = consoleLogAggregator.summarizeStats();
}
if (options.chrome && options.chrome.collectConsoleLog) {
result.statistics.console = consoleLogAggregator.summarizeStats();
}
// Post the result on the queue so other plugins can use it
queue.postMessage(
make('browsertime.pageSummary', result, {
url,
group
})
);
// Post the HAR on the queue so other plugins can use it
if (result.har) {
// Post the result on the queue so other plugins can use it
queue.postMessage(
make('browsertime.har', result.har, {
make('browsertime.pageSummary', result[resultIndex], {
url,
group
})
);
}
// Post the HAR on the queue so other plugins can use it
if (result.har) {
queue.postMessage(
make('browsertime.har', result.har, {
url,
group
})
);
}
// Check for errors. Browsertime errors is an array of all iterations
// [[],[],[]] where one iteration can have multiple errors
for (let errorsForOneIteration of result.errors) {
for (let error of errorsForOneIteration) {
queue.postMessage(make('error', error, merge({ url })));
// Check for errors. Browsertime errors is an array of all iterations
// [[],[],[]] where one iteration can have multiple errors
for (let errorsForOneIteration of result[resultIndex].errors) {
for (let error of errorsForOneIteration) {
queue.postMessage(make('error', error, merge({ url })));
}
}
}
break;
}
// It's time to summarize the metrics for all pages and runs

View File

@ -170,11 +170,17 @@ class HTMLBuilder {
);
const urlPageRenders = [];
let pageNumber = 0;
const testedPages = Object.keys(validPages).length;
for (let url of Object.keys(validPages)) {
const pageInfo = validPages[url];
const runPages = dataCollector.getURLRuns(url);
const medianRun = metricHelper.pickMedianRun(runPages, pageInfo);
// If we have multiple URLs in the same HAR the median run must be converted
// to the right run in the HAR
const harIndex = pageNumber + (medianRun.runIndex - 1) * testedPages;
let summaryPageHAR = get(pageInfo, 'data.browsertime.har');
pageNumber++;
// if we don't use Browsertime, we don't get the browser version
const browser = summaryPageHAR
? {
@ -215,13 +221,13 @@ class HTMLBuilder {
const pageSummaries = this.pageSummaries.filter(
summary => !!get(pageInfo.data, [summary.id, 'pageSummary'])
);
let data = {
daurl: url,
daurlAlias,
pageInfo,
options,
runPages,
harIndex,
summaryPageHAR,
medianRun,
browser,
@ -272,6 +278,7 @@ class HTMLBuilder {
daurlAlias,
iteration,
runIndex,
harIndex: runIndex, // for individual runs, the run index is correct for the HAR
pageInfo,
options,
runPages,

View File

@ -15,7 +15,7 @@ module.exports = {
'data.browsertime.pageSummary.statistics.timings.rumSpeedIndex.median'
);
if (speedIndexMedian) {
for (var run of runs) {
for (let run of runs) {
if (
speedIndexMedian === run.data.browsertime.run.visualMetrics.SpeedIndex
) {
@ -26,7 +26,7 @@ module.exports = {
}
}
} else if (rumSpeedIndexMedian) {
for (var rumRuns of runs) {
for (let rumRuns of runs) {
// make sure we run Browsertime for that run = 3 runs WPT and 2 runs BT
if (
rumRuns.data.browsertime &&

View File

@ -13,7 +13,7 @@ script(type='text/javascript').
leftColumnWidth: 30,
legendHolder: legendHolderEl,
pageSelector: pageSelectorEl,
selectedPage: #{runIndex || medianRun.runIndex}
selectedPage: #{harIndex}
};
if options.gzipHAR
script(src= rootPath + 'js/gunzip.min.js')

View File

@ -15,7 +15,7 @@ script(type='text/javascript').
showMimeTypeIcon: true,
leftColumnWidth: 30,
legendHolder: legendHolderEl,
selectedPage: #{runIndex || medianRun.runIndex},
selectedPage: #{harIndex},
pageSelector: pageSelectorEl
};

View File

@ -12,7 +12,7 @@ if medianRun
if (options.html.showAllWaterfallSummary === true)
p Choose HAR:
select#page-selector
#legend-holder
if options.html.fetchHARFiles

View File

@ -64,7 +64,6 @@ module.exports = {
this.usingBrowsertime ||
(!this.usingBrowsertime && this.usingWebpagetest)
) {
const url = message.url;
const group = message.group;
let config = {
includeAssets: true,
@ -75,20 +74,30 @@ module.exports = {
const pageSummary = pagexray.convert(message.data, config);
pagexrayAggregator.addToAggregate(pageSummary, group);
queue.postMessage(
make('pagexray.pageSummary', pageSummary[0], { url, group })
);
pageSummary.forEach((run, runIndex) => {
// The HAR file can have multiple URLs
const sentURL = {};
for (let summary of pageSummary) {
if (!sentURL[summary.url]) {
sentURL[summary.url] = 1;
queue.postMessage(
make('pagexray.pageSummary', summary, {
url: summary.url,
group // TODO get the group from the URL?
})
);
} else {
sentURL[summary.url] += 1;
}
// Send each individual run too
queue.postMessage(
make('pagexray.run', run, {
url,
make('pagexray.run', summary, {
url: summary.url,
group,
runIndex,
iteration: runIndex + 1
runIndex: sentURL[summary.url] - 1,
iteration: sentURL[summary.url]
})
);
});
}
}
break;
}

View File

@ -14,10 +14,11 @@ const filterRegistry = require('./support/filterRegistry');
const statsHelpers = require('./support/statsHelpers');
const packageInfo = require('../package');
const QueueHandler = require('./core/queueHandler'),
resultsStorage = require('./core/resultsStorage'),
loader = require('./core/pluginLoader'),
urlSource = require('./core/url-source');
const QueueHandler = require('./core/queueHandler');
const resultsStorage = require('./core/resultsStorage');
const loader = require('./core/pluginLoader');
const urlSource = require('./core/url-source');
const scriptSource = require('./core/script-source');
const budgetResult = {
working: {},
@ -101,7 +102,7 @@ module.exports = {
}
const runningPlugins = await loader.loadPlugins(pluginNames);
let urlSources = [urlSource];
const urlSources = [options.multi ? scriptSource : urlSource];
const allPlugins = urlSources.concat(runningPlugins);
const queueHandler = new QueueHandler(runningPlugins, options);

736
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,10 @@
{
"name": "sitespeed.io",
"bin": "./bin/sitespeed.js",
"version": "7.7.2",
"version": "8.0.0-alpha.0",
"publishConfig": {
"tag": "canary"
},
"description": "Analyze the web performance of your site",
"keywords": [
"performance",
@ -69,7 +72,7 @@
"main": "./lib/sitespeed.js",
"dependencies": {
"aws-sdk": "2.361.0",
"browsertime": "3.12.0",
"browsertime": "4.0.0-alpha.4",
"cli-color": "1.4.0",
"concurrent-queue": "7.0.2",
"dayjs-ext": "2.2.0",
@ -95,7 +98,7 @@
"mkdirp": "0.5.1",
"node-slack": "0.0.7",
"p-limit": "2.0.0",
"pagexray": "2.5.0",
"pagexray": "2.5.1",
"pug": "2.0.3",
"recursive-readdir": "2.2.2",
"simplecrawler": "1.1.6",

View File

@ -17,15 +17,15 @@ PACKAGE_VERSION=$(node -e 'console.log(require("./package").version)')
docker build --no-cache -t sitespeedio/sitespeed.io:$PACKAGE_VERSION -t sitespeedio/sitespeed.io:latest .
docker push sitespeedio/sitespeed.io:$PACKAGE_VERSION
docker push sitespeedio/sitespeed.io:latest
#docker push sitespeedio/sitespeed.io:latest
docker build -t sitespeedio/sitespeed.io:$PACKAGE_VERSION-plus1 --file docker/Dockerfile-plus1 .
docker push sitespeedio/sitespeed.io:$PACKAGE_VERSION-plus1
# Update to latet version in the docs
bin/sitespeed.js --version | tr -d '\n' > docs/_includes/version/sitespeed.io.txt
#bin/sitespeed.js --version | tr -d '\n' > docs/_includes/version/sitespeed.io.txt
# Generate the help for the docs
bin/sitespeed.js --help > docs/documentation/sitespeed.io/configuration/config.md
#bin/sitespeed.js --help > docs/documentation/sitespeed.io/configuration/config.md

View File

@ -0,0 +1,5 @@
module.exports = async function(context) {
await context.h.measure('https://www.sitespeed.io');
await context.h.measure('https://www.sitespeed.io/examples/');
return context.h.measure('https://www.sitespeed.io/documentation/');
};

View File

@ -1,5 +1,3 @@
module.exports = {
run(context) {
context.log.info('In posttask!!!');
}
module.exports = async function(context) {
context.log.info('In posttask!!!');
};

View File

@ -1,19 +1,5 @@
module.exports = {
run(context) {
context.log.info('In pretask!!!');
if (!context.taskData.loadedSitespeed) {
return context
.runWithDriver(driver => {
return driver
.get('https://www.sitespeed.io')
.then(() => driver.getTitle())
.then(title => {
context.log.info('Loaded page with title: ' + title);
});
})
.then(() => {
context.taskData.loadedSitespeed = true;
});
}
}
module.exports = async function(context) {
context.log.info('In pretask!!!');
await context.h.navigate('https://www.sitespeed.io/');
context.taskData.loadedSitespeed = true;
};