browsertime 14.11.0 → 14.13.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,25 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
+ ## 14.13.0 - 2021-12-30
4
+ ### Added
5
+ * Append text to Chrome/Edge user agent using `--chrome.appendToUserAgent` [#1688](https://github.com/sitespeedio/browsertime/pull/1688).
6
+
7
+ ### Fixed
8
+ * 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).
9
+ ## 14.12.2 - 2021-12-09
10
+ ### Fixed
11
+ * Added more info log to get a better feeling for what's going on [#1686](https://github.com/sitespeedio/browsertime/pull/1686).
12
+ * Fixed CPU throttling that was broken in Chrome 96 [#1685](https://github.com/sitespeedio/browsertime/pull/1685)
13
+ ## 14.12.1 - 2021-12-01
14
+ ### Fixed
15
+ * Changed log level to debug for Chrome/Edge when document request fails. It turns out that IRL that happens a lot and spam the log. Lets iterate over that functionality.
16
+ ## 14.12.0 - 2021-11-30
17
+ ### Fixed
18
+ * Adding error log message for Chrome/Edge when document request fails (faulty domain etc) [#1682](https://github.com/sitespeedio/browsertime/pull/1682).
19
+ * Added `'devtools.netmonitor.persistlog': true` preference for Firefox to fix the HAR issue introduced in Firefox 94 [#1684](https://github.com/sitespeedio/browsertime/pull/1684).
20
+
21
+ ### Added
22
+ * Updated to Firefox 94 in the Docker image.
3
23
  ## 14.11.0 - 2021-11-23
4
24
  ### Fixed
5
25
  * Use the viewport to determine if more cropping is needed in visual metrics. Thank you [Gregory Mierzwinski](https://github.com/gmierz) for PR [#1680](https://github.com/sitespeedio/browsertime/pull/1680).
@@ -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 });
@@ -161,6 +165,14 @@ class ChromeDevtoolsProtocol {
161
165
  return this.cdpClient.Network.clearBrowserCookies();
162
166
  }
163
167
 
168
+ async loadingFailed() {
169
+ return this.cdpClient.Network.loadingFailed(param => {
170
+ if (param.type === 'Document') {
171
+ log.debug('Could not load document:' + param.errorText);
172
+ }
173
+ });
174
+ }
175
+
164
176
  async setRequestHeaders(requestHeaders) {
165
177
  // Our cli don't validate parameters
166
178
  // so -run will become -r etc
@@ -23,5 +23,7 @@ module.exports = [
23
23
  '--override-https-image-compression-infobar',
24
24
  '--disable-fetching-hints-at-navigation-start',
25
25
  '--disable-dev-shm-usage',
26
+ '--disable-back-forward-cache',
27
+ '--disable-site-isolation-trials',
26
28
  '--remote-debugging-port=9222'
27
29
  ];
@@ -105,8 +105,23 @@ 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
 
123
+ await this.cdpClient.loadingFailed();
124
+
110
125
  // Make sure we clear the console log
111
126
  // Hopefully one time is enough?
112
127
  return runner.getLogs(Type.BROWSER);
@@ -379,6 +379,7 @@ class Measure {
379
379
  }
380
380
 
381
381
  if (this.options.screenshot) {
382
+ log.info('Take after page complete check screenshot');
382
383
  try {
383
384
  const screenshot = await this.browser.takeScreenshot(url);
384
385
  await this.screenshotManager.save(
@@ -403,6 +404,7 @@ class Measure {
403
404
  );
404
405
 
405
406
  if (this.options.screenshotLS && supportLS) {
407
+ log.info('Take cumulative layout shift screenshot');
406
408
  await this.browser.runScript(highlightLS, 'HIGHLIGHT_LS', {
407
409
  color: this.options.screenshotLSColor || 'red',
408
410
  limit: this.options.screenshotLSLimit || 0.01
@@ -432,6 +434,7 @@ class Measure {
432
434
  );
433
435
 
434
436
  if (this.options.screenshotLCP && supportLCP) {
437
+ log.info('Take largest contentful paint screenshot');
435
438
  try {
436
439
  const lcpScriptClean = `
437
440
  const c = document.getElementById("browsertime-lcp");
@@ -179,5 +179,8 @@ module.exports = {
179
179
 
180
180
  // disable calls to detectportal.firefox.com
181
181
  'network.captive-portal-service.enabled': false,
182
- 'network.connectivity-service.enabled': false
182
+ 'network.connectivity-service.enabled': false,
183
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1740116#c15
184
+ // https://github.com/sitespeedio/browsertime/issues/1671
185
+ 'devtools.netmonitor.persistlog': true
183
186
  };
@@ -106,7 +106,7 @@ module.exports = {
106
106
  scriptArgs.unshift(SCRIPT_PATH);
107
107
 
108
108
  log.debug('Running visualmetrics.py ' + scriptArgs.join(' '));
109
-
109
+ log.info('Get visual metrics from the video');
110
110
  try {
111
111
  const result = await execa(process.env.PYTHON || 'python', scriptArgs);
112
112
  log.debug('visualmetrics.py output:' + result.stdout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "description": "Browsertime",
3
- "version": "14.11.0",
3
+ "version": "14.13.0",
4
4
  "bin": "./bin/browsertime.js",
5
5
  "dependencies": {
6
6
  "@sitespeed.io/throttle": "3.0.0",