browsertime 14.13.1 → 14.16.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 +16 -0
- package/lib/android/index.js +9 -0
- package/lib/chrome/webdriver/chromium.js +4 -2
- package/lib/connectivity/humble.js +62 -0
- package/lib/connectivity/index.js +9 -0
- package/lib/core/engine/index.js +8 -0
- package/lib/firefox/webdriver/firefox.js +15 -1
- package/lib/support/cli.js +23 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Browsertime changelog (we do [semantic versioning](https://semver.org))
|
|
2
2
|
|
|
3
|
+
## 14.16.0 - 2022-01-14
|
|
4
|
+
### Added
|
|
5
|
+
* Upgraded Geckodriver downloader that downloads a pre-built Geckodriver on Raspberry Pis.
|
|
6
|
+
|
|
7
|
+
## 14.15.0 - 2022-01-12
|
|
8
|
+
### Added
|
|
9
|
+
* Added so you can append a String to Firefox User Agent [#1694](https://github.com/sitespeedio/browsertime/pull/1694), thank you [Henrik Skupin](https://github.com/whimboo) for pointing me in the right direction. With [#1695](https://github.com/sitespeedio/browsertime/pull/1695) we now have `--appendToUserAgent` that works in Chrome/Edge and Firefox.
|
|
10
|
+
## 14.14.1 - 2022-01-12
|
|
11
|
+
### Fixed
|
|
12
|
+
* Updated Chromedriver library that pickup already installed driver on Raspberry Pis. This makes it easier to run tests on an Android device from a Raspberry Pi.
|
|
13
|
+
## 14.14.0 - 2022-01-10
|
|
14
|
+
### Added
|
|
15
|
+
* Add support for [Humble](https://calendar.perfplanet.com/2021/introducing-humble-the-raspberry-pi-wifi-network-link-conditioner/) as connectivity engine for mobile phone testing. Make sure to setup Humble on a Raspberry Pi 4 and the choose engine with `--connectivity.engine humble` and set the URL to your instance `--connectivity.humble.url http://raspberrypi.local:3000`. Added in [#1691](https://github.com/sitespeedio/browsertime/pull/1691).
|
|
16
|
+
* Upgraded to Chrome 97, Edge 97 and Firefox 95 in the Docker container.
|
|
17
|
+
* Upgraded to Chromedriver 97.
|
|
18
|
+
|
|
3
19
|
## 14.13.1 - 2022-01-01
|
|
4
20
|
### Fixed
|
|
5
21
|
* Added missing `--chrome.appendToUserAgent` in the CLI help.
|
package/lib/android/index.js
CHANGED
|
@@ -228,6 +228,15 @@ class Android {
|
|
|
228
228
|
return this._runCommand('input keyevent KEYCODE_POWER');
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
async getWifi() {
|
|
232
|
+
const rawWifiInfo = await this._runCommand(
|
|
233
|
+
`dumpsys netstats | grep -E 'iface=wlan.*networkId'`
|
|
234
|
+
);
|
|
235
|
+
const wifiInfo = (await adb.util.readAll(rawWifiInfo)).toString().trim();
|
|
236
|
+
const wifi = wifiInfo.match(/(?:"[^"]*"|^[^"]*$)/)[0].replace(/"/g, '');
|
|
237
|
+
return wifi;
|
|
238
|
+
}
|
|
239
|
+
|
|
231
240
|
async closeAppNotRespondingPopup() {
|
|
232
241
|
const result = await this._runCommandAndGet('dumpsys window windows');
|
|
233
242
|
if (result.indexOf('Application Not Responding') > -1) {
|
|
@@ -105,13 +105,15 @@ class Chromium {
|
|
|
105
105
|
await this.cdpClient.setupCPUThrottling(this.chrome.CPUThrottlingRate);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
if (this.chrome.appendToUserAgent) {
|
|
108
|
+
if (this.chrome.appendToUserAgent || this.options.appendToUserAgent) {
|
|
109
109
|
const currentUserAgent = await runner.runScript(
|
|
110
110
|
'return navigator.userAgent;',
|
|
111
111
|
'GET_USER_AGENT'
|
|
112
112
|
);
|
|
113
113
|
await this.cdpClient.setUserAgent(
|
|
114
|
-
currentUserAgent +
|
|
114
|
+
currentUserAgent +
|
|
115
|
+
' ' +
|
|
116
|
+
(this.chrome.appendToUserAgent || this.options.appendToUserAgent)
|
|
115
117
|
);
|
|
116
118
|
} else if (this.chrome.mobileEmulation && this.options.userAgent) {
|
|
117
119
|
// Hack to set user agent for mobile emulation
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const http = require('http');
|
|
4
|
+
const https = require('https');
|
|
5
|
+
const get = require('lodash.get');
|
|
6
|
+
const log = require('intel').getLogger('browsertime.connectivity.humble');
|
|
7
|
+
|
|
8
|
+
class Humble {
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.url = get(options.connectivity, 'humble.url');
|
|
11
|
+
this.profile = options.connectivity.profile;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async start(profile) {
|
|
15
|
+
const lib = this.url.startsWith('https') ? https : http;
|
|
16
|
+
const res = await new Promise(resolve => {
|
|
17
|
+
if (this.profile !== 'custom') {
|
|
18
|
+
lib.get(`${this.url}/api/${this.profile}`, resolve);
|
|
19
|
+
} else {
|
|
20
|
+
lib.get(
|
|
21
|
+
`${this.url}/api/custom?up=${profile.up}&down=${profile.down}&rtt=${profile.rtt}`,
|
|
22
|
+
resolve
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
let data = await new Promise((resolve, reject) => {
|
|
28
|
+
let data = '';
|
|
29
|
+
res.on('data', chunk => (data += chunk));
|
|
30
|
+
res.on('error', err => reject(err));
|
|
31
|
+
res.on('end', () => resolve(data));
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
if (res.statusCode !== 200) {
|
|
35
|
+
log.error('Humble response: %s', data);
|
|
36
|
+
} else {
|
|
37
|
+
log.info('Switch Humble at %s to use profile %s', this.url, this.profile);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async stop() {
|
|
42
|
+
const lib = this.url.startsWith('https') ? https : http;
|
|
43
|
+
const res = await new Promise(resolve => {
|
|
44
|
+
lib.get(`${this.url}/api/stop`, resolve);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
let data = await new Promise((resolve, reject) => {
|
|
48
|
+
let data = '';
|
|
49
|
+
res.on('data', chunk => (data += chunk));
|
|
50
|
+
res.on('error', err => reject(err));
|
|
51
|
+
res.on('end', () => resolve(data));
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
if (res.statusCode !== 200) {
|
|
55
|
+
log.error('Humble response: %s', data);
|
|
56
|
+
} else {
|
|
57
|
+
log.info('Humble throttling stopped successfully');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = Humble;
|
|
@@ -5,8 +5,10 @@ const get = require('lodash.get');
|
|
|
5
5
|
const throttle = require('@sitespeed.io/throttle');
|
|
6
6
|
const log = require('intel').getLogger('browsertime.connectivity');
|
|
7
7
|
const TSProxy = require('./tsProxy');
|
|
8
|
+
const Humble = require('./humble');
|
|
8
9
|
|
|
9
10
|
let tsProxyInstance = null;
|
|
11
|
+
let humble = null;
|
|
10
12
|
|
|
11
13
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random
|
|
12
14
|
function getRandomIntInclusive(min, max) {
|
|
@@ -73,6 +75,10 @@ module.exports = {
|
|
|
73
75
|
tsProxyInstance = new TSProxy(options);
|
|
74
76
|
return tsProxyInstance.start(profile);
|
|
75
77
|
}
|
|
78
|
+
case 'humble': {
|
|
79
|
+
humble = new Humble(options);
|
|
80
|
+
return humble.start(profile);
|
|
81
|
+
}
|
|
76
82
|
}
|
|
77
83
|
},
|
|
78
84
|
getConnectivitySettings(options) {
|
|
@@ -96,6 +102,9 @@ module.exports = {
|
|
|
96
102
|
case 'tsproxy': {
|
|
97
103
|
return tsProxyInstance.stop();
|
|
98
104
|
}
|
|
105
|
+
case 'humble': {
|
|
106
|
+
return humble.stop();
|
|
107
|
+
}
|
|
99
108
|
}
|
|
100
109
|
}
|
|
101
110
|
};
|
package/lib/core/engine/index.js
CHANGED
|
@@ -180,6 +180,14 @@ class Engine {
|
|
|
180
180
|
log.info('Battery temperature is %s, lets start the tests', temp);
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
+
|
|
184
|
+
if (
|
|
185
|
+
this.options.connectivity &&
|
|
186
|
+
this.options.connectivity.engine === 'humble'
|
|
187
|
+
) {
|
|
188
|
+
const wifiName = await android.getWifi();
|
|
189
|
+
log.info('The phone is using the WiFi: %s', wifiName);
|
|
190
|
+
}
|
|
183
191
|
}
|
|
184
192
|
|
|
185
193
|
if (this.options.safari && this.options.safari.useSimulator) {
|
|
@@ -55,7 +55,21 @@ class Firefox {
|
|
|
55
55
|
/**
|
|
56
56
|
* Before the first iteration of your tests start.
|
|
57
57
|
*/
|
|
58
|
-
async beforeStartIteration() {
|
|
58
|
+
async beforeStartIteration(runner) {
|
|
59
|
+
if (
|
|
60
|
+
this.firefoxConfig.appendToUserAgent ||
|
|
61
|
+
this.options.appendToUserAgent
|
|
62
|
+
) {
|
|
63
|
+
const currentUserAgent = await runner.runScript(
|
|
64
|
+
'return navigator.userAgent;',
|
|
65
|
+
'GET_USER_AGENT'
|
|
66
|
+
);
|
|
67
|
+
let script = `Services.prefs.setStringPref('general.useragent.override', '${currentUserAgent} ${
|
|
68
|
+
this.firefoxConfig.appendToUserAgent || this.options.appendToUserAgent
|
|
69
|
+
}');`;
|
|
70
|
+
return runner.runPrivilegedScript(script, 'SET_USER_AGENT');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
59
73
|
|
|
60
74
|
/**
|
|
61
75
|
* Before each URL/test runs.
|
package/lib/support/cli.js
CHANGED
|
@@ -93,6 +93,12 @@ function validateInput(argv) {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
if (argv.connectivity && argv.connectivity.engine === 'humble') {
|
|
97
|
+
if (!argv.connectivity.humble || !argv.connectivity.humble.url) {
|
|
98
|
+
return 'You need to specify the URL to Humble by using the --connectivity.humble.url option.';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
96
102
|
if (
|
|
97
103
|
argv.firefox &&
|
|
98
104
|
((argv.firefox.nightly && argv.firefox.beta) ||
|
|
@@ -355,6 +361,11 @@ module.exports.parseCommandLine = function parseCommandLine() {
|
|
|
355
361
|
group: 'firefox'
|
|
356
362
|
})
|
|
357
363
|
|
|
364
|
+
.option('firefox.appendToUserAgent', {
|
|
365
|
+
type: 'string',
|
|
366
|
+
describe: 'Append to the user agent.',
|
|
367
|
+
group: 'firefox'
|
|
368
|
+
})
|
|
358
369
|
.option('firefox.nightly', {
|
|
359
370
|
describe:
|
|
360
371
|
'Use Firefox Nightly. Works on OS X. For Linux you need to set the binary path.',
|
|
@@ -932,9 +943,9 @@ module.exports.parseCommandLine = function parseCommandLine() {
|
|
|
932
943
|
})
|
|
933
944
|
.option('connectivity.engine', {
|
|
934
945
|
default: 'external',
|
|
935
|
-
choices: ['external', 'throttle', 'tsproxy'],
|
|
946
|
+
choices: ['external', 'throttle', 'tsproxy', 'humble'],
|
|
936
947
|
describe:
|
|
937
|
-
'The engine for connectivity. Throttle works on Mac and tc based Linux. Use external if you set the connectivity outside of Browsertime. The best way do to this is described in https://github.com/sitespeedio/browsertime#connectivity.',
|
|
948
|
+
'The engine for connectivity. Throttle works on Mac and tc based Linux. For mobile you can use Humble if you have a Humble setup. Use external if you set the connectivity outside of Browsertime. The best way do to this is described in https://github.com/sitespeedio/browsertime#connectivity.',
|
|
938
949
|
group: 'connectivity'
|
|
939
950
|
})
|
|
940
951
|
.option('connectivity.throttle.localhost', {
|
|
@@ -944,6 +955,12 @@ module.exports.parseCommandLine = function parseCommandLine() {
|
|
|
944
955
|
'Add latency/delay on localhost. Perfect for testing with WebPageReplay',
|
|
945
956
|
group: 'connectivity'
|
|
946
957
|
})
|
|
958
|
+
.option('connectivity.humble.url', {
|
|
959
|
+
type: 'string',
|
|
960
|
+
describe:
|
|
961
|
+
'The path to your Humble instance. For example http://raspberrypi:3000',
|
|
962
|
+
group: 'connectivity'
|
|
963
|
+
})
|
|
947
964
|
.option('requestheader', {
|
|
948
965
|
alias: 'r',
|
|
949
966
|
describe:
|
|
@@ -1007,6 +1024,10 @@ module.exports.parseCommandLine = function parseCommandLine() {
|
|
|
1007
1024
|
.option('userAgent', {
|
|
1008
1025
|
describe: 'Override user agent'
|
|
1009
1026
|
})
|
|
1027
|
+
.option('appendToUserAgent', {
|
|
1028
|
+
describe:
|
|
1029
|
+
'Append a String to the user agent. Works in Chrome/Edge and Firefox.'
|
|
1030
|
+
})
|
|
1010
1031
|
.option('silent', {
|
|
1011
1032
|
alias: 'q',
|
|
1012
1033
|
type: 'count',
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "Browsertime",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.16.0",
|
|
4
4
|
"bin": "./bin/browsertime.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@sitespeed.io/throttle": "3.0.0",
|
|
7
7
|
"@devicefarmer/adbkit": "2.11.3",
|
|
8
8
|
"btoa": "1.2.1",
|
|
9
|
-
"@sitespeed.io/chromedriver": "
|
|
9
|
+
"@sitespeed.io/chromedriver": "97.0.4692-7b",
|
|
10
10
|
"chrome-har": "0.12.0",
|
|
11
11
|
"chrome-remote-interface": "0.31.0",
|
|
12
12
|
"dayjs": "1.10.7",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"lodash.set": "4.3.2",
|
|
25
25
|
"selenium-webdriver": "4.1.0",
|
|
26
26
|
"@sitespeed.io/edgedriver": "95.0.1020-30",
|
|
27
|
-
"@sitespeed.io/geckodriver": "0.29.1-
|
|
27
|
+
"@sitespeed.io/geckodriver": "0.29.1-3",
|
|
28
28
|
"@sitespeed.io/tracium": "0.3.3",
|
|
29
29
|
"speedline-core": "1.4.3",
|
|
30
30
|
"@cypress/xvfb": "1.2.4",
|