@testrelic/maestro-analytics 1.2.0 → 1.2.1-next.56

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.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { TestStatus, CloudReporterOptions, ReportMode, CloudConfig, ApiCallRecord, TimelineEntry, Summary, TestRunReport, AuthMode, GitMetadata, TimelineStep, CIMetadata } from '@testrelic/core';
1
+ import { TestStatus, CloudReporterOptions, ReportMode, CloudConfig, ApiCallRecord, TimelineEntry, Summary, TestRunReport, TimelineStep, ActionStep, GitMetadata, CIMetadata, AuthMode } from '@testrelic/core';
2
2
  export { ActionCategory, ActionStep, ArtifactRunManifest, AuthMode, AuthState, CIMetadata, CIProvider, CloudConfig, CloudReporterOptions, ConsoleLogEntry, ConsoleLogLevel, FailureDiagnostic, GitMetadata, MergeOptions, QueueEntry, ReportMode, StreamingReportSummary, Summary, TestArtifacts, TestDetailData, TestIndexEntry, TestResult, TestRunReport, TestStatus, TimelineEntry, TimelineStep, UploadStrategy } from '@testrelic/core';
3
3
  export { mergeReports, mergeReportsFromDirectory } from './merge.cjs';
4
4
 
@@ -309,8 +309,16 @@ declare function discoverFlowFiles(dir: string): string[];
309
309
  * Also detects device/platform metadata from log content.
310
310
  */
311
311
 
312
- declare function parseLogContent(content: string): MaestroLogEntry[];
313
- declare function parseLogFile(filePath: string): MaestroLogEntry[];
312
+ /**
313
+ * @param defaultDate Either an ISO date string (`YYYY-MM-DD`) or a Date object.
314
+ * Used to anchor log lines that only carry a wall-clock time (`HH:MM:SS`).
315
+ * Callers should pass the log file's mtime as a Date so the local-zone
316
+ * conversion produces a correct UTC ISO timestamp for log entries. When a
317
+ * plain string is passed, the timestamp is constructed without TZ-shift
318
+ * compensation (legacy behaviour — may be off by the local UTC offset).
319
+ */
320
+ declare function parseLogContent(content: string, defaultDate?: string | Date): MaestroLogEntry[];
321
+ declare function parseLogFile(filePath: string, defaultDate?: string | Date): MaestroLogEntry[];
314
322
  declare function detectPlatformFromLogs(entries: MaestroLogEntry[]): MaestroPlatform;
315
323
  declare function discoverLogFiles(dir: string): string[];
316
324
 
@@ -406,78 +414,6 @@ interface RunMaestroExtras {
406
414
  }
407
415
  declare function runMaestro(options: MaestroTestOptions, extras?: RunMaestroExtras): Promise<MaestroRunResult>;
408
416
 
