browsertime 17.11.1 → 17.12.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,17 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
- ## 17.11.0 - 2022-06-12
3
+ ## 17.12.0 - 2022-07-19
4
+ ### Added
5
+ * Chrome and Chromedriver 115. The Chrome team has changed the hosting of Chromedriver, so the logic for downloading Chromedriver has changed [#1967](https://github.com/sitespeedio/browsertime/pull/1967).
6
+
7
+ * 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).
8
+
9
+ ## 17.11.2 - 2022-06-19
10
+ ### Fixed
11
+ * Fix --debug mode. Thank you [Gregory Mierzwinski](https://github.com/gmierz) for PR [#1959](https://github.com/sitespeedio/browsertime/pull/1959).
12
+ * Update ff-test-bidi-har-export to 0.0.11 that fixes some error logs [#1961](https://github.com/sitespeedio/browsertime/pull/1961).
13
+
14
+ ## 17.11.1 - 2022-06-12
4
15
  ### Fixed
5
16
  * If Chrome do not collect largest contentful paint, log that instead of just log null [#1957](https://github.com/sitespeedio/browsertime/pull/1957).
6
17
 
@@ -15,6 +15,11 @@ import { parse } from '../traceCategoriesParser.js';
15
15
  import { pathToFolder } from '../../support/pathToFolder.js';
16
16
  import { ChromeDevtoolsProtocol } from '../chromeDevtoolsProtocol.js';
17
17
  import { Android, isAndroidConfigured } from '../../android/index.js';
18
+ import {
19
+ getFirstContentFulPaintEvent,
20
+ getLargestContentfulPaintEvent,
21
+ getRecalculateStyleElementsAndTimeBefore
22
+ } from './traceUtilities.js';
18
23
  const unlink = promisify(_unlink);
19
24
  const rm = promisify(_rm);
20
25
 
@@ -353,6 +358,27 @@ export class Chromium {
353
358
  asset.args.data.renderBlocking;
354
359
  }
355
360
 
361
+ const fcpEvent = getFirstContentFulPaintEvent(trace.traceEvents);
362
+ const lcpEvent = getLargestContentfulPaintEvent(trace.traceEvents);
363
+
364
+ result.renderBlocking = { recalculateStyle: {}, requests: {} };
365
+
366
+ if (fcpEvent) {
367
+ const beforeFCP = getRecalculateStyleElementsAndTimeBefore(
368
+ trace.traceEvents,
369
+ fcpEvent.ts
370
+ );
371
+ result.renderBlocking.recalculateStyle.beforeFCP = beforeFCP;
372
+ }
373
+
374
+ if (lcpEvent) {
375
+ const beforeLCP = getRecalculateStyleElementsAndTimeBefore(
376
+ trace.traceEvents,
377
+ lcpEvent.ts
378
+ );
379
+ result.renderBlocking.recalculateStyle.beforeLCP = beforeLCP;
380
+ }
381
+
356
382
  if (!this.options.skipHar) {
357
383
  for (let harRequest of this.hars[index - 1].log.entries) {
358
384
  if (renderBlockingInfo[harRequest.request.url]) {
@@ -362,7 +388,7 @@ export class Chromium {
362
388
  }
363
389
  }
364
390
 
365
- result.renderBlocking = renderBlockingInfo;
391
+ result.renderBlocking.requests = renderBlockingInfo;
366
392
  }
367
393
 
368
394
  // Google Web Vitals hacksery
@@ -0,0 +1,64 @@
1
+ import intel from 'intel';
2
+ const log = intel.getLogger('browsertime.chrome');
3
+
4
+ export function getLargestContentfulPaintEvent(traceEvents) {
5
+ const lcpCandidates = traceEvents.filter(
6
+ task => task.name === 'largestContentfulPaint::Candidate'
7
+ );
8
+
9
+ if (lcpCandidates.length > 0) {
10
+ let lcpEvent = lcpCandidates[0];
11
+
12
+ for (const candidate of lcpCandidates) {
13
+ if (candidate.ts > lcpEvent.ts) {
14
+ lcpEvent = candidate;
15
+ }
16
+ }
17
+ return lcpEvent;
18
+ } else {
19
+ log.info('No LCP event found in the trace');
20
+ }
21
+ }
22
+
23
+ export function getFirstContentFulPaintEvent(traceEvents) {
24
+ // Get first contentful paint
25
+ const fcpEvent = traceEvents.find(
26
+ task => task.name === 'firstContentfulPaint'
27
+ );
28
+
29
+ if (fcpEvent) {
30
+ return fcpEvent;
31
+ } else {
32
+ log.info('Did not find the FCP event in the trace');
33
+ }
34
+ }
35
+
36
+ export function getRecalculateStyleElementsAndTimeBefore(
37
+ traceEvents,
38
+ timestamp
39
+ ) {
40
+ const recalculatesBefore = traceEvents.filter(
41
+ task =>
42
+ task.cat === 'disabled-by-default-devtools.timeline' &&
43
+ task.name === 'ScheduleStyleRecalculation' &&
44
+ task.ts < timestamp
45
+ );
46
+
47
+ const updateLayoutTree = traceEvents.filter(
48
+ task =>
49
+ task.cat === 'blink,devtools.timeline' &&
50
+ task.name === 'UpdateLayoutTree' &&
51
+ task.ts < timestamp &&
52
+ recalculatesBefore.some(
53
+ recalculate => task.args.beginData.frame === recalculate.args.data.frame
54
+ )
55
+ );
56
+ let elements = 0;
57
+ let duration = 0;
58
+ for (let a of updateLayoutTree) {
59
+ elements += a.args.elementCount;
60
+ duration += a.dur;
61
+ }
62
+
63
+ return { elements, durationInMillis: duration / 1000 };
64
+ }
@@ -404,6 +404,12 @@ export class Collector {
404
404
  results.renderBlocking = [];
405
405
  }
406
406
  results.renderBlocking.push(data.renderBlocking);
407
+
408
+ statistics.addDeep({
409
+ renderBlocking: {
410
+ recalculateStyle: data.renderBlocking.recalculateStyle
411
+ }
412
+ });
407
413
  }
408
414
 
409
415
  // Add power data (if we have it)
@@ -63,6 +63,11 @@ function validateInput(argv) {
63
63
  }
64
64
  }
65
65
 
66
+ // hack to keep backward compability to --android
67
+ if (argv.android[0] === true) {
68
+ set(argv, 'android.enabled', true);
69
+ }
70
+
66
71
  if (argv.chrome && argv.chrome.mobileEmulation) {
67
72
  const m = argv.chrome.mobileEmulation;
68
73
  if (!(m.deviceName || (m.height && m.width && m.pixelRatio))) {
@@ -82,7 +87,7 @@ function validateInput(argv) {
82
87
  return 'Debug mode do not work in Safari. Please try with Firefox/Chrome or Edge';
83
88
  }
84
89
 
85
- if (argv.debug && argv.android) {
90
+ if (argv.debug && argv.android.enabled) {
86
91
  return 'Debug mode do not work on Android. Please run debug mode on Desktop.';
87
92
  }
88
93
 
@@ -1262,10 +1267,6 @@ export function parseCommandLine() {
1262
1267
 
1263
1268
  let argv = validated.argv;
1264
1269
 
1265
- // hack to keep backward compability to --android
1266
- if (argv.android[0] === true) {
1267
- set(argv, 'android.enabled', true);
1268
- }
1269
1270
  if (
1270
1271
  argv.firefox &&
1271
1272
  (argv.firefox.nightly || argv.firefox.beta || argv.firefox.developer)
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "browsertime",
3
3
  "description": "Get performance metrics from your web page using Browsertime.",
4
- "version": "17.11.1",
4
+ "version": "17.12.0",
5
5
  "bin": "./bin/browsertime.js",
6
6
  "type": "module",
7
7
  "dependencies": {
8
8
  "@cypress/xvfb": "1.2.4",
9
9
  "@devicefarmer/adbkit": "2.11.3",
10
- "@sitespeed.io/chromedriver": "114.0.5735-90",
10
+ "@sitespeed.io/chromedriver": "115.0.5790-98",
11
11
  "@sitespeed.io/edgedriver": "113.0.1774-9b",
12
12
  "@sitespeed.io/geckodriver": "0.33.0",
13
13
  "@sitespeed.io/throttle": "5.0.0",
14
14
  "@sitespeed.io/tracium": "0.3.3",
15
- "ff-test-bidi-har-export": "0.0.10",
15
+ "ff-test-bidi-har-export": "0.0.11",
16
16
  "btoa": "1.2.1",
17
17
  "chrome-har": "0.13.1",
18
18
  "chrome-remote-interface": "0.32.2",