browsertime 16.11.2 → 16.12.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 +19 -0
- package/browserscripts/pageinfo/longTask.js +25 -21
- package/browsertime/visualmetrics-portable.py +9 -7
- package/lib/chrome/chromeDevtoolsProtocol.js +0 -13
- package/lib/chrome/webdriver/chromium.js +0 -2
- package/lib/support/preURL.js +8 -1
- package/lib/video/postprocessing/visualmetrics/visualMetrics.js +1 -0
- package/lib/video/screenRecording/setOrangeBackground.js +2 -40
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Browsertime changelog (we do [semantic versioning](https://semver.org))
|
|
2
2
|
|
|
3
|
+
## 16.12.0 - 2022-08-06
|
|
4
|
+
### Added
|
|
5
|
+
* Upgraded to Chrome 104, Edge 104, Firefox 103 in the Docker container.
|
|
6
|
+
* Upgraded to Chromedriver 104.
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
* Remove old Firefox on Android workaround for orange frame [#1821](https://github.com/sitespeedio/browsertime/pull/1821), thank you [Sean Feng](https://github.com/sefeng211) for the PR.
|
|
10
|
+
|
|
11
|
+
## 16.11.4 - 2022-07-17
|
|
12
|
+
### Fixed
|
|
13
|
+
* Automatically add white background between --preURL and the URL that you wanna test. This makes visual metrics usable when using preURL. [#1819](https://github.com/sitespeedio/browsertime/pull/1819)
|
|
14
|
+
|
|
15
|
+
## 16.11.3 - 2022-07-14
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
* If one of the visual elements failed, all failed. Fixed in [#1818](https://github.com/sitespeedio/browsertime/pull/1818).
|
|
19
|
+
* Use buffered long tasks instead of injecting the measuremnt in the page [#1817](https://github.com/sitespeedio/browsertime/pull/1817).
|
|
20
|
+
* Fixed broken CHromedriver and Geckodriver install on Windows.
|
|
21
|
+
|
|
3
22
|
## 16.11.2 - 2022-07-05
|
|
4
23
|
### Fixed
|
|
5
24
|
* Updated Geckodriver install, it will autoamtically pickup Geckodriver in the path for Raspberry Pis.
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
(function(minLength) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
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);
|
|
20
24
|
}
|
|
25
|
+
cleaned.push(e);
|
|
21
26
|
}
|
|
22
|
-
window.__bt_longtask.e = [];
|
|
23
|
-
return cleaned;
|
|
24
27
|
}
|
|
25
|
-
|
|
28
|
+
return cleaned;
|
|
29
|
+
})(arguments[arguments.length - 1]);
|
|
@@ -1266,14 +1266,16 @@ def calculate_visual_metrics(
|
|
|
1266
1266
|
viewport = hero_data["viewport"]
|
|
1267
1267
|
hero_timings = []
|
|
1268
1268
|
for hero in hero_data["heroes"]:
|
|
1269
|
-
|
|
1270
|
-
{
|
|
1271
|
-
"name": hero["name"],
|
|
1272
|
-
"value": calculate_hero_time(
|
|
1269
|
+
hero_time = calculate_hero_time(
|
|
1273
1270
|
progress, dirs, hero, viewport
|
|
1274
|
-
)
|
|
1275
|
-
|
|
1276
|
-
|
|
1271
|
+
)
|
|
1272
|
+
if hero_time is not None:
|
|
1273
|
+
hero_timings.append(
|
|
1274
|
+
{
|
|
1275
|
+
"name": hero["name"],
|
|
1276
|
+
"value": hero_time,
|
|
1277
|
+
}
|
|
1278
|
+
)
|
|
1277
1279
|
hero_timings_sorted = sorted(
|
|
1278
1280
|
hero_timings, key=lambda timing: timing["value"]
|
|
1279
1281
|
)
|
|
@@ -108,19 +108,6 @@ class ChromeDevtoolsProtocol {
|
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
async setupLongTask() {
|
|
112
|
-
const source = `
|
|
113
|
-
!function() {
|
|
114
|
-
let lt = window.__bt_longtask={e:[]};
|
|
115
|
-
lt.o = new PerformanceObserver(function(a) {
|
|
116
|
-
lt.e=lt.e.concat(a.getEntries());
|
|
117
|
-
});
|
|
118
|
-
lt.o.observe({entryTypes:['longtask']});
|
|
119
|
-
}();`;
|
|
120
|
-
|
|
121
|
-
return this.cdpClient.Page.addScriptToEvaluateOnNewDocument({ source });
|
|
122
|
-
}
|
|
123
|
-
|
|
124
111
|
async setBasicAuth(basicAuth) {
|
|
125
112
|
const parts = basicAuth.split('@');
|
|
126
113
|
const basic = 'Basic ' + btoa(parts[0] + ':' + parts[1]);
|
package/lib/support/preURL.js
CHANGED
|
@@ -6,5 +6,12 @@ const delay = ms => new Promise(res => setTimeout(res, ms));
|
|
|
6
6
|
module.exports = async function (browser, options) {
|
|
7
7
|
log.info('Accessing preURL %s', options.preURL);
|
|
8
8
|
await browser.loadAndWait(options.preURL);
|
|
9
|
-
|
|
9
|
+
if (!options.preURLDisableWhiteBackground) {
|
|
10
|
+
await browser.runScript(
|
|
11
|
+
'document.body.innerHTML = ""; document.body.style.backgroundColor = "white";',
|
|
12
|
+
'WHITE_BACKGROUND'
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return delay(options.preURLDelay ? options.preURLDelay : 1500);
|
|
10
17
|
};
|
|
@@ -2,49 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
const log = require('intel').getLogger('browsertime.video');
|
|
4
4
|
const { until, By } = require('selenium-webdriver');
|
|
5
|
-
module.exports = async function (driver
|
|
5
|
+
module.exports = async function (driver) {
|
|
6
6
|
log.debug('Add orange color');
|
|
7
7
|
// We tried other ways for Android (access an orange page)
|
|
8
8
|
// That works fine ... but break scripts
|
|
9
9
|
// https://github.com/sitespeedio/browsertime/issues/802
|
|
10
|
-
|
|
11
|
-
let orangeScript = '';
|
|
12
|
-
|
|
13
|
-
if (options.android && options.browser === 'firefox') {
|
|
14
|
-
orangeScript = `
|
|
15
|
-
(function() {
|
|
16
|
-
// Adding this extra layer of white frame fixes
|
|
17
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=1606365
|
|
18
|
-
// Not clear why it fixes this bug, looks like when
|
|
19
|
-
// WebRender is enabled, orange frame isn't being
|
|
20
|
-
// removed correctly if it's the only element
|
|
21
|
-
// in the document.
|
|
22
|
-
const white = document.createElement('div');
|
|
23
|
-
white.id = 'browsertime-white';
|
|
24
|
-
white.style.position = 'absolute';
|
|
25
|
-
white.style.top = '0';
|
|
26
|
-
white.style.left = '0';
|
|
27
|
-
white.style.width = Math.max(document.documentElement.clientWidth, document.body.clientWidth) + 'px';
|
|
28
|
-
white.style.height = Math.max(document.documentElement.clientHeight,document.body.clientHeight) + 'px';
|
|
29
|
-
white.style.backgroundColor = 'white';
|
|
30
|
-
white.style.zIndex = '2147483647';
|
|
31
|
-
document.body.appendChild(white);
|
|
32
|
-
document.body.style.display = '';
|
|
33
|
-
|
|
34
|
-
const orange = document.createElement('div');
|
|
35
|
-
orange.id = 'browsertime-orange';
|
|
36
|
-
orange.style.position = 'absolute';
|
|
37
|
-
orange.style.top = '0';
|
|
38
|
-
orange.style.left = '0';
|
|
39
|
-
orange.style.width = Math.max(document.documentElement.clientWidth, document.body.clientWidth) + 'px';
|
|
40
|
-
orange.style.height = Math.max(document.documentElement.clientHeight,document.body.clientHeight) + 'px';
|
|
41
|
-
orange.style.backgroundColor = '#DE640D';
|
|
42
|
-
orange.style.zIndex = '2147483647';
|
|
43
|
-
document.body.appendChild(orange);
|
|
44
|
-
document.body.style.display = '';
|
|
45
|
-
})();`;
|
|
46
|
-
} else {
|
|
47
|
-
orangeScript = `
|
|
10
|
+
const orangeScript = `
|
|
48
11
|
(function() {
|
|
49
12
|
const orange = document.createElement('div');
|
|
50
13
|
orange.id = 'browsertime-orange';
|
|
@@ -59,7 +22,6 @@ module.exports = async function (driver, options) {
|
|
|
59
22
|
document.body.appendChild(orange);
|
|
60
23
|
document.body.style.display = '';
|
|
61
24
|
})();`;
|
|
62
|
-
}
|
|
63
25
|
|
|
64
26
|
await driver.executeScript(orangeScript);
|
|
65
27
|
// It seems that in some cases the video do not have any orange at the start, so make sure we
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "Browsertime",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.12.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": "104.0.5112-29",
|
|
9
9
|
"@sitespeed.io/edgedriver": "103.0.1264-37",
|
|
10
|
-
"@sitespeed.io/geckodriver": "0.31.0-
|
|
10
|
+
"@sitespeed.io/geckodriver": "0.31.0-c",
|
|
11
11
|
"@sitespeed.io/throttle": "4.0.1",
|
|
12
12
|
"@sitespeed.io/tracium": "0.3.3",
|
|
13
13
|
"btoa": "1.2.1",
|