@memberjunction/react-test-harness 2.90.0 → 2.92.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.
@@ -1,9 +1,15 @@
1
1
  /// <reference types="node" />
2
2
  import { BrowserManager } from './browser-context';
3
- import { LibraryConfiguration } from '@memberjunction/react-runtime';
4
- import type { UserInfo } from '@memberjunction/core';
3
+ import type { RunViewParams, RunQueryParams, UserInfo, RunViewResult, RunQueryResult, BaseEntity, EntityInfo } from '@memberjunction/core';
5
4
  import { FixSuggestion, Violation } from './component-linter';
6
5
  import { ComponentSpec } from '@memberjunction/interactive-component-types';
6
+ export interface SimpleMJUtilities {
7
+ RunView: (params: RunViewParams, contextUser: UserInfo) => Promise<RunViewResult>;
8
+ RunViews: (params: RunViewParams[], contextUser: UserInfo) => Promise<RunViewResult[]>;
9
+ RunQuery: (params: RunQueryParams, contextUser: UserInfo) => Promise<RunQueryResult>;
10
+ Entities: EntityInfo[];
11
+ GetEntityObject: (entityName: string, contextUser: UserInfo) => Promise<BaseEntity>;
12
+ }
7
13
  export interface ComponentExecutionOptions {
8
14
  componentSpec: ComponentSpec;
9
15
  props?: Record<string, any>;
@@ -14,9 +20,9 @@ export interface ComponentExecutionOptions {
14
20
  waitForSelector?: string;
15
21
  waitForLoadState?: 'load' | 'domcontentloaded' | 'networkidle';
16
22
  contextUser: UserInfo;
17
- libraryConfiguration?: LibraryConfiguration;
18
23
  isRootComponent?: boolean;
19
24
  debug?: boolean;
25
+ utilities?: SimpleMJUtilities;
20
26
  }
21
27
  export interface ComponentExecutionResult {
22
28
  success: boolean;
@@ -34,93 +40,55 @@ export interface ComponentExecutionResult {
34
40
  lintViolations?: Violation[];
35
41
  fixSuggestions?: FixSuggestion[];
36
42
  }
43
+ /**
44
+ * ComponentRunner that uses the actual React runtime via Playwright UMD bundle
45
+ */
37
46
  export declare class ComponentRunner {
38
47
  private browserManager;
39
- private compiler;
40
- private registry;
41
- private runtimeContext;
42
48
  private static readonly CRITICAL_WARNING_PATTERNS;
43
49
  private static readonly MAX_RENDER_COUNT;
44
50
  constructor(browserManager: BrowserManager);
45
51
  /**
46
52
  * Lint component code before execution
47
53
  */
48
- lintComponent(componentCode: string, componentName: string, componentSpec?: any, isRootComponent?: boolean): Promise<{
54
+ lintComponent(componentCode: string, componentName: string, componentSpec?: any, isRootComponent?: boolean, contextUser?: UserInfo): Promise<{
49
55
  violations: Violation[];
50
56
  suggestions: FixSuggestion[];
51
57
  hasErrors: boolean;
52
58
  }>;
53
59
  executeComponent(options: ComponentExecutionOptions): Promise<ComponentExecutionResult>;
54
60
  /**
55
- * Dumps debug information to console for easier troubleshooting
56
- */
57
- private dumpDebugInfo;
58
- private createHTMLTemplate;
59
- /**
60
- * Checks if a console message is a warning
61
- */
62
- private isWarning;
63
- /**
64
- * Checks if a warning is critical and should fail the test
65
- */
66
- private isCriticalWarning;
67
- /**
68
- * Sets up console logging with warning detection
69
- */
70
- private setupConsoleLogging;
71
- /**
72
- * Sets up error handling for the page
61
+ * Load runtime libraries into the page
73
62
  */
74
- private setupErrorHandling;
63
+ private loadRuntimeLibraries;
75
64
  /**
76
- * Injects render tracking code into the page
65
+ * Load component-specific libraries from CDN
77
66
  */
78
- private injectRenderTracking;
67
+ private loadComponentLibraries;
79
68
  /**
80
- * Waits for component to render and checks for timeouts
69
+ * Set up error tracking in the page
81
70
  */
82
- private waitForRender;
71
+ private setupErrorTracking;
83
72
  /**
84
- * Gets the render count from the page
85
- */
86
- private getRenderCount;
87
- /**
88
- * Collects runtime errors that were caught during component execution
73
+ * Collect runtime errors from the page
89
74
  */
90
75
  private collectRuntimeErrors;
91
76
  /**
92
- * Captures async errors by waiting for asynchronous operations to complete
93
- * This catches errors from setTimeout, setInterval, Promises, and async effects
77
+ * Collect warnings from the page (non-fatal issues)
94
78
  */
95
- private captureAsyncErrors;
79
+ private collectWarnings;
96
80
  /**
97
- * Performs deep render validation to catch errors that might be in the DOM
81
+ * Set up console logging
98
82
  */
99
- private validateDeepRender;
100
- /**
101
- * Determines if the component execution was successful
102
- */
103
- private determineSuccess;
83
+ private setupConsoleLogging;
84
+ private buildLocalMJUtilities;
104
85
  /**
105
- * Expose MemberJunction utilities to the browser context
86
+ * Expose MJ utilities to the browser context
106
87
  */
107
88
  private exposeMJUtilities;
108
89
  /**
109
- * Analyze component errors to identify failed components
110
- * @param errors Array of error messages
111
- * @returns Array of component names that failed
90
+ * Dump debug information
112
91
  */
113
- static analyzeComponentErrors(errors: string[]): string[];
114
- /**
115
- * Get detailed error analysis
116
- * @param errors Array of error messages
117
- * @returns Detailed failure information
118
- */
119
- static getDetailedErrorAnalysis(errors: string[]): import("@memberjunction/react-runtime").FailedComponentInfo[];
120
- /**
121
- * Gets the ComponentCompiler code to inject into the browser
122
- * This is a simplified version that works in the browser context
123
- */
124
- private getComponentCompilerCode;
92
+ private dumpDebugInfo;
125
93
  }
126
94
  //# sourceMappingURL=component-runner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"component-runner.d.ts","sourceRoot":"","sources":["../../src/lib/component-runner.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAML,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAiC,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAmB,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAE5E,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAA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