browsertime 23.5.0 → 24.0.0-alpha.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +20 -2
  2. package/bin/browsertime.js +3 -2
  3. package/lib/android/gnirehtet.js +2 -2
  4. package/lib/android/index.js +2 -2
  5. package/lib/android/root.js +2 -2
  6. package/lib/chrome/chromeDevtoolsProtocol.js +4 -4
  7. package/lib/chrome/har.js +2 -2
  8. package/lib/chrome/networkManager.js +2 -2
  9. package/lib/chrome/parseCpuTrace.js +2 -2
  10. package/lib/chrome/traceCategoriesParser.js +2 -2
  11. package/lib/chrome/webdriver/builder.js +1 -2
  12. package/lib/chrome/webdriver/chromium.js +2 -2
  13. package/lib/chrome/webdriver/setupChromiumOptions.js +2 -2
  14. package/lib/chrome/webdriver/traceUtilities.js +2 -2
  15. package/lib/connectivity/humble.js +2 -2
  16. package/lib/connectivity/index.js +2 -2
  17. package/lib/core/engine/collector.js +2 -2
  18. package/lib/core/engine/command/addText.js +2 -2
  19. package/lib/core/engine/command/android.js +2 -2
  20. package/lib/core/engine/command/bidi.js +2 -2
  21. package/lib/core/engine/command/cache.js +2 -2
  22. package/lib/core/engine/command/chromeDevToolsProtocol.js +2 -2
  23. package/lib/core/engine/command/chromeTrace.js +2 -2
  24. package/lib/core/engine/command/click.js +2 -2
  25. package/lib/core/engine/command/debug.js +2 -2
  26. package/lib/core/engine/command/geckoProfiler.js +2 -2
  27. package/lib/core/engine/command/javaScript.js +2 -2
  28. package/lib/core/engine/command/measure.js +2 -2
  29. package/lib/core/engine/command/mouse/clickAndHold.js +2 -2
  30. package/lib/core/engine/command/mouse/contextClick.js +2 -2
  31. package/lib/core/engine/command/mouse/doubleClick.js +2 -2
  32. package/lib/core/engine/command/mouse/mouseMove.js +2 -2
  33. package/lib/core/engine/command/mouse/singleClick.js +2 -2
  34. package/lib/core/engine/command/navigation.js +2 -2
  35. package/lib/core/engine/command/screenshot.js +2 -2
  36. package/lib/core/engine/command/scroll.js +2 -2
  37. package/lib/core/engine/command/select.js +2 -2
  38. package/lib/core/engine/command/set.js +2 -2
  39. package/lib/core/engine/command/stopWatch.js +2 -2
  40. package/lib/core/engine/command/switch.js +2 -2
  41. package/lib/core/engine/command/wait.js +2 -2
  42. package/lib/core/engine/index.js +8 -14
  43. package/lib/core/engine/iteration.js +2 -2
  44. package/lib/core/seleniumRunner.js +8 -12
  45. package/lib/core/webdriver/index.js +1 -1
  46. package/lib/edge/webdriver/builder.js +3 -4
  47. package/lib/firefox/firefoxBidi.js +2 -2
  48. package/lib/firefox/geckoProfiler.js +2 -2
  49. package/lib/firefox/memoryReport.js +2 -2
  50. package/lib/firefox/networkManager.js +2 -2
  51. package/lib/firefox/perfStats.js +2 -2
  52. package/lib/firefox/webdriver/builder.js +3 -5
  53. package/lib/firefox/webdriver/firefox.js +2 -2
  54. package/lib/screenshot/index.js +7 -9
  55. package/lib/screenshot/loadCustomJimp.js +17 -0
  56. package/lib/support/browserScript.js +4 -5
  57. package/lib/support/cli.js +15 -5
  58. package/lib/support/dns.js +2 -2
  59. package/lib/support/engineUtils.js +4 -5
  60. package/lib/support/fileUtil.js +20 -3
  61. package/lib/support/getPort.js +25 -0
  62. package/lib/support/getViewPort.js +2 -2
  63. package/lib/support/har/index.js +5 -6
  64. package/lib/support/images/index.js +8 -17
  65. package/lib/support/logging.js +14 -39
  66. package/lib/support/pathToFolder.js +3 -3
  67. package/lib/support/preURL.js +2 -2
  68. package/lib/support/statistics.js +2 -2
  69. package/lib/support/stop.js +2 -2
  70. package/lib/support/storageManager.js +5 -5
  71. package/lib/support/util.js +73 -3
  72. package/lib/support/xvfb.js +55 -26
  73. package/lib/video/postprocessing/finetune/addTextToVideo.js +2 -2
  74. package/lib/video/postprocessing/finetune/convertFps.js +2 -2
  75. package/lib/video/postprocessing/finetune/index.js +2 -2
  76. package/lib/video/postprocessing/finetune/removeOrange.js +2 -2
  77. package/lib/video/postprocessing/visualmetrics/getVideoMetrics.js +2 -2
  78. package/lib/video/postprocessing/visualmetrics/visualMetrics.js +2 -2
  79. package/lib/video/screenRecording/android/recorder.js +2 -2
  80. package/lib/video/screenRecording/desktop/convert.js +2 -2
  81. package/lib/video/screenRecording/desktop/desktopRecorder.js +2 -2
  82. package/lib/video/screenRecording/desktop/ffmpegRecorder.js +2 -2
  83. package/lib/video/screenRecording/desktop/osx/getScreen.js +2 -2
  84. package/lib/video/screenRecording/firefox/firefoxWindowRecorder.js +2 -2
  85. package/lib/video/screenRecording/ios/convertToMp4.js +2 -2
  86. package/lib/video/screenRecording/ios/iosRecorder.js +2 -2
  87. package/lib/video/screenRecording/iosSimulator/convertToMp4.js +2 -2
  88. package/lib/video/screenRecording/iosSimulator/recorder.js +2 -2
  89. package/lib/video/screenRecording/setOrangeBackground.js +2 -2
  90. package/package.json +8 -13
  91. package/types/support/engineUtils.d.ts.map +1 -1
  92. package/types/support/fileUtil.d.ts +1 -0
  93. package/types/support/fileUtil.d.ts.map +1 -1
  94. package/types/support/util.d.ts +3 -0
  95. package/types/support/util.d.ts.map +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
