@wdio/nightwatch-devtools 1.4.0 → 1.5.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/dist/index.js CHANGED
@@ -17,7 +17,72 @@ import {
17
17
  // src/index.ts
18
18
  import { fileURLToPath } from "url";
19
19
 
20
- // ../core/src/action-mapping.ts
20
+ // ../shared/src/files.ts
21
+ var SPEC_FILE_RE = /\.(?:test|spec)\.[cm]?[jt]sx?$/i;
22
+
23
+ // ../shared/src/routes.ts
24
+ var WS_PATHS = {
25
+ /** Adapter session upgrade endpoint. One socket per running adapter. */
26
+ worker: "/worker",
27
+ /** App/UI client upgrade endpoint. Multiple browser tabs may connect. */
28
+ client: "/client"
29
+ };
30
+ var WS_SCOPE = {
31
+ /** Backend → worker: a dashboard client has subscribed. Wakes up the
32
+ * adapter's `await UI ready` gate before tests start. */
33
+ clientConnected: "clientConnected",
34
+ /** Backend → worker: the last dashboard tab closed. Triggers the
35
+ * interactive shutdown flow (close WS, exit, pkill the dashboard). */
36
+ clientDisconnected: "clientDisconnected",
37
+ /** Worker → backend → clients (or app-local): wipe the visualization data
38
+ * for a specific test/suite uid (or the whole tree). */
39
+ clearExecutionData: "clearExecutionData",
40
+ /** Worker → backend: clear-by-test-uid request (drives clearExecutionData). */
41
+ clearCommands: "clearCommands",
42
+ /** Backend → clients: signal that the active run was stopped by the UI. */
43
+ testStopped: "testStopped",
44
+ /** Worker → backend → clients: swap an earlier captured command for an
45
+ * updated entry (used when a retry coalesces commands). */
46
+ replaceCommand: "replaceCommand",
47
+ /** Worker → backend: register the config file path so reruns can spawn
48
+ * with the same config. */
49
+ config: "config"
50
+ };
51
+
52
+ // ../shared/src/runner.ts
53
+ var REUSE_ENV = {
54
+ REUSE: "DEVTOOLS_APP_REUSE",
55
+ HOST: "DEVTOOLS_APP_HOST",
56
+ PORT: "DEVTOOLS_APP_PORT",
57
+ RERUN_LABEL: "DEVTOOLS_RERUN_LABEL",
58
+ RERUN_ENTRY_TYPE: "DEVTOOLS_RERUN_ENTRY_TYPE"
59
+ };
60
+
61
+ // ../shared/src/timing.ts
62
+ var TIMING_BASE = {
63
+ /** ms to let the dashboard render between rapid state updates. */
64
+ UI_RENDER_DELAY: 150,
65
+ /** ms to wait after a test starts before flushing initial state. */
66
+ TEST_START_DELAY: 100,
67
+ /** ms gap between consecutive suite-finalize broadcasts. */
68
+ SUITE_COMPLETE_DELAY: 200,
69
+ /** ms allowed for the browser-close handshake before forcing teardown. */
70
+ BROWSER_CLOSE_WAIT: 2e3,
71
+ /** ms before first worker WS connection attempt — lets backend bind. */
72
+ INITIAL_CONNECTION_WAIT: 500,
73
+ /** ms between browser-window-alive polls. */
74
+ BROWSER_POLL_INTERVAL: 1e3
75
+ };
76
+ var DEFAULTS_BASE = {
77
+ /** Synthetic capability ID — present on every CommandLog / TestStats. */
78
+ CID: "0-0",
79
+ /** TestStats.retries default — adapters that surface retry counts override. */
80
+ RETRIES: 0,
81
+ /** _duration placeholder for not-yet-finalized stats. */
82
+ DURATION: 0
83
+ };
84
+
85
+ // ../shared/src/trace-actions.ts
21
86
  var ACTION_MAP = {
22
87
  // WDIO browser-level
23
88
  url: { class: "Page", method: "navigate" },
@@ -48,6 +113,25 @@ var ACTION_MAP = {
48
113
  switchToFrame: { class: "Frame", method: "goto" },
49
114
  touchAction: { class: "Element", method: "tap" }
50
115
  };
116
+
117
+ // ../shared/src/types.ts
118
+ var TEST_STATE = {
119
+ PENDING: "pending",
120
+ RUNNING: "running",
121
+ PASSED: "passed",
122
+ FAILED: "failed",
123
+ SKIPPED: "skipped"
124
+ };
125
+ var SCREENCAST_DEFAULTS = {
126
+ enabled: false,
127
+ captureFormat: "jpeg",
128
+ quality: 70,
129
+ maxWidth: 1280,
130
+ maxHeight: 720,
131
+ pollIntervalMs: 200
132
+ };
133
+
134
+ // ../core/src/action-mapping.ts
51
135
  function mapCommandToAction(command) {
52
136
  return ACTION_MAP[command] ?? null;
53
137
  }
@@ -1206,21 +1290,8 @@ function serializeWebSnapshot(nodes, context, options = {}) {
1206
1290
  }
1207
1291
  const indent = " ".repeat(node.depth + 1);
1208
1292
  const isInteractive = INTERACTIVE_ROLES.has(node.role);
1209
- if (node.role === "statictext" && node.name) {
1210
- let echoedByParent = false;
1211
- for (let j = i - 1; j >= 0; j--) {
1212
- if (nodes[j].depth < node.depth) {
1213
- const parentRole = nodes[j].role;
1214
- const parentName = nodes[j].name;
1215
- if (INTERACTIVE_ROLES.has(parentRole) && parentName && parentName.includes(node.name)) {
1216
- echoedByParent = true;
1217
- }
1218
- break;
1219
- }
1220
- }
1221
- if (echoedByParent) {
1222
- continue;
1223
- }
1293
+ if (isStatictextEchoedByParent(nodes, i)) {
1294
+ continue;
1224
1295
  }
1225
1296
  const roleLabel = node.role === "heading" && node.level ? `heading[${node.level}]` : node.role;
1226
1297
  if (isInteractive) {
@@ -1245,6 +1316,22 @@ function serializeWebSnapshot(nodes, context, options = {}) {
1245
1316
  }
1246
1317
  return lines.join("\n");
1247
1318
  }
1319
+ function isStatictextEchoedByParent(nodes, index) {
1320
+ const node = nodes[index];
1321
+ if (node.role !== "statictext" || !node.name) {
1322
+ return false;
1323
+ }
1324
+ for (let j = index - 1; j >= 0; j--) {
1325
+ if (nodes[j].depth < node.depth) {
1326
+ const parent = nodes[j];
1327
+ if (INTERACTIVE_ROLES.has(parent.role) && parent.name && parent.name.includes(node.name)) {
1328
+ return true;
1329
+ }
1330
+ break;
1331
+ }
1332
+ }
1333
+ return false;
1334
+ }
1248
1335
  function simplifyTag(tagName) {
1249
1336
  const dot = tagName.lastIndexOf(".");
1250
1337
  if (dot !== -1) {
@@ -1412,7 +1499,8 @@ function collectMobileNodes(element, platform, depth, nodes, walkOpts) {
1412
1499
  depth,
1413
1500
  isInteractive: false,
1414
1501
  isExplicitInteractive: false,
1415
- isInViewport: false
1502
+ isInViewport: false,
1503
+ tagName: element.tagName
1416
1504
  });
1417
1505
  return;
1418
1506
  }
@@ -1445,7 +1533,8 @@ function collectMobileNodes(element, platform, depth, nodes, walkOpts) {
1445
1533
  depth,
1446
1534
  isInteractive: interactive,
1447
1535
  isExplicitInteractive: explicit,
1448
- isInViewport: inViewport
1536
+ isInViewport: inViewport,
1537
+ tagName: element.tagName
1449
1538
  });
1450
1539
  for (const child of element.children || []) {
1451
1540
  collectMobileNodes(child, platform, depth + 1, nodes, walkOpts);
@@ -2695,88 +2784,6 @@ var RetryTracker = class {
2695
2784
  }
2696
2785
  };
2697
2786
 
2698
- // ../shared/src/files.ts
2699
- var SPEC_FILE_RE = /\.(?:test|spec)\.[cm]?[jt]sx?$/i;
2700
-
2701
- // ../shared/src/routes.ts
2702
- var WS_PATHS = {
2703
- /** Adapter session upgrade endpoint. One socket per running adapter. */
2704
- worker: "/worker",
2705
- /** App/UI client upgrade endpoint. Multiple browser tabs may connect. */
2706
- client: "/client"
2707
- };
2708
- var WS_SCOPE = {
2709
- /** Backend → worker: a dashboard client has subscribed. Wakes up the
2710
- * adapter's `await UI ready` gate before tests start. */
2711
- clientConnected: "clientConnected",
2712
- /** Backend → worker: the last dashboard tab closed. Triggers the
2713
- * interactive shutdown flow (close WS, exit, pkill the dashboard). */
2714
- clientDisconnected: "clientDisconnected",
2715
- /** Worker → backend → clients (or app-local): wipe the visualization data
2716
- * for a specific test/suite uid (or the whole tree). */
2717
- clearExecutionData: "clearExecutionData",
2718
- /** Worker → backend: clear-by-test-uid request (drives clearExecutionData). */
2719
- clearCommands: "clearCommands",
2720
- /** Backend → clients: signal that the active run was stopped by the UI. */
2721
- testStopped: "testStopped",
2722
- /** Worker → backend → clients: swap an earlier captured command for an
2723
- * updated entry (used when a retry coalesces commands). */
2724
- replaceCommand: "replaceCommand",
2725
- /** Worker → backend: register the config file path so reruns can spawn
2726
- * with the same config. */
2727
- config: "config"
2728
- };
2729
-
2730
- // ../shared/src/runner.ts
2731
- var REUSE_ENV = {
2732
- REUSE: "DEVTOOLS_APP_REUSE",
2733
- HOST: "DEVTOOLS_APP_HOST",
2734
- PORT: "DEVTOOLS_APP_PORT",
2735
- RERUN_LABEL: "DEVTOOLS_RERUN_LABEL",
2736
- RERUN_ENTRY_TYPE: "DEVTOOLS_RERUN_ENTRY_TYPE"
2737
- };
2738
-
2739
- // ../shared/src/timing.ts
2740
- var TIMING_BASE = {
2741
- /** ms to let the dashboard render between rapid state updates. */
2742
- UI_RENDER_DELAY: 150,
2743
- /** ms to wait after a test starts before flushing initial state. */
2744
- TEST_START_DELAY: 100,
2745
- /** ms gap between consecutive suite-finalize broadcasts. */
2746
- SUITE_COMPLETE_DELAY: 200,
2747
- /** ms allowed for the browser-close handshake before forcing teardown. */
2748
- BROWSER_CLOSE_WAIT: 2e3,
2749
- /** ms before first worker WS connection attempt — lets backend bind. */
2750
- INITIAL_CONNECTION_WAIT: 500,
2751
- /** ms between browser-window-alive polls. */
2752
- BROWSER_POLL_INTERVAL: 1e3
2753
- };
2754
- var DEFAULTS_BASE = {
2755
- /** Synthetic capability ID — present on every CommandLog / TestStats. */
2756
- CID: "0-0",
2757
- /** TestStats.retries default — adapters that surface retry counts override. */
2758
- RETRIES: 0,
2759
- /** _duration placeholder for not-yet-finalized stats. */
2760
- DURATION: 0
2761
- };
2762
-
2763
- // ../shared/src/types.ts
2764
- var TEST_STATE = {
2765
- PENDING: "pending",
2766
- RUNNING: "running",
2767
- PASSED: "passed",
2768
- FAILED: "failed",
2769
- SKIPPED: "skipped"
2770
- };
2771
- var SCREENCAST_DEFAULTS = {
2772
- enabled: false,
2773
- captureFormat: "jpeg",
2774
- quality: 70,
2775
- maxWidth: 1280,
2776
- maxHeight: 720,
2777
- pollIntervalMs: 200
2778
- };
2779
-
2780
2787
  // ../core/src/screencast.ts
2781
2788
  var ScreencastRecorderBase = class {
2782
2789
  buffer = [];