@wdio/nightwatch-devtools 1.1.1 → 1.3.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.
Files changed (39) hide show
  1. package/README.md +66 -1
  2. package/dist/bidi-OH4ZFDN5.js +215 -0
  3. package/dist/bidi-OH4ZFDN5.js.map +1 -0
  4. package/dist/chunk-DKSBYMPM.js +191 -0
  5. package/dist/chunk-DKSBYMPM.js.map +1 -0
  6. package/dist/index.d.ts +111 -16
  7. package/dist/index.js +6253 -770
  8. package/dist/index.js.map +1 -1
  9. package/package.json +20 -13
  10. package/dist/constants.d.ts +0 -55
  11. package/dist/constants.js +0 -95
  12. package/dist/constants.js.map +0 -1
  13. package/dist/helpers/browserProxy.d.ts +0 -46
  14. package/dist/helpers/browserProxy.js +0 -314
  15. package/dist/helpers/browserProxy.js.map +0 -1
  16. package/dist/helpers/capturePerformance.d.ts +0 -5
  17. package/dist/helpers/capturePerformance.js +0 -53
  18. package/dist/helpers/capturePerformance.js.map +0 -1
  19. package/dist/helpers/cucumberHooks.cjs +0 -54
  20. package/dist/helpers/cucumberHooks.cjs.map +0 -1
  21. package/dist/helpers/cucumberHooks.d.cts +0 -21
  22. package/dist/helpers/suiteManager.d.ts +0 -43
  23. package/dist/helpers/suiteManager.js +0 -143
  24. package/dist/helpers/suiteManager.js.map +0 -1
  25. package/dist/helpers/testManager.d.ts +0 -45
  26. package/dist/helpers/testManager.js +0 -143
  27. package/dist/helpers/testManager.js.map +0 -1
  28. package/dist/helpers/utils.d.ts +0 -83
  29. package/dist/helpers/utils.js +0 -447
  30. package/dist/helpers/utils.js.map +0 -1
  31. package/dist/reporter.d.ts +0 -44
  32. package/dist/reporter.js +0 -185
  33. package/dist/reporter.js.map +0 -1
  34. package/dist/session.d.ts +0 -78
  35. package/dist/session.js +0 -643
  36. package/dist/session.js.map +0 -1
  37. package/dist/types.d.ts +0 -190
  38. package/dist/types.js +0 -5
  39. package/dist/types.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,10 +1,106 @@
1
+ import { ScreencastOptions, DevToolsMode, TraceFormat } from '@wdio/devtools-shared';
2
+
3
+ /** Nightwatch `eventHub` shape — only `runner` + `on()` are documented; the
4
+ * rest of the public surface is `unknown` to us. */
5
+ interface NightwatchEventHub {
6
+ runner?: string;
7
+ on(event: string, listener: (data: unknown) => void): void;
8
+ [key: string]: unknown;
9
+ }
10
+ interface DevToolsOptions {
11
+ port?: number;
12
+ hostname?: string;
13
+ /**
14
+ * Screencast recording options. When enabled, a continuous video of the
15
+ * browser session is recorded and saved as a .webm file at the end of the
16
+ * test run. Polling mode only on Nightwatch (no CDP push); works on every
17
+ * browser Nightwatch supports.
18
+ */
19
+ screencast?: ScreencastOptions;
20
+ /**
21
+ * Enable WebDriver BiDi capture (browser console + JS exceptions + network
22
+ * via `selenium-webdriver/bidi`). Requires `webSocketUrl: true` in your
23
+ * capabilities and a BiDi-capable chromedriver. When attached, the per-
24
+ * command perf-log network capture path is gated off to avoid duplicate
25
+ * entries. Defaults to `false` — opt-in.
26
+ */
27
+ bidi?: boolean;
28
+ /** `live` (default) launches the DevTools UI; `trace` skips it. */
29
+ mode?: DevToolsMode;
30
+ /** Trace output layout — `zip` (default) writes a single archive,
31
+ * `ndjson-directory` unpacks into `trace-<id>/`. Only applies in trace mode. */
32
+ traceFormat?: TraceFormat;
33
+ }
34
+ interface NightwatchBrowser {
35
+ url: (url: string) => Promise<unknown>;
36
+ execute: (script: string | ((...args: unknown[]) => unknown), args?: unknown[]) => Promise<unknown>;
37
+ executeAsync: (script: (...args: unknown[]) => unknown, args?: unknown[]) => Promise<unknown>;
38
+ pause: (ms: number) => Promise<unknown>;
39
+ capabilities?: Record<string, unknown>;
40
+ desiredCapabilities?: Record<string, unknown>;
41
+ sessionId?: string;
42
+ /** Driver instance from selenium-webdriver — its public shape is wide; we
43
+ * pass it through to BiDi attach helpers that do their own narrowing. */
44
+ driver?: unknown;
45
+ options?: {
46
+ testEnv?: string;
47
+ webdriver?: {
48
+ host?: string;
49
+ };
50
+ [key: string]: unknown;
51
+ };
52
+ currentTest?: {
53
+ name?: string;
54
+ module?: string;
55
+ group?: string;
56
+ [key: string]: unknown;
57
+ };
58
+ results?: unknown;
59
+ queue?: unknown;
60
+ }
61
+
62
+ /**
63
+ * Cucumber lifecycle for the Nightwatch plugin.
64
+ *
65
+ * Extracted from the plugin class to keep `index.ts` under the file-size cap
66
+ * and to isolate the cucumber-specific orchestration from the per-test
67
+ * (Mocha/Jasmine-style) lifecycle.
68
+ *
69
+ * The plugin passes itself as a `CucumberLifecycleCtx` — a narrow interface
70
+ * exposing only the fields and methods this module needs. The lifecycle
71
+ * helpers mutate the plugin's "current execution" state via the accessors on
72
+ * the ctx (they can't reach the plugin's private fields directly).
73
+ */
74
+
75
+ /** Minimal shapes for the Cucumber objects we touch. Cucumber's own types
76
+ * vary across major versions; we pin only fields we read. */
77
+ interface CucumberPickleStep {
78
+ text?: string;
79
+ astNodeIds?: string[];
80
+ location?: {
81
+ line?: number;
82
+ };
83
+ }
84
+ interface CucumberPickle {
85
+ uri?: string;
86
+ name?: string;
87
+ location?: {
88
+ line?: number;
89
+ };
90
+ astNodeIds?: string[];
91
+ steps?: CucumberPickleStep[];
92
+ }
93
+ interface CucumberResult {
94
+ status?: string;
95
+ }
96
+
1
97
  /**
2
98
  * Nightwatch DevTools Plugin
3
99
  *
4
100
  * Integrates Nightwatch with WebdriverIO DevTools following the WDIO service pattern.
5
101
  * Captures commands, network requests, and console logs during test execution in real-time.
6
102
  */
