@wdio/nightwatch-devtools 1.8.0 → 1.8.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/dist/index.js CHANGED
@@ -60,7 +60,7 @@ import {
60
60
  upsertRichestSnapshot,
61
61
  webdriverGet,
62
62
  webdriverPost
63
- } from "./chunk-C7GXVKG6.js";
63
+ } from "./chunk-DM4FCAIJ.js";
64
64
 
65
65
  // src/index.ts
66
66
  import { fileURLToPath } from "url";
@@ -856,6 +856,14 @@ var SessionCapturer = class extends SessionCapturerBase {
856
856
  // True once BiDi inspectors are attached — the per-command perf-log network
857
857
  // capture path skips when set, so we don't double-emit network requests.
858
858
  bidiActive = false;
859
+ /** Whether the session was created with `goog:loggingPrefs.performance`, set
860
+ * from the capabilities at session init. A perf log exists only because a
861
+ * session asked for one, so without it every fetch is a round trip that can
862
+ * only fail — and the driver's own transport prints each failure, so the
863
+ * cost is a wall of errors on a run that passed: measured on iOS Safari,
864
+ * 21 of them in a two-test run, where XCUITest lists `performance` among its
865
+ * supported types and then serves none of it. */
866
+ perfLogsRequested = false;
859
867
  /** True once the collector is registered to run at document-start. Every
860
868
  * document then instruments and anchors itself, so the paths that exist to
861
869
  * notice a navigation after the fact — re-injection and the settle poll — have
@@ -1149,7 +1157,7 @@ var SessionCapturer = class extends SessionCapturerBase {
1149
1157
  * Requires loggingPrefs: { performance: 'ALL' } in Chrome capabilities.
1150
1158
  */
1151
1159
  async captureNetworkFromPerformanceLogs(browser) {
1152
- if (this.bidiActive) {
1160
+ if (this.bidiActive || !this.perfLogsRequested) {
1153
1161
  return;
1154
1162
  }
1155
1163
  try {
@@ -2640,6 +2648,10 @@ function readViewport(browser) {
2640
2648
  onWarn: (message) => log10.warn(message)
2641
2649
  });
2642
2650
  }
2651
+ function wantsPerformanceLog(capabilities, desiredCapabilities) {
2652
+ const loggingPrefs = capabilities["goog:loggingPrefs"] || desiredCapabilities["goog:loggingPrefs"] || {};
2653
+ return Boolean(loggingPrefs.performance);
2654
+ }
2643
2655
  async function broadcastSessionMetadata(ctx, browser) {
2644
2656
  const capabilities = browser.capabilities || {};
2645
2657
  const desiredCapabilities = browser.desiredCapabilities || {};
@@ -2669,8 +2681,12 @@ async function broadcastSessionMetadata(ctx, browser) {
2669
2681
  log10.info(
2670
2682
  `\u2713 Browser: ${browserName}${browserVersion ? " " + browserVersion : ""} (session: ${sessionId2})`
2671
2683
  );
2672
- const loggingPrefs = capabilities["goog:loggingPrefs"] || desiredCapabilities["goog:loggingPrefs"] || {};
2673
- if (!loggingPrefs.performance && !ctx.bidiEnabled) {
2684
+ const wantsPerfLog = wantsPerformanceLog(
2685
+ capabilities,
2686
+ desiredCapabilities
2687
+ );
2688
+ ctx.sessionCapturer.perfLogsRequested = wantsPerfLog;
2689
+ if (!wantsPerfLog && !ctx.bidiEnabled) {
2674
2690
  log10.warn(
2675
2691
  "\u26A0 Network tab will be empty \u2014 add 'goog:loggingPrefs': { performance: 'ALL' } to your capabilities (or enable bidi:true)"
2676
2692
  );
@@ -2685,7 +2701,7 @@ async function tryAttachBidi(ctx, browser) {
2685
2701
  log10.warn("bidi:true set but browser.driver unavailable \u2014 skipping");
2686
2702
  return;
2687
2703
  }
2688
- const { attachBidiHandlers, buildBidiSinks } = await import("./bidi-WAYPMJPQ.js");
2704
+ const { attachBidiHandlers, buildBidiSinks } = await import("./bidi-WNZOXX5X.js");
2689
2705
  const ok = await attachBidiHandlers(
2690
2706
  driver,
2691
2707
  buildBidiSinks(ctx.sessionCapturer)