browsertime 14.12.2 → 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,11 @@
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).
3
9
  ## 14.12.2 - 2021-12-09
4
10
  ### Fixed
5
11
  * Added more info log to get a better feeling for what's going on [#1686](https://github.com/sitespeedio/browsertime/pull/1686).
@@ -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 });
@@ -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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "description": "Browsertime",
3
- "version": "14.12.2",
3
+ "version": "14.13.0",
4
4
  "bin": "./bin/browsertime.js",
5
5
  "dependencies": {
6
6
  "@sitespeed.io/throttle": "3.0.0",