browsertime 16.11.0 → 16.11.3

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,18 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
+ ## 16.11.3 - 2022-07-14
4
+
5
+ ### Fixed
6
+ * If one of the visual elements failed, all failed. Fixed in [#1818](https://github.com/sitespeedio/browsertime/pull/1818).
7
+ * Use buffered long tasks instead of injecting the measuremnt in the page [#1817](https://github.com/sitespeedio/browsertime/pull/1817).
8
+ * Fixed broken CHromedriver and Geckodriver install on Windows.
9
+
10
+ ## 16.11.2 - 2022-07-05
11
+ ### Fixed
12
+ * Updated Geckodriver install, it will autoamtically pickup Geckodriver in the path for Raspberry Pis.
13
+ ## 16.11.1 - 2022-06-29
14
+ ### Fixed
15
+ * Fixed `--preWarmServer` so it works with `--headless`, Docker and specific Android or iOS device [#1815](https://github.com/sitespeedio/browsertime/pull/1815).
3
16
  ## 16.11.0 - 2022-06-28
4
17
 
5
18
  ### Added
@@ -7,6 +7,8 @@ const logging = require('../').logging;
7
7
  const cli = require('../lib/support/cli');
8
8
  const StorageManager = require('../lib/support/storageManager');
9
9
  const merge = require('lodash.merge');
10
+ const get = require('lodash.get');
11
+ const set = require('lodash.set');
10
12
  const fs = require('fs');
11
13
  const path = require('path');
12
14
  const log = require('intel').getLogger('browsertime');
@@ -28,12 +30,37 @@ async function parseUserScripts(scripts) {
28
30
  }
29
31
 
30
32
  async function preWarmServer(urls, options) {
31
- let engine = new Engine({
33
+ const preWarmOptions = {
32
34
  browser: options.browser,
33
35
  iterations: 1,
34
36
  xvfb: options.xvfb,
35
- android: options.android
36
- });
37
+ android: options.android,
38
+ docker: options.docker,
39
+ headless: options.headless
40
+ };
41
+ const chromeDevice = get(options, 'chrome.android.deviceSerial');
42
+ const firefoxDevice = get(options, 'firefox.android.deviceSerial');
43
+ const safariIos = get(options, 'safari.ios');
44
+ const safariDeviceName = get(options, 'safari.deviceName');
45
+ const safariDeviceUDID = get(options, 'safari.deviceUDID ');
46
+
47
+ if (chromeDevice) {
48
+ set(options, 'chrome.android.deviceSerial', chromeDevice);
49
+ } else if (firefoxDevice) {
50
+ set(options, 'firefox.android.deviceSerial', firefoxDevice);
51
+ }
52
+
53
+ if (safariIos) {
54
+ set(options, 'safari.ios', true);
55
+ if (safariDeviceName) {
56
+ set(options, 'safari.deviceName', safariDeviceName);
57
+ }
58
+ if (safariDeviceUDID) {
59
+ set(options, 'safari.deviceUDID', safariDeviceUDID);
60
+ }
61
+ }
62
+
63
+ let engine = new Engine(preWarmOptions);
37
64
  await engine.start();
38
65
  log.info('Start pre-testing/warming');
39
66
  await engine.runMultiple(urls, {});
@@ -1,25 +1,29 @@
1
1
  (function(minLength) {
2
- if (window.__bt_longtask) {
3
- const cleaned = [];
4
- for (let event of window.__bt_longtask.e) {
5
- if (event.duration >= minLength) {
6
- const e = {};
7
- e.duration = event.duration;
8
- e.name = event.name;
9
- e.startTime = event.startTime;
10
- e.attribution = [];
11
- for (let at of event.attribution) {
12
- const a = {};
13
- a.containerId = at.containerId;
14
- a.containerName = at.containerName;
15
- a.containerSrc = at.containerSrc;
16
- a.containerType = at.containerType;
17
- e.attribution.push(a);
18
- }
19
- cleaned.push(e);
2
+ const supported = PerformanceObserver.supportedEntryTypes;
3
+ if (!supported || supported.indexOf('longtask') === -1) {
4
+ return;
5
+ }
6
+ const observer = new PerformanceObserver(list => {});
7
+ observer.observe({type: 'longtask', buffered: true});
8
+ const entries = observer.takeRecords();
9
+ const cleaned = [];
10
+ for (let event of entries) {
11
+ if (event.duration >= minLength) {
12
+ const e = {};
13
+ e.duration = event.duration;
14
+ e.name = event.name;
15
+ e.startTime = event.startTime;
16
+ e.attribution = [];
17
+ for (let at of event.attribution) {
18
+ const a = {};
19
+ a.containerId = at.containerId;
20
+ a.containerName = at.containerName;
21
+ a.containerSrc = at.containerSrc;
22
+ a.containerType = at.containerType;
23
+ e.attribution.push(a);
20
24
  }
25
+ cleaned.push(e);
21
26
  }
22
- window.__bt_longtask.e = [];
23
- return cleaned;
24
27
  }
25
- })(arguments[arguments.length - 1]);
28
+ return cleaned;
29
+ })(arguments[arguments.length - 1]);
@@ -1266,14 +1266,16 @@ def calculate_visual_metrics(
1266
1266
  viewport = hero_data["viewport"]
1267
1267
  hero_timings = []
1268
1268
  for hero in hero_data["heroes"]:
1269
- hero_timings.append(
1270
- {
1271
- "name": hero["name"],
1272
- "value": calculate_hero_time(
1269
+ hero_time = calculate_hero_time(
1273
1270
  progress, dirs, hero, viewport
1274
- ),
1275
- }
1276
- )
1271
+ )
1272
+ if hero_time is not None:
1273
+ hero_timings.append(
1274
+ {
1275
+ "name": hero["name"],
1276
+ "value": hero_time,
1277
+ }
1278
+ )
1277
1279
  hero_timings_sorted = sorted(
1278
1280
  hero_timings, key=lambda timing: timing["value"]
1279
1281
  )
@@ -108,19 +108,6 @@ class ChromeDevtoolsProtocol {
108
108
  });
109
109
  }
110
110
 
111
- async setupLongTask() {
112
- const source = `
113
- !function() {
114
- let lt = window.__bt_longtask={e:[]};
115
- lt.o = new PerformanceObserver(function(a) {
116
- lt.e=lt.e.concat(a.getEntries());
117
- });
118
- lt.o.observe({entryTypes:['longtask']});
119
- }();`;
120
-
121
- return this.cdpClient.Page.addScriptToEvaluateOnNewDocument({ source });
122
- }
123
-
124
111
  async setBasicAuth(basicAuth) {
125
112
  const parts = basicAuth.split('@');
126
113
  const basic = 'Basic ' + btoa(parts[0] + ':' + parts[1]);
@@ -121,8 +121,6 @@ class Chromium {
121
121
  await this.cdpClient.setUserAgent(this.options.userAgent);
122
122
  }
123
123
 
124
- await this.cdpClient.setupLongTask();
125
-
126
124
  await this.cdpClient.loadingFailed();
127
125
 
128
126
  // Make sure we clear the console log
@@ -28,6 +28,7 @@ const PORTABLE_SCRIPT_PATH = path.join(
28
28
 
29
29
  function getScript(options) {
30
30
  if (options.visualMetricsPortable) {
31
+ log.info('Use the visual metrics portable script');
31
32
  return PORTABLE_SCRIPT_PATH;
32
33
  }
33
34
  return SCRIPT_PATH;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "description": "Browsertime",
3
- "version": "16.11.0",
3
+ "version": "16.11.3",
4
4
  "bin": "./bin/browsertime.js",
5
5
  "dependencies": {
6
6
  "@cypress/xvfb": "1.2.4",
7
7
  "@devicefarmer/adbkit": "2.11.3",
8
- "@sitespeed.io/chromedriver": "103.0.5060-24",
8
+ "@sitespeed.io/chromedriver": "103.0.5060-24b",
9
9
  "@sitespeed.io/edgedriver": "103.0.1264-37",
10
- "@sitespeed.io/geckodriver": "0.31.0",
10
+ "@sitespeed.io/geckodriver": "0.31.0-c",
11
11
  "@sitespeed.io/throttle": "4.0.1",
12
12
  "@sitespeed.io/tracium": "0.3.3",
13
13
  "btoa": "1.2.1",