browsertime 17.4.0 → 17.5.0-beta2
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 +7 -0
- package/browserscripts/pageinfo/interactionToNextPaintInfo.js +1 -1
- package/lib/core/engine/iteration.js +1 -1
- package/lib/firefox/webdriver/builder.js +3 -18
- package/lib/firefox/webdriver/firefox.js +16 -4
- package/package.json +2 -1
- package/lib/firefox/getHAR.js +0 -66
- package/vendor/har_export_trigger-0.6.1-an+fx.xpi +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Browsertime changelog (we do [semantic versioning](https://semver.org))
|
|
2
2
|
|
|
3
|
+
## 17.5.0 - UNRELEASED
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
* There's a new better way to get the HAR from [Firefox using WebDriver BiDi network events](https://github.com/firefox-devtools/bidi-har-export). Thank you [Julian Descottes](https://github.com/juliandescottes) and others at Mozilla that made this happen! With the new version we hope to see less overhead getting the HAR + it works on Firefox on Android [#1918](https://github.com/sitespeedio/browsertime/pull/1918).
|
|
7
|
+
### Fixed
|
|
8
|
+
* Fixed the interaction to next paint error message that started to appear in latest Chrome [#1924](https://github.com/sitespeedio/browsertime/pull/1924).
|
|
9
|
+
|
|
3
10
|
## 17.4.0 - 2022-03-29
|
|
4
11
|
### Added
|
|
5
12
|
* Log the CPU benchmark metric to the console. This is useful (at least for me) when debugging instances with a lot of instability. [#1920](https://github.com/sitespeedio/browsertime/pull/1920).
|
|
@@ -112,7 +112,7 @@ export class Iteration {
|
|
|
112
112
|
|
|
113
113
|
await engineDelegate.beforeBrowserStart();
|
|
114
114
|
await browser.start();
|
|
115
|
-
await engineDelegate.afterBrowserStart();
|
|
115
|
+
await engineDelegate.afterBrowserStart(browser);
|
|
116
116
|
|
|
117
117
|
// The data we push to all selenium scripts
|
|
118
118
|
const context = {
|
|
@@ -116,24 +116,6 @@ export async function configureBuilder(builder, baseDir, options) {
|
|
|
116
116
|
ffOptions.setPreference('detach', true);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
if (!options.skipHar) {
|
|
120
|
-
if (isAndroidConfigured(options)) {
|
|
121
|
-
log.info('Skip install HAR trigger on Android');
|
|
122
|
-
} else {
|
|
123
|
-
// Hack for opening the toolbar
|
|
124
|
-
// In Firefox 61 we need to have devtools open but do not need to choose netmonitor
|
|
125
|
-
// ffOptions.setPreference('devtools.toolbox.selectedTool', 'netmonitor');
|
|
126
|
-
if (!options.debug) {
|
|
127
|
-
ffOptions.setPreference('devtools.toolbox.footer.height', 0);
|
|
128
|
-
ffOptions.addArguments('-devtools');
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
ffOptions.addExtensions(
|
|
132
|
-
resolve(moduleRootPath, 'vendor', 'har_export_trigger-0.6.1-an+fx.xpi')
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
119
|
// Browsertime own extension, only load it when we need it
|
|
138
120
|
// We should be able to only install it only when needed, but that could break scripting
|
|
139
121
|
|
|
@@ -193,6 +175,9 @@ export async function configureBuilder(builder, baseDir, options) {
|
|
|
193
175
|
|
|
194
176
|
ffOptions.addArguments('-no-remote');
|
|
195
177
|
|
|
178
|
+
// Enable bidi for HAR support
|
|
179
|
+
ffOptions.enableBidi();
|
|
180
|
+
|
|
196
181
|
if (firefoxConfig.args) {
|
|
197
182
|
ffOptions.addArguments(firefoxConfig.args);
|
|
198
183
|
}
|
|
@@ -3,15 +3,16 @@ import { promisify } from 'node:util';
|
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import intel from 'intel';
|
|
5
5
|
import get from 'lodash.get';
|
|
6
|
+
import { adapters } from 'ff-test-bidi-har-export';
|
|
6
7
|
import { getEmptyHAR, mergeHars } from '../../support/har/index.js';
|
|
7
8
|
import { pathToFolder } from '../../support/pathToFolder.js';
|
|
8
9
|
import { isAndroidConfigured, Android } from '../../android/index.js';
|
|
9
10
|
import { adjustVisualProgressTimestamps } from '../../support/util.js';
|
|
10
11
|
import { findFiles } from '../../support/fileUtil.js';
|
|
11
|
-
import { getHAR } from '../getHAR.js';
|
|
12
12
|
import { GeckoProfiler } from '../geckoProfiler.js';
|
|
13
13
|
import { MemoryReport } from '../memoryReport.js';
|
|
14
14
|
import { PerfStats } from '../perfStats.js';
|
|
15
|
+
|
|
15
16
|
const log = intel.getLogger('browsertime.firefox');
|
|
16
17
|
const rename = promisify(_rename);
|
|
17
18
|
export class Firefox {
|
|
@@ -48,7 +49,13 @@ export class Firefox {
|
|
|
48
49
|
* The browser is up and running, now its time to start to
|
|
49
50
|
* configure what you need.
|
|
50
51
|
*/
|
|
51
|
-
async afterBrowserStart() {
|
|
52
|
+
async afterBrowserStart(runner) {
|
|
53
|
+
const windowId = await runner.getDriver().getWindowHandle();
|
|
54
|
+
this.har = new adapters.SeleniumBiDiHarRecorder({
|
|
55
|
+
browsingContextIds: [windowId],
|
|
56
|
+
driver: runner.getDriver()
|
|
57
|
+
});
|
|
58
|
+
}
|
|
52
59
|
|
|
53
60
|
/**
|
|
54
61
|
* Before the first iteration of your tests start.
|
|
@@ -81,6 +88,10 @@ export class Firefox {
|
|
|
81
88
|
});
|
|
82
89
|
`);
|
|
83
90
|
|
|
91
|
+
if (!this.skipHar) {
|
|
92
|
+
await this.har.startRecording();
|
|
93
|
+
}
|
|
94
|
+
|
|
84
95
|
if (isAndroidConfigured(this.options) && this.options.androidPower) {
|
|
85
96
|
await this.android.resetPowerUsage();
|
|
86
97
|
}
|
|
@@ -166,10 +177,11 @@ export class Firefox {
|
|
|
166
177
|
}
|
|
167
178
|
result.cpu = powerusage;
|
|
168
179
|
|
|
169
|
-
if (this.skipHar
|
|
180
|
+
if (this.skipHar) {
|
|
170
181
|
return result;
|
|
171
182
|
} else {
|
|
172
|
-
const
|
|
183
|
+
// const harExport = await this.har.stopRecording();
|
|
184
|
+
const har = await this.har.stopRecording();
|
|
173
185
|
if (har.log.pages.length > 0) {
|
|
174
186
|
// Hack to add the URL from a SPA
|
|
175
187
|
if (result.alias && !this.aliasAndUrl[result.alias]) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browsertime",
|
|
3
3
|
"description": "Get performance metrics from your web page using Browsertime.",
|
|
4
|
-
"version": "17.
|
|
4
|
+
"version": "17.5.0-beta2",
|
|
5
5
|
"bin": "./bin/browsertime.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"dependencies": {
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"@sitespeed.io/geckodriver": "0.32.2",
|
|
13
13
|
"@sitespeed.io/throttle": "5.0.0",
|
|
14
14
|
"@sitespeed.io/tracium": "0.3.3",
|
|
15
|
+
"ff-test-bidi-har-export": "0.0.5",
|
|
15
16
|
"btoa": "1.2.1",
|
|
16
17
|
"chrome-har": "0.13.1",
|
|
17
18
|
"chrome-remote-interface": "0.32.1",
|
package/lib/firefox/getHAR.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import intel from 'intel';
|
|
2
|
-
const log = intel.getLogger('browsertime.firefox');
|
|
3
|
-
|
|
4
|
-
// Get the HAR from Firefox
|
|
5
|
-
// Using https://github.com/firefox-devtools/har-export-trigger
|
|
6
|
-
export async function getHAR(runner, includeResponseBodies) {
|
|
7
|
-
const script = `
|
|
8
|
-
const callback = arguments[arguments.length - 1];
|
|
9
|
-
async function triggerExport() {
|
|
10
|
-
try {
|
|
11
|
-
const result = await HAR.triggerExport();
|
|
12
|
-
if (result.pages.length > 0) {
|
|
13
|
-
result.pages[0].title = document.URL;
|
|
14
|
-
return callback({'har': {log: result}});
|
|
15
|
-
} else {
|
|
16
|
-
return callback({'error': 'The HAR export trigger returned an empty HAR' + JSON.stringify(result)});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
catch(e) {
|
|
20
|
-
// Sometimes the HAR trigger is really slow so then HAR is not defined.
|
|
21
|
-
// we catch that with one extra delay
|
|
22
|
-
const delay = ms => new Promise(res => setTimeout(res, ms));
|
|
23
|
-
await delay(10000);
|
|
24
|
-
try {
|
|
25
|
-
const result = await HAR.triggerExport();
|
|
26
|
-
result.pages[0].title = document.URL;
|
|
27
|
-
return callback({'har': {log: result}});
|
|
28
|
-
} catch(e) {
|
|
29
|
-
return callback({'error': e.toString()});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
return triggerExport();
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
|
-
log.info('Waiting on har-export-trigger to collect the HAR');
|
|
37
|
-
try {
|
|
38
|
-
const harResult = await runner.runAsyncScript(script, 'GET_HAR_SCRIPT');
|
|
39
|
-
if (harResult.har) {
|
|
40
|
-
// The HAR from Firefox always includes content and that can make the HAR file
|
|
41
|
-
// really big, so we have an option to remove it.
|
|
42
|
-
if (
|
|
43
|
-
includeResponseBodies === 'none' ||
|
|
44
|
-
includeResponseBodies === 'html'
|
|
45
|
-
) {
|
|
46
|
-
for (let entry of harResult.har.log.entries) {
|
|
47
|
-
if (includeResponseBodies === 'none') {
|
|
48
|
-
delete entry.response.content.text;
|
|
49
|
-
} else if (
|
|
50
|
-
entry.response.content.mimeType &&
|
|
51
|
-
!entry.response.content.mimeType.includes('text/html')
|
|
52
|
-
) {
|
|
53
|
-
delete entry.response.content.text;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return harResult.har;
|
|
58
|
-
} else {
|
|
59
|
-
log.error(
|
|
60
|
-
'Got an error from HAR Export Trigger ' + JSON.stringify(harResult)
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
} catch (error) {
|
|
64
|
-
log.error('Could not get the HAR from Firefox', error);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
Binary file
|