browsertime 21.1.0 → 21.2.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,21 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
+ ## 21.2.1 - 2024-02-11
4
+ ### Fixed
5
+ * Fix correct JavaScript signaure for stopAsError in types.
6
+
7
+ ## 21.2.0 - 2024-02-11
8
+ ### Added
9
+ * Edge 121 in the Docker container [#2071](https://github.com/sitespeedio/browsertime/pull/2071).
10
+ * You can stop a measurement as a failure and make sure no metrics is collected. This is useful if you catch an error in try/catch when trying to measure a page. `measure.stopAsError(failureMessage, optionalURL)`. Add your message and if you know the URL, add it. [2076](https://github.com/sitespeedio/browsertime/pull/2076).
11
+
12
+ ### Fixed
13
+ * Set correct viewports for the following emulated mobiles for Chrome: iPhone 14 Pro Max [#2070](https://github.com/sitespeedio/browsertime/pull/2070).
14
+ * Update adbkit to 3.2.6 [#2069](https://github.com/sitespeedio/browsertime/pull/2069).
15
+ * Selenium 4.17.0 [#2068](https://github.com/sitespeedio/browsertime/pull/2068).
16
+ * There was a missing await when getting the tcpdump [#2075](https://github.com/sitespeedio/browsertime/pull/2075)
17
+ * Remove all trace level logs (and do debug instead) since trace added unnecessary stacktraces to the log [#2074](https://github.com/sitespeedio/browsertime/pull/2074).
18
+
3
19
  ## 21.1.0 - 2024-01-24
4
20
  ### Added
5
21
  * Firefox 122, Chrome 121 and Chromedriver 121 [#2067](https://github.com/sitespeedio/browsertime/pull/2067).
@@ -85,7 +85,7 @@ export class Android {
85
85
  }
86
86
 
87
87
  async _downloadFile(sourcePath, destinationPath) {
88
- log.trace(`Pulling to ${destinationPath} from ${sourcePath}`);
88
+ log.debug(`Pulling to ${destinationPath} from ${sourcePath}`);
89
89
 
90
90
  const transfer = await this.device.pull(sourcePath);
91
91
 
@@ -372,6 +372,21 @@ export class Measure {
372
372
  }
373
373
  }
374
374
 
375
+ /**
376
+ * Stop the current measurement and mark it as a failure. This stop function will not measure anything on a page. This is useful if you need to stop a measurement in a (try) catch and you
377
+ * know something has failed.
378
+ *
379
+ * @async
380
+ * @param {string} errorMessage - The message about the error. This will end up on the HTML report for sitespeed.io so give it a good message so you know what's gone wrong.
381
+ * @param {string} optionalURL - The URL of the page that you wanted to test. If you don't know the URL (you clicked on a link etc) skip it.
382
+ * @returns {Promise} A promise that resolves when the stop process has completed.
383
+ * @since 21.2.0
384
+ */
385
+ async stopAsError(errorMessage, optionalURL) {
386
+ this._error(errorMessage);
387
+ this.areWeMeasuring = false;
388
+ return this.stop(optionalURL, false);
389
+ }
375
390
  /**
376
391
  * Stops the measurement process, collects metrics, and handles any post-measurement tasks.
377
392
  * It finalizes the URL being tested, manages any URL-specific metadata, stops any ongoing video recordings,
@@ -382,7 +397,7 @@ export class Measure {
382
397
  * @throws {Error} Throws an error if there are issues in stopping the measurement or collecting data.
383
398
  * @returns {Promise} A promise that resolves with the collected metrics data.
384
399
  */
385
- async stop(testedStartUrl) {
400
+ async stop(testedStartUrl, collectMeasurements = true) {
386
401
  log.debug('Stop measuring');
387
402
  // If we don't have a URL (tested using clicking on link etc) get the URL from the browser
388
403
  let url =
@@ -443,7 +458,12 @@ export class Measure {
443
458
  this.result[this.numberOfMeasuredPages],
444
459
  res
445
460
  );
446
- return this.collect(url);
461
+
462
+ if (this.options.tcpdump) {
463
+ await this.tcpDump.stop();
464
+ }
465
+
466
+ return collectMeasurements === false ? undefined : this.collect(url);
447
467
  }
448
468
 
449
469
  /**
@@ -486,9 +506,6 @@ export class Measure {
486
506
  * @private
487
507
  */
488
508
  async collect(url) {
489
- if (this.options.tcpdump) {
490
- await this.tcpDump.stop();
491
- }
492
509
  // This stops collecting trace logs in Chrome etc
493
510
  // await this.engineDelegate.beforeCollect();
494
511
 
@@ -649,7 +666,7 @@ export class Measure {
649
666
  }
650
667
 
651
668
  if (this.options.tcpdump) {
652
- this.tcpDump.mv(url, this.index);
669
+ await this.tcpDump.mv(url, this.index);
653
670
  }
654
671
 
655
672
  await this.engineDelegate.afterEachURL(
@@ -436,7 +436,7 @@ export class SeleniumRunner {
436
436
  );
437
437
  }
438
438
 
439
- log.trace('Executing privileged script %s', script);
439
+ log.verbose('Executing privileged script %s', script);
440
440
  log.verbose('Executing privileged script %s', name);
441
441
 
442
442
  const oldContext = await this.driver.getContext();
@@ -486,7 +486,7 @@ export class SeleniumRunner {
486
486
  );
487
487
  }
488
488
 
489
- log.trace('Executing privileged async script %s', script);
489
+ log.verbose('Executing privileged async script %s', script);
490
490
  log.verbose('Executing privileged async script %s', name);
491
491
 
492
492
  try {
@@ -244,7 +244,7 @@ export async function configureBuilder(builder, baseDir, options) {
244
244
  }
245
245
 
246
246
  if (options.headless) {
247
- ffOptions.headless();
247
+ ffOptions.addArguments('-headless');
248
248
  }
249
249
 
250
250
  if (firefoxConfig.acceptInsecureCerts) {
@@ -28,6 +28,7 @@ const sizeMap = {
28
28
  'iPhone SE': '377x668',
29
29
  'iPhone 12 Pro': '390x844',
30
30
  'iPhone 14 Pro': '430x932',
31
+ 'iPhone 14 Pro Max': '430x932',
31
32
  'Pixel 5': '394x852',
32
33
  'Pixel 7': '412x916',
33
34
  'Samsung Galaxy S8+': '412x846',
@@ -88,7 +88,7 @@ async function startRecording(ffmpegArguments, nice, taskset, filePath) {
88
88
  async function waitForRecording(readableStream) {
89
89
  return new Promise((resolve, reject) => {
90
90
  readableStream.on('data', data => {
91
- log.trace(data.toString());
91
+ log.verbose(data.toString());
92
92
  if (/Press \[q] to stop/.test(data.toString())) {
93
93
  // readableStream.removeAllListeners('data');
94
94
  return resolve();
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": "21.1.0",
4
+ "version": "21.2.1",
5
5
  "bin": "./bin/browsertime.js",
6
6
  "type": "module",
7
7
  "types": "./types/scripting.d.ts",
8
8
  "dependencies": {
9
9
  "@cypress/xvfb": "1.2.4",
10
- "@devicefarmer/adbkit": "3.2.5",
10
+ "@devicefarmer/adbkit": "3.2.6",
11
11
  "@sitespeed.io/chromedriver": "121.0.6167-85",
12
12
  "@sitespeed.io/edgedriver": "120.0.2210-77",
13
13
  "@sitespeed.io/geckodriver": "0.34.0",
@@ -30,7 +30,7 @@
30
30
  "lodash.merge": "4.6.2",
31
31
  "lodash.pick": "4.4.0",
32
32
  "lodash.set": "4.3.2",
33
- "selenium-webdriver": "4.16.0",
33
+ "selenium-webdriver": "4.17.0",
34
34
  "yargs": "17.7.2"
35
35
  },
36
36
  "optionalDependencies": {
@@ -38,14 +38,14 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/selenium-webdriver": "4.1.21",
41
- "ava": "6.0.1",
41
+ "ava": "6.1.1",
42
42
  "clean-jsdoc-theme": "4.2.17",
43
43
  "eslint": "8.56.0",
44
44
  "eslint-config-prettier": "9.1.0",
45
45
  "eslint-plugin-prettier": "5.1.3",
46
46
  "eslint-plugin-unicorn": "50.0.1",
47
47
  "jsdoc": "4.0.2",
48
- "prettier": "3.2.2",
48
+ "prettier": "3.2.4",
49
49
  "serve": "14.2.1",
50
50
  "serve-handler": "6.1.5",
51
51
  "typescript": "5.3.3"
@@ -155,6 +155,17 @@ export class Measure {
155
155
  * @returns {Promise<void>} A promise that resolves when the start process is complete, or rejects if there are errors.
156
156
  */
157
157
  start(urlOrAlias: string, optionalAlias?: string): Promise<void>;
158
+ /**
159
+ * Stop the current measurement and mark it as a failure. This stop function will not measure anything on a page. This is useful if you need to stop a measurement in a (try) catch and you
160
+ * know something has failed.
161
+ *
162
+ * @async
163
+ * @param {string} errorMessage - The message about the error. This will end up on the HTML report for sitespeed.io so give it a good message so you know what's gone wrong.
164
+ * @param {string} optionalURL - The URL of the page that you wanted to test. If you don't know the URL (you clicked on a link etc) skip it.
165
+ * @returns {Promise} A promise that resolves when the stop process has completed.
166
+ * @since 21.2.0
167
+ */
168
+ stopAsError(errorMessage: string, optionalURL: string): Promise<any>;
158
169
  /**
159
170
  * Stops the measurement process, collects metrics, and handles any post-measurement tasks.
160
171
  * It finalizes the URL being tested, manages any URL-specific metadata, stops any ongoing video recordings,
@@ -165,7 +176,7 @@ export class Measure {
165
176
  * @throws {Error} Throws an error if there are issues in stopping the measurement or collecting data.
166
177
  * @returns {Promise} A promise that resolves with the collected metrics data.
167
178
  */
168
- stop(testedStartUrl: string): Promise<any>;
179
+ stop(testedStartUrl: string, collectMeasurements?: boolean): Promise<any>;
169
180
  /**
170
181
  * Adds a custom metric to the current measurement result.
171
182
  * This method should be called after a measurement has started and before it has stopped.
@@ -1 +1 @@
1
- {"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../../../lib/core/engine/command/measure.js"],"names":[],"mappings":"AA6BA;;;;;;GAMG;AACH;IACE,sRA4GC;IA5FC;;OAEG;IACH,gBAAsB;IACtB;;OAEG;IACH,0BAA0C;IAC1C;;OAEG;IACH,cAAkB;IAClB;;OAEG;IACH,eAAoB;IACpB;;OAEG;IACH,uBAAoC;IACpC;;OAEG;IACH,gBAAsB;IACtB;;OAEG;IACH,0BAA0C;IAC1C;;OAEG;IACH,uBAAoC;IACpC;;OAEG;IACH,oBAAyD;IACzD;;OAEG;IACH,wBAAsC;IACtC;;OAEG;IACH,eAAoB;IACpB;;OAEG;IACH,0BAA0C;IAC1C;;OAEG;IACH,+BAAoD;IACpD;;OAEG;IACH,uBAAoC;IACpC;;OAEG;IACH,gBAAsB;IACtB;;OAEG;IACH,8BAA8B;IAC9B;;OAEG;IACH,6BAA6B;IAC7B;;OAEG;IACH,uBAA2B;IAC3B;;OAEG;IACH,mBAAoB;IACpB;;OAEG;IACH,gBAA6D;IAC7D;;OAEG;IACH,2BAAsE;IACtE;;OAEG;IACH,uBAA8D;IAC9D;;OAEG;IACH,2BAAqE;IAGvE;;;OAGG;IACH,oBAsBC;IArBC,aAAuE;IAuBzE;;;OAGG;IACH,mBAKC;IAED;;;OAGG;IACH,eAsBC;IAED;;;OAGG;IACH,iBAQC;IAED;;;;;;;;;;;;OAYG;IACH,kBAuBC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,kBALW,MAAM,kBACN,MAAM,GAEJ,QAAQ,IAAI,CAAC,CAwFzB;IAED;;;;;;;;;OASG;IACH,qBAJW,MAAM,gBAkEhB;IAED;;;;;;;OAOG;IACH,UAJW,MAAM,oBAYhB;IAED;;;;;;;OAOG;IACH,6BAOC;IAED;;;OAGG;IACH,gBA+KC;CACF;sBAlpBqB,yBAAyB"}
1
+ {"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../../../lib/core/engine/command/measure.js"],"names":[],"mappings":"AA6BA;;;;;;GAMG;AACH;IACE,sRA4GC;IA5FC;;OAEG;IACH,gBAAsB;IACtB;;OAEG;IACH,0BAA0C;IAC1C;;OAEG;IACH,cAAkB;IAClB;;OAEG;IACH,eAAoB;IACpB;;OAEG;IACH,uBAAoC;IACpC;;OAEG;IACH,gBAAsB;IACtB;;OAEG;IACH,0BAA0C;IAC1C;;OAEG;IACH,uBAAoC;IACpC;;OAEG;IACH,oBAAyD;IACzD;;OAEG;IACH,wBAAsC;IACtC;;OAEG;IACH,eAAoB;IACpB;;OAEG;IACH,0BAA0C;IAC1C;;OAEG;IACH,+BAAoD;IACpD;;OAEG;IACH,uBAAoC;IACpC;;OAEG;IACH,gBAAsB;IACtB;;OAEG;IACH,8BAA8B;IAC9B;;OAEG;IACH,6BAA6B;IAC7B;;OAEG;IACH,uBAA2B;IAC3B;;OAEG;IACH,mBAAoB;IACpB;;OAEG;IACH,gBAA6D;IAC7D;;OAEG;IACH,2BAAsE;IACtE;;OAEG;IACH,uBAA8D;IAC9D;;OAEG;IACH,2BAAqE;IAGvE;;;OAGG;IACH,oBAsBC;IArBC,aAAuE;IAuBzE;;;OAGG;IACH,mBAKC;IAED;;;OAGG;IACH,eAsBC;IAED;;;OAGG;IACH,iBAQC;IAED;;;;;;;;;;;;OAYG;IACH,kBAuBC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,kBALW,MAAM,kBACN,MAAM,GAEJ,QAAQ,IAAI,CAAC,CAwFzB;IAED;;;;;;;;;OASG;IACH,0BALW,MAAM,eACL,MAAM,gBAQjB;IACD;;;;;;;;;OASG;IACH,qBAJW,MAAM,+CAuEhB;IAED;;;;;;;OAOG;IACH,UAJW,MAAM,oBAYhB;IAED;;;;;;;OAOG;IACH,6BAOC;IAED;;;OAGG;IACH,gBA4KC;CACF;sBAnqBqB,yBAAyB"}
@@ -1 +1 @@
1
- {"version":3,"file":"getViewPort.d.ts","sourceRoot":"","sources":["../../lib/support/getViewPort.js"],"names":[],"mappings":"AAoCA,+CAkCC"}
1
+ {"version":3,"file":"getViewPort.d.ts","sourceRoot":"","sources":["../../lib/support/getViewPort.js"],"names":[],"mappings":"AAqCA,+CAkCC"}