409
- /**
410
- * Report orchestrator — ties all parsers together to produce
411
- * a TestRunReport from Maestro's output artifacts.
412
- */
413
-
414
- interface OrchestratorInput {
415
- readonly junitPath?: string;
416
- readonly testOutputDir?: string;
417
- readonly debugOutputDir?: string;
418
- readonly flowsDir?: string;
419
- readonly config: ResolvedMaestroConfig;
420
- /** Device serial / name used during this run, e.g. "emulator-5554". Passed through to each flow result and uploaded as deviceName. */
421
- readonly device?: string;
422
- /**
423
- * Explicit mobile platform override ('android' | 'ios').
424
- * When set, this takes precedence over log-based detection so callers that
425
- * already know the target platform (e.g. the E2E script using adb) do not
426
- * rely on heuristic detection that may return 'unknown'.
427
- */
428
- readonly platform?: MaestroPlatform;
429
- /**
430
- * Directory containing JSONL files emitted by `network-proxy.ts` (mitmproxy
431
- * addon). When omitted, the orchestrator still picks up `config.network.harPath`
432
- * if set. Unrelated to Maestro's own debug output.
433
- */
434
- readonly networkJsonlDir?: string | null;
435
- }
436
- interface OrchestratorResult {
437
- readonly report: TestRunReport;
438
- readonly flowResults: MaestroFlowResult[];
439
- readonly aiDefects: AIDefect[];
440
- readonly artifacts: CollectedArtifacts;
441
- }
442
- declare function orchestrateReport(input: OrchestratorInput): Promise<OrchestratorResult>;
443
-
444
- /**
445
- * CloudClient — manages cloud connectivity lifecycle for Maestro analytics.
446
- * Handles auth, repo resolution, token refresh, and queue flush.
447
- */
448
-
449
- declare class CloudClient {
450
- private config;
451
- private authState;
452
- private gitMetadata;
453
- private repoId;
454
- private failureReason;
455
- private flushPromise;
456
- private healthCheckTimer;
457
- constructor(cloudConfig: CloudConfig | null);
458
- initialize(): Promise<void>;
459
- getMode(): AuthMode;
460
- isCloudMode(): boolean;
461
- isLocalMode(): boolean;
462
- getAccessToken(): string | null;
463
- getRepoId(): string | null;
464
- getGitMetadata(): GitMetadata | null;
465
- getConfig(): CloudConfig | null;
466
- getFailureReason(): string | null;
467
- getEndpoint(): string;
468
- ensureValidToken(): Promise<boolean>;
469
- switchToLocalMode(reason: string): void;
470
- dispose(): Promise<void>;
471
- private setLocalMode;
472
- private handleAuthError;
473
- private resolveRepoId;
474
- private readRepoCache;
475
- private writeRepoCache;
476
- private hashApiKey;
477
- private startBackgroundFlush;
478
- private startHealthCheck;
479
- }
480
-
481
417
  /**
482
418
  * Cloud upload — batch and realtime upload functions.
483
419
  * Adapted from appium-analytics with testFramework: 'maestro'.
@@ -523,6 +459,23 @@ interface TestResultForUpload {
523
459
  * via Ask AI's `query_network_logs` tool — works for free, no cloud changes.
524
460
  */
525
461
  readonly apiCalls?: readonly ApiCallRecord[];
462
+ /**
463
+ * Per-flow ActionStep array (mapped from Maestro `commands` + `assertions`,
464
+ * sorted by timestamp + sequenceNumber, with `retry`/`repeat` children
465
+ * nested under their wrapper and `videoOffset` computed from
466
+ * `flow.startedAt`). The cloud server's per-test ingest path
467
+ * (`server/src/services/run.service.ts:uploadTest` → `enrichTimeline` →
468
+ * OpenObserve `timeline_{orgId}` + RustFS `actions.json`) consumes this
469
+ * and powers the Session Workspace's Steps + Assertions tabs and Ask AI's
470
+ * `query_test_steps` tool.
471
+ *
472
+ * The same array also rides on `timeline[i].tests[j].actions` in the
473
+ * upload's `timeline` field — but the cloud's per-test ingest path keys off
474
+ * `tests[].actions`. Without this field, Maestro test detail pages show
475
+ * "No step data available" even though the run summary reports correct step
476
+ * counts. See issue #77.
477
+ */
478
+ readonly actions?: readonly ActionStep[];
526
479
  }
527
480
  interface RunUploadPayload {
528
481
  readonly runId: string;
@@ -581,6 +534,78 @@ declare function finalizeRun(endpoint: string, accessToken: string, cloudRunId:
581
534
  commitMessage?: string | null;
582
535
  }): Promise<boolean>;
583
536
 