7
- import { type DevToolsOptions, type NightwatchBrowser } from './types.js';
103
+
8
104
  declare class NightwatchDevToolsPlugin {
9
105
  #private;
10
106
  private options;
@@ -16,24 +112,23 @@ declare class NightwatchDevToolsPlugin {
16
112
  private isScriptInjected;
17
113
  constructor(options?: DevToolsOptions);
18
114
  before(): Promise<void>;
19
- cucumberBefore(browser: NightwatchBrowser, pickle: any): Promise<void>;
20
- cucumberAfter(browser: NightwatchBrowser, result: any, pickle: any): Promise<void>;
21
- /** Called from Cucumber BeforeStep hook — marks the step as running. */
22
- cucumberBeforeStep(browser: NightwatchBrowser, pickleStep: any, _pickle: any): Promise<void>;
23
- /** Called from Cucumber AfterStep hook — records the step result. */
24
- cucumberAfterStep(_browser: NightwatchBrowser, result: any, pickleStep: any, _pickle: any): Promise<void>;
115
+ cucumberBefore(browser: NightwatchBrowser, pickle: CucumberPickle): Promise<void>;
116
+ cucumberAfter(browser: NightwatchBrowser, result: CucumberResult, pickle: CucumberPickle): Promise<void>;
117
+ cucumberBeforeStep(browser: NightwatchBrowser, pickleStep: CucumberPickleStep, pickle: CucumberPickle): Promise<void>;
118
+ cucumberAfterStep(browser: NightwatchBrowser, result: CucumberResult, pickleStep: CucumberPickleStep, pickle: CucumberPickle): Promise<void>;
25
119
  beforeEach(browser: NightwatchBrowser): Promise<void>;
26
120
  afterEach(browser: NightwatchBrowser): Promise<void>;
27
121
  after(browser?: NightwatchBrowser): Promise<void>;
28
- registerEventHandlers(eventHub: any): void;
122
+ registerEventHandlers(eventHub: NightwatchEventHub): void;
29
123
  }
30
- export declare const cucumberHooksPath: string;
31
- export default function createNightwatchDevTools(options?: DevToolsOptions): {
124
+ declare const cucumberHooksPath: string;
125
+ declare function createNightwatchDevTools(options?: DevToolsOptions): {
32
126
  asyncHookTimeout: number;
33
- before: (this: any) => Promise<void>;
34
- beforeEach: (this: any, browser: NightwatchBrowser) => Promise<void>;
35
- afterEach: (this: any, browser: NightwatchBrowser) => Promise<void>;
36
- after: (this: any) => Promise<void>;
37
- registerEventHandlers: (eventHub: any) => void;
127
+ before: (this: unknown) => Promise<void>;
128
+ beforeEach: (this: unknown, browser: NightwatchBrowser) => Promise<void>;
129
+ afterEach: (this: unknown, browser: NightwatchBrowser) => Promise<void>;
130
+ after: (this: unknown) => Promise<void>;
131
+ registerEventHandlers: (eventHub: NightwatchEventHub) => void;
38
132
  };
39
- export { NightwatchDevToolsPlugin };
133
+
134
+ export { NightwatchDevToolsPlugin, cucumberHooksPath, createNightwatchDevTools as default };