browsertime 17.19.0 → 19.0.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,6 +1,25 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
- ## 17.19.0 - 2022-11-03
3
+
4
+ ## 19.0.0 - 2023-11-15
5
+ ### Breaking
6
+ * This only affects you if you run your tests on a rooted Moto G5: With PR[#2021](https://github.com/sitespeedio/browsertime/pull/2021) we add the ability to set the CPU speed for the phone at min/middle/max (the same way as possible on Samsung A51). Before the speed always was set to max. Default now is that the CPU speed will be set to min (the same way as the A51).
7
+
8
+ ### Fixed
9
+ * Largest contentful paint and First contentful paint in Firefox now also fills the "googleWebitals" fields in the results. Thank you [Gregory Mierzwinski](https://github.com/gmierz) for PR [#2018](https://github.com/sitespeedio/browsertime/pull/2018) and my PR [#2020](https://github.com/sitespeedio/browsertime/pull/2020).
10
+ * Make sure `--android.pinCPUSpeed` works [#2019](https://github.com/sitespeedio/browsertime/pull/2019)
11
+
12
+ ## 18.0.0 - 2023-11-07
13
+
14
+ ### Breaking
15
+ * Dropping support for NodeJS 16.
16
+
17
+ ### Fixed
18
+ * Updated all dev-dependencies to latest versions [#2013](https://github.com/sitespeedio/browsertime/pull/2013).
19
+ * Updated GitHub Actions to use latest versions of actions and Ubuntu 22.04 [#2012](https://github.com/sitespeedio/browsertime/pull/2012), [#2014](https://github.com/sitespeedio/browsertime/pull/2014) and [#2016](https://github.com/sitespeedio/browsertime/pull/2016)
20
+ * Updated all dependencies to latest versions: ADB kit 3.2.5 [#2017](https://github.com/sitespeedio/browsertime/pull/2017), execa, dayjs, get-port and Chromedriver [#2015](https://github.com/sitespeedio/browsertime/pull/2015).
21
+
22
+ ## 17.19.0 - 2023-11-03
4
23
  ### Added
5
24
  * Updated to Chrome, Firefox and Edge 119 in the Docker container [#2010](https://github.com/sitespeedio/browsertime/pull/2010).
6
25
  * Updated to Edgedriver 119.
@@ -8,12 +27,12 @@
8
27
  ### Fixed
9
28
  * Updated to Selenium 4.15.0 [#2011](https://github.com/sitespeedio/browsertime/pull/2011).
10
29
 
11
- ## 17.18.1 - 2022-10-31
30
+ ## 17.18.1 - 2023-10-31
12
31
  ### Fixed
13
32
  * WebDriver 4.14.0
14
33
  * Chromedriver 119.0.6045-59
15
34
 
16
- ## 17.18.0 - 2022-10-23
35
+ ## 17.18.0 - 2023-10-23
17
36
  ### Added
18
37
  * Updated to Chromedriver 119 [#2003](https://github.com/sitespeedio/browsertime/pull/2003). 119 works with both Chrome 118 and 119 so it fixes [#1197](https://github.com/sitespeedio/browsertime/issues/1997).
19
38
  * Add support for network idle method to know when to end a test that uses network logs. Uses Bidi for Firefox and CDP for Chrome to listen on network events to know when to end a test. By default 5 seconds idle network time ends a tests (you could have network responses that hasn't arrived yet) [#1960](https://github.com/sitespeedio/browsertime/pull/1960). Potentially this can help SPA users or users where the page uses iframes. You can try it out by adding `--pageCompleteCheckNetworkIdle` yo your command line. This is still some work in progress but feel free to try ut out.
@@ -23,7 +42,7 @@
23
42
  * Make sure timer always is cleared. There was case of where we do a rase beteween a promise and a timeout where the timeout timer wasn't cleared/removed [#2005](https://github.com/sitespeedio/browsertime/pull/2005).
24
43
  * Better way to get the url when you use GeckoProfiler.stop for Firefox, thank you [Nazım Can Altınova](https://github.com/canova) for PR [#1999](https://github.com/sitespeedio/browsertime/pull/1999)
25
44
 
26
- ## 17.17.0 - 2022-10-11
45
+ ## 17.17.0 - 2023-10-11
27
46
  ### Added
28
47
  * Firefox 118, Edge 117 and Chrome/Chromedriver 118 in the Docker container [#1996](https://github.com/sitespeedio/browsertime/pull/1996).
29
48
  * Expose trace start/stop for Chrome in scripting (the same way as for Firefox). Thank you [KS](https://github.com/92kns) for [#1988](https://github.com/sitespeedio/browsertime/pull/1988). Documentation is coming when the functionality is rolled out in sitespeed.io.
@@ -31,46 +50,46 @@
31
50
  ### Updated
32
51
  * Updated to Selenium 4.12
33
52
 
34
- ## 17.16.0 - 2022-09-04
53
+ ## 17.16.0 - 2023-09-04
35
54
  ### Added
36
55
  * Firefox 117 and Edge 116 in the Docker container.
37
56
 
38
57
  ### Fixed
39
58
  * Updated the BiDi HAR exporter for Firefox to version 0.0.12. This version will not work with Firefox 116 so if you use the BiDi HAR exporter you need to upgrade to Firefox 117.
40
59
 
41
- ## 17.15.0 - 2022-08-16
60
+ ## 17.15.0 - 2023-08-16
42
61
  ### Added
43
62
  * Updated Chrome and Chromedriver to 116.
44
63
 
45
- ## 17.14.3 - 2022-08-16
64
+ ## 17.14.3 - 2023-08-16
46
65
 
47
66
  ### Fixed
48
67
  * Updated to Selenium 4.11.1 [#1978](https://github.com/sitespeedio/browsertime/pull/1978).
49
68
  * Updated Chrome and Chromedriver to minor versions.
50
69
 
51
- ## 17.14.2 - 2022-07-31
70
+ ## 17.14.2 - 2023-07-31
52
71
  ### Fixed
53
72
  * The auto build of release Docker container was broken so no tagged containers was pushed.
54
73
 
55
- ## 17.14.1 - 2022-07-31
74
+ ## 17.14.1 - 2023-07-31
56
75
 
57
76
  ### Fixed
58
77
  * Default jimp resize didn't handle large values (2000) when running in Docker AMD on a ARM machine so changing to another algorithm (HERMITE) [#1977](https://github.com/sitespeedio/browsertime/pull/1977).
59
78
 
60
79
  * Update: chrome-har, dayjs, execa, chrome-remote-interface and jimp [#1976](https://github.com/sitespeedio/browsertime/pull/1976).
61
80
 
62
- ## 17.14.0 - 2022-07-24
81
+ ## 17.14.0 - 2023-07-24
63
82
 
64
83
  ### Added
65
84
  * Edge and Edgedriver 115 [#1973](https://github.com/sitespeedio/browsertime/pull/1973).
66
85
 
67
- ## 17.13.1 - 2022-07-22
86
+ ## 17.13.1 - 2023-07-22
68
87
 
69
88
  ### Tech
70
89
  * Internal fix how the render blocking result is added [#1972](https://github.com/sitespeedio/browsertime/pull/1972).
71
90
 
72
91
 
73
- ## 17.13.0 - 2022-07-21
92
+ ## 17.13.0 - 2023-07-21
74
93
  ### Fixed
75
94
  * Fix for Chromedriver 115 so that it works on Mac again [#1971](https://github.com/sitespeedio/browsertime/pull/1971).
76
95
 
@@ -80,7 +99,7 @@
80
99
  ### Tech
81
100
  * Run tests on Chrome/Firefox/Edge on Mac OS on our GitHub Actions to catch the next time Chromedriver is broken on Mac [#1970](https://github.com/sitespeedio/browsertime/pull/1970)
82
101
 
83
- ## 17.12.1 - 2022-07-19
102
+ ## 17.12.1 - 2023-07-19
84
103
  ### Fixed
85
104
  * Hmm, Chromedriver 115 doesn't seems to work on Mac so reverted to 114.
86
105
 
@@ -90,31 +109,31 @@
90
109
 
91
110
  * If you collect the Chrome devtools trace using `--cpu` we will now also collect the number of elements that needs recalculate styles before FCP/LCP.[#1964](https://github.com/sitespeedio/browsertime/pull/1964).
92
111
 
93
- ## 17.11.2 - 2022-06-19
112
+ ## 17.11.2 - 2023-06-19
94
113
  ### Fixed
95
114
  * Fix --debug mode. Thank you [Gregory Mierzwinski](https://github.com/gmierz) for PR [#1959](https://github.com/sitespeedio/browsertime/pull/1959).
96
115
  * Update ff-test-bidi-har-export to 0.0.11 that fixes some error logs [#1961](https://github.com/sitespeedio/browsertime/pull/1961).
97
116
 
98
- ## 17.11.1 - 2022-06-12
117
+ ## 17.11.1 - 2023-06-12
99
118
  ### Fixed
100
119
  * If Chrome do not collect largest contentful paint, log that instead of just log null [#1957](https://github.com/sitespeedio/browsertime/pull/1957).
101
120
 
102
- ## 17.11.0 - 2022-06-01
121
+ ## 17.11.0 - 2023-06-01
103
122
  ### Fixed
104
123
  * Fixed broken Docker auto build that skipped adding Docker manifest file.
105
124
 
106
125
  ### Added
107
126
  * Use Chrome ane Chromedriver 114.
108
127
 
109
- ## 17.10.2 - 2022-05-26
128
+ ## 17.10.2 - 2023-05-26
110
129
  ### Fixed
111
130
  * Fix for --host-resolver-rules, thank you [Mikhail](https://github.com/atuchin-m) for PR [#1953](https://github.com/sitespeedio/browsertime/pull/1953).
112
131
 
113
- ## 17.10.1 - 2022-05-19
132
+ ## 17.10.1 - 2023-05-19
114
133
  ### Fixed
115
134
  * Updated code to collect Interaction To Next Paint [#1952](https://github.com/sitespeedio/browsertime/pull/1952). This new version follow updated version(s) of Google Web Vitals.
116
135
 
117
- ## 17.10.0 - 2022-05-19
136
+ ## 17.10.0 - 2023-05-19
118
137
 
119
138
  ### Added
120
139
  * Chrome, Edge and Firefox 113 [#1946](https://github.com/sitespeedio/browsertime/pull/1946), Chromedriver 113 [#1947](https://github.com/sitespeedio/browsertime/pull/1947) and Edgedriver 113 [#1949](https://github.com/sitespeedio/browsertime/pull/1949).
@@ -123,7 +142,7 @@
123
142
  * Bugfix for running iPhone Siumlator (and run tests on latest Mac OS) [#1945](https://github.com/sitespeedio/browsertime/pull/1945).
124
143
  * Bumped dependencies for Selenium, yargs and jimp [#1950](https://github.com/sitespeedio/browsertime/pull/1950).
125
144
 
126
- ## 17.9.0 - 2022-04-19
145
+ ## 17.9.0 - 2023-04-19
127
146
  ### Added
128
147
  * New command to start geckoprofiling when scripting using Firefox. Thank you [KS](https://github.com/92kns) for PR [#1934](https://github.com/sitespeedio/browsertime/pull/1934). This is probably only something you need if you work at Mozilla. There's also a follow PR [#1940](https://github.com/sitespeedio/browsertime/pull/1940) that fixes some of the issues I've been wanted to fix with the Geckoprofiler code.
129
148
 
@@ -132,20 +151,20 @@
132
151
  ### Fixed
133
152
  * Bump Chrome remote interface and execa [#1941](https://github.com/sitespeedio/browsertime/pull/1941).
134
153
 
135
- ## 17.8.1 - 2022-04-12
154
+ ## 17.8.1 - 2023-04-12
136
155
  ### Fixed
137
156
  * Upgraded to Firefox HAR 0.0.10 [#1939](https://github.com/sitespeedio/browsertime/pull/1939).
138
- ## 17.8.0 - 2022-04-11
157
+ ## 17.8.0 - 2023-04-11
139
158
  ### Fixed
140
159
  * Upgraded to Firefox HAR 0.0.8 [#1937](https://github.com/sitespeedio/browsertime/pull/1937).
141
160
 
142
161
  ### Added
143
162
  * Upgraded to Firefox 112 in the Docker container.
144
- ## 17.7.0 - 2022-04-07
163
+ ## 17.7.0 - 2023-04-07
145
164
  ### Added
146
165
  * Added Edge/Edgedriver 112.
147
166
 
148
- ## 17.6.0 - 2022-04-05
167
+ ## 17.6.0 - 2023-04-05
149
168
  ### Fixed
150
169
  * Increased the default wait time from 2 to 5 seconds when a element a clicked and the page complete check runs [#1931](https://github.com/sitespeedio/browsertime/pull/1931)
151
170
 
@@ -153,7 +172,7 @@
153
172
  * Upgraded to Chrome/Chromedriver 112 in the Docker container [#1932](https://github.com/sitespeedio/browsertime/pull/1932).
154
173
  * If you use `--headless` Chrome will use the new headless switch [#1933](https://github.com/sitespeedio/browsertime/pull/1933).
155
174
 
156
- ## 17.5.0 - 2022-04-04
175
+ ## 17.5.0 - 2023-04-04
157
176
 
158
177
  ### Added
159
178
  * 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). You can turn it on with `--firefox.bidihar`.
@@ -163,12 +182,12 @@
163
182
  * Fixed the interaction to next paint error message that started to appear in latest Chrome [#1924](https://github.com/sitespeedio/browsertime/pull/1924).
164
183
  * Safer check for getting last meaningful paint [#1927](https://github.com/sitespeedio/browsertime/pull/1927)
165
184
 
166
- ## 17.4.0 - 2022-03-29
185
+ ## 17.4.0 - 2023-03-29
167
186
  ### Added
168
187
  * 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).
169
188
  * In Chrome 111 some metrics become more instable when running on host with limited CPU. This change also exists in 112 beta. However we where missing out on a couple of command line magic to disable features in Chrome, this fixes that [#1921](https://github.com/sitespeedio/browsertime/pull/1921).
170
189
 
171
- ## 17.3.0 - 2022-03-26
190
+ ## 17.3.0 - 2023-03-26
172
191
 
173
192
  ### Fixed
174
193
  * Bumped Selenium-webdriver to 4.8.2 [#1916](https://github.com/sitespeedio/browsertime/pull/1916).
@@ -177,20 +196,20 @@
177
196
  * On Linux you can use taskset to assing FFMPEG to specific CPUs using `--videoParams.taskset "0,5,7,9-11" `. It will start FFMPEG with `taskset -c <CPUS>` to pin FFMPG to specific CPU(s). Specify a numerical list of processors. The list may contain multiple items, separated by comma, and ranges. For example, "0,5,7,9-11". Use it together with isolcpus. Added in [#1917](https://github.com/sitespeedio/browsertime/pull/1917).
178
197
 
179
198
  * If you use a rooted Samsung A51 you can now choose the CPU speed (min/middle/max) using `--android.pinCPUSpeed min|middle|max` [#1915](https://github.com/sitespeedio/browsertime/pull/1915).
180
- ## 17.2.1 - 2022-03-16
199
+ ## 17.2.1 - 2023-03-16
181
200
  ### Fixed
182
201
  * Bumped Geckodriver to 0.32.2 and Edgedriver to 111.
183
202
 
184
- ## 17.2.0 - 2022-03-14
203
+ ## 17.2.0 - 2023-03-14
185
204
  ### Added
186
205
  * Updated Chrome, Chromedriver, Edge and Firefox to 111.
187
206
 
188
- ## 17.1.1 - 2022-03-04
207
+ ## 17.1.1 - 2023-03-04
189
208
  ### Fixed
190
209
  * Updated jimp, yargs, webdriver, execa and chrome-remote-interface dependencies [#1909](https://github.com/sitespeedio/browsertime/pull/1909).
191
210
  * Added extra log message when using the package.json hack.
192
211
 
193
- ## 17.1.0 - 2022-02-24
212
+ ## 17.1.0 - 2023-02-24
194
213
 
195
214
  ### Added
196
215
  * Expose chrome-remote-interface client to scripting. This makes it so much easier to run whatever CDP command. Get the raw version `commands.cdp.getRawClient();`. See PR [#1905](https://github.com/sitespeedio/browsertime/pull/1905) for a concrete example until we update the documentation.
@@ -198,7 +217,7 @@
198
217
  * Fix visual-complete progress calculations to not use fuzz/slop, thank you [Gregory Mierzwinski](https://github.com/gmierz) for PR [#1902](https://github.com/sitespeedio/browsertime/pull/1902).
199
218
  * Update to new Chrome HAR [#1906](https://github.com/sitespeedio/browsertime/pull/1906).
200
219
  * Fix flushing DNS on Ubuntu 22.04 [#1907](https://github.com/sitespeedio/browsertime/pull/1907).
201
- ## 17.0.0 - 2022-02-10
220
+ ## 17.0.0 - 2023-02-10
202
221
 
203
222
  ### Breaking changes
204
223
  The project was transitioned to a [pure ESM package](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) [#1859](https://github.com/sitespeedio/browsertime/pull/1859), allowing us to stay current with dependencies that have made the same transition and ensuring the ability to always utilize the latest versions of our dependencies. This is important for us and will make the project easier to maintain.
@@ -4,8 +4,8 @@ import { join } from 'node:path';
4
4
  import { EOL as endOfLine } from 'node:os';
5
5
  import { execa } from 'execa';
6
6
  import intel from 'intel';
7
- import adbKit from '@devicefarmer/adbkit';
8
- const { createClient, util } = adbKit;
7
+ import pkg from '@devicefarmer/adbkit';
8
+ const { Adb } = pkg;
9
9
  import get from 'lodash.get';
10
10
  const log = intel.getLogger('browsertime.android');
11
11
  const mkdir = promisify(_mkdir);
@@ -21,7 +21,8 @@ export class Android {
21
21
  }
22
22
 
23
23
  Android.instance = this;
24
- this.client = createClient();
24
+ this.client = Adb.createClient();
25
+
25
26
  this.id = get(
26
27
  options,
27
28
  'chrome.android.deviceSerial',
@@ -48,36 +49,34 @@ export class Android {
48
49
  }
49
50
  }
50
51
 
52
+ this.device = this.client.getDevice(this.id);
53
+
51
54
  if (!this.sdcard) {
52
55
  this.sdcard = await this._runCommandAndGet('echo $EXTERNAL_STORAGE');
53
56
  }
54
57
  }
55
58
 
56
59
  async _runCommand(command) {
57
- return this.client.shell(this.id, command);
60
+ return this.device.shell(command);
58
61
  }
59
62
 
60
63
  async _runCommandAndGet(command) {
61
- const data = await this.client.shell(this.id, command);
62
- const output = await util.readAll(data);
64
+ const data = await this.device.shell(command);
65
+ const output = await Adb.util.readAll(data);
63
66
  return output.toString().trim();
64
67
  }
65
68
 
66
69
  async _runAsRootAndGet(command) {
67
- const data = await this.client.shell(
68
- this.id,
69
- 'su - root -c "' + command + '"'
70
- );
71
- const output = await util.readAll(data);
70
+ const data = await this.device.shell('su - root -c "' + command + '"');
71
+ const output = await Adb.util.readAll(data);
72
72
  return output.toString().trim();
73
73
  }
74
74
 
75
75
  async _runAsRoot(command) {
76
- const data = await this.client.shell(
77
- this.id,
76
+ const data = await this.device.shell(
78
77
  'su - root -c "' + command + ' && echo SUCCESS || echo FAIL"'
79
78
  );
80
- const output = await util.readAll(data);
79
+ const output = await Adb.util.readAll(data);
81
80
  const result = output.toString().trim();
82
81
  if (result === 'FAIL') {
83
82
  log.error('Failing running as root:' + command);
@@ -88,7 +87,7 @@ export class Android {
88
87
  async _downloadFile(sourcePath, destinationPath) {
89
88
  log.trace(`Pulling to ${destinationPath} from ${sourcePath}`);
90
89
 
91
- const transfer = await this.client.pull(this.id, sourcePath);
90
+ const transfer = await this.device.pull(sourcePath);
92
91
 
93
92
  return new Promise((resolve, reject) => {
94
93
  transfer.on('end', function () {
@@ -100,7 +99,7 @@ export class Android {
100
99
  }
101
100
 
102
101
  async _downloadDir(sourcePath, destinationPath) {
103
- const files = await this.client.readdir(this.id, sourcePath);
102
+ const files = await this.device.readdir(sourcePath);
104
103
 
105
104
  for (const file of files) {
106
105
  const fullSourcePath = `${sourcePath}/${file.name}`;
@@ -141,7 +140,7 @@ export class Android {
141
140
  }
142
141
 
143
142
  async reboot() {
144
- await this.client.reboot(this.id);
143
+ await this.device.reboot(this.id);
145
144
  return delay(60_000);
146
145
  }
147
146
 
@@ -155,24 +154,24 @@ export class Android {
155
154
  }
156
155
 
157
156
  async getMeta() {
158
- const rawModel = await util.readAll(
157
+ const rawModel = await Adb.util.readAll(
159
158
  await this._runCommand(`getprop ro.product.model`)
160
159
  );
161
160
  const model = rawModel.toString().trim();
162
- const rawName = await util.readAll(
161
+ const rawName = await Adb.util.readAll(
163
162
  await this._runCommand(`getprop ro.product.name`)
164
163
  );
165
164
  const name = rawName.toString().trim();
166
- const rawDevice = await util.readAll(
165
+ const rawDevice = await Adb.util.readAll(
167
166
  await this._runCommand(`getprop ro.product.device`)
168
167
  );
169
168
  const device = rawDevice.toString().trim();
170
- const rawId = await util.readAll(
169
+ const rawId = await Adb.util.readAll(
171
170
  await this._runCommand(`getprop ro.serialno`)
172
171
  );
173
172
  const id = rawId.toString().trim();
174
173
  const wifi = await this.getWifi();
175
- const rawRelease = await util.readAll(
174
+ const rawRelease = await Adb.util.readAll(
176
175
  await this._runCommand(`getprop ro.build.version.release `)
177
176
  );
178
177
  const androidVersion = rawRelease.toString().trim();
@@ -187,8 +186,7 @@ export class Android {
187
186
  }
188
187
 
189
188
  async addDevtoolsFw() {
190
- return this.client.forward(
191
- this.id,
189
+ return this.device.forward(
192
190
  'tcp:' + this.port,
193
191
  'localabstract:chrome_devtools_remote'
194
192
  );
@@ -236,13 +234,13 @@ export class Android {
236
234
  }
237
235
 
238
236
  async getWifi() {
239
- const rawWifiInfo = await util.readAll(
237
+ const rawWifiInfo = await Adb.util.readAll(
240
238
  await this._runCommand(
241
239
  `dumpsys netstats | grep -E 'iface=wlan.*networkId'`
242
240
  )
243
241
  );
244
242
  const wifiInfo = rawWifiInfo.toString().trim();
245
- const wifi = wifiInfo.match(/"[^"]*"|^[^"]*$/)[0].replace(/"/g, '');
243
+ const wifi = wifiInfo.match(/"[^"]*"|^[^"]*$/)[0].replaceAll('"', '');
246
244
  return wifi;
247
245
  }
248
246
 
@@ -299,7 +297,7 @@ export class Android {
299
297
  const cmd1 = `pidof ${packageName}`;
300
298
  log.debug(`pidof ${cmd1}`);
301
299
  const proc1 = await this._runCommand(cmd1);
302
- const ps1 = await util.readAll(proc1);
300
+ const ps1 = await Adb.util.readAll(proc1);
303
301
  const ps = ps1.toString();
304
302
  log.debug(`pidof ${ps}`);
305
303
 
@@ -328,7 +326,7 @@ export class Android {
328
326
  const cmd = `ps`;
329
327
  log.debug(`pidof ${cmd}`);
330
328
  const proc = await this._runCommand(cmd);
331
- const psTemporary = await util.readAll(proc);
329
+ const psTemporary = await Adb.util.readAll(proc);
332
330
  const ps = psTemporary.toString();
333
331
  log.debug(`pidof ${ps}`);
334
332
 
@@ -382,7 +380,9 @@ export class Android {
382
380
  // `cut` and `awk`, to make this more robust.
383
381
  const cut = `echo $EPOCHREALTIME && cut -d ' ' -f 1 /proc/uptime && cut -d ' ' -f 22 /proc/self/stat /proc/${pid}/stat`;
384
382
  // const awk = `date +%s%3N && awk '{print $1}' /proc/uptime && awk '{print $22}' /proc/self/stat /proc/${pid}/stat`;
385
- const statAndTimestamp = await util.readAll(await this._runCommand(cut));
383
+ const statAndTimestamp = await Adb.util.readAll(
384
+ await this._runCommand(cut)
385
+ );
386
386
  const output = statAndTimestamp.toString();
387
387
 
388
388
  const [
@@ -79,13 +79,35 @@ export class RootedDevice {
79
79
  async setCPUPerformanceMotoG5() {
80
80
  // # MSM8937(8x 1.4GHz)
81
81
  // values obtained from:
82
- // /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies
82
+ // cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_available_frequencies
83
+ // 960000 1094400 1209600 1248000 1344000 1401000
84
+
85
+ let cpuSpeed = 1_401_000;
86
+ if (
87
+ this.options.androidPinCPUSpeed === 'min' ||
88
+ (this.options.android && this.options.android.pinCPUSpeed === 'min')
89
+ ) {
90
+ log.info('Set min CPU speed');
91
+ cpuSpeed = 960_000;
92
+ } else if (
93
+ this.options.androidPinCPUSpeed === 'middle' ||
94
+ (this.options.android && this.options.android.pinCPUSpeed === 'middle')
95
+ ) {
96
+ log.info('Set middle CPU speed');
97
+ cpuSpeed = 1_209_600;
98
+ } else {
99
+ log.info('Set max CPU speed');
100
+ }
101
+
83
102
  for (let index = 0; index < 8; index++) {
84
103
  await this.client._runAsRoot(
85
104
  `echo performance > /sys/devices/system/cpu/cpu${index}/cpufreq/scaling_governor`
86
105
  );
87
106
  await this.client._runAsRoot(
88
- `echo 1401000 > /sys/devices/system/cpu/cpu${index}/cpufreq/scaling_min_freq`
107
+ `echo ${cpuSpeed} > /sys/devices/system/cpu/cpu${index}/cpufreq/scaling_min_freq`
108
+ );
109
+ await this.client._runAsRoot(
110
+ `echo ${cpuSpeed} > /sys/devices/system/cpu/cpu${index}/cpufreq/scaling_max_freq`
89
111
  );
90
112
  }
91
113
  }
@@ -120,7 +142,10 @@ export class RootedDevice {
120
142
  'cat /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq'
121
143
  );
122
144
 
123
- if (this.options.androidPinCPUSpeed === 'min') {
145
+ if (
146
+ this.options.androidPinCPUSpeed === 'min' ||
147
+ (this.options.android && this.options.android.pinCPUSpeed === 'min')
148
+ ) {
124
149
  log.info('Set min CPU speed');
125
150
 
126
151
  // The min settings, see the possible slowest setting by
@@ -144,7 +169,10 @@ export class RootedDevice {
144
169
  await this._setCPU(minPolicy4, '4', 'max');
145
170
  return this._setCPU(minPolicy4, '4', 'min');
146
171
  }
147
- } else if (this.options.androidPinCPUSpeed === 'middle') {
172
+ } else if (
173
+ this.options.androidPinCPUSpeed === 'middle' ||
174
+ (this.options.android && this.options.android.pinCPUSpeed === 'middle')
175
+ ) {
148
176
  log.info('Set middle CPU speed');
149
177
 
150
178
  const middlePolicy0 = 910_000;
@@ -129,7 +129,7 @@ export class Click {
129
129
  async byXpath(xpath) {
130
130
  try {
131
131
  // This is how Selenium do internally
132
- const replaced = xpath.replace(/"/g, "'");
132
+ const replaced = xpath.replaceAll('"', "'");
133
133
  const script = `document.evaluate("${replaced}", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click();`;
134
134
  return this.browser.runScript(script, 'CUSTOM');
135
135
  } catch (error) {
@@ -148,7 +148,7 @@ export class Click {
148
148
  async byXpathAndWait(xpath) {
149
149
  try {
150
150
  // This is how Selenium do internally
151
- const replaced = xpath.replace(/"/g, "'");
151
+ const replaced = xpath.replaceAll('"', "'");
152
152
  const script = `document.evaluate("${replaced}", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click();`;
153
153
  await this.browser.runScript(script, 'CUSTOM');
154
154
  return this.browser.extraWait(this.pageCompleteCheck);
@@ -114,10 +114,10 @@ export class Measure {
114
114
  // If we have tested pages before, but not in the making of
115
115
  // measuring a page, associate the error with that latest page.
116
116
  if (this.result.length > 0) {
117
- if (this.result[this.result.length - 1].error === undefined) {
118
- this.result[this.result.length - 1].error = [message];
117
+ if (this.result.at(-1).error === undefined) {
118
+ this.result.at(-1).error = [message];
119
119
  } else {
120
- this.result[this.result.length - 1].error.push(message);
120
+ this.result.at(-1).error.push(message);
121
121
  }
122
122
  } else {
123
123
  // error not associated to a start/run so far
@@ -224,6 +224,25 @@ export class Firefox {
224
224
  if (this.appConstants) {
225
225
  result.browserScripts.browser.appConstants = this.appConstants;
226
226
  }
227
+
228
+ result.googleWebVitals = {};
229
+ if (
230
+ result.browserScripts.timings &&
231
+ result.browserScripts.timings.largestContentfulPaint
232
+ ) {
233
+ result.googleWebVitals.largestContentfulPaint =
234
+ result.browserScripts.timings.largestContentfulPaint.renderTime ||
235
+ result.browserScripts.timings.largestContentfulPaint.loadTime;
236
+ }
237
+
238
+ if (
239
+ result.browserScripts.timings &&
240
+ result.browserScripts.timings.paintTiming &&
241
+ result.browserScripts.timings.paintTiming['first-contentful-paint']
242
+ ) {
243
+ result.googleWebVitals.firstContentfulPaint =
244
+ result.browserScripts.timings.paintTiming['first-contentful-paint'];
245
+ }
227
246
  }
228
247
 
229
248
  async postWork(index, results) {
@@ -757,7 +757,7 @@ export function parseCommandLine() {
757
757
  choices: ['min', 'middle', 'max'],
758
758
  default: 'min',
759
759
  describe:
760
- 'Using a Samsung A51 you can choose how to pin the CPU to better align the speed with your users',
760
+ 'Using a Samsung A51 or Moto G5 you can choose how to pin the CPU to better align the speed with your users. This only works on rooted phones and together with --android.rooted',
761
761
  group: 'android'
762
762
  })
763
763
  .option('android.batteryTemperatureLimit', {
@@ -6,7 +6,7 @@ const log = intel.getLogger('browsertime');
6
6
 
7
7
  function toSafeKey(key) {
8
8
  // U+2013 : EN DASH – as used on https://en.wikipedia.org/wiki/2019–20_coronavirus_pandemic
9
- return key.replace(/[ %&()+,./:?|~–]|%7C/g, '-');
9
+ return key.replaceAll(/[ %&()+,./:?|~–]|%7C/g, '-');
10
10
  }
11
11
 
12
12
  export function pathToFolder(url, options) {
@@ -59,7 +59,7 @@ export function pathToFolder(url, options) {
59
59
 
60
60
  for (const [index, segment] of pathSegments.entries()) {
61
61
  if (segment) {
62
- pathSegments[index] = segment.replace(/[^\w.\u0621-\u064A-]/gi, '-');
62
+ pathSegments[index] = segment.replaceAll(/[^\w.\u0621-\u064A-]/gi, '-');
63
63
  }
64
64
  }
65
65
 
@@ -23,7 +23,7 @@ const mkdir = promisify(_mkdir);
23
23
  const log = intel.getLogger('browsertime');
24
24
 
25
25
  const defaultDir = 'browsertime-results';
26
- let timestamp = dayjs().format().replace(/:/g, '');
26
+ let timestamp = dayjs().format().replaceAll(':', '');
27
27
 
28
28
  function pathNameFromUrl(url) {
29
29
  const parsedUrl = parse(url),
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "browsertime",
3
3
  "description": "Get performance metrics from your web page using Browsertime.",
4
- "version": "17.19.0",
4
+ "version": "19.0.0",
5
5
  "bin": "./bin/browsertime.js",
6
6
  "type": "module",
7
7
  "dependencies": {
8
8
  "@cypress/xvfb": "1.2.4",
9
- "@devicefarmer/adbkit": "2.11.3",
10
- "@sitespeed.io/chromedriver": "119.0.6045-59",
9
+ "@devicefarmer/adbkit": "3.2.5",
10
+ "@sitespeed.io/chromedriver": "119.0.6045-105",
11
11
  "@sitespeed.io/edgedriver": "119.0.2151-42",
12
12
  "@sitespeed.io/geckodriver": "0.33.0",
13
13
  "@sitespeed.io/throttle": "5.0.0",
@@ -16,11 +16,11 @@
16
16
  "btoa": "1.2.1",
17
17
  "chrome-har": "0.13.2",
18
18
  "chrome-remote-interface": "0.33.0",
19
- "dayjs": "1.11.9",
20
- "execa": "7.2.0",
19
+ "dayjs": "1.11.10",
20
+ "execa": "8.0.1",
21
21
  "fast-stats": "0.0.6",
22
22
  "find-up": "6.3.0",
23
- "get-port": "6.1.2",
23
+ "get-port": "7.0.0",
24
24
  "hasbin": "1.2.3",
25
25
  "intel": "1.2.0",
26
26
  "lodash.get": "4.4.2",
@@ -36,14 +36,14 @@
36
36
  "jimp": "0.22.10"
37
37
  },
38
38
  "devDependencies": {
39
- "ava": "5.1.0",
40
- "eslint": "8.31.0",
41
- "eslint-config-prettier": "8.6.0",
42
- "eslint-plugin-prettier": "4.2.1",
43
- "eslint-plugin-unicorn": "45.0.2",
44
- "prettier": "2.8.2",
39
+ "ava": "5.3.1",
40
+ "eslint": "8.53.0",
41
+ "eslint-config-prettier": "9.0.0",
42
+ "eslint-plugin-prettier": "5.0.1",
43
+ "eslint-plugin-unicorn": "49.0.0",
44
+ "prettier": "3.0.3",
45
45
  "serve-handler": "6.1.5",
46
- "serve": "14.1.2"
46
+ "serve": "14.2.1"
47
47
  },
48
48
  "engines": {
49
49
  "node": ">=14.19.1"