browsertime 16.2.2 → 16.5.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 +17 -0
- package/browserscripts/pageinfo/visualElements.js +16 -0
- package/browsertime/visualmetrics-portable.py +16 -11
- package/lib/support/cli.js +6 -0
- package/lib/video/postprocessing/finetune/getTimingMetrics.js +7 -1
- package/lib/video/postprocessing/visualmetrics/visualMetrics.js +5 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Browsertime changelog (we do [semantic versioning](https://semver.org))
|
|
2
2
|
|
|
3
|
+
## 16.5.0 - 2022-05-11
|
|
4
|
+
### Added
|
|
5
|
+
* Make it possible to configure the max size in pixels for the filmstrip screenshots using `--videoParams.thumbsize` [#1787](https://github.com/sitespeedio/browsertime/pull/1787).
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
* Handle all boundaries when cropping image in portable script, thank you [Gregory Mierzwinski](https://github.com/gmierz) for PR [#1788](https://github.com/sitespeedio/browsertime/pull/1788).
|
|
9
|
+
## 16.4.0 - 2022-05-11
|
|
10
|
+
### Added
|
|
11
|
+
* If we have the Largest Contentful Paint for the video, add that to the video text instead of DOMContentLoaded [#1783](https://github.com/sitespeedio/browsertime/pull/1783).
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
* Only get LCP in Visual Metrics if the LCP API gives us a element [#1786](https://github.com/sitespeedio/browsertime/pull/1786).
|
|
15
|
+
## 16.3.0 - 2022-05-07
|
|
16
|
+
### Added
|
|
17
|
+
* If you use `--visualElements` and the browser supports the Largest Contentful API, we also record
|
|
18
|
+
the LCP from the video. This will help the Chrome team and other browser teams to get it right (see [https://bugs.chromium.org/p/chromium/issues/detail?id=1291502](https://bugs.chromium.org/p/chromium/issues/detail?id=1291502)) [#1782](https://github.com/sitespeedio/browsertime/pull/1782).
|
|
19
|
+
|
|
3
20
|
## 16.2.2 - 2022-05-06
|
|
4
21
|
### Fixed
|
|
5
22
|
* The Docker container uses Ubuntu 20 again (instead of 22) since there's been multiple problems (running on ARM and on some cloud services).
|
|
@@ -125,6 +125,22 @@
|
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
127
|
|
|
128
|
+
// If the browser support largest contentful paint, get that element as well
|
|
129
|
+
const supported = PerformanceObserver.supportedEntryTypes;
|
|
130
|
+
if (supported && supported.indexOf('largest-contentful-paint') > -1) {
|
|
131
|
+
const observer = new PerformanceObserver(list => {});
|
|
132
|
+
observer.observe({ type: 'largest-contentful-paint', buffered: true });
|
|
133
|
+
const entries = observer.takeRecords();
|
|
134
|
+
if (entries.length > 0) {
|
|
135
|
+
const largestEntry = entries[entries.length - 1];
|
|
136
|
+
// It seems that the API do not alwayas have a elememt
|
|
137
|
+
if (largestEntry.element && isElementPartlyInViewportAndVisible(largestEntry.element)) {
|
|
138
|
+
keepLargestElementByType('LargestContentfulPaint', largestEntry.element);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
128
144
|
// We need to follow the standard for VisualMetrics
|
|
129
145
|
return {
|
|
130
146
|
viewport: {
|
|
@@ -105,17 +105,22 @@ def crop_im(img, crop_x, crop_y, crop_x_offset, crop_y_offset, gravity=None):
|
|
|
105
105
|
base_x -= crop_x // 2
|
|
106
106
|
base_y -= crop_y // 2
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
108
|
+
# Handle the boundaries of the crop using max to prevent
|
|
109
|
+
# negatives, and min to prevent going over the othersde of
|
|
110
|
+
# the image
|
|
111
|
+
start_x = min(width - 1, max(base_x + crop_x_offset, 0))
|
|
112
|
+
start_y = min(height - 1, max(base_y + crop_y_offset, 0))
|
|
113
|
+
|
|
114
|
+
end_x = min(width - 1, max(start_x + crop_x, 0))
|
|
115
|
+
end_y = min(height - 1, max(start_y + crop_y, 0))
|
|
116
|
+
|
|
117
|
+
if len(img[start_y:end_y, start_x:end_x, :]) == 0:
|
|
118
|
+
raise Exception(
|
|
119
|
+
f"Cropped image is empty. Image dimensions: {img.shape}, "
|
|
120
|
+
f"Crop Region: {crop_x}, {crop_y}, {crop_x_offset}, {crop_y_offset}"
|
|
121
|
+
)
|
|
115
122
|
|
|
116
|
-
return Image.fromarray(
|
|
117
|
-
img[base_y : base_y + crop_y, base_x : base_x + crop_x, :]
|
|
118
|
-
)
|
|
123
|
+
return Image.fromarray(img[start_y:end_y, start_x:end_x, :])
|
|
119
124
|
except BaseException as e:
|
|
120
125
|
logging.exception(e)
|
|
121
126
|
return None
|
|
@@ -2214,7 +2219,7 @@ def calculate_hero_time(progress, directory, hero, viewport):
|
|
|
2214
2219
|
|
|
2215
2220
|
logging.debug(
|
|
2216
2221
|
'Calculating render time for hero element "%s" at position [%d, %d, %d, %d]'
|
|
2217
|
-
% (hero["name"],
|
|
2222
|
+
% (hero["name"], hero_x, hero_y, hero_width, hero_height)
|
|
2218
2223
|
)
|
|
2219
2224
|
|
|
2220
2225
|
# Apply the mask to the target frame to create the reference frame
|
package/lib/support/cli.js
CHANGED
|
@@ -584,6 +584,12 @@ module.exports.parseCommandLine = function parseCommandLine() {
|
|
|
584
584
|
'Keep the original video. Use it when you have a Visual Metrics bug and want to create an issue at GitHub',
|
|
585
585
|
group: 'video'
|
|
586
586
|
})
|
|
587
|
+
.option('videoParams.thumbsize', {
|
|
588
|
+
default: 400,
|
|
589
|
+
describe:
|
|
590
|
+
'The maximum size of the thumbnail in the filmstrip. Default is 400 pixels in either direction. If videoParams.filmstripFullSize is used that setting overrides this.',
|
|
591
|
+
group: 'video'
|
|
592
|
+
})
|
|
587
593
|
.option('videoParams.filmstripFullSize', {
|
|
588
594
|
type: 'boolean',
|
|
589
595
|
default: false,
|
|
@@ -52,7 +52,13 @@ module.exports = function (videoMetrics, timingMetrics, options) {
|
|
|
52
52
|
value: vm.LastVisualChange
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
|
|
56
|
+
if (vm.LargestContentfulPaint) {
|
|
57
|
+
metricsAndValues.push({
|
|
58
|
+
name: 'LargestContentfulPaint',
|
|
59
|
+
value: vm.LargestContentfulPaint
|
|
60
|
+
});
|
|
61
|
+
} else if (timingMetrics) {
|
|
56
62
|
const pt = timingMetrics;
|
|
57
63
|
metricsAndValues.push({
|
|
58
64
|
name: 'DOMContentLoaded',
|
|
@@ -58,6 +58,8 @@ module.exports = {
|
|
|
58
58
|
false
|
|
59
59
|
);
|
|
60
60
|
|
|
61
|
+
const thumbsize = get(options, 'videoParams.thumbsize', 400);
|
|
62
|
+
|
|
61
63
|
const scriptArgs = [
|
|
62
64
|
'--video',
|
|
63
65
|
videoPath,
|
|
@@ -112,6 +114,9 @@ module.exports = {
|
|
|
112
114
|
scriptArgs.unshift('--dir', imageDirPath);
|
|
113
115
|
if (fullSizeFilmstrip) {
|
|
114
116
|
scriptArgs.push('--full');
|
|
117
|
+
} else if (thumbsize !== 400) {
|
|
118
|
+
scriptArgs.push('--thumbsize');
|
|
119
|
+
scriptArgs.push(thumbsize);
|
|
115
120
|
}
|
|
116
121
|
}
|
|
117
122
|
|