browsertime 14.10.2 → 14.12.2

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,24 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
+ ## 14.12.2 - 2021-12-09
4
+ ### Fixed
5
+ * Added more info log to get a better feeling for what's going on [#1686](https://github.com/sitespeedio/browsertime/pull/1686).
6
+ * Fixed CPU throttling that was broken in Chrome 96 [#1685](https://github.com/sitespeedio/browsertime/pull/1685)
7
+ ## 14.12.1 - 2021-12-01
8
+ ### Fixed
9
+ * Changed log level to debug for Chrome/Edge when document request fails. It turns out that IRL that happens a lot and spam the log. Lets iterate over that functionality.
10
+ ## 14.12.0 - 2021-11-30
11
+ ### Fixed
12
+ * Adding error log message for Chrome/Edge when document request fails (faulty domain etc) [#1682](https://github.com/sitespeedio/browsertime/pull/1682).
13
+ * Added `'devtools.netmonitor.persistlog': true` preference for Firefox to fix the HAR issue introduced in Firefox 94 [#1684](https://github.com/sitespeedio/browsertime/pull/1684).
14
+
15
+ ### Added
16
+ * Updated to Firefox 94 in the Docker image.
17
+ ## 14.11.0 - 2021-11-23
18
+ ### Fixed
19
+ * Use the viewport to determine if more cropping is needed in visual metrics. Thank you [Gregory Mierzwinski](https://github.com/gmierz) for PR [#1680](https://github.com/sitespeedio/browsertime/pull/1680).
20
+ ### Added
21
+ * Updated to Selenium 4.1.0 [#1679](https://github.com/sitespeedio/browsertime/pull/1679)
3
22
 
4
23
  ## 14.10.2 - 2021-11-20
5
24
  ### Fixed
@@ -95,7 +95,7 @@ def video_to_frames(
95
95
  os.mkdir(directory, 0o755)
96
96
  if os.path.isdir(directory):
97
97
  directory = os.path.realpath(directory)
98
- viewport = find_video_viewport(
98
+ viewport, cropped = find_video_viewport(
99
99
  video,
100
100
  directory,
101
101
  find_viewport,
@@ -122,12 +122,12 @@ def video_to_frames(
122
122
  remove_orange_frames(dir, orange_file)
123
123
  find_first_frame(dir, white_file)
124
124
  blank_first_frame(dir)
125
- find_render_start(dir, orange_file, gray_file)
125
+ find_render_start(dir, orange_file, gray_file, cropped)
126
126
  find_last_frame(dir, white_file)
127
127
  adjust_frame_times(dir)
128
128
  if timeline_file is not None and not multiple:
129
129
  synchronize_to_timeline(dir, timeline_file)
130
- eliminate_duplicate_frames(dir)
130
+ eliminate_duplicate_frames(dir, cropped)
131
131
  eliminate_similar_frames(dir)
132
132
  # See if we are limiting the number of frames to keep
133
133
  # (before processing them to save processing time)
@@ -374,6 +374,11 @@ def find_video_viewport(
374
374
  ):
375
375
  logging.debug("Finding Video Viewport...")
376
376
  viewport = None
377
+
378
+ # cropped will be True if the viewport setting changes
379
+ # the original frame
380
+ cropped = False
381
+
377
382
  try:
378
383
  from PIL import Image
379
384
 
@@ -461,12 +466,21 @@ def find_video_viewport(
461
466
  viewport = find_image_viewport(frame)
462
467
  else:
463
468
  viewport = {"x": 0, "y": 0, "width": width, "height": height}
469
+
464
470
  os.remove(frame)
465
471
 
472
+ if viewport is not None and viewport != {
473
+ "x": 0,
474
+ "y": 0,
475
+ "width": width,
476
+ "height": height,
477
+ }:
478
+ cropped = True
479
+
466
480
  except Exception as e:
467
481
  viewport = None
468
482
 
469
- return viewport
483
+ return viewport, cropped
470
484
 
471
485
 
472
486
  def trim_video_end(directory, trim_time):
@@ -615,7 +629,7 @@ def find_last_frame(directory, white_file):
615
629
  logging.exception("Error finding last frame")
616
630
 
617
631
 
618
- def find_render_start(directory, orange_file, gray_file):
632
+ def find_render_start(directory, orange_file, gray_file, cropped):
619
633
  logging.debug("Finding Render Start...")
620
634
  try:
621
635
  if (
@@ -641,6 +655,10 @@ def find_render_start(directory, orange_file, gray_file):
641
655
  mask["y"] = int(math.floor(height / 2 - mask["height"] / 2))
642
656
  else:
643
657
  mask = None
658
+
659
+ im_width = width
660
+ im_height = height
661
+
644
662
  top = 10
645
663
  right_margin = 10
646
664
  bottom_margin = 24
@@ -660,6 +678,14 @@ def find_render_start(directory, orange_file, gray_file):
660
678
  width = max(client_viewport["width"] - right_margin, 1)
661
679
  left += client_viewport["x"]
662
680
  top += client_viewport["y"]
681
+ elif cropped:
682
+ # The image was already cropped, so only cutout the bottom
683
+ # to get rid of the network request/etc. information
684
+ top = 0
685
+ left = 0
686
+ width = im_width
687
+ height = im_height - bottom_margin
688
+
663
689
  crop = "{0:d}x{1:d}+{2:d}+{3:d}".format(width, height, left, top)
664
690
  for i in range(1, count):
665
691
  if frames_match(first, files[i], 10, 0, crop, mask):
@@ -679,7 +705,7 @@ def find_render_start(directory, orange_file, gray_file):
679
705
  logging.exception("Error getting render start")
680
706
 
681
707
 
682
- def eliminate_duplicate_frames(directory):
708
+ def eliminate_duplicate_frames(directory, cropped):
683
709
  logging.debug("Eliminating Duplicate Frames...")
684
710
  global client_viewport
685
711
  try:
@@ -697,6 +723,9 @@ def eliminate_duplicate_frames(directory):
697
723
  ):
698
724
  client_viewport = None
699
725
 
726
+ im_width = width
727
+ im_height = height
728
+
700
729
  # Figure out the region of the image that we care about
701
730
  top = 40
702
731
  right_margin = 10
@@ -714,6 +743,13 @@ def eliminate_duplicate_frames(directory):
714
743
  width = max(client_viewport["width"] - right_margin, 1)
715
744
  left += client_viewport["x"]
716
745
  top += client_viewport["y"]
746
+ elif cropped:
747
+ # The image was already cropped, so only cutout the bottom
748
+ # to get rid of the network request/etc. information
749
+ top = 0
750
+ left = 0
751
+ width = im_width
752
+ height = im_height - bottom_margin
717
753
 
718
754
  crop = "{0:d}x{1:d}+{2:d}+{3:d}".format(width, height, left, top)
719
755
  logging.debug("Viewport cropping set to " + crop)
@@ -161,6 +161,14 @@ class ChromeDevtoolsProtocol {
161
161
  return this.cdpClient.Network.clearBrowserCookies();
162
162
  }
163
163
 
164
+ async loadingFailed() {
165
+ return this.cdpClient.Network.loadingFailed(param => {
166
+ if (param.type === 'Document') {
167
+ log.debug('Could not load document:' + param.errorText);
168
+ }
169
+ });
170
+ }
171
+
164
172
  async setRequestHeaders(requestHeaders) {
165
173
  // Our cli don't validate parameters
166
174
  // so -run will become -r etc
@@ -23,5 +23,7 @@ module.exports = [
23
23
  '--override-https-image-compression-infobar',
24
24
  '--disable-fetching-hints-at-navigation-start',
25
25
  '--disable-dev-shm-usage',
26
+ '--disable-back-forward-cache',
27
+ '--disable-site-isolation-trials',
26
28
  '--remote-debugging-port=9222'
27
29
  ];
@@ -107,6 +107,8 @@ class Chromium {
107
107
 
108
108
  await this.cdpClient.setupLongTask();
109
109
 
110
+ await this.cdpClient.loadingFailed();
111
+
110
112
  // Make sure we clear the console log
111
113
  // Hopefully one time is enough?
112
114
  return runner.getLogs(Type.BROWSER);
@@ -379,6 +379,7 @@ class Measure {
379
379
  }
380
380
 
381
381
  if (this.options.screenshot) {
382
+ log.info('Take after page complete check screenshot');
382
383
  try {
383
384
  const screenshot = await this.browser.takeScreenshot(url);
384
385
  await this.screenshotManager.save(
@@ -403,6 +404,7 @@ class Measure {
403
404
  );
404
405
 
405
406
  if (this.options.screenshotLS && supportLS) {
407
+ log.info('Take cumulative layout shift screenshot');
406
408
  await this.browser.runScript(highlightLS, 'HIGHLIGHT_LS', {
407
409
  color: this.options.screenshotLSColor || 'red',
408
410
  limit: this.options.screenshotLSLimit || 0.01
@@ -432,6 +434,7 @@ class Measure {
432
434
  );
433
435
 
434
436
  if (this.options.screenshotLCP && supportLCP) {
437
+ log.info('Take largest contentful paint screenshot');
435
438
  try {
436
439
  const lcpScriptClean = `
437
440
  const c = document.getElementById("browsertime-lcp");
@@ -179,5 +179,8 @@ module.exports = {
179
179
 
180
180
  // disable calls to detectportal.firefox.com
181
181
  'network.captive-portal-service.enabled': false,
182
- 'network.connectivity-service.enabled': false
182
+ 'network.connectivity-service.enabled': false,
183
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1740116#c15
184
+ // https://github.com/sitespeedio/browsertime/issues/1671
185
+ 'devtools.netmonitor.persistlog': true
183
186
  };
@@ -106,7 +106,7 @@ module.exports = {
106
106
  scriptArgs.unshift(SCRIPT_PATH);
107
107
 
108
108
  log.debug('Running visualmetrics.py ' + scriptArgs.join(' '));
109
-
109
+ log.info('Get visual metrics from the video');
110
110
  try {
111
111
  const result = await execa(process.env.PYTHON || 'python', scriptArgs);
112
112
  log.debug('visualmetrics.py output:' + result.stdout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "description": "Browsertime",
3
- "version": "14.10.2",
3
+ "version": "14.12.2",
4
4
  "bin": "./bin/browsertime.js",
5
5
  "dependencies": {
6
6
  "@sitespeed.io/throttle": "3.0.0",
@@ -22,7 +22,7 @@
22
22
  "lodash.merge": "4.6.2",
23
23
  "lodash.pick": "4.4.0",
24
24
  "lodash.set": "4.3.2",
25
- "selenium-webdriver": "4.0.0",
25
+ "selenium-webdriver": "4.1.0",
26
26
  "@sitespeed.io/edgedriver": "95.0.1020-30",
27
27
  "@sitespeed.io/geckodriver": "0.29.1-2",
28
28
  "@sitespeed.io/tracium": "0.3.3",