browsertime 14.12.0 → 14.13.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,22 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
+ ## 14.13.1 - 2022-01-01
4
+ ### Fixed
5
+ * Added missing `--chrome.appendToUserAgent` in the CLI help.
6
+
7
+ ## 14.13.0 - 2021-12-30
8
+ ### Added
9
+ * Append text to Chrome/Edge user agent using `--chrome.appendToUserAgent` [#1688](https://github.com/sitespeedio/browsertime/pull/1688).
10
+
11
+ ### Fixed
12
+ * 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).
13
+ ## 14.12.2 - 2021-12-09
14
+ ### Fixed
15
+ * Added more info log to get a better feeling for what's going on [#1686](https://github.com/sitespeedio/browsertime/pull/1686).
16
+ * Fixed CPU throttling that was broken in Chrome 96 [#1685](https://github.com/sitespeedio/browsertime/pull/1685)
17
+ ## 14.12.1 - 2021-12-01
18
+ ### Fixed
19
+ * 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.
3
20
  ## 14.12.0 - 2021-11-30
4
21
  ### Fixed
5
22
  * Adding error log message for Chrome/Edge when document request fails (faulty domain etc) [#1682](https://github.com/sitespeedio/browsertime/pull/1682).
@@ -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 });
@@ -164,7 +168,7 @@ class ChromeDevtoolsProtocol {
164
168
  async loadingFailed() {
165
169
  return this.cdpClient.Network.loadingFailed(param => {
166
170
  if (param.type === 'Document') {
167
- log.error('Could not load document:' + param.errorText);
171
+ log.debug('Could not load document:' + param.errorText);
168
172
  }
169
173
  });
170
174
  }
@@ -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,6 +105,19 @@ 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
 
110
123
  await this.cdpClient.loadingFailed();
@@ -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");
@@ -282,6 +282,11 @@ module.exports.parseCommandLine = function parseCommandLine() {
282
282
  describe: 'Collect Chromes console log and save to disk.',
283
283
  group: 'chrome'
284
284
  })
285
+ .option('chrome.appendToUserAgent', {
286
+ type: 'string',
287
+ describe: 'Append to the user agent.',
288
+ group: 'chrome'
289
+ })
285
290
  .option('chrome.noDefaultOptions', {
286
291
  type: 'boolean',
287
292
  describe:
@@ -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.12.0",
3
+ "version": "14.13.1",
4
4
  "bin": "./bin/browsertime.js",
5
5
  "dependencies": {
6
6
  "@sitespeed.io/throttle": "3.0.0",