537
+ /**
538
+ * Report orchestrator — ties all parsers together to produce
539
+ * a TestRunReport from Maestro's output artifacts.
540
+ */
541
+
542
+ interface OrchestratorInput {
543
+ readonly junitPath?: string;
544
+ readonly testOutputDir?: string;
545
+ readonly debugOutputDir?: string;
546
+ readonly flowsDir?: string;
547
+ readonly config: ResolvedMaestroConfig;
548
+ /** Device serial / name used during this run, e.g. "emulator-5554". Passed through to each flow result and uploaded as deviceName. */
549
+ readonly device?: string;
550
+ /**
551
+ * Explicit mobile platform override ('android' | 'ios').
552
+ * When set, this takes precedence over log-based detection so callers that
553
+ * already know the target platform (e.g. the E2E script using adb) do not
554
+ * rely on heuristic detection that may return 'unknown'.
555
+ */
556
+ readonly platform?: MaestroPlatform;
557
+ /**
558
+ * Directory containing JSONL files emitted by `network-proxy.ts` (mitmproxy
559
+ * addon). When omitted, the orchestrator still picks up `config.network.harPath`
560
+ * if set. Unrelated to Maestro's own debug output.
561
+ */
562
+ readonly networkJsonlDir?: string | null;
563
+ }
564
+ interface OrchestratorResult {
565
+ readonly report: TestRunReport;
566
+ readonly flowResults: MaestroFlowResult[];
567
+ readonly aiDefects: AIDefect[];
568
+ readonly artifacts: CollectedArtifacts;
569
+ }
570
+ declare function orchestrateReport(input: OrchestratorInput): Promise<OrchestratorResult>;
571
+
572
+ /**
573
+ * CloudClient — manages cloud connectivity lifecycle for Maestro analytics.
574
+ * Handles auth, repo resolution, token refresh, and queue flush.
575
+ */
576
+
577
+ declare class CloudClient {
578
+ private config;
579
+ private authState;
580
+ private gitMetadata;
581
+ private repoId;
582
+ private failureReason;
583
+ private flushPromise;
584
+ private healthCheckTimer;
585
+ constructor(cloudConfig: CloudConfig | null);
586
+ initialize(): Promise<void>;
587
+ getMode(): AuthMode;
588
+ isCloudMode(): boolean;
589
+ isLocalMode(): boolean;
590
+ getAccessToken(): string | null;
591
+ getRepoId(): string | null;
592
+ getGitMetadata(): GitMetadata | null;
593
+ getConfig(): CloudConfig | null;
594
+ getFailureReason(): string | null;
595
+ getEndpoint(): string;
596
+ ensureValidToken(): Promise<boolean>;
597
+ switchToLocalMode(reason: string): void;
598
+ dispose(): Promise<void>;
599
+ private setLocalMode;
600
+ private handleAuthError;
601
+ private resolveRepoId;
602
+ private readRepoCache;
603
+ private writeRepoCache;
604
+ private hashApiKey;
605
+ private startBackgroundFlush;
606
+ private startHealthCheck;
607
+ }
608
+
584
609
  /**
585
610
  * Cloud reporter orchestration for Maestro analytics.
586
611
  * Handles batch upload and artifact upload to the TestRelic platform.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { TestStatus, CloudReporterOptions, ReportMode, CloudConfig, ApiCallRecord, TimelineEntry, Summary, TestRunReport, AuthMode, GitMetadata, TimelineStep, CIMetadata } from '@testrelic/core';
1
+ import { TestStatus, CloudReporterOptions, ReportMode, CloudConfig, ApiCallRecord, TimelineEntry, Summary, TestRunReport, TimelineStep, ActionStep, GitMetadata, CIMetadata, AuthMode } from '@testrelic/core';
2
2
  export { ActionCategory, ActionStep, ArtifactRunManifest, AuthMode, AuthState, CIMetadata, CIProvider, CloudConfig, CloudReporterOptions, ConsoleLogEntry, ConsoleLogLevel, FailureDiagnostic, GitMetadata, MergeOptions, QueueEntry, ReportMode, StreamingReportSummary, Summary, TestArtifacts, TestDetailData, TestIndexEntry, TestResult, TestRunReport, TestStatus, TimelineEntry, TimelineStep, UploadStrategy } from '@testrelic/core';
3
3
  export { mergeReports, mergeReportsFromDirectory } from './merge.js';
4
4
 
@@ -309,8 +309,16 @@ declare function discoverFlowFiles(dir: string): string[];
309
309
  * Also detects device/platform metadata from log content.
310
310
  */
311
311
 
312
- declare function parseLogContent(content: string): MaestroLogEntry[];
313
- declare function parseLogFile(filePath: string): MaestroLogEntry[];
312
+ /**
313
+ * @param defaultDate Either an ISO date string (`YYYY-MM-DD`) or a Date object.
314
+ * Used to anchor log lines that only carry a wall-clock time (`HH:MM:SS`).
315
+ * Callers should pass the log file's mtime as a Date so the local-zone
316
+ * conversion produces a correct UTC ISO timestamp for log entries. When a
317
+ * plain string is passed, the timestamp is constructed without TZ-shift
318
+ * compensation (legacy behaviour — may be off by the local UTC offset).
319
+ */
320
+ declare function parseLogContent(content: string, defaultDate?: string | Date): MaestroLogEntry[];
321
+ declare function parseLogFile(filePath: string, defaultDate?: string | Date): MaestroLogEntry[];
314
322
  declare function detectPlatformFromLogs(entries: MaestroLogEntry[]): MaestroPlatform;
