@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.
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/browser-context.d.ts.map +1 -1
- package/dist/lib/browser-context.js +6 -2
- package/dist/lib/browser-context.js.map +1 -1
- package/dist/lib/component-linter.d.ts +31 -1
- package/dist/lib/component-linter.d.ts.map +1 -1
- package/dist/lib/component-linter.js +4292 -703
- package/dist/lib/component-linter.js.map +1 -1
- package/dist/lib/component-runner.d.ts +28 -60
- package/dist/lib/component-runner.d.ts.map +1 -1
- package/dist/lib/component-runner.js +981 -1004
- package/dist/lib/component-runner.js.map +1 -1
- package/dist/lib/library-lint-cache.d.ts +46 -0
- package/dist/lib/library-lint-cache.d.ts.map +1 -0
- package/dist/lib/library-lint-cache.js +119 -0
- package/dist/lib/library-lint-cache.js.map +1 -0
- package/dist/lib/test-harness.d.ts +1 -0
- package/dist/lib/test-harness.d.ts.map +1 -1
- package/dist/lib/test-harness.js +1 -1
- package/dist/lib/test-harness.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { BrowserManager } from './browser-context';
|
|
3
|
-
import {
|
|
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
|
-
*
|
|
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
|
|
63
|
+
private loadRuntimeLibraries;
|
|
75
64
|
/**
|
|
76
|
-
*
|
|
65
|
+
* Load component-specific libraries from CDN
|
|
77
66
|
*/
|
|
78
|
-
private
|
|
67
|
+
private loadComponentLibraries;
|
|
79
68
|
/**
|
|
80
|
-
*
|
|
69
|
+
* Set up error tracking in the page
|
|
81
70
|
*/
|
|
82
|
-
private
|
|
71
|
+
private setupErrorTracking;
|
|
83
72
|
/**
|
|
84
|
-
*
|
|
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
|
-
*
|
|
93
|
-
* This catches errors from setTimeout, setInterval, Promises, and async effects
|
|
77
|
+
* Collect warnings from the page (non-fatal issues)
|
|
94
78
|
*/
|
|
95
|
-
private
|
|
79
|
+
private collectWarnings;
|
|
96
80
|
/**
|
|
97
|
-
*
|
|
81
|
+
* Set up console logging
|
|
98
82
|
*/
|
|
99
|
-
private
|
|
100
|
-
|
|
101
|
-
* Determines if the component execution was successful
|
|
102
|
-
*/
|
|
103
|
-
private determineSuccess;
|
|
83
|
+
private setupConsoleLogging;
|
|
84
|
+
private buildLocalMJUtilities;
|
|
104
85
|
/**
|
|
105
|
-
* Expose
|
|
86
|
+
* Expose MJ utilities to the browser context
|
|
106
87
|
*/
|
|
107
88
|
private exposeMJUtilities;
|
|
108
89
|
/**
|
|
109
|
-
*
|
|
110
|
-
* @param errors Array of error messages
|
|
111
|
-
* @returns Array of component names that failed
|
|
90
|
+
* Dump debug information
|
|
112
91
|
*/
|
|
113
|
-
|
|
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;
|
|
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;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC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