browsertime 14.12.2 → 14.14.1
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 +19 -0
- package/lib/android/index.js +9 -0
- package/lib/chrome/chromeDevtoolsProtocol.js +4 -0
- package/lib/chrome/webdriver/chromium.js +13 -0
- package/lib/connectivity/humble.js +62 -0
- package/lib/connectivity/index.js +9 -0
- package/lib/core/engine/index.js +8 -0
- package/lib/support/cli.js +19 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Browsertime changelog (we do [semantic versioning](https://semver.org))
|
|
2
2
|
|
|
3
|
+
## 14.14.1 - 2022-01-12
|
|
4
|
+
### Fixed
|
|
5
|
+
* 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.
|
|
6
|
+
## 14.14.0 - 2022-01-10
|
|
7
|
+
### Added
|
|
8
|
+
* 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).
|
|
9
|
+
* Upgraded to Chrome 97, Edge 97 and Firefox 95 in the Docker container.
|
|
10
|
+
* Upgraded to Chromedriver 97.
|
|
11
|
+
|
|
12
|
+
## 14.13.1 - 2022-01-01
|
|
13
|
+
### Fixed
|
|
14
|
+
* Added missing `--chrome.appendToUserAgent` in the CLI help.
|
|
15
|
+
|
|
16
|
+
## 14.13.0 - 2021-12-30
|
|
17
|
+
### Added
|
|
18
|
+
* Append text to Chrome/Edge user agent using `--chrome.appendToUserAgent` [#1688](https://github.com/sitespeedio/browsertime/pull/1688).
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
* When you use Chrome and use a "emulated device" that will use the user agent that you provide using `--userAgent`[#1689](https://github.com/sitespeedio/browsertime/pull/1689).
|
|
3
22
|
## 14.12.2 - 2021-12-09
|
|
4
23
|
### Fixed
|
|
5
24
|
* Added more info log to get a better feeling for what's going on [#1686](https://github.com/sitespeedio/browsertime/pull/1686).
|
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) {
|
|
@@ -129,6 +129,10 @@ class ChromeDevtoolsProtocol {
|
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
async setUserAgent(userAgent) {
|
|
133
|
+
return this.cdpClient.Network.setUserAgentOverride({ userAgent });
|
|
134
|
+
}
|
|
135
|
+
|
|
132
136
|
async blockUrls(blockers) {
|
|
133
137
|
const block = util.toArray(blockers);
|
|
134
138
|
return this.cdpClient.Network.setBlockedURLs({ urls: block });
|
|
@@ -105,6 +105,19 @@ class Chromium {
|
|
|
105
105
|
await this.cdpClient.setupCPUThrottling(this.chrome.CPUThrottlingRate);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
if (this.chrome.appendToUserAgent) {
|
|
109
|
+
const currentUserAgent = await runner.runScript(
|
|
110
|
+
'return navigator.userAgent;',
|
|
111
|
+
'GET_USER_AGENT'
|
|
112
|
+
);
|
|
113
|
+
await this.cdpClient.setUserAgent(
|
|
114
|
+
currentUserAgent + ' ' + this.chrome.appendToUserAgent
|
|
115
|
+
);
|
|
116
|
+
} else if (this.chrome.mobileEmulation && this.options.userAgent) {
|
|
117
|
+
// Hack to set user agent for mobile emulation
|
|
118
|
+
await this.cdpClient.setUserAgent(this.options.userAgent);
|
|
119
|
+
}
|
|
120
|
+
|
|
108
121
|
await this.cdpClient.setupLongTask();
|
|
109
122
|
|
|
110
123
|
await this.cdpClient.loadingFailed();
|
|
@@ -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) {
|
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) ||
|
|
@@ -282,6 +288,11 @@ module.exports.parseCommandLine = function parseCommandLine() {
|
|
|
282
288
|
describe: 'Collect Chromes console log and save to disk.',
|
|
283
289
|
group: 'chrome'
|
|
284
290
|
})
|
|
291
|
+
.option('chrome.appendToUserAgent', {
|
|
292
|
+
type: 'string',
|
|
293
|
+
describe: 'Append to the user agent.',
|
|
294
|
+
group: 'chrome'
|
|
295
|
+
})
|
|
285
296
|
.option('chrome.noDefaultOptions', {
|
|
286
297
|
type: 'boolean',
|
|
287
298
|
describe:
|
|
@@ -927,9 +938,9 @@ module.exports.parseCommandLine = function parseCommandLine() {
|
|
|
927
938
|
})
|
|
928
939
|
.option('connectivity.engine', {
|
|
929
940
|
default: 'external',
|
|
930
|
-
choices: ['external', 'throttle', 'tsproxy'],
|
|
941
|
+
choices: ['external', 'throttle', 'tsproxy', 'humble'],
|
|
931
942
|
describe:
|
|
932
|
-
'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.',
|
|
943
|
+
'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.',
|
|
933
944
|
group: 'connectivity'
|
|
934
945
|
})
|
|
935
946
|
.option('connectivity.throttle.localhost', {
|
|
@@ -939,6 +950,12 @@ module.exports.parseCommandLine = function parseCommandLine() {
|
|
|
939
950
|
'Add latency/delay on localhost. Perfect for testing with WebPageReplay',
|
|
940
951
|
group: 'connectivity'
|
|
941
952
|
})
|
|
953
|
+
.option('connectivity.humble.url', {
|
|
954
|
+
type: 'string',
|
|
955
|
+
describe:
|
|
956
|
+
'The path to your Humble instance. For example http://raspberrypi:3000',
|
|
957
|
+
group: 'connectivity'
|
|
958
|
+
})
|
|
942
959
|
.option('requestheader', {
|
|
943
960
|
alias: 'r',
|
|
944
961
|
describe:
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "Browsertime",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.14.1",
|
|
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",
|