315
323
  declare function discoverLogFiles(dir: string): string[];
316
324
 
@@ -406,78 +414,6 @@ interface RunMaestroExtras {
406
414
  }
407
415
  declare function runMaestro(options: MaestroTestOptions, extras?: RunMaestroExtras): Promise<MaestroRunResult>;
408
416
 
409
- /**
410
- * Report orchestrator — ties all parsers together to produce
411
- * a TestRunReport from Maestro's output artifacts.
412
- */
413
-
414
- interface OrchestratorInput {
415
- readonly junitPath?: string;
416
- readonly testOutputDir?: string;
417
- readonly debugOutputDir?: string;
418
- readonly flowsDir?: string;
419
- readonly config: ResolvedMaestroConfig;
420
- /** Device serial / name used during this run, e.g. "emulator-5554". Passed through to each flow result and uploaded as deviceName. */
421
- readonly device?: string;
422
- /**
423
- * Explicit mobile platform override ('android' | 'ios').
424
- * When set, this takes precedence over log-based detection so callers that
425
- * already know the target platform (e.g. the E2E script using adb) do not
426
- * rely on heuristic detection that may return 'unknown'.
427
- */
428
- readonly platform?: MaestroPlatform;
429
- /**
430
- * Directory containing JSONL files emitted by `network-proxy.ts` (mitmproxy
431
- * addon). When omitted, the orchestrator still picks up `config.network.harPath`
432
- * if set. Unrelated to Maestro's own debug output.
433
- */
434
- readonly networkJsonlDir?: string | null;
435
- }
436
- interface OrchestratorResult {
437
- readonly report: TestRunReport;
438
- readonly flowResults: MaestroFlowResult[];
439
- readonly aiDefects: AIDefect[];
440
- readonly artifacts: CollectedArtifacts;
441
- }
442
- declare function orchestrateReport(input: OrchestratorInput): Promise<OrchestratorResult>;
443
-
444
- /**
445
- * CloudClient — manages cloud connectivity lifecycle for Maestro analytics.
446
- * Handles auth, repo resolution, token refresh, and queue flush.
447
- */
448
-
449
- declare class CloudClient {
450
- private config;
451
- private authState;
452
- private gitMetadata;
453
- private repoId;
454
- private failureReason;
455
- private flushPromise;
456
- private healthCheckTimer;
457
- constructor(cloudConfig: CloudConfig | null);
458
- initialize(): Promise<void>;
459
- getMode(): AuthMode;
460
- isCloudMode(): boolean;
461
- isLocalMode(): boolean;
462
- getAccessToken(): string | null;
463
- getRepoId(): string | null;
464
- getGitMetadata(): GitMetadata | null;
465
- getConfig(): CloudConfig | null;
466
- getFailureReason(): string | null;
467
- getEndpoint(): string;
468
- ensureValidToken(): Promise<boolean>;
469
- switchToLocalMode(reason: string): void;
470
- dispose(): Promise<void>;
471
- private setLocalMode;
472
- private handleAuthError;
473
- private resolveRepoId;
474
- private readRepoCache;
475
- private writeRepoCache;
476
- private hashApiKey;
477
- private startBackgroundFlush;
478
- private startHealthCheck;
479
- }
480
-
481
417
  /**
482
418
  * Cloud upload — batch and realtime upload functions.
483
419
  * Adapted from appium-analytics with testFramework: 'maestro'.
@@ -523,6 +459,23 @@ interface TestResultForUpload {
523
459
  * via Ask AI's `query_network_logs` tool — works for free, no cloud changes.
524
460
  */
525
461
  readonly apiCalls?: readonly ApiCallRecord[];
