browsertime 18.0.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,5 +1,14 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
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
+
3
12
  ## 18.0.0 - 2023-11-07
4
13
 
5
14
  ### Breaking
@@ -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;
@@ -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', {
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": "18.0.0",
4
+ "version": "19.0.0",
5
5
  "bin": "./bin/browsertime.js",
6
6
  "type": "module",
7
7
  "dependencies": {