+ ## 24.0.0-alpha.1 - 2025-01-07
4
+ ### Fixed
5
+ * Replace dependencies with local implementation:
6
+ * Replace btoa [#2233](https://github.com/sitespeedio/browsertime/pull/2233).
7
+ * Replace hasbin [#2234](https://github.com/sitespeedio/browsertime/pull/2234).
8
+ * Replace DayJS [#2235](https://github.com/sitespeedio/browsertime/pull/2235).
9
+ * Replace lodash.pick [#2237](https://github.com/sitespeedio/browsertime/pull/2237).
10
+ * Replace lodash.groupBy [#2238](https://github.com/sitespeedio/browsertime/pull/2238).
11
+ * Replace find-up [#2240](https://github.com/sitespeedio/browsertime/pull/2240).
12
+ * Replace lodash.isEmpty [#2241](https://github.com/sitespeedio/browsertime/pull/2241).
13
+ * Replace get-port [#2242](https://github.com/sitespeedio/browsertime/pull/2242).
14
+ * Replace jimp with jimp custom [#2243](https://github.com/sitespeedio/browsertime/pull/2243).
15
+ * Replace @cypress/xvfb [#2245](https://github.com/sitespeedio/browsertime/pull/2245).
16
+ * Replace intel (log) with sitespeed.io/log [#2246](https://github.com/sitespeedio/browsertime/pull/2246).
17
+ * Fix Docker file ENV to follow the new standard [#2239](https://github.com/sitespeedio/browsertime/pull/2239).
18
+ * Edgedriver 131 [#2236](https://github.com/sitespeedio/browsertime/pull/2236).
19
+
20
+
3
21
  ## 23.5.0 - 2024-12-23
4
22
  ### Added
5
23
  * Added `--userTimingBlockList` [#2227](https://github.com/sitespeedio/browsertime/pull/2227).
@@ -7,7 +25,7 @@
7
25
  ### Fixed
8
26
  * Updated to webdriver 4.28 [#2226](https://github.com/sitespeedio/browsertime/pull/2226).
9
27
  * Updated dev dependencies [#2228](https://github.com/sitespeedio/browsertime/pull/2228).
10
- * Fix so the check for gnirehtet always use --android.gnirehtet to fix problens setting it in sitespeed.io [#2229](https://github.com/sitespeedio/browsertime/pull/2229).
28
+ * Fix so the check for gnirehtet always use --android.gnirehtet to fix problems setting it in sitespeed.io [#2229](https://github.com/sitespeedio/browsertime/pull/2229).
11
29
  * Update to execa 9.5.2 [#2231](https://github.com/sitespeedio/browsertime/pull/2231).
12
30
  * Update to adbkit 3.3.8 [#2232](https://github.com/sitespeedio/browsertime/pull/2232).
13
31
  * Fix so you cannot use gnirehtet with webpagereplay [#2230](https://github.com/sitespeedio/browsertime/pull/2230).
@@ -15,7 +33,7 @@
15
33
 
16
34
  ## 23.4.5 - 2024-12-20
17
35
  ### Fixed
18
- * Change bottom margin from 10 to 14 pixel when recoring a video on mobile, se bug [#2224](https://github.com/sitespeedio/browsertime/issues/2224) and PR [#2225](https://github.com/sitespeedio/browsertime/pull/2225).
36
+ * Change bottom margin from 10 to 14 pixel when recording a video on mobile, se bug [#2224](https://github.com/sitespeedio/browsertime/issues/2224) and PR [#2225](https://github.com/sitespeedio/browsertime/pull/2225).
19
37
 
20
38
  ## 23.4.4 - 2024-12-18
21
39
  ### Fixed
@@ -2,7 +2,7 @@
2
2
  import merge from 'lodash.merge';
3
3
  import get from 'lodash.get';
4
4
  import set from 'lodash.set';
5
- import intel from 'intel';
5
+ import { getLogger } from '@sitespeed.io/log';
6
6
  import { existsSync, mkdirSync } from 'node:fs';
7
7
  import path from 'node:path';
8
8
  import { Engine } from '../lib/core/engine/index.js';
@@ -17,7 +17,7 @@ import { StorageManager } from '../lib/support/storageManager.js';
17
17
  import { loadScript } from '../lib/support/engineUtils.js';
18
18
  import { isAndroidConfigured } from '../lib/android/index.js';
19
19
 
20
- const log = intel.getLogger('browsertime');
20
+ const log = getLogger('browsertime');
21
21
  const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
22
22
  const delay = ms => new Promise(response => setTimeout(response, ms));
23
23
 
@@ -193,6 +193,7 @@ async function run(urls, options) {
193
193
  }
194
194
  } catch (error) {
195
195
  log.error('Error running browsertime', error);
196
+ console.log(error);
196
197
  process.exitCode = 1;
197
198
  } finally {
198
199
  process.exit();
@@ -1,6 +1,6 @@
1
1
  import { execa } from 'execa';
2
- import intel from 'intel';
3
- const log = intel.getLogger('browsertime.gnirehtet');
2
+ import { getLogger } from '@sitespeed.io/log';
3
+ const log = getLogger('browsertime.gnirehtet');
4
4
  const delay = ms => new Promise(response => setTimeout(response, ms));
5
5
 
6
6
  export class Gnirehtet {
@@ -3,13 +3,13 @@ import { mkdir as _mkdir, createWriteStream } from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import { EOL as endOfLine } from 'node:os';
5
5
  import { execa } from 'execa';
6
- import intel from 'intel';
6
+ import { getLogger } from '@sitespeed.io/log';
7
7
  import pkg from '@devicefarmer/adbkit';
8
8
  import usbPowerProfiler from 'usb-power-profiling/usb-power-profiling.js';
9
9
  const { Adb } = pkg;
10
10
  import get from 'lodash.get';
11
11
  import { pathToFolder } from '../support/pathToFolder.js';
12
- const log = intel.getLogger('browsertime.android');
12
+ const log = getLogger('browsertime.android');
13
13
  const mkdir = promisify(_mkdir);
14
14
  const delay = ms => new Promise(res => setTimeout(res, ms));
15
15
 
@@ -1,5 +1,5 @@
1
- import intel from 'intel';
2
- const log = intel.getLogger('browsertime.android');
1
+ import { getLogger } from '@sitespeed.io/log';
2
+ const log = getLogger('browsertime.android');
3
3
 
4
4
  // Adopted from
5
5
  // https://dxr.mozilla.org/mozilla-central/source/testing/raptor/raptor/performance_tuning.py
@@ -1,7 +1,6 @@
1
- import intel from 'intel';
1
+ import { getLogger } from '@sitespeed.io/log';
2
2
  import CDP from 'chrome-remote-interface';
3
- import btoa from 'btoa';
4
- const log = intel.getLogger('browsertime.chrome.cdp');
3
+ const log = getLogger('browsertime.chrome.cdp');
5
4
  import { toArray } from '../support/util.js';
6
5
  import { traceCategories as defaultTraceCategories } from './settings/traceCategories.js';
7
6
 
@@ -107,7 +106,8 @@ export class ChromeDevtoolsProtocol {
107
106
 
108
107
  async setBasicAuth(basicAuth) {
109
108
  const parts = basicAuth.split('@');
110
- const basic = 'Basic ' + btoa(parts[0] + ':' + parts[1]);
109
+ const basic =
110
+ 'Basic ' + Buffer.from(parts[0] + ':' + parts[1]).toString('base64');
111
111
  await this.cdpClient.Network.setExtraHTTPHeaders({
112
112
  headers: { Authorization: basic }
113
113
  });
package/lib/chrome/har.js CHANGED
@@ -1,7 +1,7 @@
1
- import intel from 'intel';
1
+ import { getLogger } from '@sitespeed.io/log';
2
2
  import { harFromMessages } from 'chrome-har';
3
3
  import { logging } from 'selenium-webdriver';
4
- const log = intel.getLogger('browsertime.chrome');
4
+ const log = getLogger('browsertime.chrome');
5
5
  import { addBrowser } from '../support/har/index.js';
6
6
  const { Type } = logging;
7
7
 
@@ -1,7 +1,7 @@
1
- import intel from 'intel';
1
+ import { getLogger } from '@sitespeed.io/log';
2
2
  import get from 'lodash.get';
3
3
 
4
- const log = intel.getLogger('browsertime.chrome.network');
4
+ const log = getLogger('browsertime.chrome.network');
5
5
 
6
6
  export class NetworkManager {
7
7
  constructor(cdpClient, options) {
@@ -1,6 +1,6 @@
1
- import intel from 'intel';
1
+ import { getLogger } from '@sitespeed.io/log';
2
2
  import { computeMainThreadTasks } from '@sitespeed.io/tracium';
3
- const log = intel.getLogger('browsertime.chrome.cpu');
3
+ const log = getLogger('browsertime.chrome.cpu');
4
4
 
5
5
  function round(number_, decimals = 3) {
6
6
  const pow = Math.pow(10, decimals);
@@ -1,5 +1,5 @@
1
- import intel from 'intel';
2
- const log = intel.getLogger('browsertime.chrome.trace');
1
+ import { getLogger } from '@sitespeed.io/log';
2
+ const log = getLogger('browsertime.chrome.trace');
3
3
 
4
4
  // Adopting the Lighthouse way to clean the Trace log
5
5
  // https://github.com/GoogleChrome/lighthouse/blob/50a68ab2bf0115427e767e5e40dfe6be671902fe/lighthouse-core/config/config.js#L29-L110
@@ -1,10 +1,9 @@
1
- import pick from 'lodash.pick';
2
- import isEmpty from 'lodash.isempty';
3
1
  import get from 'lodash.get';
4
2
  import { logging } from 'selenium-webdriver';
5
3
  import { ServiceBuilder, Options } from 'selenium-webdriver/chrome.js';
6
4
  import { pac, manual } from 'selenium-webdriver/proxy.js';
7
5
  import { setupChromiumOptions } from './setupChromiumOptions.js';
6
+ import { pick, isEmpty } from '../../support/util.js';
8
7
 
9
8
  /**
10
9
  * Configure a WebDriver builder based on the specified options.
@@ -2,9 +2,9 @@ import { promisify } from 'node:util';
2
2
  import { unlink as _unlink, rm as _rm } from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import { logging } from 'selenium-webdriver';
5
- import intel from 'intel';
5
+ import { getLogger } from '@sitespeed.io/log';
6
6
  import usbPowerProfiler from 'usb-power-profiling/usb-power-profiling.js';
7
- const log = intel.getLogger('browsertime.chrome');
7
+ const log = getLogger('browsertime.chrome');
8
8
  const { Type } = logging;
9
9
  import { longTaskMetrics } from '../longTaskMetrics.js';
10
10
  import { parseCPUTrace } from '../parseCpuTrace.js';
@@ -1,11 +1,11 @@
1
1
  import { readFileSync } from 'node:fs';
2
- import intel from 'intel';
2
+ import { getLogger } from '@sitespeed.io/log';
3
3
  import { chromeDesktopOptions as defaultChromeOptions } from '../settings/chromeDesktopOptions.js';
4
4
  import { chromeAndroidOptions as defaultAndroidChromeOptions } from '../settings/chromeAndroidOptions.js';
5
5
  import { getViewPort } from '../../support/getViewPort.js';
6
6
  import { toArray } from '../../support/util.js';
7
7
  import { isAndroidConfigured } from '../../android/index.js';
8
- const log = intel.getLogger('browsertime.chrome');
8
+ const log = getLogger('browsertime.chrome');
9
9
 
10
10
  const CHROME_AMD_EDGE_INTERNAL_PHONE_HOME = [
11
11
  'MAP cache.pack.google.com 127.0.0.1',
@@ -1,5 +1,5 @@
1
- import intel from 'intel';
2
- const log = intel.getLogger('browsertime.chrome');
1
+ import { getLogger } from '@sitespeed.io/log';
2
+ const log = getLogger('browsertime.chrome');
3
3
 
4
4
  function getLargestContentfulPaintEvent(traceEvents) {
5
5
  const lcpCandidates = traceEvents.filter(
@@ -1,8 +1,8 @@
1
1
  import http from 'node:http';
2
2
  import https from 'node:https';
3
3
  import get from 'lodash.get';
4
- import intel from 'intel';
5
- const log = intel.getLogger('browsertime.connectivity.humble');
4
+ import { getLogger } from '@sitespeed.io/log';
5
+ const log = getLogger('browsertime.connectivity.humble');
6
6
 
7
7
  export class Humble {
8
8
  constructor(options) {
@@ -1,10 +1,10 @@
1
1
  import get from 'lodash.get';
2
- import intel from 'intel';
2
+ import { getLogger } from '@sitespeed.io/log';
3
3
  import {
4
4
  start as throttleStart,
5
5
  stop as throttleStop
6
6
  } from '@sitespeed.io/throttle';
7
- const log = intel.getLogger('browsertime.connectivity');
7
+ const log = getLogger('browsertime.connectivity');
8
8
  import { Humble } from './humble.js';
9
9
  import { parseTrafficShapeConfig } from './trafficShapeParser.js';
10
10
 
@@ -1,7 +1,7 @@
1
1
  import path from 'node:path';
2
2
  import { createRequire } from 'node:module';
3
3
  import get from 'lodash.get';
4
- import intel from 'intel';
4
+ import { getLogger } from '@sitespeed.io/log';
5
5
  import { timestamp as _timestamp } from '../../support/engineUtils.js';
6
6
  import { Statistics } from '../../support/statistics.js';
7
7
  import { pathToFolder } from '../../support/pathToFolder.js';
@@ -9,7 +9,7 @@ import { getConnectivitySettings } from '../../connectivity/index.js';
9
9
  import { formatMetric } from '../../support/util.js';
10
10
  const require = createRequire(import.meta.url);
11
11
  const version = require('../../../package.json').version;
12
- const log = intel.getLogger('browsertime');
12
+ const log = getLogger('browsertime');
13
13
 
14
14
  function getNewResult(url, options) {
15
15
  return {
@@ -1,6 +1,6 @@
1
1
  import { By } from 'selenium-webdriver';
2
- import intel from 'intel';
3
- const log = intel.getLogger('browsertime.command.addText');
2
+ import { getLogger } from '@sitespeed.io/log';
3
+ const log = getLogger('browsertime.command.addText');
4
4
 
5
5
  /**
6
6
  * Provides functionality to add text to elements on a web page using various selectors.
@@ -1,6 +1,6 @@
1
- import intel from 'intel';
1
+ import { getLogger } from '@sitespeed.io/log';
2
2
  import { Android, isAndroidConfigured } from '../../../android/index.js';
3
- const log = intel.getLogger('browsertime.command.android');
3
+ const log = getLogger('browsertime.command.android');
4
4
  /**
5
5
  * Provides functionality to interact with an Android device through shell commands.
6
6
  * @class
@@ -1,5 +1,5 @@
1
- import intel from 'intel';
2
- const log = intel.getLogger('browsertime.command.bidi');
1
+ import { getLogger } from '@sitespeed.io/log';
2
+ const log = getLogger('browsertime.command.bidi');
3
3
 
4
4
  /**
5
5
  * Manages interactions using Bidi. At the moment this only works for Firefox
@@ -1,5 +1,5 @@
1
- import intel from 'intel';
2
- const log = intel.getLogger('browsertime.command.cache');
1
+ import { getLogger } from '@sitespeed.io/log';
2
+ const log = getLogger('browsertime.command.cache');
3
3
  /**
4
4
  * Manage the browser cache.
5
5
  * This class provides methods to clear the cache and cookies in different browsers.
@@ -1,5 +1,5 @@
1
- import intel from 'intel';
2
- const log = intel.getLogger('browsertime.command.devtoolsprotocol');
1
+ import { getLogger } from '@sitespeed.io/log';
2
+ const log = getLogger('browsertime.command.devtoolsprotocol');
3
3
 
4
4
  /**
5
5
  * Manages interactions with the Chrome DevTools Protocol for Chrome and Edge browsers.
@@ -1,9 +1,9 @@
1
- import intel from 'intel';
1
+ import { getLogger } from '@sitespeed.io/log';
2
2
 
3
3
  import { getRenderBlocking } from '../../../chrome/webdriver/traceUtilities.js';
4
4
  import { parse } from '../../../chrome/traceCategoriesParser.js';
5
5
  import { parseCPUTrace } from '../../../chrome/parseCpuTrace.js';
6
- const log = intel.getLogger('browsertime.command.chrometrace');
6
+ const log = getLogger('browsertime.command.chrometrace');
7
7
  /**
8
8
  * Manages Chrome trace functionality, enabling custom profiling and trace collection in Chrome.
9
9
  *
@@ -1,5 +1,5 @@
1
- import intel from 'intel';
2
- const log = intel.getLogger('browsertime.command.click');
1
+ import { getLogger } from '@sitespeed.io/log';
2
+ const log = getLogger('browsertime.command.click');
3
3
 
4
4
  function addClick(js) {
5
5
  const trimmed = js.trim();
@@ -1,5 +1,5 @@
1
- import intel from 'intel';
2
- const log = intel.getLogger('browsertime.command.debug');
1
+ import { getLogger } from '@sitespeed.io/log';
2
+ const log = getLogger('browsertime.command.debug');
3
3
  const delay = ms => new Promise(res => setTimeout(res, ms));
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import intel from 'intel';
2
- const log = intel.getLogger('browsertime.command.geckoprofiler');
1
+ import { getLogger } from '@sitespeed.io/log';
2
+ const log = getLogger('browsertime.command.geckoprofiler');
3
3
  /**
4
4
  * Manages the Gecko Profiler for profiling Firefox performance.
5
5
  *
@@ -1,5 +1,5 @@
1
- import intel from 'intel';
2
- const log = intel.getLogger('browsertime.command.javascript');
1
+ import { getLogger } from '@sitespeed.io/log';
2
+ const log = getLogger('browsertime.command.javascript');
3
3
  /**
4
4
  * Provides functionality to execute JavaScript code in the context of the current page.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path';
2
- import intel from 'intel';
2
+ import { getLogger } from '@sitespeed.io/log';
3
3
  import get from 'lodash.get';
4
4
  import merge from 'lodash.merge';
5
5
  import { timestamp as _timestamp } from '../../../support/engineUtils.js';
@@ -15,7 +15,7 @@ import { TCPDump } from '../../../support/tcpdump.js';
15
15
  import { lcpHighlightScript as highlightLargestContentfulPaint } from './util/lcpHighlightScript.js';
16
16
  import { clsHighlightScript as highlightLS } from './util/lsHighlightScript.js';
17
17
  const delay = ms => new Promise(res => setTimeout(res, ms));
18
- const log = intel.getLogger('browsertime.command.measure');
18
+ const log = getLogger('browsertime.command.measure');
19
19
 
20
20
  // In some cases we could have one alias mapped to multiple URLs
21
21
  // we've seen it for login etc where the user get different query parameter
@@ -1,6 +1,6 @@
1
- import intel from 'intel';
1
+ import { getLogger } from '@sitespeed.io/log';
2
2
  import { By, Origin } from 'selenium-webdriver';
3
- const log = intel.getLogger('browsertime.command.mouse');
3
+ const log = getLogger('browsertime.command.mouse');
4
4
 
5
5
  /**
6
6
  * Provides functionality to click and hold elements on a web page using different strategies.
@@ -1,6 +1,6 @@
1
- import intel from 'intel';
1
+ import { getLogger } from '@sitespeed.io/log';
2
2
  import { By } from 'selenium-webdriver';
3
- const log = intel.getLogger('browsertime.command.mouse');
3
+ const log = getLogger('browsertime.command.mouse');
4
4
 
5
5
  /**
6
6
  * Provides functionality to perform a context click (right-click) on elements in a web page.
@@ -1,6 +1,6 @@
1
- import intel from 'intel';
1
+ import { getLogger } from '@sitespeed.io/log';
2
2
  import { By } from 'selenium-webdriver';
3
- const log = intel.getLogger('browsertime.command.mouse');
3
+ const log = getLogger('browsertime.command.mouse');
4
4
  /**
5
5
  * Provides functionality to perform a double-click action on elements in a web page.
6
6
  *
@@ -1,6 +1,6 @@
1
- import intel from 'intel';
1
+ import { getLogger } from '@sitespeed.io/log';
2
2
  import { By, Origin } from 'selenium-webdriver';
3
- const log = intel.getLogger('browsertime.command.mouse');
3
+ const log = getLogger('browsertime.command.mouse');
4
4
  /**
5
5
  * Provides functionality to move the mouse cursor to elements or specific positions on a web page.
6
6
  *
@@ -1,6 +1,6 @@
1
- import intel from 'intel';
1
+ import { getLogger } from '@sitespeed.io/log';
2
2
  import { By } from 'selenium-webdriver';
3
- const log = intel.getLogger('browsertime.command.mouse');
3
+ const log = getLogger('browsertime.command.mouse');
4
4
 
5
5
  /**
6
6
  * Provides functionality to perform a single click action on elements or at specific positions in a web page. Uses Seleniums Action API.
@@ -1,5 +1,5 @@
1
- import intel from 'intel';
2
- const log = intel.getLogger('browsertime.command.navigation');
1
+ import { getLogger } from '@sitespeed.io/log';
2
+ const log = getLogger('browsertime.command.navigation');
3
3
 
4
4
  /**
5
5
  * Provides functionality to control browser navigation such as back, forward, and refresh actions.
@@ -1,5 +1,5 @@
1
- import intel from 'intel';
2
- const log = intel.getLogger('browsertime.command.screenshot');
1
+ import { getLogger } from '@sitespeed.io/log';
2
+ const log = getLogger('browsertime.command.screenshot');
3
3
 
4
4
  /**
5
5
  * Take a screenshot. The screenshot will be stored to disk,
@@ -1,5 +1,5 @@
1
- import intel from 'intel';
2
- const log = intel.getLogger('browsertime.command.scroll');
1
+ import { getLogger } from '@sitespeed.io/log';
2
+ const log = getLogger('browsertime.command.scroll');
3
3
  const delay = ms => new Promise(res => setTimeout(res, ms));
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import intel from 'intel';
2
- const log = intel.getLogger('browsertime.command.select');
1
+ import { getLogger } from '@sitespeed.io/log';
2
+ const log = getLogger('browsertime.command.select');
3
3
 
4
4
  /**
5
5
  * Provides functionality to interact with `<select>` elements on a web page.
@@ -1,5 +1,5 @@
1
- import intel from 'intel';
2
- const log = intel.getLogger('browsertime.command.set');
1
+ import { getLogger } from '@sitespeed.io/log';
2
+ const log = getLogger('browsertime.command.set');
3
3
 
4
4
  /**
5
5
  * Provides functionality to set properties like innerHTML, innerText, and value on elements in a web page.
@@ -1,6 +1,6 @@
1
1
  import { performance } from 'node:perf_hooks';
2
- import intel from 'intel';
3
- const log = intel.getLogger('browsertime.command.stopwatch');
2
+ import { getLogger } from '@sitespeed.io/log';
3
+ const log = getLogger('browsertime.command.stopwatch');
4
4
 
5
5
  /**
6
6
  * A stopwatch utility for measuring time intervals.
@@ -1,6 +1,6 @@
1
- import intel from 'intel';
1
+ import { getLogger } from '@sitespeed.io/log';
2
2
  import { By } from 'selenium-webdriver';
3
- const log = intel.getLogger('browsertime.command.switch');
3
+ const log = getLogger('browsertime.command.switch');
4
4
 
5
5
  /**
6
6
  * Provides functionality to switch between frames, windows, and tabs in the browser.
@@ -1,6 +1,6 @@
1
1
  import webdriver from 'selenium-webdriver';
2
- import intel from 'intel';
3
- const log = intel.getLogger('browsertime.command.wait');
2
+ import { getLogger } from '@sitespeed.io/log';
3
+ const log = getLogger('browsertime.command.wait');
4
4
  const delay = ms => new Promise(res => setTimeout(res, ms));
5
5
 
6
6
  /**
@@ -1,7 +1,6 @@
1
1
  import { arch as _arch } from 'node:os';
2
- import intel from 'intel';
2
+ import { getLogger } from '@sitespeed.io/log';
3
3
  import merge from 'lodash.merge';
4
- import getPort, { portNumbers } from 'get-port';
5
4
  import { execaCommand as command } from 'execa';
6
5
  import get from 'lodash.get';
7
6
  import { StorageManager } from '../../support/storageManager.js';
@@ -31,7 +30,8 @@ import {
31
30
  loadScript,
32
31
  loadPageCompleteScript
33
32
  } from '../../support/engineUtils.js';
34
- const log = intel.getLogger('browsertime');
33
+ import { getAvailablePort } from '../../support/getPort.js';
34
+ const log = getLogger('browsertime');
35
35
  const defaults = {
36
36
  scripts: [],
37
37
  iterations: 3,
@@ -52,9 +52,9 @@ function shouldDelay(index, total, delay) {
52
52
  export class Engine {
53
53
  constructor(options) {
54
54
  this.options = merge({}, defaults, options);
55
- if (log.isEnabledFor(log.DEBUG)) {
56
- log.debug('Running with options: %:2j', this.options);
57
- }
55
+
56
+ log.debug('Running with options: %:2j', this.options);
57
+
58
58
  this.myXVFB = new XVFB(this.options);
59
59
  }
60
60
 
@@ -67,19 +67,13 @@ export class Engine {
67
67
  async start() {
68
68
  const options = this.options;
69
69
 
70
- options.devToolsPort = await getPort({
71
- port: portNumbers(9222, 9350),
72
- host: '127.0.0.1'
73
- });
70
+ options.devToolsPort = await getAvailablePort([9222, 9350]);
74
71
 
75
72
  log.debug(
76
73
  `Preparing port ${options.devToolsPort} for devtools on Chrome/Edge`
77
74
  );
78
75
 
79
- options.safariDriverPort = await getPort({
80
- port: portNumbers(1234, 2000),
81
- host: '127.0.0.1'
82
- });
76
+ options.safariDriverPort = await getAvailablePort([1234, 2000]);
83
77
 
84
78
  if (options.browser === 'safari' && options.safari.ios && options.video) {
85
79
  await IOSRecorder.activate();
@@ -1,6 +1,6 @@
1
1
  import { platform } from 'node:os';
2
2
  import webdriver from 'selenium-webdriver';
3
- import intel from 'intel';
3
+ import { getLogger } from '@sitespeed.io/log';
4
4
 
5
5
  import { Context } from './context.js';
6
6
  import { Commands } from './commands.js';
@@ -23,7 +23,7 @@ import { flushDNS } from '../../support/dns.js';
23
23
 
24
24
  import { getNumberOfRunningProcesses } from '../../support/processes.js';
25
25
  import { isAndroidConfigured, Android } from '../../android/index.js';
26
- const log = intel.getLogger('browsertime');
26
+ const log = getLogger('browsertime');
27
27
  const delay = ms => new Promise(res => setTimeout(res, ms));
28
28
 
29
29
  // Make this configurable
@@ -1,4 +1,4 @@
1
- import intel from 'intel';
1
+ import { getLogger } from '@sitespeed.io/log';
2
2
  import merge from 'lodash.merge';
3
3
  import get from 'lodash.get';
4
4
  import { Condition } from 'selenium-webdriver';
@@ -9,7 +9,7 @@ import { getViewPort } from '../support/getViewPort.js';
9
9
  import { defaultPageCompleteCheck } from './pageCompleteChecks/defaultPageCompleteCheck.js';
10
10
  import { pageCompleteCheckByInactivity } from './pageCompleteChecks/pageCompleteCheckByInactivity.js';
11
11
  import { spaInactivity as spaCheck } from './pageCompleteChecks/spaInactivity.js';
12
- const log = intel.getLogger('browsertime');
12
+ const log = getLogger('browsertime');
13
13
 
14
14
  const defaults = {
15
15
  timeouts: {
@@ -402,11 +402,8 @@ export class SeleniumRunner {
402
402
  async runScript(script, name, arguments_) {
403
403
  let scriptTimeout = this.options.timeouts.script;
404
404
 
405
- if (log.isEnabledFor(log.TRACE)) {
406
- log.verbose('Executing script %s', script);
407
- } else if (log.isEnabledFor(log.VERBOSE)) {
408
- log.verbose('Executing script %s', name);
409
- }
405
+ log.verbose('Executing script %s', script);
406
+ log.verbose('Executing script %s', name);
410
407
 
411
408
  try {
412
409
  const result = await timeout(
@@ -463,11 +460,10 @@ export class SeleniumRunner {
463
460
  * @throws {BrowserError}
464
461
  */
465
462
  async runAsyncScript(script, name, arguments_) {
466
- if (log.isEnabledFor(log.TRACE)) {
467
- log.verbose('Executing async script %s', script);
468
- } else if (log.isEnabledFor(log.VERBOSE)) {
469
- log.verbose('Executing async script %s', name);
470
- }
463
+ log.verbose('Executing async script %s', script);
464
+
465
+ log.verbose('Executing async script %s', name);
466
+
471
467
  return this.driver.executeAsyncScript(script, arguments_);
472
468
  }
473
469