browsertime 14.10.1 → 14.12.1

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,8 +1,29 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
+ ## 14.12.1 - 2021-12-01
4
+ ### Fixed
5
+ * 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.
6
+ ## 14.12.0 - 2021-11-30
7
+ ### Fixed
8
+ * Adding error log message for Chrome/Edge when document request fails (faulty domain etc) [#1682](https://github.com/sitespeedio/browsertime/pull/1682).
9
+ * 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).
10
+
11
+ ### Added
12
+ * Updated to Firefox 94 in the Docker image.
13
+ ## 14.11.0 - 2021-11-23
14
+ ### Fixed
15
+ * 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).
16
+ ### Added
17
+ * Updated to Selenium 4.1.0 [#1679](https://github.com/sitespeedio/browsertime/pull/1679)
18
+
19
+ ## 14.10.2 - 2021-11-20
20
+ ### Fixed
21
+ * Disabled the version check for Edge/Edgedriver in Edgedriver [#1678](https://github.com/sitespeedio/browsertime/pull/1678).
22
+
3
23
  ## 14.10.1 - 2021-11-19
4
24
  ### Fixed
5
25
  * Disabled the automatic Chrome/Chromedriver version check in Chromedriver [#1676](https://github.com/sitespeedio/browsertime/pull/1676).
26
+ * Loop until we find a frame with a good viewport or until we run out of retries for Visual Metrics. Thank you [Gregory Mierzwinski](https://github.com/gmierz) for PR [#1668](https://github.com/sitespeedio/browsertime/pull/1668).
6
27
 
7
28
  ## 14.10.0 - 2021-11-16
8
29
  ### Added
@@ -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
@@ -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);
@@ -25,6 +25,10 @@ module.exports.configureBuilder = function (builder, baseDir, options) {
25
25
  }
26
26
 
27
27
  const serviceBuilder = new edge.ServiceBuilder(edgedriverPath);
28
+
29
+ // Remove the check that matches the Edgedriver version with Edge version.
30
+ serviceBuilder.addArguments('--disable-build-check');
31
+
28
32
  if (
29
33
  options.verbose >= 2 ||
30
34
  chromeConfig.enableChromeDriverLog ||
@@ -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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "description": "Browsertime",
3
- "version": "14.10.1",
3
+ "version": "14.12.1",
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",