browsertime 22.3.0 → 22.4.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,5 +1,13 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
+ ## 22.3.1 - 2024-06-07
4
+ ### Fixed
5
+ * Make sure the engine is stopped before the extra video/profile run [#2140](https://github.com/sitespeedio/browsertime/pull/2140).
6
+
7
+ ## 22.3.0 - 2024-06-06
8
+ ### Added
9
+ * Use `--enableVideoRun` to get one extra run with a video and visual metrics [#2139](https://github.com/sitespeedio/browsertime/pull/2139)
10
+
3
11
  ## 22.3.0 - 2024-06-04
4
12
  ### Added
5
13
  * Add the ability to gather power usage measurements on Android from USB power meters, thank you [Gregory Mierzwinski](https://github.com/gmierz) for PR [#2134](https://github.com/sitespeedio/browsertime/pull/2134).
@@ -123,27 +123,6 @@ async function run(urls, options) {
123
123
  );
124
124
  }
125
125
 
126
- if (options.enableProfileRun) {
127
- log.info('Make one extra run to collect trace information');
128
- options.iterations = 1;
129
- if (options.browser === 'firefox') {
130
- options.firefox.geckoProfiler = true;
131
- } else if (options.browser === 'chrome') {
132
- options.chrome.timeline = true;
133
- options.cpu = true;
134
- options.chrome.enableTraceScreenshots = true;
135
- options.chrome.traceCategory = [
136
- 'disabled-by-default-v8.cpu_profiler'
137
- ];
138
- }
139
- options.video = false;
140
- options.visualMetrics = false;
141
- const traceEngine = new Engine(options);
142
- await traceEngine.start();
143
- await traceEngine.runMultiple(urls, scriptsByCategory);
144
- await traceEngine.stop();
145
- }
146
-
147
126
  await Promise.all(saveOperations);
148
127
 
149
128
  const resultDirectory = relative(process.cwd(), storageManager.directory);
@@ -173,6 +152,41 @@ async function run(urls, options) {
173
152
  process.exitCode = 1;
174
153
  }
175
154
  }
155
+
156
+ if (options.enableProfileRun || options.enableVideoRun) {
157
+ log.info('Make one extra run to collect trace/video information');
158
+ options.iterations = 1;
159
+ if (options.enableProfileRun) {
160
+ if (options.browser === 'firefox') {
161
+ options.firefox.geckoProfiler = true;
162
+ } else if (options.browser === 'chrome') {
163
+ options.chrome.timeline = true;
164
+ options.cpu = true;
165
+ options.chrome.enableTraceScreenshots = true;
166
+ options.chrome.traceCategory = [
167
+ 'disabled-by-default-v8.cpu_profiler'
168
+ ];
169
+ }
170
+ }
171
+ if (options.enableVideoRun) {
172
+ if (options.video === true) {
173
+ log.error(
174
+ 'You can only configure video run if you do not collect any video'
175
+ );
176
+ // This is a hack to not get an error
177
+ options.video = false;
178
+ options.visualMetrics = false;
179
+ } else {
180
+ options.video = true;
181
+ options.visualMetrics = true;
182
+ }
183
+ }
184
+ const traceEngine = new Engine(options);
185
+ await traceEngine.start();
186
+ await traceEngine.runMultiple(urls, scriptsByCategory);
187
+ await traceEngine.stop();
188
+ log.info('Extra run finished');
189
+ }
176
190
  } catch (error) {
177
191
  log.error('Error running browsertime', error);
178
192
  process.exitCode = 1;
@@ -614,6 +614,11 @@ export function parseCommandLine() {
614
614
  describe:
615
615
  'Make one extra run that collects the profiling trace log (no other metrics is collected). For Chrome it will collect the timeline trace, for Firefox it will get the Geckoprofiler trace. This means you do not need to get the trace for all runs and can skip the overhead it produces.'
616
616
  })
617
+ .option('enableVideoRun', {
618
+ type: 'boolean',
619
+ describe:
620
+ 'Make one extra run that collects video and visual metrics. This means you can do your runs with --visualMetrics true --video false --enableVideoRun true to collect visual metrics from all runs and save a video from the profile/video run. If you run it together with --enableProfileRun it will also collect profiling trace.'
621
+ })
617
622
  .option('video', {
618
623
  type: 'boolean',
619
624
  describe:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "browsertime",
3
3
  "description": "Get performance metrics from your web page using Browsertime.",
4
- "version": "22.3.0",
4
+ "version": "22.4.1",
5
5
  "bin": "./bin/browsertime.js",
6
6
  "type": "module",
7
7
  "types": "./types/scripting.d.ts",