browsertime 17.0.0-beta.4 → 17.0.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 +22 -13
- package/bin/browsertime.js +4 -4
- package/bin/browsertimeWebPageReplay.js +2 -2
- package/index.js +2 -2
- package/lib/android/gnirehtet.js +1 -2
- package/lib/android/root.js +57 -16
- package/lib/chrome/chromeDevtoolsProtocol.js +2 -3
- package/lib/chrome/har.js +1 -1
- package/lib/chrome/longTaskMetrics.js +1 -1
- package/lib/chrome/parseCpuTrace.js +2 -2
- package/lib/chrome/settings/chromeAndroidOptions.js +1 -1
- package/lib/chrome/settings/chromeDesktopOptions.js +1 -1
- package/lib/chrome/settings/traceCategories.js +1 -1
- package/lib/chrome/traceCategoriesParser.js +3 -3
- package/lib/chrome/webdriver/builder.js +1 -1
- package/lib/chrome/webdriver/chromium.js +13 -17
- package/lib/chrome/webdriver/setupChromiumOptions.js +18 -13
- package/lib/connectivity/humble.js +10 -12
- package/lib/connectivity/index.js +1 -1
- package/lib/core/engine/collector.js +2 -4
- package/lib/core/engine/command/addText.js +1 -2
- package/lib/core/engine/command/android.js +1 -1
- package/lib/core/engine/command/cache.js +1 -2
- package/lib/core/engine/command/chromeDevToolsProtocol.js +1 -2
- package/lib/core/engine/command/click.js +1 -2
- package/lib/core/engine/command/debug.js +1 -3
- package/lib/core/engine/command/javaScript.js +1 -2
- package/lib/core/engine/command/measure.js +13 -15
- package/lib/core/engine/command/meta.js +1 -1
- package/lib/core/engine/command/navigation.js +1 -1
- package/lib/core/engine/command/screenshot.js +1 -1
- package/lib/core/engine/command/scroll.js +1 -1
- package/lib/core/engine/command/select.js +1 -1
- package/lib/core/engine/command/set.js +1 -1
- package/lib/core/engine/command/stopWatch.js +1 -1
- package/lib/core/engine/command/switch.js +44 -1
- package/lib/core/engine/command/util/lcpHighlightScript.js +1 -1
- package/lib/core/engine/command/util/lsHighlightScript.js +1 -1
- package/lib/core/engine/command/wait.js +1 -1
- package/lib/core/engine/index.js +12 -12
- package/lib/core/engine/iteration.js +27 -27
- package/lib/core/engine/run.js +1 -1
- package/lib/core/pageCompleteChecks/defaultPageCompleteCheck.js +1 -1
- package/lib/core/pageCompleteChecks/pageCompleteCheckByInactivity.js +1 -1
- package/lib/core/pageCompleteChecks/spaInactivity.js +1 -1
- package/lib/core/seleniumRunner.js +9 -11
- package/lib/edge/webdriver/builder.js +1 -1
- package/lib/extensionserver/index.js +2 -4
- package/lib/extensionserver/setup.js +1 -1
- package/lib/firefox/geckoProfiler.js +46 -16
- package/lib/firefox/getHAR.js +1 -1
- package/lib/firefox/memoryReport.js +1 -1
- package/lib/firefox/settings/disableSafeBrowsingPreferences.js +1 -1
- package/lib/firefox/settings/disableTrackingProtectionPreferences.js +1 -1
- package/lib/firefox/settings/firefoxPreferences.js +1 -1
- package/lib/firefox/webdriver/builder.js +9 -9
- package/lib/firefox/webdriver/firefox.js +24 -6
- package/lib/safari/webdriver/safari.js +1 -1
- package/lib/screenshot/defaults.js +1 -1
- package/lib/screenshot/index.js +3 -5
- package/lib/support/cli.js +5 -5
- package/lib/support/dns.js +1 -1
- package/lib/support/engineUtils.js +5 -13
- package/lib/support/getViewPort.js +1 -1
- package/lib/support/har/index.js +6 -8
- package/lib/support/images/index.js +1 -1
- package/lib/support/logging.js +1 -1
- package/lib/support/pathToFolder.js +4 -4
- package/lib/support/preURL.js +1 -1
- package/lib/support/processes.js +1 -1
- package/lib/support/setResourceTimingBufferSize.js +1 -1
- package/lib/support/stop.js +1 -1
- package/lib/support/storageManager.js +1 -3
- package/lib/support/tcpdump.js +2 -2
- package/lib/support/xvfb.js +2 -4
- package/lib/video/postprocessing/finetune/addTextToVideo.js +3 -3
- package/lib/video/postprocessing/finetune/convertFps.js +1 -1
- package/lib/video/postprocessing/finetune/getFont.js +1 -1
- package/lib/video/postprocessing/finetune/getTimingMetrics.js +2 -2
- package/lib/video/postprocessing/finetune/index.js +4 -4
- package/lib/video/postprocessing/finetune/removeOrange.js +1 -1
- package/lib/video/postprocessing/visualmetrics/extraMetrics.js +1 -1
- package/lib/video/postprocessing/visualmetrics/getVideoMetrics.js +2 -2
- package/lib/video/screenRecording/android/recorder.js +1 -1
- package/lib/video/screenRecording/desktop/convert.js +1 -1
- package/lib/video/screenRecording/desktop/desktopRecorder.js +3 -3
- package/lib/video/screenRecording/desktop/ffmpegRecorder.js +6 -6
- package/lib/video/screenRecording/desktop/osx/getSPDisplaysDataType.js +1 -1
- package/lib/video/screenRecording/desktop/osx/getScreen.js +1 -1
- package/lib/video/screenRecording/firefox/firefoxWindowRecorder.js +1 -1
- package/lib/video/screenRecording/ios/convertToMp4.js +1 -1
- package/lib/video/screenRecording/ios/iosRecorder.js +2 -2
- package/lib/video/screenRecording/iosSimulator/convertToMp4.js +1 -1
- package/lib/video/screenRecording/iosSimulator/recorder.js +2 -2
- package/lib/video/screenRecording/recorder.js +6 -6
- package/lib/video/screenRecording/setOrangeBackground.js +1 -1
- package/lib/video/video.js +9 -11
- package/package.json +17 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# Browsertime changelog (we do [semantic versioning](https://semver.org))
|
|
2
2
|
|
|
3
|
-
## 17.0.0 -
|
|
3
|
+
## 17.0.0 - 2022-02-10
|
|
4
4
|
|
|
5
5
|
### Breaking changes
|
|
6
|
-
|
|
6
|
+
The project was transitioned to a [pure ESM package](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) [#1859](https://github.com/sitespeedio/browsertime/pull/1859), allowing us to stay current with dependencies that have made the same transition and ensuring the ability to always utilize the latest versions of our dependencies. This is important for us and will make the project easier to maintain.
|
|
7
|
+
|
|
7
8
|
|
|
8
9
|
#### CLI users
|
|
9
10
|
If you are a command line user and use scripting, you will need to do a change to your scripts or add a extra configuration.
|
|
11
|
+
|
|
10
12
|
The new browsertime version treat all JavaScript files that ends with *.js* as ESM modules, that means your old script files will not work out of the box. There's a couple of fixes for that:
|
|
11
13
|
|
|
12
14
|
**The best fix**:
|
|
@@ -25,11 +27,13 @@ export default async function (context, commands) {
|
|
|
25
27
|
}
|
|
26
28
|
```
|
|
27
29
|
|
|
28
|
-
If you have more complicated scripts, follow the [ESM package guide](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
|
|
30
|
+
If you have more complicated scripts, follow the [ESM package guide](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
|
|
31
|
+
|
|
32
|
+
This is the best fix and will woirk 100% of the time.
|
|
29
33
|
|
|
30
|
-
**The quick fix**: Rename your *.js* to *.cjs* that way NodeJS will treat your file as a common JS file and
|
|
34
|
+
**The quick fix**: Rename your *.js* to *.cjs* that way NodeJS will treat your file as a common JS file and everything will just work. For example if you have a file names `login.js` you can rename that to `login.cjs` and make sure you load that new file.
|
|
31
35
|
|
|
32
|
-
**Another quick fix alternative**:
|
|
36
|
+
**Another quick fix alternative**: As a last alternative add `--cjs` as a parameter to your test. That way the scripting file will be treated as a commonjs file. This is a hack, so to make sure it works, the user that runs Browsertime need to have write privileges to the folder where you have your scripting files. Browsertime will create a package.json file on the same levels as yoru script file. If you already have a package.json there, it will be overwritten.
|
|
33
37
|
|
|
34
38
|
#### Non cli users
|
|
35
39
|
If you import Browsertime in NodeJS we changed how you do your import.
|
|
@@ -50,7 +54,7 @@ Read [Sindre Sorhus Pure ESM package guide](https://gist.github.com/sindresorhus
|
|
|
50
54
|
|
|
51
55
|
* We moved to use a new [Visual Metrics script](https://github.com/sitespeedio/browsertime/blob/main/browsertime/visualmetrics-portable.py) as default contributed by [Gregory Mierzwinski](https://github.com/gmierz) that do _not_ use ImageMagick. Mozilla has used this script for many months and we have internally used it in our test infrastructure since it was first released.
|
|
52
56
|
|
|
53
|
-
If you run Browsertime direct using NodeJs (and not using Docker) you need to install two new Python dependencies OpenCV-Python Numpy
|
|
57
|
+
If you run Browsertime direct using NodeJs (and not using Docker) you need to install two new Python dependencies `OpenCV-Python Numpy`.
|
|
54
58
|
|
|
55
59
|
```
|
|
56
60
|
python -m pip install --user OpenCV-Python Numpy
|
|
@@ -59,16 +63,21 @@ python -m pip install --user OpenCV-Python Numpy
|
|
|
59
63
|
This is pretty cool because it makes dependencies easier to install on all platforms + the script has also been cleaned up so its easier for us to maintain.
|
|
60
64
|
|
|
61
65
|
### Added
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* Updated
|
|
65
|
-
* Updated to
|
|
66
|
-
*
|
|
67
|
-
|
|
66
|
+
* Selenium 4.8.
|
|
67
|
+
* Updated dependencies: execa, days, find-up, get-ports, jimp, yargs [#1860](https://github.com/sitespeedio/browsertime/pull/1860)
|
|
68
|
+
* Updated to Chrome, Firefox and Edge 109 in the Docker container. Also updated all drivers.
|
|
69
|
+
* Updated to NodeJS 18 and Ubuntu 22.04 in the Docker container.
|
|
70
|
+
* Get CPU metrics using Glean on Firefox, thank you [afinder-mozilla](https://github.com/afinder-mozilla) for PR [#1875](https://github.com/sitespeedio/browsertime/pull/1875)
|
|
71
|
+
* Provide active tab id to gecko profiler StartProfiler API in Firefox, thank you [Nazım Can Altınova](https://github.com/canova) for PR [#1874](https://github.com/sitespeedio/browsertime/pull/1874).
|
|
72
|
+
* There's two new methods to switch to frame: `switch.toFrameByXpath(xpath)` and `switch.toFrameBySelector(selector)` [#1880](https://github.com/sitespeedio/browsertime/pull/1880).
|
|
73
|
+
* Add a timeout to gecko profiler gzipping phase, thank you [Nazım Can Altınova](https://github.com/canova) for PR [#1896](https://github.com/sitespeedio/browsertime/pull/1896)
|
|
74
|
+
* Pin CPU freq to fastest for Samsung A51 (if you have a rooted device) [#1895](https://github.com/sitespeedio/browsertime/pull/1895).
|
|
68
75
|
### Fixed
|
|
69
76
|
* Pause the gecko profiler before starting to collect the profile data, thank you [Nazım Can Altınova](https://github.com/canova) for PR [#1856](https://github.com/sitespeedio/browsertime/pull/1856).
|
|
70
77
|
|
|
71
|
-
* All Android configurations has been moved to an Android group. That makes it easier when you run --help and can see all Android configuration grouped together. For example `--androidBatteryTemperature` is now `--android.batteryTemperatureLimit`. Old names will still work
|
|
78
|
+
* All Android configurations has been moved to an Android group. That makes it easier when you run --help and can see all Android configuration grouped together. For example `--androidBatteryTemperature` is now `--android.batteryTemperatureLimit`. Old names will still work but are deprecated [#1865](https://github.com/sitespeedio/browsertime/pull/1865).
|
|
79
|
+
|
|
80
|
+
* Updated to Chromedriver 110 to work with Android 13 [#1894](https://github.com/sitespeedio/browsertime/pull/1894).
|
|
72
81
|
|
|
73
82
|
## 16.17.0 - 2022-09-27
|
|
74
83
|
### Added
|
package/bin/browsertime.js
CHANGED
|
@@ -5,15 +5,15 @@ import set from 'lodash.set';
|
|
|
5
5
|
import intel from 'intel';
|
|
6
6
|
import { existsSync, mkdirSync } from 'node:fs';
|
|
7
7
|
import { resolve, relative } from 'node:path';
|
|
8
|
-
import Engine from '../lib/core/engine/index.js';
|
|
8
|
+
import { Engine } from '../lib/core/engine/index.js';
|
|
9
9
|
import {
|
|
10
10
|
findAndParseScripts,
|
|
11
11
|
allScriptCategories,
|
|
12
12
|
getScriptsForCategories
|
|
13
13
|
} from '../lib/support/browserScript.js';
|
|
14
|
-
import
|
|
14
|
+
import { configure } from '../lib/support/logging.js';
|
|
15
15
|
import { parseCommandLine } from '../lib/support/cli.js';
|
|
16
|
-
import StorageManager from '../lib/support/storageManager.js';
|
|
16
|
+
import { StorageManager } from '../lib/support/storageManager.js';
|
|
17
17
|
import { loadScript } from '../lib/support/engineUtils.js';
|
|
18
18
|
import { isAndroidConfigured } from '../lib/android/index.js';
|
|
19
19
|
|
|
@@ -154,7 +154,7 @@ async function run(urls, options) {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
let cliResult = parseCommandLine();
|
|
157
|
-
|
|
157
|
+
configure(cliResult.options);
|
|
158
158
|
|
|
159
159
|
/*
|
|
160
160
|
Each url can be:
|
|
@@ -3,8 +3,8 @@ import merge from 'lodash.merge';
|
|
|
3
3
|
import yargs from 'yargs';
|
|
4
4
|
import { hideBin } from 'yargs/helpers';
|
|
5
5
|
|
|
6
|
-
import Engine from '../lib/core/engine/index.js';
|
|
7
|
-
import logging from '../lib/support/logging.js';
|
|
6
|
+
import { Engine } from '../lib/core/engine/index.js';
|
|
7
|
+
import { configure as logging } from '../lib/support/logging.js';
|
|
8
8
|
|
|
9
9
|
async function runBrowsertime() {
|
|
10
10
|
let yargsInstance = yargs(hideBin(process.argv));
|
package/index.js
CHANGED
|
@@ -12,5 +12,5 @@ export const browserScripts = {
|
|
|
12
12
|
findAndParseScripts
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
15
|
+
export { Engine as BrowsertimeEngine } from './lib/core/engine/index.js';
|
|
16
|
+
export { configure as configureLogging } from './lib/support/logging.js';
|
package/lib/android/gnirehtet.js
CHANGED
|
@@ -3,7 +3,7 @@ import intel from 'intel';
|
|
|
3
3
|
const log = intel.getLogger('browsertime.gnirehtet');
|
|
4
4
|
const delay = ms => new Promise(response => setTimeout(response, ms));
|
|
5
5
|
|
|
6
|
-
class Gnirehtet {
|
|
6
|
+
export class Gnirehtet {
|
|
7
7
|
constructor(options) {
|
|
8
8
|
this.options = options;
|
|
9
9
|
}
|
|
@@ -65,4 +65,3 @@ class Gnirehtet {
|
|
|
65
65
|
return delay(2000);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
export default Gnirehtet;
|
package/lib/android/root.js
CHANGED
|
@@ -11,7 +11,7 @@ const animationsToStop = [
|
|
|
11
11
|
'window_animation_scale'
|
|
12
12
|
];
|
|
13
13
|
|
|
14
|
-
class RootedDevice {
|
|
14
|
+
export class RootedDevice {
|
|
15
15
|
constructor(androidClient) {
|
|
16
16
|
this.client = androidClient;
|
|
17
17
|
}
|
|
@@ -83,6 +83,29 @@ class RootedDevice {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
async setCPUPerformanceSamsungA51() {
|
|
87
|
+
// Octa-core (4x2.3 GHz Cortex-A73 & 4x1.7 GHz Cortex-A53)
|
|
88
|
+
// See values by
|
|
89
|
+
// cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies
|
|
90
|
+
// cat /sys/devices/system/cpu/cpufreq/policy4/scaling_available_frequencies
|
|
91
|
+
|
|
92
|
+
await this.client._runAsRoot(
|
|
93
|
+
'echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor'
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
await this.client._runAsRoot(
|
|
97
|
+
'echo performance > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor'
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
await this.client._runAsRoot(
|
|
101
|
+
'echo 1742000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq'
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
return this.client._runAsRoot(
|
|
105
|
+
'echo 2314000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq'
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
86
109
|
async setCPUPerformancePixel2() {
|
|
87
110
|
// MSM8998 (4x 2.35GHz, 4x 1.9GHz)
|
|
88
111
|
// values obtained from:
|
|
@@ -166,6 +189,11 @@ class RootedDevice {
|
|
|
166
189
|
);
|
|
167
190
|
}
|
|
168
191
|
|
|
192
|
+
async setGPUPerformanceSamsungA51() {
|
|
193
|
+
// Mali-G72 MP3 (3 @ 850 MHz)
|
|
194
|
+
// Missing info on how to set the GPU
|
|
195
|
+
}
|
|
196
|
+
|
|
169
197
|
async start() {
|
|
170
198
|
await this.stopServices();
|
|
171
199
|
await this.stopAnimations();
|
|
@@ -178,19 +206,34 @@ class RootedDevice {
|
|
|
178
206
|
`getprop ro.product.model`
|
|
179
207
|
);
|
|
180
208
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
209
|
+
switch (model) {
|
|
210
|
+
case 'Moto G (5)': {
|
|
211
|
+
log.info('Set CPU and GPU performance settings for Moto G5');
|
|
212
|
+
await this.setCPUPerformanceMotoG5();
|
|
213
|
+
await this.setGPUPerformanceMotoG5();
|
|
214
|
+
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
case 'Pixel 2': {
|
|
218
|
+
log.info('Set CPU and GPU performance settings for Pixel 2');
|
|
219
|
+
await this.setCPUPerformancePixel2();
|
|
220
|
+
await this.setGPUPerformancePixel2();
|
|
221
|
+
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
case 'SM-A515F': {
|
|
225
|
+
// Samsung A51
|
|
226
|
+
await this.setCPUPerformanceSamsungA51();
|
|
227
|
+
await this.setGPUPerformanceSamsungA51();
|
|
228
|
+
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
default: {
|
|
232
|
+
log.info(
|
|
233
|
+
'No specific CPU/GPU settings for %s - you can help out by creating a PR at https://github.com/sitespeedio/browsertime for your phone',
|
|
234
|
+
model
|
|
235
|
+
);
|
|
236
|
+
}
|
|
194
237
|
}
|
|
195
238
|
}
|
|
196
239
|
|
|
@@ -199,5 +242,3 @@ class RootedDevice {
|
|
|
199
242
|
return this.startAnimations();
|
|
200
243
|
}
|
|
201
244
|
}
|
|
202
|
-
|
|
203
|
-
export default RootedDevice;
|
|
@@ -3,7 +3,7 @@ import CDP from 'chrome-remote-interface';
|
|
|
3
3
|
import btoa from 'btoa';
|
|
4
4
|
const log = intel.getLogger('browsertime.chrome.cdp');
|
|
5
5
|
import { toArray } from '../support/util.js';
|
|
6
|
-
import defaultTraceCategories from './settings/traceCategories.js';
|
|
6
|
+
import { traceCategories as defaultTraceCategories } from './settings/traceCategories.js';
|
|
7
7
|
|
|
8
8
|
const MIME_TYPE_MATCHERS = [
|
|
9
9
|
[/^text\/html/, 'html'],
|
|
@@ -20,7 +20,7 @@ function getContentType(mimeType) {
|
|
|
20
20
|
return MIME_TYPE_MATCHERS.find(matcher => matcher[0].test(mimeType))[1];
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
class ChromeDevtoolsProtocol {
|
|
23
|
+
export class ChromeDevtoolsProtocol {
|
|
24
24
|
constructor(options) {
|
|
25
25
|
this.options = options;
|
|
26
26
|
this.chrome = options.chrome || {};
|
|
@@ -234,4 +234,3 @@ class ChromeDevtoolsProtocol {
|
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
export default ChromeDevtoolsProtocol;
|
package/lib/chrome/har.js
CHANGED
|
@@ -11,7 +11,7 @@ function slowestFirst(a, b) {
|
|
|
11
11
|
return b.value - a.value;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export async function parseCPUTrace(tracelog, url) {
|
|
15
15
|
try {
|
|
16
16
|
log.debug('Start parse Chrome trace log using Tracium.');
|
|
17
17
|
const tasks = computeMainThreadTasks(tracelog, {
|
|
@@ -87,4 +87,4 @@ export default async (tracelog, url) => {
|
|
|
87
87
|
);
|
|
88
88
|
return {};
|
|
89
89
|
}
|
|
90
|
-
}
|
|
90
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* see https://github.com/GoogleChrome/chrome-launcher/blob/master/docs/chrome-flags-for-tools.md
|
|
4
4
|
* https://peter.sh/experiments/chromium-command-line-switches/
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export const chromeAndroidOptions = [
|
|
7
7
|
'--disable-fre',
|
|
8
8
|
// : Disable reporting to UMA, but allows for collection
|
|
9
9
|
'--metrics-recording-only',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// See https://github.com/GoogleChrome/chrome-launcher/blob/master/docs/chrome-flags-for-tools.md
|
|
2
2
|
// https://peter.sh/experiments/chromium-command-line-switches/
|
|
3
|
-
export
|
|
3
|
+
export const chromeDesktopOptions = [
|
|
4
4
|
'--disable-background-networking',
|
|
5
5
|
'--no-default-browser-check',
|
|
6
6
|
'--no-first-run',
|
|
@@ -119,9 +119,7 @@ function cleanTrace(trace, url) {
|
|
|
119
119
|
// and using TS of first found TracingStartedIn* event
|
|
120
120
|
|
|
121
121
|
// With Chrome 58 we got undefined events on Travis (I cant't reproduce it on my local)
|
|
122
|
-
if (mostActiveFrame
|
|
123
|
-
traceEvents.unshift(makeMockEvent(mostActiveFrame, ts));
|
|
124
|
-
} else {
|
|
122
|
+
if (mostActiveFrame === undefined) {
|
|
125
123
|
// sometimes it seems we are missing inserting the 'TracingStartedInPage
|
|
126
124
|
// let log and find out more
|
|
127
125
|
log.error(
|
|
@@ -130,6 +128,8 @@ function cleanTrace(trace, url) {
|
|
|
130
128
|
traceEvents.length,
|
|
131
129
|
threads
|
|
132
130
|
);
|
|
131
|
+
} else {
|
|
132
|
+
traceEvents.unshift(makeMockEvent(mostActiveFrame, ts));
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
// Verify that we got a navigationStart event for that frame. In Chrome 76 we started to get
|
|
@@ -4,7 +4,7 @@ import get from 'lodash.get';
|
|
|
4
4
|
import { logging } from 'selenium-webdriver';
|
|
5
5
|
import { ServiceBuilder, Options } from 'selenium-webdriver/chrome.js';
|
|
6
6
|
import { pac, manual } from 'selenium-webdriver/proxy.js';
|
|
7
|
-
import setupChromiumOptions from './setupChromiumOptions.js';
|
|
7
|
+
import { setupChromiumOptions } from './setupChromiumOptions.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Configure a WebDriver builder based on the specified options.
|
|
@@ -5,20 +5,20 @@ import { logging } from 'selenium-webdriver';
|
|
|
5
5
|
import intel from 'intel';
|
|
6
6
|
const log = intel.getLogger('browsertime.chrome');
|
|
7
7
|
const { Type } = logging;
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
8
|
+
import { longTaskMetrics } from '../longTaskMetrics.js';
|
|
9
|
+
import { parseCPUTrace } from '../parseCpuTrace.js';
|
|
10
|
+
import { getHar } from '../har.js';
|
|
11
11
|
import { getEmptyHAR, mergeHars } from '../../support/har/index.js';
|
|
12
12
|
import { toArray } from '../../support/util.js';
|
|
13
13
|
import { logging as _logging } from 'selenium-webdriver';
|
|
14
14
|
import { parse } from '../traceCategoriesParser.js';
|
|
15
|
-
import pathToFolder from '../../support/pathToFolder.js';
|
|
16
|
-
import ChromeDevtoolsProtocol from '../chromeDevtoolsProtocol.js';
|
|
15
|
+
import { pathToFolder } from '../../support/pathToFolder.js';
|
|
16
|
+
import { ChromeDevtoolsProtocol } from '../chromeDevtoolsProtocol.js';
|
|
17
17
|
import { Android, isAndroidConfigured } from '../../android/index.js';
|
|
18
18
|
const unlink = promisify(_unlink);
|
|
19
19
|
const rm = promisify(_rm);
|
|
20
20
|
|
|
21
|
-
class Chromium {
|
|
21
|
+
export class Chromium {
|
|
22
22
|
constructor(storageManager, options) {
|
|
23
23
|
this.options = options;
|
|
24
24
|
this.chrome = options.chrome || {};
|
|
@@ -248,7 +248,7 @@ class Chromium {
|
|
|
248
248
|
|
|
249
249
|
if (!this.skipHar) {
|
|
250
250
|
this.hars.push(
|
|
251
|
-
await
|
|
251
|
+
await getHar(
|
|
252
252
|
runner,
|
|
253
253
|
result,
|
|
254
254
|
index,
|
|
@@ -286,11 +286,9 @@ class Chromium {
|
|
|
286
286
|
break;
|
|
287
287
|
}
|
|
288
288
|
default: {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
cleanedMetrics[m.name] = m.value;
|
|
293
|
-
}
|
|
289
|
+
cleanedMetrics[m.name] = m.name.includes('Duration')
|
|
290
|
+
? m.value * 1000
|
|
291
|
+
: m.value;
|
|
294
292
|
}
|
|
295
293
|
}
|
|
296
294
|
}
|
|
@@ -334,7 +332,7 @@ class Chromium {
|
|
|
334
332
|
if (this.collectTracingEvents) {
|
|
335
333
|
const trace = parse(this.events, result.url);
|
|
336
334
|
result.extraJson[`trace-${index}.json`] = trace;
|
|
337
|
-
const cpu = await
|
|
335
|
+
const cpu = await parseCPUTrace(trace, result.url);
|
|
338
336
|
result.cpu = cpu;
|
|
339
337
|
|
|
340
338
|
// Collect render blocking info
|
|
@@ -420,7 +418,7 @@ class Chromium {
|
|
|
420
418
|
result.browserScripts.pageinfo &&
|
|
421
419
|
result.browserScripts.pageinfo.longTask
|
|
422
420
|
) {
|
|
423
|
-
const cpuData =
|
|
421
|
+
const cpuData = longTaskMetrics(result, this.options);
|
|
424
422
|
if (result.cpu) {
|
|
425
423
|
result.cpu.longTasks = cpuData.longTasks;
|
|
426
424
|
} else {
|
|
@@ -492,12 +490,10 @@ class Chromium {
|
|
|
492
490
|
}
|
|
493
491
|
|
|
494
492
|
async getHARs() {
|
|
495
|
-
return
|
|
493
|
+
return this.skipHar ? {} : { har: mergeHars(this.hars) };
|
|
496
494
|
}
|
|
497
495
|
|
|
498
496
|
async setCookies(url, cookies) {
|
|
499
497
|
return this.cdpClient.setCookies(url, cookies);
|
|
500
498
|
}
|
|
501
499
|
}
|
|
502
|
-
|
|
503
|
-
export default Chromium;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import intel from 'intel';
|
|
3
|
-
import defaultChromeOptions from '../settings/chromeDesktopOptions.js';
|
|
4
|
-
import defaultAndroidChromeOptions from '../settings/chromeAndroidOptions.js';
|
|
5
|
-
import getViewPort from '../../support/getViewPort.js';
|
|
3
|
+
import { chromeDesktopOptions as defaultChromeOptions } from '../settings/chromeDesktopOptions.js';
|
|
4
|
+
import { chromeAndroidOptions as defaultAndroidChromeOptions } from '../settings/chromeAndroidOptions.js';
|
|
5
|
+
import { getViewPort } from '../../support/getViewPort.js';
|
|
6
6
|
import { toArray } from '../../support/util.js';
|
|
7
7
|
import { isAndroidConfigured } from '../../android/index.js';
|
|
8
8
|
const log = intel.getLogger('browsertime.chrome');
|
|
@@ -19,7 +19,12 @@ const CHROME_AMD_EDGE_INTERNAL_PHONE_HOME = [
|
|
|
19
19
|
'"MAP optimizationguide-pa.googleapis.com 127.0.0.1"'
|
|
20
20
|
];
|
|
21
21
|
|
|
22
|
-
export
|
|
22
|
+
export function setupChromiumOptions(
|
|
23
|
+
seleniumOptions,
|
|
24
|
+
browserOptions,
|
|
25
|
+
options,
|
|
26
|
+
baseDir
|
|
27
|
+
) {
|
|
23
28
|
// Fixing save password popup, only on Desktop
|
|
24
29
|
|
|
25
30
|
if (!isAndroidConfigured(options)) {
|
|
@@ -93,9 +98,9 @@ export default function (seleniumOptions, browserOptions, options, baseDir) {
|
|
|
93
98
|
}
|
|
94
99
|
|
|
95
100
|
if (options.extension) {
|
|
96
|
-
const extensions =
|
|
97
|
-
?
|
|
98
|
-
: options.extension;
|
|
101
|
+
const extensions = Array.isArray(options.extension)
|
|
102
|
+
? options.extension
|
|
103
|
+
: [options.extension];
|
|
99
104
|
for (const extension of extensions) {
|
|
100
105
|
seleniumOptions.addExtensions(
|
|
101
106
|
readFileSync(extension, { encoding: 'base64' })
|
|
@@ -119,9 +124,9 @@ export default function (seleniumOptions, browserOptions, options, baseDir) {
|
|
|
119
124
|
}
|
|
120
125
|
|
|
121
126
|
if (browserOptions.collectNetLog) {
|
|
122
|
-
const dir =
|
|
123
|
-
?
|
|
124
|
-
:
|
|
127
|
+
const dir = isAndroidConfigured(browserOptions)
|
|
128
|
+
? '/data/local/tmp'
|
|
129
|
+
: baseDir;
|
|
125
130
|
seleniumOptions.addArguments(`--log-net-log=${dir}/chromeNetlog.json`);
|
|
126
131
|
const level = browserOptions.netLogCaptureMode || 'IncludeSensitive';
|
|
127
132
|
seleniumOptions.addArguments(`--net-log-capture-mode=${level}`);
|
|
@@ -133,13 +138,13 @@ export default function (seleniumOptions, browserOptions, options, baseDir) {
|
|
|
133
138
|
'--remote-debugging-port=' + options.devToolsPort
|
|
134
139
|
);
|
|
135
140
|
} else {
|
|
136
|
-
if (
|
|
141
|
+
if (browserOptions.noDefaultOptions) {
|
|
142
|
+
log.info('Skip setting default options for Chrome');
|
|
143
|
+
} else {
|
|
137
144
|
seleniumOptions.addArguments(defaultChromeOptions);
|
|
138
145
|
seleniumOptions.addArguments(
|
|
139
146
|
'--remote-debugging-port=' + options.devToolsPort
|
|
140
147
|
);
|
|
141
|
-
} else {
|
|
142
|
-
log.info('Skip setting default options for Chrome');
|
|
143
148
|
}
|
|
144
149
|
}
|
|
145
150
|
|
|
@@ -4,7 +4,7 @@ import get from 'lodash.get';
|
|
|
4
4
|
import intel from 'intel';
|
|
5
5
|
const log = intel.getLogger('browsertime.connectivity.humble');
|
|
6
6
|
|
|
7
|
-
class Humble {
|
|
7
|
+
export class Humble {
|
|
8
8
|
constructor(options) {
|
|
9
9
|
this.url = get(options.connectivity, 'humble.url');
|
|
10
10
|
this.profile = options.connectivity.profile;
|
|
@@ -13,13 +13,13 @@ class Humble {
|
|
|
13
13
|
async start(profile) {
|
|
14
14
|
const library = this.url.startsWith('https') ? https : http;
|
|
15
15
|
const res = await new Promise(resolve => {
|
|
16
|
-
if (this.profile
|
|
17
|
-
library.get(`${this.url}/api/${this.profile}`, resolve);
|
|
18
|
-
} else {
|
|
16
|
+
if (this.profile === 'custom') {
|
|
19
17
|
library.get(
|
|
20
18
|
`${this.url}/api/custom?up=${profile.up}&down=${profile.down}&rtt=${profile.rtt}`,
|
|
21
19
|
resolve
|
|
22
20
|
);
|
|
21
|
+
} else {
|
|
22
|
+
library.get(`${this.url}/api/${this.profile}`, resolve);
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
|
|
@@ -30,10 +30,10 @@ class Humble {
|
|
|
30
30
|
res.on('end', () => resolve(data));
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
if (res.statusCode
|
|
34
|
-
log.error('Humble response: %s', data);
|
|
35
|
-
} else {
|
|
33
|
+
if (res.statusCode === 200) {
|
|
36
34
|
log.info('Switch Humble at %s to use profile %s', this.url, this.profile);
|
|
35
|
+
} else {
|
|
36
|
+
log.error('Humble response: %s', data);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -50,12 +50,10 @@ class Humble {
|
|
|
50
50
|
res.on('end', () => resolve(data));
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
if (res.statusCode
|
|
54
|
-
log.error('Humble response: %s', data);
|
|
55
|
-
} else {
|
|
53
|
+
if (res.statusCode === 200) {
|
|
56
54
|
log.info('Humble throttling stopped successfully');
|
|
55
|
+
} else {
|
|
56
|
+
log.error('Humble response: %s', data);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
export default Humble;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
stop as throttleStop
|
|
6
6
|
} from '@sitespeed.io/throttle';
|
|
7
7
|
const log = intel.getLogger('browsertime.connectivity');
|
|
8
|
-
import Humble from './humble.js';
|
|
8
|
+
import { Humble } from './humble.js';
|
|
9
9
|
import { parseTrafficShapeConfig } from './trafficShapeParser.js';
|
|
10
10
|
|
|
11
11
|
let humble;
|
|
@@ -4,7 +4,7 @@ import get from 'lodash.get';
|
|
|
4
4
|
import intel from 'intel';
|
|
5
5
|
import { timestamp as _timestamp } from '../../support/engineUtils.js';
|
|
6
6
|
import { Statistics } from '../../support/statistics.js';
|
|
7
|
-
import pathToFolder from '../../support/pathToFolder.js';
|
|
7
|
+
import { pathToFolder } from '../../support/pathToFolder.js';
|
|
8
8
|
import { getConnectivitySettings } from '../../connectivity/index.js';
|
|
9
9
|
import { formatMetric } from '../../support/util.js';
|
|
10
10
|
const require = createRequire(import.meta.url);
|
|
@@ -60,7 +60,7 @@ function getNewResult(url, options) {
|
|
|
60
60
|
* per iteration and store what's needed to disk.
|
|
61
61
|
* @class
|
|
62
62
|
*/
|
|
63
|
-
class Collector {
|
|
63
|
+
export class Collector {
|
|
64
64
|
constructor(url, storageManager, options) {
|
|
65
65
|
this.options = options;
|
|
66
66
|
this.storageManager = storageManager;
|
|
@@ -520,5 +520,3 @@ class Collector {
|
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
|
-
|
|
524
|
-
export default Collector;
|
|
@@ -2,7 +2,7 @@ import { By } from 'selenium-webdriver';
|
|
|
2
2
|
import intel from 'intel';
|
|
3
3
|
const log = intel.getLogger('browsertime.command.addText');
|
|
4
4
|
|
|
5
|
-
class AddText {
|
|
5
|
+
export class AddText {
|
|
6
6
|
constructor(browser) {
|
|
7
7
|
this.browser = browser;
|
|
8
8
|
}
|
|
@@ -117,4 +117,3 @@ class AddText {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
export default AddText;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import intel from 'intel';
|
|
2
2
|
import { Android, isAndroidConfigured } from '../../../android/index.js';
|
|
3
3
|
const log = intel.getLogger('browsertime.command.android');
|
|
4
|
-
export
|
|
4
|
+
export class AndroidCommand {
|
|
5
5
|
constructor(options) {
|
|
6
6
|
this.options = options;
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import intel from 'intel';
|
|
2
2
|
const log = intel.getLogger('browsertime.command.cache');
|
|
3
|
-
class Cache {
|
|
3
|
+
export class Cache {
|
|
4
4
|
constructor(browser, browserName, extensionServer, cdp) {
|
|
5
5
|
this.browser = browser;
|
|
6
6
|
this.browserName = browserName;
|
|
@@ -45,4 +45,3 @@ class Cache {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
export default Cache;
|
|
@@ -2,7 +2,7 @@ import intel from 'intel';
|
|
|
2
2
|
const log = intel.getLogger('browsertime.command.devtoolsprotocol');
|
|
3
3
|
|
|
4
4
|
// https://chromedevtools.github.io/devtools-protocol/
|
|
5
|
-
class
|
|
5
|
+
export class ChromeDevelopmentToolsProtocol {
|
|
6
6
|
constructor(engineDelegate, browserName) {
|
|
7
7
|
this.engineDelegate = engineDelegate;
|
|
8
8
|
this.browserName = browserName;
|
|
@@ -70,4 +70,3 @@ class DevelopmentToolsProtocol {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
export default DevelopmentToolsProtocol;
|