@wdio/nightwatch-devtools 1.8.0 → 1.8.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.
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";
@@ -546,23 +546,16 @@ async function openDevtoolsBrowser(ctx, url) {
546
546
  }
547
547
  ctx.devtoolsBrowser = await remote({
548
548
  logLevel: "info",
549
- automationProtocol: "devtools",
550
549
  capabilities: {
551
550
  browserName: "chrome",
552
551
  "goog:chromeOptions": {
552
+ excludeSwitches: ["enable-automation"],
553
553
  args: [
554
554
  "--window-size=1600,1200",
555
555
  `--user-data-dir=${ctx.userDataDir}`,
556
556
  "--no-first-run",
557
557
  "--no-default-browser-check"
558
558
  ]
559
- },
560
- // Dashboard uses the Puppeteer-based 'devtools' protocol; drop the
561
- // "controlled by automated test software" infobar by ignoring
562
- // Puppeteer's --enable-automation default. (Runtime-valid capability
563
- // not present in the type.)
564
- "wdio:devtoolsOptions": {
565
- ignoreDefaultArgs: ["--enable-automation"]
566
559
  }
567
560
  }
568
561
  });
@@ -601,7 +594,7 @@ async function waitForDevtoolsBrowserClose(ctx) {
601
594
  }
602
595
  ;
603
596
  logger2.setLevel(
604
- "devtools",
597
+ "webdriver",
605
598
  "warn"
606
599
  );
607
600
  let exitBySignal = false;
@@ -629,7 +622,7 @@ async function waitForDevtoolsBrowserClose(ctx) {
629
622
  process.removeListener("SIGINT", signalHandler);
630
623
  process.removeListener("SIGTERM", signalHandler);
631
624
  logger2.setLevel(
632
- "devtools",
625
+ "webdriver",
633
626
  "info"
634
627
  );
635
628
  try {
@@ -856,6 +849,14 @@ var SessionCapturer = class extends SessionCapturerBase {
856
849
  // True once BiDi inspectors are attached — the per-command perf-log network
857
850
  // capture path skips when set, so we don't double-emit network requests.
858
851
  bidiActive = false;
852
+ /** Whether the session was created with `goog:loggingPrefs.performance`, set
853
+ * from the capabilities at session init. A perf log exists only because a
854
+ * session asked for one, so without it every fetch is a round trip that can
855
+ * only fail — and the driver's own transport prints each failure, so the
856
+ * cost is a wall of errors on a run that passed: measured on iOS Safari,
857
+ * 21 of them in a two-test run, where XCUITest lists `performance` among its
858
+ * supported types and then serves none of it. */
859
+ perfLogsRequested = false;
859
860
  /** True once the collector is registered to run at document-start. Every
860
861
  * document then instruments and anchors itself, so the paths that exist to
861
862
  * notice a navigation after the fact — re-injection and the settle poll — have
@@ -1149,7 +1150,7 @@ var SessionCapturer = class extends SessionCapturerBase {
1149
1150
  * Requires loggingPrefs: { performance: 'ALL' } in Chrome capabilities.
1150
1151
  */
1151
1152
  async captureNetworkFromPerformanceLogs(browser) {
1152
- if (this.bidiActive) {
1153
+ if (this.bidiActive || !this.perfLogsRequested) {
1153
1154
  return;
1154
1155
  }
1155
1156
  try {
@@ -2640,6 +2641,10 @@ function readViewport(browser) {
2640
2641
  onWarn: (message) => log10.warn(message)
2641
2642
  });
2642
2643
  }
2644
+ function wantsPerformanceLog(capabilities, desiredCapabilities) {
2645
+ const loggingPrefs = capabilities["goog:loggingPrefs"] || desiredCapabilities["goog:loggingPrefs"] || {};
2646
+ return Boolean(loggingPrefs.performance);
2647
+ }
2643
2648
  async function broadcastSessionMetadata(ctx, browser) {
2644
2649
  const capabilities = browser.capabilities || {};
2645
2650
  const desiredCapabilities = browser.desiredCapabilities || {};
@@ -2669,8 +2674,12 @@ async function broadcastSessionMetadata(ctx, browser) {
2669
2674
  log10.info(
2670
2675
  `\u2713 Browser: ${browserName}${browserVersion ? " " + browserVersion : ""} (session: ${sessionId2})`
2671
2676
  );
2672
- const loggingPrefs = capabilities["goog:loggingPrefs"] || desiredCapabilities["goog:loggingPrefs"] || {};
2673
- if (!loggingPrefs.performance && !ctx.bidiEnabled) {
2677
+ const wantsPerfLog = wantsPerformanceLog(
2678
+ capabilities,
2679
+ desiredCapabilities
2680
+ );
2681
+ ctx.sessionCapturer.perfLogsRequested = wantsPerfLog;
2682
+ if (!wantsPerfLog && !ctx.bidiEnabled) {
2674
2683
  log10.warn(
2675
2684
  "\u26A0 Network tab will be empty \u2014 add 'goog:loggingPrefs': { performance: 'ALL' } to your capabilities (or enable bidi:true)"
2676
2685
  );
@@ -2685,7 +2694,7 @@ async function tryAttachBidi(ctx, browser) {
2685
2694
  log10.warn("bidi:true set but browser.driver unavailable \u2014 skipping");
2686
2695
  return;
2687
2696
  }
2688
- const { attachBidiHandlers, buildBidiSinks } = await import("./bidi-WAYPMJPQ.js");
2697
+ const { attachBidiHandlers, buildBidiSinks } = await import("./bidi-WNZOXX5X.js");
2689
2698
  const ok = await attachBidiHandlers(
2690
2699
  driver,
2691
2700
  buildBidiSinks(ctx.sessionCapturer)