browsertime 16.15.0 → 16.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
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Browsertime changelog (we do [semantic versioning](https://semver.org))
|
|
2
2
|
|
|
3
|
+
## 16.16.0 - 2022-09-20
|
|
4
|
+
### Added
|
|
5
|
+
* Chrome 105, Firefox 104 and Chromedriver 105 [#1843](https://github.com/sitespeedio/browsertime/pull/1843).
|
|
6
|
+
* Before you start a test on Android you can push the home button using `--androidPretestPressHomeButton` [#1844](https://github.com/sitespeedio/browsertime/pull/1844).
|
|
7
|
+
|
|
8
|
+
## 16.15.1 - 2022-08-30
|
|
9
|
+
### Fixed
|
|
10
|
+
* 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).
|
|
3
11
|
## 16.15.0 - 2022-08-30
|
|
4
12
|
### Added
|
|
5
13
|
* 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).
|
package/lib/android/index.js
CHANGED
|
@@ -249,6 +249,10 @@ class Android {
|
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
+
async pressHomeButton() {
|
|
253
|
+
return this._runCommand('input keyevent KEYCODE_HOME');
|
|
254
|
+
}
|
|
255
|
+
|
|
252
256
|
async stopVideo() {
|
|
253
257
|
return this._runCommand(
|
|
254
258
|
'command -v pkill >/dev/null && pkill -l SIGINT screenrecord || kill -2 $(ps screenrecord | grep -Eo [0-9]+ | grep -m 1 -Eo [0-9]+)'
|
|
@@ -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
|
@@ -101,6 +101,10 @@ class Engine {
|
|
|
101
101
|
await android.clickPowerButton();
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
if (options.androidPretestPressHomeButton) {
|
|
105
|
+
await android.pressHomeButton();
|
|
106
|
+
}
|
|
107
|
+
|
|
104
108
|
if (options.androidVerifyNetwork) {
|
|
105
109
|
const pingAddress = get(options, 'androidPingAddress', '8.8.8.8');
|
|
106
110
|
const connection = await android.ping(pingAddress);
|
package/lib/support/cli.js
CHANGED
|
@@ -716,6 +716,11 @@ module.exports.parseCommandLine = function parseCommandLine() {
|
|
|
716
716
|
default: false,
|
|
717
717
|
describe: 'Press the power button on the phone before a test starts.'
|
|
718
718
|
})
|
|
719
|
+
.option('androidPretestPressHomeButton', {
|
|
720
|
+
type: 'boolean',
|
|
721
|
+
default: false,
|
|
722
|
+
describe: 'Press the home button on the phone before a test starts.'
|
|
723
|
+
})
|
|
719
724
|
.option('androidVerifyNetwork', {
|
|
720
725
|
type: 'boolean',
|
|
721
726
|
default: false,
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "Browsertime",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.16.0",
|
|
4
4
|
"bin": "./bin/browsertime.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@cypress/xvfb": "1.2.4",
|
|
7
7
|
"@devicefarmer/adbkit": "2.11.3",
|
|
8
|
-
"@sitespeed.io/chromedriver": "
|
|
8
|
+
"@sitespeed.io/chromedriver": "105.0.5195-19",
|
|
9
9
|
"@sitespeed.io/edgedriver": "104.0.1293-47",
|
|
10
10
|
"@sitespeed.io/geckodriver": "0.31.0-c",
|
|
11
11
|
"@sitespeed.io/throttle": "5.0.0",
|
|
@@ -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]);
|