browsertime 16.16.0 → 17.0.0-beta.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 +52 -0
- package/bin/browsertime.js +43 -43
- package/bin/browsertimeWebPageReplay.js +10 -9
- package/browserscripts/pageinfo/generator.js +1 -1
- package/index.js +14 -13
- package/lib/android/gnirehtet.js +14 -15
- package/lib/android/index.js +92 -89
- package/lib/android/root.js +6 -9
- package/lib/chrome/chromeDevtoolsProtocol.js +46 -45
- package/lib/chrome/har.js +12 -13
- package/lib/chrome/longTaskMetrics.js +3 -5
- package/lib/chrome/parseCpuTrace.js +13 -10
- package/lib/chrome/settings/chromeAndroidOptions.js +1 -3
- package/lib/chrome/settings/chromeDesktopOptions.js +1 -3
- package/lib/chrome/settings/traceCategories.js +1 -3
- package/lib/chrome/traceCategoriesParser.js +35 -36
- package/lib/chrome/webdriver/builder.js +18 -26
- package/lib/chrome/webdriver/chromium.js +56 -46
- package/lib/chrome/webdriver/setupChromiumOptions.js +32 -27
- package/lib/connectivity/humble.js +13 -14
- package/lib/connectivity/index.js +74 -77
- package/lib/connectivity/trafficShapeParser.js +31 -35
- package/lib/core/engine/collector.js +25 -22
- package/lib/core/engine/command/addText.js +24 -27
- package/lib/core/engine/command/android.js +7 -11
- package/lib/core/engine/command/cache.js +3 -4
- package/lib/core/engine/command/chromeDevToolsProtocol.js +20 -20
- package/lib/core/engine/command/click.js +48 -49
- package/lib/core/engine/command/debug.js +3 -4
- package/lib/core/engine/command/javaScript.js +18 -19
- package/lib/core/engine/command/measure.js +31 -37
- package/lib/core/engine/command/meta.js +1 -4
- package/lib/core/engine/command/mouse/clickAndHold.js +36 -39
- package/lib/core/engine/command/mouse/contextClick.js +17 -18
- package/lib/core/engine/command/mouse/doubleClick.js +17 -19
- package/lib/core/engine/command/mouse/index.js +5 -9
- package/lib/core/engine/command/mouse/mouseMove.js +19 -23
- package/lib/core/engine/command/mouse/singleClick.js +15 -19
- package/lib/core/engine/command/navigation.js +12 -14
- package/lib/core/engine/command/screenshot.js +1 -4
- package/lib/core/engine/command/scroll.js +4 -7
- package/lib/core/engine/command/select.js +26 -26
- package/lib/core/engine/command/set.js +25 -23
- package/lib/core/engine/command/stopWatch.js +5 -8
- package/lib/core/engine/command/switch.js +18 -20
- package/lib/core/engine/command/util/lcpHighlightScript.js +1 -2
- package/lib/core/engine/command/util/lsHighlightScript.js +1 -2
- package/lib/core/engine/command/wait.js +18 -18
- package/lib/core/engine/index.js +81 -71
- package/lib/core/engine/iteration.js +93 -79
- package/lib/core/engine/run.js +5 -9
- package/lib/core/pageCompleteChecks/defaultPageCompleteCheck.js +1 -2
- package/lib/core/pageCompleteChecks/pageCompleteCheckByInactivity.js +1 -3
- package/lib/core/pageCompleteChecks/spaInactivity.js +1 -3
- package/lib/core/seleniumRunner.js +92 -100
- package/lib/core/webdriver/index.js +24 -21
- package/lib/edge/webdriver/builder.js +21 -26
- package/lib/extensionserver/httpServer.js +17 -21
- package/lib/extensionserver/index.js +8 -12
- package/lib/extensionserver/setup.js +12 -12
- package/lib/firefox/geckoProfiler.js +27 -21
- package/lib/firefox/getHAR.js +7 -8
- package/lib/firefox/memoryReport.js +9 -11
- package/lib/firefox/perfStats.js +5 -7
- package/lib/firefox/settings/disableSafeBrowsingPreferences.js +1 -3
- package/lib/firefox/settings/disableTrackingProtectionPreferences.js +1 -3
- package/lib/firefox/settings/firefoxPreferences.js +2 -4
- package/lib/firefox/settings/geckoProfilerDefaults.js +5 -9
- package/lib/firefox/webdriver/builder.js +66 -63
- package/lib/firefox/webdriver/firefox.js +43 -48
- package/lib/safari/webdriver/builder.js +4 -5
- package/lib/safari/webdriver/safari.js +4 -8
- package/lib/screenshot/defaults.js +1 -3
- package/lib/screenshot/index.js +24 -21
- package/lib/support/browserScript.js +65 -56
- package/lib/support/cli.js +123 -85
- package/lib/support/dns.js +6 -7
- package/lib/support/engineUtils.js +85 -38
- package/lib/support/errors.js +4 -13
- package/lib/support/fileUtil.js +81 -68
- package/lib/support/filters.js +15 -20
- package/lib/support/getViewPort.js +6 -7
- package/lib/support/har/index.js +208 -216
- package/lib/support/images/index.js +54 -26
- package/lib/support/logging.js +20 -17
- package/lib/support/pathToFolder.js +18 -23
- package/lib/support/preURL.js +5 -6
- package/lib/support/processes.js +4 -6
- package/lib/support/setResourceTimingBufferSize.js +2 -4
- package/lib/support/statistics.js +58 -56
- package/lib/support/stop.js +7 -8
- package/lib/support/storageManager.js +44 -44
- package/lib/support/tcpdump.js +22 -16
- package/lib/support/userTiming.js +7 -13
- package/lib/support/util.js +204 -224
- package/lib/support/xvfb.js +11 -13
- package/lib/video/defaults.js +6 -10
- package/lib/video/postprocessing/finetune/addTextToVideo.js +15 -15
- package/lib/video/postprocessing/finetune/convertFps.js +14 -8
- package/lib/video/postprocessing/finetune/getFont.js +7 -9
- package/lib/video/postprocessing/finetune/getTimingMetrics.js +19 -18
- package/lib/video/postprocessing/finetune/index.js +40 -36
- package/lib/video/postprocessing/finetune/removeOrange.js +10 -11
- package/lib/video/postprocessing/visualmetrics/extraMetrics.js +17 -13
- package/lib/video/postprocessing/visualmetrics/getVideoMetrics.js +12 -13
- package/lib/video/postprocessing/visualmetrics/visualMetrics.js +117 -128
- package/lib/video/screenRecording/android/recorder.js +12 -17
- package/lib/video/screenRecording/desktop/convert.js +13 -11
- package/lib/video/screenRecording/desktop/desktopRecorder.js +29 -24
- package/lib/video/screenRecording/desktop/ffmpegRecorder.js +60 -63
- package/lib/video/screenRecording/desktop/osx/getSPDisplaysDataType.js +4 -6
- package/lib/video/screenRecording/desktop/osx/getScreen.js +9 -10
- package/lib/video/screenRecording/firefox/firefoxWindowRecorder.js +54 -54
- package/lib/video/screenRecording/ios/convertToMp4.js +10 -11
- package/lib/video/screenRecording/ios/iosRecorder.js +23 -21
- package/lib/video/screenRecording/iosSimulator/convertToMp4.js +10 -11
- package/lib/video/screenRecording/iosSimulator/recorder.js +10 -9
- package/lib/video/screenRecording/recorder.js +8 -9
- package/lib/video/screenRecording/setOrangeBackground.js +5 -6
- package/lib/video/video.js +28 -34
- package/package.json +19 -17
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
import { execa } from 'execa';
|
|
2
|
+
import intel from 'intel';
|
|
3
|
+
const log = intel.getLogger('browsertime.video');
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
module.exports = async function convert(src, dest) {
|
|
7
|
-
const scriptArgs = [
|
|
5
|
+
export default async function convert(source, destination) {
|
|
6
|
+
const scriptArguments = [
|
|
8
7
|
// '-framerate',
|
|
9
8
|
// 60,
|
|
10
9
|
'-i',
|
|
11
|
-
|
|
10
|
+
source,
|
|
12
11
|
'-c:v',
|
|
13
12
|
'copy',
|
|
14
13
|
'-f',
|
|
15
14
|
'mp4',
|
|
16
|
-
|
|
15
|
+
destination,
|
|
17
16
|
'-y'
|
|
18
17
|
];
|
|
19
18
|
|
|
20
|
-
log.debug('Converting video from h264 to mp4 %j',
|
|
19
|
+
log.debug('Converting video from h264 to mp4 %j', scriptArguments);
|
|
21
20
|
|
|
22
|
-
return execa('ffmpeg',
|
|
23
|
-
}
|
|
21
|
+
return execa('ffmpeg', scriptArguments);
|
|
22
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import util from 'node:util';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import { execa } from 'execa';
|
|
5
|
+
import intel from 'intel';
|
|
6
|
+
import { default as convert } from './convertToMp4.js';
|
|
6
7
|
const unlink = util.promisify(fs.unlink);
|
|
7
|
-
const convert = require('./convertToMp4');
|
|
8
8
|
const delay = ms => new Promise(res => setTimeout(res, ms));
|
|
9
|
+
const log = intel.getLogger('browsertime.video');
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
export default class IOSSimulatorRecorder {
|
|
11
12
|
constructor(options, baseDir) {
|
|
12
13
|
this.options = options;
|
|
13
14
|
this.tmpVideo = path.join(baseDir, 'tmp.mov');
|
|
@@ -35,6 +36,6 @@ module.exports = class IOSSimulatorRecorder {
|
|
|
35
36
|
await delay(2500);
|
|
36
37
|
await convert(this.tmpVideo, destination);
|
|
37
38
|
await unlink(this.tmpVideo);
|
|
38
|
-
return
|
|
39
|
+
return this.xcrunProcess;
|
|
39
40
|
}
|
|
40
|
-
}
|
|
41
|
+
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const IOSRecorder = require('./ios/iosRecorder');
|
|
1
|
+
import { isAndroidConfigured } from '../../android/index.js';
|
|
2
|
+
import AndroidRecorder from './android/recorder.js';
|
|
3
|
+
import DesktopRecorder from './desktop/desktopRecorder.js';
|
|
4
|
+
import FirefoxWindowRecorder from './firefox/firefoxWindowRecorder.js';
|
|
5
|
+
import IOSSimulatorRecorder from './iosSimulator/recorder.js';
|
|
6
|
+
import IOSRecorder from './ios/iosRecorder.js';
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
export default function getRecorder(options, browser, baseDir) {
|
|
10
9
|
if (
|
|
11
10
|
options.browser === 'firefox' &&
|
|
12
11
|
options.firefox &&
|
|
@@ -32,4 +31,4 @@ module.exports = function getRecorder(options, browser, baseDir) {
|
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
return new DesktopRecorder(options);
|
|
35
|
-
}
|
|
34
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const log =
|
|
4
|
-
|
|
5
|
-
module.exports = async function (driver) {
|
|
1
|
+
import intel from 'intel';
|
|
2
|
+
import { until, By } from 'selenium-webdriver';
|
|
3
|
+
const log = intel.getLogger('browsertime.video');
|
|
4
|
+
export default async function (driver) {
|
|
6
5
|
log.debug('Add orange color');
|
|
7
6
|
// We tried other ways for Android (access an orange page)
|
|
8
7
|
// That works fine ... but break scripts
|
|
@@ -27,4 +26,4 @@ module.exports = async function (driver) {
|
|
|
27
26
|
// It seems that in some cases the video do not have any orange at the start, so make sure we
|
|
28
27
|
// the div orange div really exits
|
|
29
28
|
return driver.wait(until.elementsLocated(By.id('browsertime-orange')));
|
|
30
|
-
}
|
|
29
|
+
}
|
package/lib/video/video.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const pathToFolders = require('../support/pathToFolder');
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import get from 'lodash.get';
|
|
3
|
+
import getRecorder from './screenRecording/recorder.js';
|
|
4
|
+
import getVideoMetrics from './postprocessing/visualmetrics/getVideoMetrics.js';
|
|
5
|
+
import finetuneVideo from './postprocessing/finetune/index.js';
|
|
6
|
+
import { rename, removeFile, removeDirAndFiles } from '../support/fileUtil.js';
|
|
7
|
+
import pathToFolders from '../support/pathToFolder.js';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Create a new Video that handles everything with the video
|
|
@@ -25,15 +24,15 @@ class Video {
|
|
|
25
24
|
this.index = index;
|
|
26
25
|
|
|
27
26
|
this.videoDir = await storageManager.createSubDataDir(
|
|
28
|
-
|
|
27
|
+
join(pathToFolders(url, this.options), 'video')
|
|
29
28
|
);
|
|
30
29
|
|
|
31
30
|
await storageManager.createSubDataDir(
|
|
32
|
-
|
|
31
|
+
join(pathToFolders(url, this.options), 'video', 'images', '' + index)
|
|
33
32
|
);
|
|
34
33
|
|
|
35
34
|
this.filmstripDir = await storageManager.createSubDataDir(
|
|
36
|
-
|
|
35
|
+
join(pathToFolders(url, this.options), 'filmstrip', '' + index)
|
|
37
36
|
);
|
|
38
37
|
}
|
|
39
38
|
|
|
@@ -48,8 +47,8 @@ class Video {
|
|
|
48
47
|
// skip recording if we already have one going
|
|
49
48
|
if (!this.isRecording) {
|
|
50
49
|
this.isRecording = true;
|
|
51
|
-
let
|
|
52
|
-
return this.recorder.start(
|
|
50
|
+
let temporary = join(this.tmpDir, 'x11-tmp.mp4');
|
|
51
|
+
return this.recorder.start(temporary);
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
|
|
@@ -59,7 +58,7 @@ class Video {
|
|
|
59
58
|
*/
|
|
60
59
|
async stop(url) {
|
|
61
60
|
this.isRecording = false;
|
|
62
|
-
this.videoPath =
|
|
61
|
+
this.videoPath = join(
|
|
63
62
|
this.storageManager.directory,
|
|
64
63
|
pathToFolders(url, this.options),
|
|
65
64
|
'video',
|
|
@@ -72,16 +71,13 @@ class Video {
|
|
|
72
71
|
async cleanup() {
|
|
73
72
|
// Keep or remove the original file
|
|
74
73
|
if (get(this.options, 'videoParams.keepOriginalVideo', false)) {
|
|
75
|
-
const originalFile =
|
|
76
|
-
|
|
77
|
-
this.index + '-original.mp4'
|
|
78
|
-
);
|
|
79
|
-
await fileUtil.rename(this.videoPath, originalFile);
|
|
74
|
+
const originalFile = join(this.videoDir, this.index + '-original.mp4');
|
|
75
|
+
await rename(this.videoPath, originalFile);
|
|
80
76
|
} else {
|
|
81
|
-
await
|
|
77
|
+
await removeFile(this.videoPath);
|
|
82
78
|
}
|
|
83
79
|
// Remove all tmp videos (and screenshots)
|
|
84
|
-
return
|
|
80
|
+
return removeDirAndFiles(join(this.videoDir, 'tmp'));
|
|
85
81
|
}
|
|
86
82
|
|
|
87
83
|
/**
|
|
@@ -103,18 +99,16 @@ class Video {
|
|
|
103
99
|
this.options
|
|
104
100
|
);
|
|
105
101
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
await fileUtil.removeFile(this.videoPath);
|
|
117
|
-
}
|
|
102
|
+
await (this.options.video === true
|
|
103
|
+
? finetuneVideo(
|
|
104
|
+
this.videoDir,
|
|
105
|
+
this.videoPath,
|
|
106
|
+
this.index,
|
|
107
|
+
videoMetrics,
|
|
108
|
+
timingMetrics,
|
|
109
|
+
this.options
|
|
110
|
+
)
|
|
111
|
+
: removeFile(this.videoPath));
|
|
118
112
|
return videoMetrics;
|
|
119
113
|
}
|
|
120
114
|
|
|
@@ -127,4 +121,4 @@ class Video {
|
|
|
127
121
|
}
|
|
128
122
|
}
|
|
129
123
|
|
|
130
|
-
|
|
124
|
+
export default Video;
|
package/package.json
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "Browsertime",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0-beta.0",
|
|
4
4
|
"bin": "./bin/browsertime.js",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"dependencies": {
|
|
6
7
|
"@cypress/xvfb": "1.2.4",
|
|
7
8
|
"@devicefarmer/adbkit": "2.11.3",
|
|
8
|
-
"@sitespeed.io/chromedriver": "
|
|
9
|
-
"@sitespeed.io/edgedriver": "
|
|
9
|
+
"@sitespeed.io/chromedriver": "106.0.5249-61",
|
|
10
|
+
"@sitespeed.io/edgedriver": "106.0.1370-34",
|
|
10
11
|
"@sitespeed.io/geckodriver": "0.31.0-c",
|
|
11
12
|
"@sitespeed.io/throttle": "5.0.0",
|
|
12
13
|
"@sitespeed.io/tracium": "0.3.3",
|
|
13
14
|
"btoa": "1.2.1",
|
|
14
15
|
"chrome-har": "0.13.0",
|
|
15
16
|
"chrome-remote-interface": "0.31.3",
|
|
16
|
-
"dayjs": "1.11.
|
|
17
|
-
"execa": "
|
|
17
|
+
"dayjs": "1.11.6",
|
|
18
|
+
"execa": "6.1.0",
|
|
18
19
|
"fast-stats": "0.0.6",
|
|
19
|
-
"find-up": "
|
|
20
|
-
"get-port": "
|
|
20
|
+
"find-up": "6.3.0",
|
|
21
|
+
"get-port": "6.1.2",
|
|
21
22
|
"hasbin": "1.2.3",
|
|
22
23
|
"intel": "1.2.0",
|
|
23
24
|
"lodash.get": "4.4.2",
|
|
@@ -26,20 +27,21 @@
|
|
|
26
27
|
"lodash.merge": "4.6.2",
|
|
27
28
|
"lodash.pick": "4.4.0",
|
|
28
29
|
"lodash.set": "4.3.2",
|
|
29
|
-
"selenium-webdriver": "4.
|
|
30
|
-
"yargs": "17.
|
|
30
|
+
"selenium-webdriver": "4.5.0",
|
|
31
|
+
"yargs": "17.6.0"
|
|
31
32
|
},
|
|
32
33
|
"optionalDependencies": {
|
|
33
|
-
"jimp": "0.16.
|
|
34
|
+
"jimp": "0.16.2"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"ava": "
|
|
37
|
-
"eslint": "8.
|
|
37
|
+
"ava": "5.0.1",
|
|
38
|
+
"eslint": "8.26.0",
|
|
38
39
|
"eslint-config-prettier": "8.5.0",
|
|
39
|
-
"eslint-plugin-prettier": "4.
|
|
40
|
-
"
|
|
40
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
41
|
+
"eslint-plugin-unicorn": "44.0.2",
|
|
42
|
+
"prettier": "2.7.1",
|
|
41
43
|
"serve-handler": "6.1.3",
|
|
42
|
-
"serve": "
|
|
44
|
+
"serve": "14.0.1"
|
|
43
45
|
},
|
|
44
46
|
"engines": {
|
|
45
47
|
"node": ">=14.19.1"
|
|
@@ -60,7 +62,7 @@
|
|
|
60
62
|
"package.json",
|
|
61
63
|
"vendor"
|
|
62
64
|
],
|
|
63
|
-
"
|
|
65
|
+
"exports": "./index.js",
|
|
64
66
|
"scripts": {
|
|
65
67
|
"test": "ava",
|
|
66
68
|
"start-server": "serve test/data/html/",
|
|
@@ -91,7 +93,7 @@
|
|
|
91
93
|
"!test/data"
|
|
92
94
|
],
|
|
93
95
|
"concurrency": 1,
|
|
94
|
-
"failFast":
|
|
96
|
+
"failFast": false,
|
|
95
97
|
"require": [
|
|
96
98
|
"./test/util/setup.js"
|
|
97
99
|
],
|