browsertime 19.3.1 → 20.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,18 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
+ ## 20.0.0 - 2023-12-22
4
+
5
+ ### Breaking
6
+ * Changed `--userTimingWhitelist` to `--userTimingAllowList` in [#2023](https://github.com/sitespeedio/browsertime/pull/2023).
7
+ * Reading pageCompleteCheck JavaScript from file now works as intended. It should be a plain JavaScript file named .js [#2034](https://github.com/sitespeedio/browsertime/pull/2034) see [#912](https://github.com/sitespeedio/browsertime/issues/912)
8
+
9
+ ### Fixed
10
+ * Group page load parameters as PageLoad to make them easier to find using `--help` [#2035](https://github.com/sitespeedio/browsertime/pull/2035).
11
+ * Fix starting Firefox 121 on Mac [#2043](https://github.com/sitespeedio/browsertime/pull/2043).
12
+
13
+ ### Added
14
+ * Firefox 121 in the Docker container.g
15
+
3
16
  ## 19.3.1 - 2023-12-18
4
17
  ### Fixed
5
18
  * Ensure that visual metrics python script is included in the release.
package/README.md CHANGED
@@ -168,13 +168,14 @@ To get the HAR from Firefox we use the [HAR Export Trigger](https://github.com/f
168
168
 
169
169
  We welcome contributions from the community! Whether you're fixing a bug, adding a feature, or improving documentation, your help is valuable. Here’s how you can contribute:
170
170
 
171
- 1. **Fork and Clone**: Fork the repository and clone it locally.
172
- 2. **Create a Branch**: Create a new branch for your feature or bug fix.
173
- 3. **Develop**: Make your changes. Ensure you adhere to the coding standards and write tests if applicable.
174
- 4. **Test**: Run tests to ensure everything works as expected.
175
- 5. **Submit a Pull Request**: Push your changes to your fork and submit a pull request to the main repository.
176
-
177
- Before contributing, please read our [CONTRIBUTING.md](CONTRIBUTING.md) for more detailed information on how to contribute.
171
+ 1. **Create an Issue**: Create an issue and discuss with us how to implement the issue.
172
+ 2. **Fork and Clone**: Fork the repository and clone it locally.
173
+ 3. **Create a Branch**: Create a new branch for your feature or bug fix.
174
+ 4. **Develop**: Make your changes. Ensure you adhere to the coding standards and write tests if applicable.
175
+ 5. **Test**: Run tests to ensure everything works as expected.
176
+ 6. **Submit a Pull Request**: Push your changes to your fork and submit a pull request to the main repository.
177
+
178
+ Before contributing, please read our [CONTRIBUTING.md](.github/CONTRIBUTING.md) for more detailed information on how to contribute.
178
179
 
179
180
  ### Reporting Issues
180
181
  Found a bug or have a feature request? Please use the [GitHub Issues](https://github.com/sitespeedio/browsertime/issues) to report them. Be sure to check existing issues to avoid duplicates.
@@ -6,7 +6,7 @@ import { timestamp as _timestamp } from '../../../support/engineUtils.js';
6
6
  import { Video } from '../../../video/video.js';
7
7
  import { pathToFolder } from '../../../support/pathToFolder.js';
8
8
  import { setOrangeBackground } from '../../../video/screenRecording/setOrangeBackground.js';
9
- import { filterWhitelisted } from '../../../support/userTiming.js';
9
+ import { filterAllowlisted } from '../../../support/userTiming.js';
10
10
  import { isAndroidConfigured, Android } from '../../../android/index.js';
11
11
  import { TCPDump } from '../../../support/tcpdump.js';
12
12
  import { lcpHighlightScript as highlightLargestContentfulPaint } from './util/lcpHighlightScript.js';
@@ -487,11 +487,11 @@ export class Measure {
487
487
 
488
488
  // Some sites has crazy amount of user timings:
489
489
  // strip them if you want
490
- if (this.options.userTimingWhitelist) {
491
- filterWhitelisted(
490
+ if (this.options.userTimingAllowList) {
491
+ filterAllowlisted(
492
492
  this.result[this.numberOfMeasuredPages].browserScripts.timings
493
493
  .userTimings,
494
- this.options.userTimingWhitelist
494
+ this.options.userTimingAllowList
495
495
  );
496
496
  }
497
497
 
@@ -26,7 +26,11 @@ import { Android, isAndroidConfigured } from '../../android/index.js';
26
26
  import { RootedDevice } from '../../android/root.js';
27
27
  import { run } from './run.js';
28
28
  import { IOSRecorder } from '../../video/screenRecording/ios/iosRecorder.js';
29
- import { loadPrePostScripts, loadScript } from '../../support/engineUtils.js';
29
+ import {
30
+ loadPrePostScripts,
31
+ loadScript,
32
+ loadPageCompleteScript
33
+ } from '../../support/engineUtils.js';
30
34
  const log = intel.getLogger('browsertime');
31
35
  const defaults = {
32
36
  scripts: [],
@@ -260,7 +264,7 @@ export class Engine {
260
264
  postScripts = await loadPrePostScripts(options.postScript, options);
261
265
  postURLScripts = await loadPrePostScripts(options.postURLScript, options);
262
266
  pageCompleteCheck = options.pageCompleteCheck
263
- ? await loadScript(options.pageCompleteCheck, options)
267
+ ? await loadPageCompleteScript(options.pageCompleteCheck)
264
268
  : undefined;
265
269
  } catch (error) {
266
270
  log.error(error.message);
@@ -1,6 +1,7 @@
1
1
  import { resolve } from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
3
  import path from 'node:path';
4
+ import { platform } from 'node:os';
4
5
  import {
5
6
  ServiceBuilder,
6
7
  Options,
@@ -168,9 +169,36 @@ export async function configureBuilder(builder, baseDir, options) {
168
169
  // https://bugzilla.mozilla.org/show_bug.cgi?id=1751196
169
170
 
170
171
  if (!isAndroidConfigured(options)) {
171
- ffOptions.setBinary(
172
- firefoxTypes.length > 0 ? firefoxTypes[0] : Channel.RELEASE
173
- );
172
+ // Fix for https://github.com/sitespeedio/browsertime/issues/2041
173
+ if (platform() === 'darwin') {
174
+ if (
175
+ !firefoxConfig.binaryPath &&
176
+ !firefoxConfig.nightly &&
177
+ !firefoxConfig.beta &&
178
+ !firefoxConfig.developer
179
+ ) {
180
+ ffOptions.setBinary('/Applications/Firefox.app/Contents/MacOS/firefox');
181
+ } else if (firefoxConfig.nightly) {
182
+ ffOptions.setBinary(
183
+ '/Applications/Firefox Nightly.app/Contents/MacOS/firefox'
184
+ );
185
+ } else if (firefoxConfig.beta) {
186
+ ffOptions.setBinary(
187
+ '/Applications/Firefox Nightly.app/Contents/MacOS/firefox'
188
+ );
189
+ } else if (firefoxConfig.developer) {
190
+ ffOptions.setBinary(
191
+ '/Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox'
192
+ );
193
+ } else if (firefoxConfig.binaryPath) {
194
+ ffOptions.setBinary(firefoxConfig.binaryPath);
195
+ }
196
+ } else {
197
+ // See https://github.com/sitespeedio/browsertime/issues/2041
198
+ ffOptions.setBinary(
199
+ firefoxTypes.length > 0 ? firefoxTypes[0] : Channel.RELEASE
200
+ );
201
+ }
174
202
  }
175
203
 
176
204
  ffOptions.addArguments('-no-remote');
@@ -905,43 +905,50 @@ export function parseCommandLine() {
905
905
  })
906
906
  .option('pageCompleteCheck', {
907
907
  describe:
908
- 'Supply a JavaScript (inline or JavaScript file) that decides when the browser is finished loading the page and can start to collect metrics. The JavaScript snippet is repeatedly queried to see if page has completed loading (indicated by the script returning true). Use it to fetch timings happening after the loadEventEnd. By default the tests ends 2 seconds after loadEventEnd. Also checkout --pageCompleteCheckInactivity and --pageCompleteCheckPollTimeout'
908
+ 'Supply a JavaScript (inline or JavaScript file) that decides when the browser is finished loading the page and can start to collect metrics. The JavaScript snippet is repeatedly queried to see if page has completed loading (indicated by the script returning true). Use it to fetch timings happening after the loadEventEnd. By default the tests ends 2 seconds after loadEventEnd. Also checkout --pageCompleteCheckInactivity and --pageCompleteCheckPollTimeout',
909
+ group: 'PageLoad'
909
910
  })
910
911
  .option('pageCompleteWaitTime', {
911
912
  describe:
912
913
  'How long time you want to wait for your pageComplteteCheck to finish, after it is signaled to closed. Extra parameter passed on to your pageCompleteCheck.',
913
- default: 8000
914
+ default: 8000,
915
+ group: 'PageLoad'
914
916
  })
915
917
  .option('pageCompleteCheckInactivity', {
916
918
  describe:
917
919
  'Alternative way to choose when to end your test. This will wait for 2 seconds of inactivity that happens after loadEventEnd.',
918
920
  type: 'boolean',
919
- default: false
921
+ default: false,
922
+ group: 'PageLoad'
920
923
  })
921
924
  .option('pageCompleteCheckNetworkIdle', {
922
925
  describe:
923
926
  'Alternative way to choose when to end your test that works in Chrome and Firefox. Uses CDP or WebDriver Bidi to look at network traffic instead of running JavaScript in the browser to know when to end the test. By default this will wait 5 seconds of inactivity in the network log (no requets/responses in 5 seconds). Use --timeouts.networkIdle to change the 5 seconds. The test will end after 2 minutes if there is still activity on the network. You can change that timout using --timeouts.pageCompleteCheck ',
924
927
  type: 'boolean',
925
- default: false
928
+ default: false,
929
+ group: 'PageLoad'
926
930
  })
927
931
  .option('pageCompleteCheckPollTimeout', {
928
932
  type: 'number',
929
933
  default: 1500,
930
934
  describe:
931
- 'The time in ms to wait for running the page complete check the next time.'
935
+ 'The time in ms to wait for running the page complete check the next time.',
936
+ group: 'PageLoad'
932
937
  })
933
938
  .option('pageCompleteCheckStartWait', {
934
939
  type: 'number',
935
940
  default: 5000,
936
941
  describe:
937
- 'The time in ms to wait for running the page complete check for the first time. Use this when you have a pageLoadStrategy set to none'
942
+ 'The time in ms to wait for running the page complete check for the first time. Use this when you have a pageLoadStrategy set to none',
943
+ group: 'PageLoad'
938
944
  })
939
945
  .option('pageLoadStrategy', {
940
946
  type: 'string',
941
947
  default: 'none',
942
948
  choices: ['eager', 'none', 'normal'],
943
949
  describe:
944
- 'Set the strategy to waiting for document readiness after a navigation event. After the strategy is ready, your pageCompleteCheck will start runninhg.'
950
+ 'Set the strategy to waiting for document readiness after a navigation event. After the strategy is ready, your pageCompleteCheck will start running.',
951
+ group: 'PageLoad'
945
952
  })
946
953
  .option('iterations', {
947
954
  alias: 'n',
@@ -965,13 +972,15 @@ export function parseCommandLine() {
965
972
  type: 'number',
966
973
  default: 0,
967
974
  describe:
968
- 'Extra time added for the browser to settle before starting to test a URL. This delay happens after the browser was opened and before the navigation to the URL'
975
+ 'Extra time added for the browser to settle before starting to test a URL. This delay happens after the browser was opened and before the navigation to the URL',
976
+ group: 'PageLoad'
969
977
  })
970
978
  .option('webdriverPageload', {
971
979
  type: 'boolean',
972
980
  describe:
973
981
  'Use webdriver.get to initialize the page load instead of window.location.',
974
- default: false
982
+ default: false,
983
+ group: 'PageLoad'
975
984
  })
976
985
  .option('proxy.pac', {
977
986
  type: 'string',
@@ -1106,7 +1115,8 @@ export function parseCommandLine() {
1106
1115
  describe:
1107
1116
  'Use internal browser functionality to clear browser cache between runs instead of only using Selenium.',
1108
1117
  type: 'boolean',
1109
- default: false
1118
+ default: false,
1119
+ group: 'PageLoad'
1110
1120
  })
1111
1121
  .option('basicAuth', {
1112
1122
  describe:
@@ -1211,9 +1221,9 @@ export function parseCommandLine() {
1211
1221
  type: 'integer',
1212
1222
  default: 1500
1213
1223
  })
1214
- .option('userTimingWhitelist', {
1224
+ .option('userTimingAllowList', {
1215
1225
  describe:
1216
- 'All userTimings are captured by default this option takes a regex that will whitelist which userTimings to capture in the results.'
1226
+ 'All userTimings are captured by default this option takes a regex that will allow which userTimings to capture in the results.'
1217
1227
  })
1218
1228
  .option('headless', {
1219
1229
  type: 'boolean',
@@ -1233,7 +1243,8 @@ export function parseCommandLine() {
1233
1243
  type: 'boolean',
1234
1244
  default: false,
1235
1245
  describe:
1236
- 'Flush DNS between runs, works on Mac OS and Linux. Your user needs sudo rights to be able to flush the DNS.'
1246
+ 'Flush DNS between runs, works on Mac OS and Linux. Your user needs sudo rights to be able to flush the DNS.',
1247
+ group: 'PageLoad'
1237
1248
  })
1238
1249
  .option('extension', {
1239
1250
  describe:
@@ -1243,7 +1254,8 @@ export function parseCommandLine() {
1243
1254
  describe:
1244
1255
  'Convenient parameter to use if you test a SPA application: will automatically wait for X seconds after last network activity and use hash in file names. Read more: https://www.sitespeed.io/documentation/sitespeed.io/spa/',
1245
1256
  type: 'boolean',
1246
- default: false
1257
+ default: false,
1258
+ group: 'PageLoad'
1247
1259
  })
1248
1260
  .option('cjs', {
1249
1261
  describe:
@@ -1255,7 +1267,8 @@ export function parseCommandLine() {
1255
1267
  type: 'number',
1256
1268
  default: 3,
1257
1269
  describe:
1258
- 'If the browser fails to start, you can retry to start it this amount of times.'
1270
+ 'If the browser fails to start, you can retry to start it this amount of times.',
1271
+ group: 'PageLoad'
1259
1272
  })
1260
1273
  .option('preWarmServer', {
1261
1274
  type: 'boolean',
@@ -1,12 +1,17 @@
1
1
  import { resolve, dirname, join } from 'node:path';
2
2
  import { promisify } from 'node:util';
3
- import { writeFile as _writeFile, unlink as _unlink } from 'node:fs';
3
+ import {
4
+ writeFile as _writeFile,
5
+ unlink as _unlink,
6
+ readFile as _readFile
7
+ } from 'node:fs';
4
8
  import { pathToFileURL } from 'node:url';
5
9
  import dayjs from 'dayjs';
6
10
  import intel from 'intel';
7
11
  import { toArray } from '../support/util.js';
8
12
  const log = intel.getLogger('browsertime');
9
13
  const writeFile = promisify(_writeFile);
14
+ const readFile = promisify(_readFile);
10
15
  const unlink = promisify(_unlink);
11
16
 
12
17
  const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
@@ -82,6 +87,13 @@ export async function loadPrePostScripts(scripts, options) {
82
87
  return readScripts;
83
88
  }
84
89
 
90
+ export async function loadPageCompleteScript(script) {
91
+ if (script && script.endsWith('js')) {
92
+ return readFile(resolve(script), 'utf8');
93
+ }
94
+ return script;
95
+ }
96
+
85
97
  export async function loadScript(script, options, throwError) {
86
98
  if (script) {
87
99
  return loadFile(script, options, throwError);
@@ -1,5 +1,5 @@
1
- export function filterWhitelisted(userTimings, whitelistRegex) {
2
- const allowed = new RegExp(whitelistRegex);
1
+ export function filterAllowlisted(userTimings, allowlistRegex) {
2
+ const allowed = new RegExp(allowlistRegex);
3
3
  userTimings.marks = userTimings.marks.filter(mark => allowed.test(mark.name));
4
4
  userTimings.measures = userTimings.measures.filter(measure =>
5
5
  allowed.test(measure.name)
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": "19.3.1",
4
+ "version": "20.0.0",
5
5
  "bin": "./bin/browsertime.js",
6
6
  "type": "module",
7
7
  "dependencies": {
@@ -58,7 +58,6 @@
58
58
  "browsersupport",
59
59
  "visualmetrics",
60
60
  "browsertime.png",
61
- "docs",
62
61
  "index.js",
63
62
  "lib",
64
63
  "package.json",
package/CONTRIBUTING.md DELETED
@@ -1,24 +0,0 @@
1
- # How to contribute
2
- Browser Time (it's browser time!) needs help from the users so please contribute!
3
-
4
- ## Making changes
5
- If you want help out, that's great! Check the issue list and see if there's something there you want to do and drop Peter a note so we know and we can help you get into the project.
6
- - Create a new branch for your change
7
- - Make commits of logical units and write an informative message
8
- - Make sure you have added the tests needed for your change
9
- - Run all the tests to make sure you haven't broken anything else (it happens to the best!)
10
-
11
- ## Add a defect
12
- First, check the defect/bug list https://github.com/sitespeedio/browsertime/issues?q=is%3Aissue+is%3Aopen+label%3Abug to make sure that it hasn't been filed yet.
13
-
14
- If you find a defect, please file a bug report and follow the instructions in https://www.sitespeed.io/documentation/sitespeed.io/bug-report/
15
-
16
- If you have the skills & the time, it is perfect if you send a pull request with a fix, that helps me alot!
17
-
18
- ## Add a change request/new functionality request
19
- If you have an idea or something that you want Browser Time to handle, add an issue and lets discuss it there. Ideas/changes/requests are very very welcome!
20
-
21
-
22
- Thanks for your support & time!
23
-
24
- Peter
@@ -1,9 +0,0 @@
1
- Examples
2
- ========
3
- All examples are under the assumption that the tool was installed via npm. If you have cloned the git repository you will need to substitute "browsertime" with the path to the JS file "bin/browsertime.js" relative to the checked out repository.
4
-
5
- - [Basic](basic.md)
6
- - [Advance](advance.md)
7
- - [Firefox](firefox.md)
8
- - [Chrome](chrome.md)
9
- - [Android](android.md)
@@ -1,12 +0,0 @@
1
- Advance Examples
2
- ================
3
-
4
- This page shows a few of the more advance examples of browsertime
5
-
6
- browsertime https://www.sitespeed.io --script ~/browserscripts/scripts.js
7
-
8
- - The script option allows for a single file or a directory to be passed to gather custom values that will be available in the JSON output. An additional page will be created to cover this option in the future.
9
-
10
- bin/browsertime.js https://www.sitespeed.io --pageCompleteCheck 'return window.performance.timing.loadEventEnd>0'
11
-
12
- - You can pass in a javascript snippet that is repeatedly queried to see if page has completed loading (indicated by the script returning true). Default script is 'return window.performance.timing.loadEventEnd>0'.
@@ -1,54 +0,0 @@
1
- Android Examples
2
- ================
3
-
4
- This page will give a few example to get you up and running with
5
- browsertime on Android devices. Generally, add `--android` and then
6
- configure the browser vehicle.
7
-
8
- `browsertime --android https://www.sitespeed.io`
9
-
10
- - The `--android` flag targets Chrome for Android by
11
- default.
12
- - Chrome for Android means the `com.android.chrome` package (and the
13
- `com.google.android.apps.chrome.Main` activity).
14
-
15
- `browsertime --android --browser chrome --chrome.android.deviceSerial SERIAL https://www.sitespeed.io`
16
-
17
- - Use `chrome.android.deviceSerial` to target a specific device (by
18
- serial or by ADB-over-TCP/IP address.
19
-
20
- `browsertime --android --browser firefox https://www.sitespeed.io`
21
-
22
- - The `firefox` browser means GeckoView example by default.
23
- - GeckoView example means the `org.mozilla.geckoview_example` package
24
- and the `org.mozilla.geckoview_example.GeckoViewActivity` activity.
25
-
26
- `browsertime --android --browser firefox --firefox.android.deviceSerial '127.0.0.1:555' https://www.sitespeed.io`
27
-
28
- - Use `firefox.android.deviceSerial` to target a specific device (by
29
- serial or by ADB-over-TCP/IP address.
30
-
31
- `browsertime --android --browser firefox --firefox.android.package org.mozilla.fenix.debug --firefox.android.activity org.mozilla.fenix.IntentReceiverActivity https://www.sitespeed.io`
32
-
33
- - Use `firefox.android.{package,activity}` to configure which Android
34
- package and activity is invoked for GeckoView (`--browser firefox`)
35
- Apps.
36
-
37
- `browsertime --android --browser firefox --firefox.android.package org.mozilla.firefox --firefox.android.activity org.mozilla.gecko.BrowserApp --firefox.android.intentArgument=--ez --firefox.android.intentArgument=skipstartpane --firefox.android.intentArgument=true https://www.sitespeed.io`
38
-
39
- - Use `firefox.android.intentArgument` to configure how the Android
40
- intent is launched.
41
- - Prefer `firefox.android.intentArgument=...`, especially with
42
- arguments starting with hyphens, to avoid a browsertime parsing
43
- issue where the `--...` will be interpreted as an argument to
44
- browsertime itself.
45
- - Passed through to `adb shell am start ...` follow the format at
46
- [https://developer.android.com/studio/command-line/adb#IntentSpec](https://developer.android.com/studio/command-line/adb#IntentSpec).
47
- - To add multiple arguments, repeat `--firefox.android.intentArgument`
48
- arguments.
49
-
50
- `browsertime --android --browser chrome --chrome.android.package org.mozilla.tv.firefox.debug --firefox.android.activity .MainActivity https://www.sitespeed.io`
51
-
52
- - Use `chrome.android.{package,activity}` to configure which Android
53
- package and activity is invoked for WebView (`--browser chrome`)
54
- Apps.
@@ -1,36 +0,0 @@
1
- Basic Examples
2
- ==============
3
-
4
- This page will give a few example to get you up and running with browsertime.
5
-
6
- browsertime --help
7
-
8
- - Use the help option if you would like to know what options are available.
9
-
10
- browsertime https://www.sitespeed.io
11
-
12
- - The only required option when running browsertime is the URL you want to test.
13
-
14
- browsertime https://www.sitespeed.io -n 5
15
-
16
- - If you would like to override the default number of runs. It defaults to 3.
17
-
18
- browsertime https://www.sitespeed.io --screenshot
19
-
20
- - If you would like to capture screenshots during your run(s). It will capture a screenshot for each run.
21
-
22
- browsertime https://www.sitespeed.io -b chrome
23
-
24
- - If you would like to override the default browser used. Defaults to Firefox.
25
-
26
- browsertime https://www.sitespeed.io --prettyPrint
27
-
28
- - If you would like to output the HAR in a more human readable format.
29
-
30
- browsertime https://www.sitespeed.io --delay 5000
31
-
32
- - If you would like to deploy the time in between test runs. This option takes milliseconds and defaults no delay(0).
33
-
34
- browsertime https://www.sitespeed.io --userAgent 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)'
35
-
36
- - If you want to customize the user agent passed to the test runs you can do so with the user agent option.
@@ -1,28 +0,0 @@
1
- Chrome Examples
2
- ===============
3
-
4
- This page shows a few of the options specific to Chrome.
5
-
6
- browsertime https://www.sitespeed.io -b chrome
7
-
8
- - Will use chrome's native performance logs to generate a HAR file.
9
-
10
- browsertime https://www.sitespeed.io --chrome.collectPerfLog -b chrome
11
-
12
- - Used for debugging chrome's native HAR export you can have it additionally output the Chrome performance logs.
13
-
14
- browsertime https://www.sitespeed.io --chrome.args -b chrome
15
-
16
- - Extra command line args to pass directly to the chrome process. (e.g. --no-sandbox)
17
-
18
- browsertime https://www.sitespeed.io --chrome.binaryPath -b chrome
19
-
20
- - Path to custom Chrome binary (e.g. Chrome Canary). On OS X, the path should be to the binary inside the app bundle. (e.g. /Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary)
21
-
22
- browsertime https://www.sitespeed.io --chrome.mobileEmulation.deviceName 'Apple iPad' -b chrome
23
-
24
- - Name of device to emulate (see list in Chrome DevTools)
25
-
26
- browsertime https://www.sitespeed.io --chrome.mobileEmulation.width 360 --chrome.mobileEmulation.height 640 --chrome.mobileEmulation.pixelRatio 2.0 -b chrome
27
-
28
- - Width in pixels of emulated mobile screen (e.g. 360), Height in pixels of emulated mobile screen (e.g. 640), Pixel ration of emulated mobile screen (e.g. 2.0)
@@ -1,10 +0,0 @@
1
- Firefox Examples
2
- ================
3
-
4
- This page shows a few of the options specific to Firefox.
5
-
6
- ```
7
- browsertime https://www.sitespeed.io -b firefox --firefox.binaryPath '/Applications/Firefox.app/Contents/MacOS/firefox-bin'
8
- ```
9
-
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)
package/docs/issues.md DELETED
@@ -1,18 +0,0 @@
1
- Running one of the example from the example docs produces the following error:
2
-
3
- ``` shellsession
4
- browsertime https://www.sitespeed.io/
5
- [2016-04-06 22:40:03] Running chrome for url: https://www.sitespeed.io/
6
- events.js:141
7
- throw er; // Unhandled 'error' event
8
- ^
9
-
10
- Error: spawn java ENOENT
11
- at exports._errnoException (util.js:870:11)
12
- at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
13
- at onErrorNT (internal/child_process.js:344:16)
14
- at nextTickCallbackWith2Args (node.js:442:9)
15
- at process._tickCallback (node.js:356:17)
16
- ```
17
-
18
- Solution: Java is missing from your system and you will need install it.
@@ -1,38 +0,0 @@
1
- # New-style script objects:
2
-
3
- A new-style object allows the user to write a script that executes in an environment that meets certain requirements. The script writer specifies the requirements for their script and the browser will meet those requirements before executing the script's functionality. If the requirements cannot be met, then the script's functionality will not be executed.
4
-
5
- A new-style script object is defined in a script file by a single object that is assigned to `module.exports`. A new-style script object has the following keys:
6
-
7
- * *requires*: An object whose keys define the requirements for executing this script object's functionality.
8
- * *function*: A possibly asynchronous function that actually performs the script object's actions. The function will be invoked with no parameters. If the function is asynchronous, it must return a `Promise`. The value `resolve`d by that promise is serialized into browsertime's result output. If the function is not asynchronous, any value returned by this function is written into browsertime's result output.
9
-
10
- At the moment, browsertime only supports one requirement in new-style script objects, the `privilege` requirement. If the `privilege` requirement is set to `true`, the new-style script object's functionality will execute with access to the browser's privileged APIs (which is currently only available in Firefox). If the browser cannot guarantee that the script can execute with access to the browser's privileged API (for whatever reason), it will not be executed.
11
-
12
- For example,
13
-
14
- module.exports = {
15
- requires: { privilege: true },
16
- function: function() {
17
- const { AppConstants } = ChromeUtils.import(
18
- 'resource://gre/modules/AppConstants.jsm'
19
- );
20
- return AppConstants;
21
- }
22
- };
23
-
24
- defines a new-style script object that requires access to the browser's privileged API in order to fetch its constants.
25
-
26
- The equivalent functionality can be accomplished asynchronously:
27
-
28
- module.exports = {
29
- requires: { privilege: true },
30
- function: async function() {
31
- return new Promise(resolve => {
32
- const { AppConstants } = ChromeUtils.import(
33
- 'resource://gre/modules/AppConstants.jsm'
34
- );
35
- resolve(AppConstants);
36
- });
37
- }
38
- };
@@ -1,24 +0,0 @@
1
- title Load a url and wait for load to complete
2
-
3
- caller -> SeleniumRunner: loadAndWait
4
- SeleniumRunner -> Browser: set page load timeout
5
- SeleniumRunner -> Browser: set script timeout
6
- SeleniumRunner -> Browser: Load url
7
-
8
- note right of Browser
9
- Wait at most "page load timeout"
10
- milliseconds
11
- end note
12
-
13
- Browser -> SeleniumRunner :
14
- SeleniumRunner -> Browser: executeScript "pageCompleteCheck"
15
-
16
- note right of Browser
17
- Keep testing script
18
- at most "wait script timeout"
19
- milliseconds
20
- end note
21
-
22
- Browser -> SeleniumRunner :
23
-
24
- SeleniumRunner -> caller :
@@ -1,24 +0,0 @@
1
- title Run one url via Engine
2
-
3
- caller -> Engine: run
4
- Engine -> EngineDelegate: onStartRun (BmpRunner - start proxy)
5
-
6
- loop n times
7
- Engine -> SeleniumRunner: start
8
- SeleniumRunner -> Browser: launch browser
9
- Engine -> EngineDelegate: onStartIteration (createHAR OR startNewPage)
10
- Engine -> SeleniumRunner: loadAndWait
11
- SeleniumRunner -> Browser: get url and execute pageCompleteCheck
12
- loop for each script
13
- Engine -> SeleniumRunner: runScript
14
- SeleniumRunner -> Browser: executeScript
15
- end
16
- Engine -> EngineDelegate: onStopIteration
17
- Engine -> SeleniumRunner: stop
18
- SeleniumRunner -> Browser: quit browser
19
- Engine -> Engine: optionally wait for short delay
20
- end
21
-
22
- Engine -> EngineDelegate: onStopRun (BmpRunner - getHAR, stop proxy)
23
-
24
- Engine -> caller : [return HAR and script results]