browsertime 15.4.0 → 16.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,16 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
+ ## 16.0.0 - 2022-04-05
4
+ ### Changed
5
+ * 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).
6
+
7
+ ### Added
8
+ * Firefox 99 in the Docker container
9
+ * Edge and Edgedriver 100
10
+
11
+ ### Fixed
12
+ * Automatically save the original video if visual metrics fails [#1755](https://github.com/sitespeedio/browsertime/pull/1755).
13
+
3
14
  ## 15.4.0 - 2022-03-30
4
15
  ### Added
5
16
  * Updated to Chrome and Chromedriver 100 [#1743](https://github.com/sitespeedio/browsertime/pull/1743).
@@ -137,7 +137,7 @@ def resize(img, width, height):
137
137
  def scale(img, maxsize):
138
138
  """Scale an image to the given max size."""
139
139
  width, height = img.size
140
- ratio = min(maxsize / width, maxsize / height)
140
+ ratio = min(float(maxsize) / width, float(maxsize) / height)
141
141
  return resize(img, int(width * ratio), int(height * ratio))
142
142
 
143
143
 
@@ -2286,47 +2286,52 @@ def calculate_hero_time(progress, directory, hero, viewport):
2286
2286
  def check_config():
2287
2287
  ok = True
2288
2288
 
2289
- print("ffmpeg: ")
2289
+
2290
2290
  if get_decimate_filter() is not None:
2291
- print("OK")
2291
+ logging.debug('FFMPEG found')
2292
2292
  else:
2293
- print("FAIL")
2293
+ print("ffmpeg: FAIL")
2294
+ ok = False
2295
+
2296
+
2297
+ if sys.version_info >= (3, 6):
2298
+ logging.debug('Python 3.6+ found')
2299
+ else:
2300
+ print("Python 3.6+: FAIL")
2294
2301
  ok = False
2295
2302
 
2296
- print("Numpy: ")
2297
2303
  try:
2298
2304
  import numpy as np
2299
2305
 
2300
- print("OK")
2306
+ logging.debug('Numpy found')
2301
2307
  except BaseException:
2302
- print("FAIL")
2308
+ print("Numpy: FAIL")
2303
2309
  ok = False
2304
2310
 
2305
- print("OpenCV-Python: ")
2311
+
2306
2312
  try:
2307
2313
  import cv2
2308
-
2309
- print("OK")
2314
+
2315
+ logging.debug('OpenCV-Python found')
2310
2316
  except BaseException:
2311
- print("FAIL")
2317
+ print("OpenCV-Python: FAIL")
2312
2318
  ok = False
2313
2319
 
2314
- print("Pillow: ")
2320
+
2315
2321
  try:
2316
2322
  from PIL import Image, ImageCms, ImageDraw, ImageOps # noqa
2317
2323
 
2318
- print("OK")
2324
+ logging.debug('Pillow found')
2319
2325
  except BaseException:
2320
- print("FAIL")
2326
+ print("Pillow: FAIL")
2321
2327
  ok = False
2322
2328
 
2323
- print("SSIM: ")
2329
+
2324
2330
  try:
2325
2331
  from ssim import compute_ssim # noqa
2326
-
2327
- print("OK")
2332
+ logging.debug('SSIM found')
2328
2333
  except BaseException:
2329
- print("FAIL")
2334
+ print("SSIM: FAIL")
2330
2335
  ok = False
2331
2336
 
2332
2337
  return ok
@@ -2656,6 +2661,13 @@ def main():
2656
2661
  ok = False
2657
2662
  try:
2658
2663
  if not options.check:
2664
+ # Run a quick check to make sure all requirements exist,
2665
+ # otherwise failures might be silent due to how this code is
2666
+ # structured.
2667
+ ok = check_config()
2668
+ if not ok:
2669
+ raise Exception("Please install requirements before running.")
2670
+
2659
2671
  if options.video:
2660
2672
  orange_file = None
2661
2673
  if options.orange:
@@ -3,6 +3,8 @@ Firefox Examples
3
3
 
4
4
  This page shows a few of the options specific to Firefox.
5
5
 
6
- browsertime https://www.sitespeed.io --firefox.binaryPath '/Applications/Firefox.app/Contents/MacOS/firefox-bin'
6
+ ```
7
+ browsertime https://www.sitespeed.io -b firefox --firefox.binaryPath '/Applications/Firefox.app/Contents/MacOS/firefox-bin'
8
+ ```
7
9
 
8
10
  - Path to custom Firefox binary (e.g. Firefox Nightly). On OS X, the path should be to the binary inside the app bundle. (e.g. /Applications/Firefox.app/Contents/MacOS/firefox-bin)
@@ -102,7 +102,7 @@ class Iteration {
102
102
  const engineDelegate = this.engineDelegate;
103
103
 
104
104
  try {
105
- if (!options.disableDNSFlush === true) {
105
+ if (options.flushDNS) {
106
106
  await flushDNS(options);
107
107
  }
108
108
  if (options.connectivity && options.connectivity.variance) {
@@ -1117,6 +1117,12 @@ module.exports.parseCommandLine = function parseCommandLine() {
1117
1117
  describe:
1118
1118
  'Start gnirehtet and reverse tethering the traffic from your Android phone.'
1119
1119
  })
1120
+ .option('flushDNS', {
1121
+ type: 'boolean',
1122
+ default: false,
1123
+ describe:
1124
+ 'Flush DNS between runs, works on Mac OS and Linux. Your user needs sudo rights to be able to flush the DNS.'
1125
+ })
1120
1126
  .option('extension', {
1121
1127
  describe:
1122
1128
  'Path to a WebExtension to be installed in the browser. Note that --extension can be passed multiple times.'
@@ -14,7 +14,7 @@ module.exports = async function (options) {
14
14
  }
15
15
 
16
16
  if (process.platform === 'darwin') {
17
- log.debug('Flush DNS cache on MacOS');
17
+ log.info('Flush DNS cache on MacOS');
18
18
  await execa('sudo', ['killall', '-HUP', 'mDNSResponder'], {
19
19
  reject: false
20
20
  });
@@ -25,7 +25,7 @@ module.exports = async function (options) {
25
25
  reject: false
26
26
  });
27
27
  } else if (process.platform === 'linux') {
28
- log.debug('Flush DNS cache on Linux');
28
+ log.info('Flush DNS cache on Linux');
29
29
  await execa('sudo', ['systemd-resolve', '--flush-caches'], {
30
30
  reject: false
31
31
  });
@@ -6,6 +6,7 @@ const readdir = promisify(fs.readdir);
6
6
  const lstat = promisify(fs.lstat);
7
7
  const unlink = promisify(fs.unlink);
8
8
  const rmdir = promisify(fs.rmdir);
9
+ const copyFile = promisify(fs.copyFile);
9
10
  const rename = promisify(fs.rename);
10
11
  const readFile = promisify(fs.readFile);
11
12
  const filters = require('./filters');
@@ -15,6 +16,9 @@ module.exports = {
15
16
  async rename(old, newName) {
16
17
  return rename(old, newName);
17
18
  },
19
+ async copyFile(source, destination) {
20
+ return copyFile(source, destination);
21
+ },
18
22
  async removeFile(fileName) {
19
23
  return unlink(fileName);
20
24
  },
@@ -4,7 +4,7 @@ const execa = require('execa');
4
4
  const log = require('intel').getLogger('browsertime.video');
5
5
  const get = require('lodash.get');
6
6
  const path = require('path');
7
- const { readFile, removeFile } = require('../../../support/fileUtil');
7
+ const { readFile, removeFile, copyFile } = require('../../../support/fileUtil');
8
8
 
9
9
  const SCRIPT_PATH = path.join(
10
10
  __dirname,
@@ -149,6 +149,7 @@ module.exports = {
149
149
  return JSON.parse(result.stdout);
150
150
  } catch (e) {
151
151
  log.error('VisualMetrics failed to run', e);
152
+ await copyFile(videoPath, videoPath + '.failed.mp4');
152
153
  // If something goes wrong, dump the visual metrics log to our log
153
154
  const visualMetricLog = await readFile(visualMetricsLogFile);
154
155
  log.error('Log from VisualMetrics: %s', visualMetricLog);
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "description": "Browsertime",
3
- "version": "15.4.0",
3
+ "version": "16.0.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
8
  "@sitespeed.io/chromedriver": "100.0.4896-20",
9
- "@sitespeed.io/edgedriver": "99.0.1150-25",
9
+ "@sitespeed.io/edgedriver": "100.0.1185-29",
10
10
  "@sitespeed.io/geckodriver": "0.30.0",
11
11
  "@sitespeed.io/throttle": "3.0.0",
12
12
  "@sitespeed.io/tracium": "0.3.3",