browsertime 15.1.1 → 15.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/browsertime/visualmetrics-portable.py +2755 -0
- package/lib/chrome/webdriver/chromium.js +23 -1
- package/lib/support/cli.js +12 -1
- package/lib/support/getViewPort.js +6 -1
- package/lib/video/postprocessing/visualmetrics/visualMetrics.js +30 -4
- package/package.json +3 -3
|
@@ -9,12 +9,14 @@ const path = require('path');
|
|
|
9
9
|
const parseCpuTrace = require('../parseCpuTrace');
|
|
10
10
|
const har = require('../har');
|
|
11
11
|
const harBuilder = require('../../support/har');
|
|
12
|
+
const util = require('../../support/util');
|
|
12
13
|
const webdriver = require('selenium-webdriver');
|
|
13
14
|
const traceCategoriesParser = require('../traceCategoriesParser');
|
|
14
15
|
const pathToFolder = require('../../support/pathToFolder');
|
|
15
16
|
const ChromeDevtoolsProtocol = require('../chromeDevtoolsProtocol');
|
|
16
17
|
const { Android } = require('../../android');
|
|
17
18
|
const unlink = promisify(fs.unlink);
|
|
19
|
+
const rm = promisify(fs.rm);
|
|
18
20
|
|
|
19
21
|
class Chromium {
|
|
20
22
|
constructor(storageManager, options) {
|
|
@@ -408,7 +410,27 @@ class Chromium {
|
|
|
408
410
|
/**
|
|
409
411
|
* Before the browser is stopped/closed.
|
|
410
412
|
*/
|
|
411
|
-
async afterBrowserStopped() {
|
|
413
|
+
async afterBrowserStopped() {
|
|
414
|
+
// If we supply a user data dir on desktop, we want to clean up before each start
|
|
415
|
+
if (
|
|
416
|
+
this.chrome.args &&
|
|
417
|
+
this.chrome.cleanUserDataDir &&
|
|
418
|
+
!this.chrome.android
|
|
419
|
+
) {
|
|
420
|
+
const args = util.toArray(this.chrome.args);
|
|
421
|
+
for (let arg of args) {
|
|
422
|
+
if (arg.includes('user-data-dir')) {
|
|
423
|
+
const userDataDir = arg.split('=')[1];
|
|
424
|
+
try {
|
|
425
|
+
await rm(userDataDir, { recursive: true });
|
|
426
|
+
log.info(`Deleted user data dir: ${userDataDir}`);
|
|
427
|
+
} catch (e) {
|
|
428
|
+
log.error(`Could not delete user data dir: ${userDataDir}`, e);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
412
434
|
|
|
413
435
|
async getHARs() {
|
|
414
436
|
if (!this.skipHar) {
|
package/lib/support/cli.js
CHANGED
|
@@ -287,6 +287,12 @@ module.exports.parseCommandLine = function parseCommandLine() {
|
|
|
287
287
|
'Prevent Browsertime from setting its default options for Chrome',
|
|
288
288
|
group: 'chrome'
|
|
289
289
|
})
|
|
290
|
+
.option('chrome.cleanUserDataDir', {
|
|
291
|
+
type: 'boolean',
|
|
292
|
+
describe:
|
|
293
|
+
'If you use --user-data-dir as an argument to Chrome and want to clean that directory between each iteration you should use --chrome.cleanUserDataDir true.',
|
|
294
|
+
group: 'chrome'
|
|
295
|
+
})
|
|
290
296
|
.option('cpu', {
|
|
291
297
|
type: 'boolean',
|
|
292
298
|
describe:
|
|
@@ -634,6 +640,11 @@ module.exports.parseCommandLine = function parseCommandLine() {
|
|
|
634
640
|
type: 'boolean',
|
|
635
641
|
describe: 'Collect Contentful Speed Index when you run --visualMetrics.'
|
|
636
642
|
})
|
|
643
|
+
.option('visualMetricsPortable', {
|
|
644
|
+
type: 'boolean',
|
|
645
|
+
describe:
|
|
646
|
+
'Use the portable visual-metrics processing script (no ImageMagick dependencies).'
|
|
647
|
+
})
|
|
637
648
|
.option('scriptInput.visualElements', {
|
|
638
649
|
describe:
|
|
639
650
|
'Include specific elements in visual elements. Give the element a name and select it with document.body.querySelector. Use like this: --scriptInput.visualElements name:domSelector see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors. Add multiple instances to measure multiple elements. Visual Metrics will use these elements and calculate when they are visible and fully rendered.'
|
|
@@ -964,7 +975,7 @@ module.exports.parseCommandLine = function parseCommandLine() {
|
|
|
964
975
|
})
|
|
965
976
|
.option('block', {
|
|
966
977
|
describe:
|
|
967
|
-
'Domain to block
|
|
978
|
+
'Domain to block or URL or URL pattern to block. If you use Chrome you can also use --blockDomainsExcept (that is more performant). Works in Chrome/Edge. For Firefox you can only block domains.'
|
|
968
979
|
})
|
|
969
980
|
.option('percentiles', {
|
|
970
981
|
type: 'array',
|
|
@@ -22,7 +22,12 @@ const sizeMap = {
|
|
|
22
22
|
'Pixel 2': '412x732',
|
|
23
23
|
'Pixel 2 XL': '412x824',
|
|
24
24
|
iPad: '768x1024',
|
|
25
|
-
'iPad Pro': '1024x1366'
|
|
25
|
+
'iPad Pro': '1024x1366',
|
|
26
|
+
'iPhone XR': '414x896',
|
|
27
|
+
'iPhone SE': '377x668',
|
|
28
|
+
'iPhone 12 Pro': '390x844',
|
|
29
|
+
'Pixel 5': '394x852',
|
|
30
|
+
'Samsung Galaxy S8+': '412x846'
|
|
26
31
|
};
|
|
27
32
|
|
|
28
33
|
module.exports = function (options) {
|
|
@@ -16,9 +16,29 @@ const SCRIPT_PATH = path.join(
|
|
|
16
16
|
'visualmetrics.py'
|
|
17
17
|
);
|
|
18
18
|
|
|
19
|
+
const PORTABLE_SCRIPT_PATH = path.join(
|
|
20
|
+
__dirname,
|
|
21
|
+
'..',
|
|
22
|
+
'..',
|
|
23
|
+
'..',
|
|
24
|
+
'..',
|
|
25
|
+
'browsertime',
|
|
26
|
+
'visualmetrics-portable.py'
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
function getScript(options) {
|
|
30
|
+
if (options.visualMetricsPortable) {
|
|
31
|
+
return PORTABLE_SCRIPT_PATH;
|
|
32
|
+
}
|
|
33
|
+
return SCRIPT_PATH;
|
|
34
|
+
}
|
|
35
|
+
|
|
19
36
|
module.exports = {
|
|
20
|
-
async checkDependencies() {
|
|
21
|
-
return execa(process.env.PYTHON || 'python', [
|
|
37
|
+
async checkDependencies(options) {
|
|
38
|
+
return execa(process.env.PYTHON || 'python', [
|
|
39
|
+
getScript(options),
|
|
40
|
+
'--check'
|
|
41
|
+
]);
|
|
22
42
|
},
|
|
23
43
|
async run(
|
|
24
44
|
videoPath,
|
|
@@ -46,7 +66,13 @@ module.exports = {
|
|
|
46
66
|
'--renderignore',
|
|
47
67
|
5,
|
|
48
68
|
'--json',
|
|
49
|
-
'--viewport'
|
|
69
|
+
'--viewport',
|
|
70
|
+
'--viewportretries',
|
|
71
|
+
60,
|
|
72
|
+
'--viewportminheight',
|
|
73
|
+
100,
|
|
74
|
+
'--viewportminwidth',
|
|
75
|
+
100
|
|
50
76
|
];
|
|
51
77
|
|
|
52
78
|
if (options.visualMetricsPerceptual) {
|
|
@@ -103,7 +129,7 @@ module.exports = {
|
|
|
103
129
|
scriptArgs.push('-vvv');
|
|
104
130
|
}
|
|
105
131
|
|
|
106
|
-
scriptArgs.unshift(
|
|
132
|
+
scriptArgs.unshift(getScript(options));
|
|
107
133
|
|
|
108
134
|
log.debug('Running visualmetrics.py ' + scriptArgs.join(' '));
|
|
109
135
|
log.info('Get visual metrics from the video');
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "Browsertime",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.4.0",
|
|
4
4
|
"bin": "./bin/browsertime.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@cypress/xvfb": "1.2.4",
|
|
7
7
|
"@devicefarmer/adbkit": "2.11.3",
|
|
8
|
-
"@sitespeed.io/chromedriver": "
|
|
9
|
-
"@sitespeed.io/edgedriver": "
|
|
8
|
+
"@sitespeed.io/chromedriver": "100.0.4896-20",
|
|
9
|
+
"@sitespeed.io/edgedriver": "99.0.1150-25",
|
|
10
10
|
"@sitespeed.io/geckodriver": "0.30.0",
|
|
11
11
|
"@sitespeed.io/throttle": "3.0.0",
|
|
12
12
|
"@sitespeed.io/tracium": "0.3.3",
|