browsertime 16.0.0 → 16.2.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,27 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
+ ## 16.2.0 - 2022-05-01
4
+ ### Added
5
+ * Updated to Chrome and Chromedriver 101 [#1773](https://github.com/sitespeedio/browsertime/pull/1773).
6
+ * Updated to Edge and Edgedriver 101 [#1778](https://github.com/sitespeedio/browsertime/pull/1778).
7
+ * Use Geckodriver 0.31.0 [#1775](https://github.com/sitespeedio/browsertime/pull/1775).
8
+ * Added new alias for warm cache load. You can now use either `--preURL` or `--warmLoad` [#1774](https://github.com/sitespeedio/browsertime/pull/1774).
9
+
10
+ ### Fixed
11
+ * Updated to Selenium 4.1.2 [#1779](https://github.com/sitespeedio/browsertime/pull/1779).
12
+ ### Tech
13
+ * Updated dev dependencies [#1776](https://github.com/sitespeedio/browsertime/pull/1776).
14
+ ## 16.1.0 - 2022-04-20
15
+ ### Fixed
16
+ * Handle negative x/y offsets when cropping images in the new portable visual metrocs script, thank you [Gregory Mierzwinski](https://github.com/gmierz) for PR [#1770](https://github.com/sitespeedio/browsertime/pull/1770).
17
+ * Bumped Throttle dependency [#1769](https://github.com/sitespeedio/browsertime/pull/1769).
18
+ * Bumped chrome-har, chrome-remote-interface, dayjs and yargs dependencies [#1771](https://github.com/sitespeedio/browsertime/pull/1771).
19
+ ### Added
20
+ * Added blocking of Chrome and Edge phone home domains [#1763](https://github.com/sitespeedio/browsertime/pull/1763).
21
+
22
+ ## 16.0.1 - 2022-04-06
23
+ ### Fixed
24
+ * If visual metrics fails and you also use --visualElements, make sure that file is also stored so we can reporduce the issue [#1757](https://github.com/sitespeedio/browsertime/pull/1757).
3
25
  ## 16.0.0 - 2022-04-05
4
26
  ### Changed
5
27
  * When I introduced flushing of the DNS per run I missed that it makes you need to run sudo to do it (Mac/Linux). That sucks so instead of being able to disable the flushing `--disableDNSFlush` you now enables it with `--flushDNS` [#1752](https://github.com/sitespeedio/browsertime/pull/1752).
@@ -108,6 +108,11 @@ def crop_im(img, crop_x, crop_y, crop_x_offset, crop_y_offset, gravity=None):
108
108
  base_x += crop_x_offset
109
109
  base_y += crop_y_offset
110
110
 
111
+ # Take the maximum in case the offset was negative, and
112
+ # smaller than the base position
113
+ base_x = max(base_x, 0)
114
+ base_y = max(base_y, 0)
115
+
111
116
  return Image.fromarray(
112
117
  img[base_y : base_y + crop_y, base_x : base_x + crop_x, :]
113
118
  )
@@ -2109,9 +2114,10 @@ def calculate_contentful_speed_index(progress, directory):
2109
2114
  content.append(value)
2110
2115
 
2111
2116
  for i, value in enumerate(content):
2112
- content[i] = (
2113
- maxContent == 0 and 0.0 or float(content[i]) / float(maxContent)
2114
- )
2117
+ if maxContent > 0:
2118
+ content[i] = float(content[i]) / float(maxContent)
2119
+ else:
2120
+ content[i] = 0.0
2115
2121
 
2116
2122
  # Assume 0 content for first frame
2117
2123
  cont_si = 1 * (progress[1]["time"] - progress[0]["time"])
@@ -5,6 +5,17 @@ const getViewPort = require('../../support/getViewPort');
5
5
  const util = require('../../support/util');
6
6
  const log = require('intel').getLogger('browsertime.chrome');
7
7
 
8
+ const CHROME_AMD_EDGE_INTERNAL_PHONE_HOME = [
9
+ '"MAP cache.pack.google.com 127.0.0.1"',
10
+ '"MAP clients1.google.com 127.0.0.1"',
11
+ '"MAP update.googleapis.com 127.0.0.1"',
12
+ '"MAP redirector.gvt1.com 127.0.0.1"',
13
+ '"MAP laptop-updates.brave.com 127.0.0.1"',
14
+ '"MAP offlinepages-pa.googleapis.com 127.0.0.1"',
15
+ '"MAP edge.microsoft.com 127.0.0.1"',
16
+ '"MAP optimizationguide-pa.googleapis.com 127.0.0.1"'
17
+ ];
18
+
8
19
  module.exports = function (seleniumOptions, browserOptions, options, baseDir) {
9
20
  // Fixing save password popup, only on Desktop
10
21
  if (!options.android) {
@@ -64,6 +75,17 @@ module.exports = function (seleniumOptions, browserOptions, options, baseDir) {
64
75
  excludes += 'MAP * 127.0.0.1, EXCLUDE ' + domain + ',';
65
76
  }
66
77
  seleniumOptions.addArguments('--host-resolver-rules=' + excludes);
78
+ } else {
79
+ // Make sure we only set this if we do not have any other host resolver rules
80
+ const chromeCommandLineArgs = util.toArray(browserOptions.args);
81
+ const argsWithHostResolverRules = chromeCommandLineArgs.filter(arg =>
82
+ arg.includes('host-resolver-rules')
83
+ );
84
+ if (argsWithHostResolverRules.length === 0) {
85
+ seleniumOptions.addArguments(
86
+ '--host-resolver-rules=' + CHROME_AMD_EDGE_INTERNAL_PHONE_HOME.join(',')
87
+ );
88
+ }
67
89
  }
68
90
 
69
91
  if (options.extension) {
@@ -1092,10 +1092,12 @@ module.exports.parseCommandLine = function parseCommandLine() {
1092
1092
  type: 'string'
1093
1093
  })
1094
1094
  .option('preURL', {
1095
+ alias: 'warmLoad',
1095
1096
  describe:
1096
1097
  'A URL that will be accessed first by the browser before the URL that you wanna analyze. Use it to fill the browser cache.'
1097
1098
  })
1098
1099
  .option('preURLDelay', {
1100
+ alias: 'warmLoadDealy',
1099
1101
  describe:
1100
1102
  'Delay between preURL and the URL you want to test (in milliseconds)',
1101
1103
  type: 'integer',
@@ -9,6 +9,7 @@ const fs = require('fs');
9
9
  const get = require('lodash.get');
10
10
  const { promisify } = require('util');
11
11
  const rename = promisify(fs.rename);
12
+ const copyFile = promisify(fs.copyFile);
12
13
  const unlink = promisify(fs.unlink);
13
14
  const defaults = require('../../defaults');
14
15
 
@@ -23,6 +24,11 @@ module.exports = async function (
23
24
  const newStart = videoMetrics.videoRecordingStart / 1000;
24
25
  let tmpFile = path.join(videoDir, 'tmp.mp4');
25
26
 
27
+ if (get(options, 'videoParams.keepOriginalVideo', false)) {
28
+ const originalFile = path.join(videoDir, index + '-original.mp4');
29
+ await copyFile(videoPath, originalFile);
30
+ }
31
+
26
32
  // if there's no orange (too slow instance like travis?)
27
33
  // we don't wanna cut
28
34
  if (videoMetrics.videoRecordingStart > 0) {
@@ -45,11 +51,6 @@ module.exports = async function (
45
51
  tmpFile = videoPath;
46
52
  }
47
53
 
48
- if (get(options, 'videoParams.keepOriginalVideo', false)) {
49
- const originalFile = path.join(videoDir, index + '-original.mp4');
50
- await rename(videoPath, originalFile);
51
- }
52
-
53
54
  if (
54
55
  options.android &&
55
56
  get(options, 'videoParams.convert', defaults.convert)
@@ -150,6 +150,11 @@ module.exports = {
150
150
  } catch (e) {
151
151
  log.error('VisualMetrics failed to run', e);
152
152
  await copyFile(videoPath, videoPath + '.failed.mp4');
153
+
154
+ if (options.visualElements) {
155
+ await copyFile(elementsFile, elementsFile + '.failed.json');
156
+ }
157
+
153
158
  // If something goes wrong, dump the visual metrics log to our log
154
159
  const visualMetricLog = await readFile(visualMetricsLogFile);
155
160
  log.error('Log from VisualMetrics: %s', visualMetricLog);
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "description": "Browsertime",
3
- "version": "16.0.0",
3
+ "version": "16.2.0",
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": "100.0.4896-20",
9
- "@sitespeed.io/edgedriver": "100.0.1185-29",
10
- "@sitespeed.io/geckodriver": "0.30.0",
11
- "@sitespeed.io/throttle": "3.0.0",
8
+ "@sitespeed.io/chromedriver": "101.0.4951-15",
9
+ "@sitespeed.io/edgedriver": "101.0.1210-32",
10
+ "@sitespeed.io/geckodriver": "0.31.0",
11
+ "@sitespeed.io/throttle": "3.1.1",
12
12
  "@sitespeed.io/tracium": "0.3.3",
13
13
  "btoa": "1.2.1",
14
- "chrome-har": "0.12.0",
15
- "chrome-remote-interface": "0.31.0",
16
- "dayjs": "1.10.7",
14
+ "chrome-har": "0.13.0",
15
+ "chrome-remote-interface": "0.31.2",
16
+ "dayjs": "1.11.1",
17
17
  "execa": "5.1.1",
18
18
  "fast-stats": "0.0.6",
19
19
  "find-up": "5.0.0",
@@ -26,23 +26,23 @@
26
26
  "lodash.merge": "4.6.2",
27
27
  "lodash.pick": "4.4.0",
28
28
  "lodash.set": "4.3.2",
29
- "selenium-webdriver": "4.1.1",
30
- "yargs": "17.2.1"
29
+ "selenium-webdriver": "4.1.2",
30
+ "yargs": "17.4.1"
31
31
  },
32
32
  "optionalDependencies": {
33
33
  "jimp": "0.16.1"
34
34
  },
35
35
  "devDependencies": {
36
- "ava": "4.0.1",
37
- "eslint": "8.0.1",
38
- "eslint-config-prettier": "8.3.0",
36
+ "ava": "4.2.0",
37
+ "eslint": "8.14.0",
38
+ "eslint-config-prettier": "8.5.0",
39
39
  "eslint-plugin-prettier": "4.0.0",
40
- "prettier": "2.4.1",
40
+ "prettier": "2.6.2",
41
41
  "serve-handler": "6.1.3",
42
42
  "serve": "13.0.2"
43
43
  },
44
44
  "engines": {
45
- "node": ">=10.13.0"
45
+ "node": ">=14.19.1"
46
46
  },
47
47
  "files": [
48
48
  "CHANGELOG.md",