browsertime 16.14.1 → 16.15.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
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Browsertime changelog (we do [semantic versioning](https://semver.org))
|
|
2
2
|
|
|
3
|
+
## 16.15.1 - 2022-08-30
|
|
4
|
+
### Fixed
|
|
5
|
+
* Make sure long tasks are collected direct after a test ends. On a slow device it sometimes happened that long tasks was browsertime running scripts to collect metrics [#1841](https://github.com/sitespeedio/browsertime/pull/1841).
|
|
6
|
+
## 16.15.0 - 2022-08-30
|
|
7
|
+
### Added
|
|
8
|
+
* Always get the wifi name that your Android phone is using and add it to the result [#1839](https://github.com/sitespeedio/browsertime/pull/1839).
|
|
9
|
+
|
|
10
|
+
## 16.14.2 - 2022-08-26
|
|
11
|
+
### Fixed
|
|
12
|
+
* Using `--preWarmServer` didn't work on Android/iOS [#1837](https://github.com/sitespeedio/browsertime/pull/1837).
|
|
3
13
|
## 16.14.1 - 2022-08-26
|
|
4
14
|
### Fixed
|
|
5
15
|
* Guard relative standard deviation agains 0 standard deviation [#1835](https://github.com/sitespeedio/browsertime/pull/1835).
|
package/bin/browsertime.js
CHANGED
|
@@ -44,19 +44,22 @@ async function preWarmServer(urls, options) {
|
|
|
44
44
|
const safariDeviceName = get(options, 'safari.deviceName');
|
|
45
45
|
const safariDeviceUDID = get(options, 'safari.deviceUDID ');
|
|
46
46
|
|
|
47
|
+
if (options.android && options.browser === 'chrome') {
|
|
48
|
+
set(preWarmOptions, 'chrome.android.package', 'com.android.chrome');
|
|
49
|
+
}
|
|
47
50
|
if (chromeDevice) {
|
|
48
|
-
set(
|
|
51
|
+
set(preWarmOptions, 'chrome.android.deviceSerial', chromeDevice);
|
|
49
52
|
} else if (firefoxDevice) {
|
|
50
|
-
set(
|
|
53
|
+
set(preWarmOptions, 'firefox.android.deviceSerial', firefoxDevice);
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
if (safariIos) {
|
|
54
|
-
set(
|
|
57
|
+
set(preWarmOptions, 'safari.ios', true);
|
|
55
58
|
if (safariDeviceName) {
|
|
56
|
-
set(
|
|
59
|
+
set(preWarmOptions, 'safari.deviceName', safariDeviceName);
|
|
57
60
|
}
|
|
58
61
|
if (safariDeviceUDID) {
|
|
59
|
-
set(
|
|
62
|
+
set(preWarmOptions, 'safari.deviceUDID', safariDeviceUDID);
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
|
package/lib/android/index.js
CHANGED
|
@@ -154,7 +154,7 @@ class Android {
|
|
|
154
154
|
return temp / 10;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
async
|
|
157
|
+
async getMeta() {
|
|
158
158
|
const rawModel = await this._runCommand(`getprop ro.product.model`);
|
|
159
159
|
const model = (await adb.util.readAll(rawModel)).toString().trim();
|
|
160
160
|
const rawName = await this._runCommand(`getprop ro.product.name`);
|
|
@@ -163,14 +163,14 @@ class Android {
|
|
|
163
163
|
const device = (await adb.util.readAll(rawDevice)).toString().trim();
|
|
164
164
|
const rawId = await this._runCommand(`getprop ro.serialno`);
|
|
165
165
|
const id = (await adb.util.readAll(rawId)).toString().trim();
|
|
166
|
-
|
|
166
|
+
const wifi = await this.getWifi();
|
|
167
167
|
const rawRelease = await this._runCommand(
|
|
168
168
|
`getprop ro.build.version.release `
|
|
169
169
|
);
|
|
170
170
|
const androidVersion = (await adb.util.readAll(rawRelease))
|
|
171
171
|
.toString()
|
|
172
172
|
.trim();
|
|
173
|
-
return { model, name, device, androidVersion, id };
|
|
173
|
+
return { model, name, device, androidVersion, id, wifi };
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
async pullNetLog(destination) {
|
package/lib/chrome/har.js
CHANGED
|
@@ -52,7 +52,7 @@ module.exports = async function (
|
|
|
52
52
|
harBuilder.addBrowser(har, info.name, info.version);
|
|
53
53
|
|
|
54
54
|
if (androidClient) {
|
|
55
|
-
har.log._android = await androidClient.
|
|
55
|
+
har.log._android = await androidClient.getMeta();
|
|
56
56
|
har.log._android.id = androidClient.id;
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -175,6 +175,39 @@ class Chromium {
|
|
|
175
175
|
this.events = await this.cdpClient.stopTrace();
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
+
// We get the long tasks early because on slow devices
|
|
179
|
+
// we want to make usre our own script isnt't picked up
|
|
180
|
+
let longTaskScript = `
|
|
181
|
+
const minLength = ${this.options.minLongTaskLength || 50};
|
|
182
|
+
const observer = new PerformanceObserver(list => {});
|
|
183
|
+
observer.observe({type: 'longtask', buffered: true});
|
|
184
|
+
const entries = observer.takeRecords();
|
|
185
|
+
const cleaned = [];
|
|
186
|
+
for (let event of entries) {
|
|
187
|
+
if (event.duration >= minLength) {
|
|
188
|
+
const e = {};
|
|
189
|
+
e.duration = event.duration;
|
|
190
|
+
e.name = event.name;
|
|
191
|
+
e.startTime = event.startTime;
|
|
192
|
+
e.attribution = [];
|
|
193
|
+
for (let at of event.attribution) {
|
|
194
|
+
const a = {};
|
|
195
|
+
a.containerId = at.containerId;
|
|
196
|
+
a.containerName = at.containerName;
|
|
197
|
+
a.containerSrc = at.containerSrc;
|
|
198
|
+
a.containerType = at.containerType;
|
|
199
|
+
e.attribution.push(a);
|
|
200
|
+
}
|
|
201
|
+
cleaned.push(e);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return cleaned;
|
|
205
|
+
`;
|
|
206
|
+
this.longTaskInfo = await runner.runScript(
|
|
207
|
+
longTaskScript,
|
|
208
|
+
'GET_LONG_TASKS'
|
|
209
|
+
);
|
|
210
|
+
|
|
178
211
|
if (this.android && this.options.androidPower) {
|
|
179
212
|
result.power = await this.android.measurePowerUsage(
|
|
180
213
|
this.chrome.android.package
|
|
@@ -261,6 +294,13 @@ class Chromium {
|
|
|
261
294
|
* The URL/test is finished, all metrics are collected.
|
|
262
295
|
*/
|
|
263
296
|
async afterEachURL(runner, index, result) {
|
|
297
|
+
// When we move long tasks to run direct after the test end
|
|
298
|
+
// we still want to keep the old structure
|
|
299
|
+
// this hack fixes that
|
|
300
|
+
if (result.browserScripts && result.browserScripts.pageinfo) {
|
|
301
|
+
result.browserScripts.pageinfo.longTask = this.longTaskInfo;
|
|
302
|
+
}
|
|
303
|
+
|
|
264
304
|
if (this.chrome.collectNetLog && this.chrome.android) {
|
|
265
305
|
// THIS needs to be unique per page
|
|
266
306
|
const filename = path.join(
|
package/lib/core/engine/index.js
CHANGED
|
@@ -250,7 +250,7 @@ class Engine {
|
|
|
250
250
|
const collector = new Collector(name, storageManager, options);
|
|
251
251
|
|
|
252
252
|
if (this.android) {
|
|
253
|
-
const model = await this.android.
|
|
253
|
+
const model = await this.android.getMeta();
|
|
254
254
|
log.info(
|
|
255
255
|
'Run tests on %s [%s] using Android version %s',
|
|
256
256
|
model.model,
|
|
@@ -371,7 +371,7 @@ class Engine {
|
|
|
371
371
|
}
|
|
372
372
|
|
|
373
373
|
if (this.android) {
|
|
374
|
-
const model = await this.android.
|
|
374
|
+
const model = await this.android.getMeta();
|
|
375
375
|
for (let result of totalResult) {
|
|
376
376
|
result.info.android = model;
|
|
377
377
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "Browsertime",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.15.1",
|
|
4
4
|
"bin": "./bin/browsertime.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@cypress/xvfb": "1.2.4",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"jimp": "0.16.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"ava": "4.
|
|
36
|
+
"ava": "4.3.3",
|
|
37
37
|
"eslint": "8.14.0",
|
|
38
38
|
"eslint-config-prettier": "8.5.0",
|
|
39
39
|
"eslint-plugin-prettier": "4.0.0",
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
(function(minLength) {
|
|
2
|
-
const supported = PerformanceObserver.supportedEntryTypes;
|
|
3
|
-
if (!supported || supported.indexOf('longtask') === -1) {
|
|
4
|
-
return;
|
|
5
|
-
}
|
|
6
|
-
const observer = new PerformanceObserver(list => {});
|
|
7
|
-
observer.observe({type: 'longtask', buffered: true});
|
|
8
|
-
const entries = observer.takeRecords();
|
|
9
|
-
const cleaned = [];
|
|
10
|
-
for (let event of entries) {
|
|
11
|
-
if (event.duration >= minLength) {
|
|
12
|
-
const e = {};
|
|
13
|
-
e.duration = event.duration;
|
|
14
|
-
e.name = event.name;
|
|
15
|
-
e.startTime = event.startTime;
|
|
16
|
-
e.attribution = [];
|
|
17
|
-
for (let at of event.attribution) {
|
|
18
|
-
const a = {};
|
|
19
|
-
a.containerId = at.containerId;
|
|
20
|
-
a.containerName = at.containerName;
|
|
21
|
-
a.containerSrc = at.containerSrc;
|
|
22
|
-
a.containerType = at.containerType;
|
|
23
|
-
e.attribution.push(a);
|
|
24
|
-
}
|
|
25
|
-
cleaned.push(e);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return cleaned;
|
|
29
|
-
})(arguments[arguments.length - 1]);
|