462
+ /**
463
+ * Per-flow ActionStep array (mapped from Maestro `commands` + `assertions`,
464
+ * sorted by timestamp + sequenceNumber, with `retry`/`repeat` children
465
+ * nested under their wrapper and `videoOffset` computed from
466
+ * `flow.startedAt`). The cloud server's per-test ingest path
467
+ * (`server/src/services/run.service.ts:uploadTest` → `enrichTimeline` →
468
+ * OpenObserve `timeline_{orgId}` + RustFS `actions.json`) consumes this
469
+ * and powers the Session Workspace's Steps + Assertions tabs and Ask AI's
470
+ * `query_test_steps` tool.
471
+ *
472
+ * The same array also rides on `timeline[i].tests[j].actions` in the
473
+ * upload's `timeline` field — but the cloud's per-test ingest path keys off
474
+ * `tests[].actions`. Without this field, Maestro test detail pages show
475
+ * "No step data available" even though the run summary reports correct step
476
+ * counts. See issue #77.
477
+ */
478
+ readonly actions?: readonly ActionStep[];
526
479
  }
527
480
  interface RunUploadPayload {
528
481
  readonly runId: string;
@@ -581,6 +534,78 @@ declare function finalizeRun(endpoint: string, accessToken: string, cloudRunId:
581
534
  commitMessage?: string | null;
582
535
  }): Promise<boolean>;
583
536
 
537
+ /**
538
+ * Report orchestrator — ties all parsers together to produce
539
+ * a TestRunReport from Maestro's output artifacts.
540
+ */
541
+
542
+ interface OrchestratorInput {
543
+ readonly junitPath?: string;
544
+ readonly testOutputDir?: string;
545
+ readonly debugOutputDir?: string;
546
+ readonly flowsDir?: string;
547
+ readonly config: ResolvedMaestroConfig;
548
+ /** Device serial / name used during this run, e.g. "emulator-5554". Passed through to each flow result and uploaded as deviceName. */
549
+ readonly device?: string;
550
+ /**
551
+ * Explicit mobile platform override ('android' | 'ios').
552
+ * When set, this takes precedence over log-based detection so callers that
553
+ * already know the target platform (e.g. the E2E script using adb) do not
554
+ * rely on heuristic detection that may return 'unknown'.
555
+ */
556
+ readonly platform?: MaestroPlatform;
557
+ /**
558
+ * Directory containing JSONL files emitted by `network-proxy.ts` (mitmproxy
559
+ * addon). When omitted, the orchestrator still picks up `config.network.harPath`
560
+ * if set. Unrelated to Maestro's own debug output.
561
+ */
562
+ readonly networkJsonlDir?: string | null;
563
+ }
564
+ interface OrchestratorResult {
565
+ readonly report: TestRunReport;
566
+ readonly flowResults: MaestroFlowResult[];
567
+ readonly aiDefects: AIDefect[];
568
+ readonly artifacts: CollectedArtifacts;
569
+ }
570
+ declare function orchestrateReport(input: OrchestratorInput): Promise<OrchestratorResult>;
571
+
572
+ /**
573
+ * CloudClient — manages cloud connectivity lifecycle for Maestro analytics.
574
+ * Handles auth, repo resolution, token refresh, and queue flush.
575
+ */
576
+
577
+ declare class CloudClient {
578
+ private config;
579
+ private authState;
580
+ private gitMetadata;
581
+ private repoId;
582
+ private failureReason;
583
+ private flushPromise;
584
+ private healthCheckTimer;
585
+ constructor(cloudConfig: CloudConfig | null);
586
+ initialize(): Promise<void>;
587
+ getMode(): AuthMode;
588
+ isCloudMode(): boolean;
589
+ isLocalMode(): boolean;
590
+ getAccessToken(): string | null;
591
+ getRepoId(): string | null;
592
+ getGitMetadata(): GitMetadata | null;
593
+ getConfig(): CloudConfig | null;
594
+ getFailureReason(): string | null;
595
+ getEndpoint(): string;
596
+ ensureValidToken(): Promise<boolean>;
597
+ switchToLocalMode(reason: string): void;
598
+ dispose(): Promise<void>;
599
+ private setLocalMode;
600
+ private handleAuthError;
601
+ private resolveRepoId;
602
+ private readRepoCache;
603
+ private writeRepoCache;
604
+ private hashApiKey;
605
+ private startBackgroundFlush;
606
+ private startHealthCheck;
607
+ }
608
+
584
609
  /**
585
610
  * Cloud reporter orchestration for Maestro analytics.
586
611
  * Handles batch upload and artifact upload to the TestRelic platform.