testchimp-runner-core 0.0.35 → 0.0.37
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/orchestrator/orchestrator-agent.d.ts.map +1 -1
- package/dist/orchestrator/orchestrator-agent.js +7 -4
- package/dist/orchestrator/orchestrator-agent.js.map +1 -1
- package/dist/orchestrator/orchestrator-prompts.d.ts.map +1 -1
- package/dist/orchestrator/orchestrator-prompts.js +73 -15
- package/dist/orchestrator/orchestrator-prompts.js.map +1 -1
- package/dist/orchestrator/page-som-handler.d.ts +1 -2
- package/dist/orchestrator/page-som-handler.d.ts.map +1 -1
- package/dist/orchestrator/page-som-handler.js +51 -25
- package/dist/orchestrator/page-som-handler.js.map +1 -1
- package/package.json +6 -1
- package/plandocs/BEFORE_AFTER_VERIFICATION.md +0 -148
- package/plandocs/COORDINATE_MODE_DIAGNOSIS.md +0 -144
- package/plandocs/CREDIT_CALLBACK_ARCHITECTURE.md +0 -253
- package/plandocs/HUMAN_LIKE_IMPROVEMENTS.md +0 -642
- package/plandocs/IMPLEMENTATION_STATUS.md +0 -108
- package/plandocs/INTEGRATION_COMPLETE.md +0 -322
- package/plandocs/MULTI_AGENT_ARCHITECTURE_REVIEW.md +0 -844
- package/plandocs/ORCHESTRATOR_MVP_SUMMARY.md +0 -539
- package/plandocs/PHASE1_ABSTRACTION_COMPLETE.md +0 -241
- package/plandocs/PHASE1_FINAL_STATUS.md +0 -210
- package/plandocs/PHASE_1_COMPLETE.md +0 -165
- package/plandocs/PHASE_1_SUMMARY.md +0 -184
- package/plandocs/PLANNING_SESSION_SUMMARY.md +0 -372
- package/plandocs/PROMPT_OPTIMIZATION_ANALYSIS.md +0 -120
- package/plandocs/PROMPT_SANITY_CHECK.md +0 -120
- package/plandocs/SCRIPT_CLEANUP_FEATURE.md +0 -201
- package/plandocs/SCRIPT_GENERATION_ARCHITECTURE.md +0 -364
- package/plandocs/SELECTOR_IMPROVEMENTS.md +0 -139
- package/plandocs/SESSION_SUMMARY_v0.0.33.md +0 -151
- package/plandocs/TROUBLESHOOTING_SESSION.md +0 -72
- package/plandocs/VISION_DIAGNOSTICS_IMPROVEMENTS.md +0 -336
- package/plandocs/VISUAL_AGENT_EVOLUTION_PLAN.md +0 -396
- package/plandocs/WHATS_NEW_v0.0.33.md +0 -183
- package/plandocs/exploratory-mode-support-v2.plan.md +0 -953
- package/plandocs/exploratory-mode-support.plan.md +0 -928
- package/plandocs/journey-id-tracking-addendum.md +0 -227
- package/releasenotes/RELEASE_0.0.26.md +0 -165
- package/releasenotes/RELEASE_0.0.27.md +0 -236
- package/releasenotes/RELEASE_0.0.28.md +0 -286
- package/src/auth-config.ts +0 -84
- package/src/credit-usage-service.ts +0 -188
- package/src/env-loader.ts +0 -103
- package/src/execution-service.ts +0 -996
- package/src/file-handler.ts +0 -104
- package/src/index.ts +0 -432
- package/src/llm-facade.ts +0 -821
- package/src/llm-provider.ts +0 -53
- package/src/model-constants.ts +0 -35
- package/src/orchestrator/decision-parser.ts +0 -139
- package/src/orchestrator/index.ts +0 -58
- package/src/orchestrator/orchestrator-agent.ts +0 -1282
- package/src/orchestrator/orchestrator-prompts.ts +0 -786
- package/src/orchestrator/page-som-handler.ts +0 -1565
- package/src/orchestrator/som-types.ts +0 -188
- package/src/orchestrator/tool-registry.ts +0 -184
- package/src/orchestrator/tools/check-page-ready.ts +0 -75
- package/src/orchestrator/tools/extract-data.ts +0 -92
- package/src/orchestrator/tools/index.ts +0 -15
- package/src/orchestrator/tools/inspect-page.ts +0 -42
- package/src/orchestrator/tools/recall-history.ts +0 -72
- package/src/orchestrator/tools/refresh-som-markers.ts +0 -69
- package/src/orchestrator/tools/take-screenshot.ts +0 -128
- package/src/orchestrator/tools/verify-action-result.ts +0 -159
- package/src/orchestrator/tools/view-previous-screenshot.ts +0 -103
- package/src/orchestrator/types.ts +0 -291
- package/src/playwright-mcp-service.ts +0 -224
- package/src/progress-reporter.ts +0 -144
- package/src/prompts.ts +0 -842
- package/src/providers/backend-proxy-llm-provider.ts +0 -91
- package/src/providers/local-llm-provider.ts +0 -38
- package/src/scenario-service.ts +0 -252
- package/src/scenario-worker-class.ts +0 -1110
- package/src/script-utils.ts +0 -203
- package/src/types.ts +0 -239
- package/src/utils/browser-utils.ts +0 -348
- package/src/utils/coordinate-converter.ts +0 -162
- package/src/utils/page-info-retry.ts +0 -65
- package/src/utils/page-info-utils.ts +0 -285
- package/testchimp-runner-core-0.0.35.tgz +0 -0
- package/tsconfig.json +0 -19
package/src/script-utils.ts
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Script Generation Utilities
|
|
3
|
-
*
|
|
4
|
-
* This module provides utilities for generating and formatting test scripts
|
|
5
|
-
* with TestChimp-specific markers and comments.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* TestChimp smart test comment that should be added to all generated scripts
|
|
10
|
-
*/
|
|
11
|
-
export const TESTCHIMP_SMART_COMMENT = `/*
|
|
12
|
-
|
|
13
|
-
This is a TestChimp Smart Test.
|
|
14
|
-
Version: 1.0
|
|
15
|
-
|
|
16
|
-
*/`;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Generates TestChimp smart test comment with optional repair advice and hashtags
|
|
20
|
-
* @param repairAdvice Optional repair advice to include in the comment
|
|
21
|
-
* @param hashtags Optional hashtags for semantic grouping
|
|
22
|
-
* @returns The complete comment block
|
|
23
|
-
*/
|
|
24
|
-
export function generateTestChimpComment(repairAdvice?: string, hashtags?: string[]): string {
|
|
25
|
-
const hashtagString = hashtags ? hashtags.map(tag => tag.startsWith('#') ? tag : `#${tag}`).join(' ') : '';
|
|
26
|
-
|
|
27
|
-
if (repairAdvice) {
|
|
28
|
-
return `/*
|
|
29
|
-
|
|
30
|
-
This is a TestChimp Smart Test.
|
|
31
|
-
Version: 1.0
|
|
32
|
-
|
|
33
|
-
${hashtagString}
|
|
34
|
-
|
|
35
|
-
Repair Advice:
|
|
36
|
-
${repairAdvice}
|
|
37
|
-
|
|
38
|
-
*/`;
|
|
39
|
-
}
|
|
40
|
-
return `/*
|
|
41
|
-
|
|
42
|
-
This is a TestChimp Smart Test.
|
|
43
|
-
Version: 1.0
|
|
44
|
-
|
|
45
|
-
${hashtagString}
|
|
46
|
-
|
|
47
|
-
*/`;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Extracts hashtags from an existing TestChimp comment
|
|
52
|
-
* @param script The script content containing the comment
|
|
53
|
-
* @returns Array of hashtags found in the comment
|
|
54
|
-
*/
|
|
55
|
-
export function extractHashtagsFromComment(script: string): string[] {
|
|
56
|
-
const commentMatch = script.match(/\/\*[\s\S]*?This is a TestChimp (Managed|Smart) Test\.[\s\S]*?\*\//);
|
|
57
|
-
if (!commentMatch) {
|
|
58
|
-
return [];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const comment = commentMatch[0];
|
|
62
|
-
// Look for any line in the comment that starts with #
|
|
63
|
-
const hashtags: string[] = [];
|
|
64
|
-
const lines = comment.split('\n');
|
|
65
|
-
|
|
66
|
-
for (const line of lines) {
|
|
67
|
-
const trimmedLine = line.trim();
|
|
68
|
-
if (trimmedLine.startsWith('#')) {
|
|
69
|
-
// Extract hashtags from this line
|
|
70
|
-
const lineHashtags = trimmedLine.match(/#\w+/g) || [];
|
|
71
|
-
hashtags.push(...lineHashtags);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return hashtags;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Adds the TestChimp smart test comment to the beginning of a script
|
|
80
|
-
* @param script The original script content
|
|
81
|
-
* @param repairAdvice Optional repair advice to include in the comment
|
|
82
|
-
* @param hashtags Optional hashtags for semantic grouping
|
|
83
|
-
* @returns The script with TestChimp comment prepended
|
|
84
|
-
*/
|
|
85
|
-
export function addTestChimpComment(script: string, repairAdvice?: string, hashtags?: string[]): string {
|
|
86
|
-
// If the script already has the TestChimp comment, update it with repair advice if provided
|
|
87
|
-
// Prioritize Smart Test detection, fallback to Managed Test for backward compatibility
|
|
88
|
-
if (script.includes('This is a TestChimp Smart Test') || script.includes('This is a TestChimp Managed Test')) {
|
|
89
|
-
if (repairAdvice) {
|
|
90
|
-
// Extract existing hashtags from the current comment
|
|
91
|
-
const existingHashtags = extractHashtagsFromComment(script);
|
|
92
|
-
// Use existing hashtags if no new ones provided, otherwise use new ones
|
|
93
|
-
const finalHashtags = hashtags && hashtags.length > 0 ? hashtags : existingHashtags;
|
|
94
|
-
|
|
95
|
-
// Replace existing comment with new one that includes repair advice and preserved hashtags
|
|
96
|
-
const commentRegex = /\/\*[\s\S]*?This is a TestChimp (Managed|Smart) Test\.[\s\S]*?\*\//;
|
|
97
|
-
const newComment = generateTestChimpComment(repairAdvice, finalHashtags);
|
|
98
|
-
return script.replace(commentRegex, newComment);
|
|
99
|
-
}
|
|
100
|
-
return script;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Add the comment at the beginning of the script
|
|
104
|
-
const comment = generateTestChimpComment(repairAdvice, hashtags);
|
|
105
|
-
return `${comment}\n\n${script}`;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Generates a complete test script with TestChimp comment, imports, and test structure
|
|
110
|
-
* @param testName The name of the test
|
|
111
|
-
* @param steps Array of test steps with descriptions and commands
|
|
112
|
-
* @param repairAdvice Optional repair advice to include in the comment
|
|
113
|
-
* @param hashtags Optional hashtags for semantic grouping
|
|
114
|
-
* @returns The complete test script
|
|
115
|
-
*/
|
|
116
|
-
export function generateTestScript(
|
|
117
|
-
testName: string,
|
|
118
|
-
steps: Array<{
|
|
119
|
-
stepNumber: number;
|
|
120
|
-
description: string;
|
|
121
|
-
playwrightCommand?: string;
|
|
122
|
-
playwrightCommands?: string[];
|
|
123
|
-
success?: boolean;
|
|
124
|
-
error?: string;
|
|
125
|
-
}>,
|
|
126
|
-
repairAdvice?: string,
|
|
127
|
-
hashtags?: string[]
|
|
128
|
-
): string {
|
|
129
|
-
const scriptLines: string[] = [];
|
|
130
|
-
|
|
131
|
-
// Always add TestChimp comment
|
|
132
|
-
const comment = generateTestChimpComment(repairAdvice, hashtags);
|
|
133
|
-
scriptLines.push(comment);
|
|
134
|
-
scriptLines.push('');
|
|
135
|
-
|
|
136
|
-
// Add imports
|
|
137
|
-
scriptLines.push(`import { test, expect } from '@playwright/test';`);
|
|
138
|
-
|
|
139
|
-
// Add test structure
|
|
140
|
-
scriptLines.push(`test('${testName.replace(/'/g, "\\'")}', async ({ page, browser, context }) => {`);
|
|
141
|
-
|
|
142
|
-
// Add steps
|
|
143
|
-
for (const step of steps) {
|
|
144
|
-
// Check if step was skipped
|
|
145
|
-
const isSkipped = step.error?.includes('Skipped due to') ||
|
|
146
|
-
(step.success === false && (!step.playwrightCommand && (!step.playwrightCommands || step.playwrightCommands.length === 0)));
|
|
147
|
-
|
|
148
|
-
if (isSkipped) {
|
|
149
|
-
// Step was skipped due to previous failures
|
|
150
|
-
scriptLines.push(` // ${step.description} [SKIPPED]`);
|
|
151
|
-
} else if (step.success === false) {
|
|
152
|
-
// Step failed - only show command if this step actually attempted any commands
|
|
153
|
-
if (step.playwrightCommands && step.playwrightCommands.length > 0) {
|
|
154
|
-
// Failed after attempting commands - show them
|
|
155
|
-
scriptLines.push(` // ${step.description} [FAILED]`);
|
|
156
|
-
step.playwrightCommands.forEach((cmd: string) => {
|
|
157
|
-
scriptLines.push(` // Attempted: ${cmd}`);
|
|
158
|
-
});
|
|
159
|
-
} else if (step.playwrightCommand) {
|
|
160
|
-
// Single command attempted (backward compatibility)
|
|
161
|
-
scriptLines.push(` // ${step.description} [FAILED] - ${step.playwrightCommand}`);
|
|
162
|
-
} else {
|
|
163
|
-
// Failed without attempting any commands
|
|
164
|
-
scriptLines.push(` // ${step.description} [FAILED]`);
|
|
165
|
-
}
|
|
166
|
-
} else {
|
|
167
|
-
// Step succeeded or in progress
|
|
168
|
-
// Only add comment if step has commands to show
|
|
169
|
-
const hasCommands = (step.playwrightCommands && step.playwrightCommands.length > 0) || step.playwrightCommand;
|
|
170
|
-
|
|
171
|
-
if (hasCommands) {
|
|
172
|
-
scriptLines.push(` // ${step.description}`);
|
|
173
|
-
|
|
174
|
-
// Handle multiple commands per step
|
|
175
|
-
if (step.playwrightCommands && step.playwrightCommands.length > 0) {
|
|
176
|
-
// Multiple commands - output all of them
|
|
177
|
-
step.playwrightCommands.forEach((cmd: string) => {
|
|
178
|
-
scriptLines.push(` ${cmd}`);
|
|
179
|
-
});
|
|
180
|
-
} else if (step.playwrightCommand) {
|
|
181
|
-
// Single command (backward compatibility)
|
|
182
|
-
scriptLines.push(` ${step.playwrightCommand}`);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
// If step has no commands, skip it entirely (work was done in previous step)
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
scriptLines.push(`});`);
|
|
190
|
-
|
|
191
|
-
return scriptLines.join('\n');
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Checks if a script is a TestChimp managed/smart test
|
|
196
|
-
* Prioritizes detection of "Smart Test" format while maintaining backward compatibility with "Managed Test"
|
|
197
|
-
* @param script The script content to check
|
|
198
|
-
* @returns True if the script contains the TestChimp smart/managed test comment
|
|
199
|
-
*/
|
|
200
|
-
export function isTestChimpManagedTest(script: string): boolean {
|
|
201
|
-
// Prioritize Smart Test detection, fallback to Managed Test for backward compatibility
|
|
202
|
-
return script.includes('This is a TestChimp Smart Test') || script.includes('This is a TestChimp Managed Test');
|
|
203
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// CORE TYPES
|
|
3
|
-
// ============================================================================
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Playwright MCP configuration - JavaScript config file content (playwright.config.js)
|
|
7
|
-
*/
|
|
8
|
-
export type PlaywrightConfig = string;
|
|
9
|
-
|
|
10
|
-
// ============================================================================
|
|
11
|
-
// SCRIPT EXECUTION TYPES
|
|
12
|
-
// ============================================================================
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Request structure for the Playwright script executor
|
|
16
|
-
*/
|
|
17
|
-
export interface PlaywrightExecutionRequest {
|
|
18
|
-
/** Main Playwright script content */
|
|
19
|
-
script: string;
|
|
20
|
-
/** Optional pre-script to run before the main script */
|
|
21
|
-
prescript?: string;
|
|
22
|
-
/** Optional post-script to run after the main script */
|
|
23
|
-
postscript?: string;
|
|
24
|
-
/** Playwright configuration file content */
|
|
25
|
-
playwrightConfig: string;
|
|
26
|
-
/** Optional GPT model to use for AI operations */
|
|
27
|
-
model?: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Response structure for the Playwright script executor
|
|
32
|
-
*/
|
|
33
|
-
export interface PlaywrightExecutionResponse {
|
|
34
|
-
/** Whether the execution was successful */
|
|
35
|
-
success: boolean;
|
|
36
|
-
/** Execution results from each script phase */
|
|
37
|
-
results: {
|
|
38
|
-
prescript?: ScriptResult;
|
|
39
|
-
script: ScriptResult;
|
|
40
|
-
postscript?: ScriptResult;
|
|
41
|
-
};
|
|
42
|
-
/** Overall execution time in milliseconds */
|
|
43
|
-
executionTime: number;
|
|
44
|
-
/** Any errors that occurred during execution */
|
|
45
|
-
error?: string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Individual script execution result
|
|
50
|
-
*/
|
|
51
|
-
export interface ScriptResult {
|
|
52
|
-
/** Whether this specific script executed successfully */
|
|
53
|
-
success: boolean;
|
|
54
|
-
/** Output from the script execution */
|
|
55
|
-
output: string;
|
|
56
|
-
/** Any errors from this script */
|
|
57
|
-
error?: string;
|
|
58
|
-
/** Execution time for this script in milliseconds */
|
|
59
|
-
executionTime: number;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// ============================================================================
|
|
63
|
-
// SCENARIO EXECUTION TYPES
|
|
64
|
-
// ============================================================================
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Scenario execution request
|
|
68
|
-
*/
|
|
69
|
-
export interface ScenarioRequest {
|
|
70
|
-
scenario: string;
|
|
71
|
-
testName?: string;
|
|
72
|
-
playwrightConfig?: PlaywrightConfig;
|
|
73
|
-
model?: string;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Scenario execution job for worker queue
|
|
78
|
-
*/
|
|
79
|
-
export interface ScenarioRunJob {
|
|
80
|
-
id: string;
|
|
81
|
-
scenario: string;
|
|
82
|
-
testName?: string;
|
|
83
|
-
playwrightConfig?: PlaywrightConfig;
|
|
84
|
-
model?: string;
|
|
85
|
-
scenarioFileName?: string;
|
|
86
|
-
|
|
87
|
-
// Optional: Provide existing browser/page/context (for server-side usage)
|
|
88
|
-
existingBrowser?: any;
|
|
89
|
-
existingContext?: any;
|
|
90
|
-
existingPage?: any;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Scenario execution response
|
|
95
|
-
*/
|
|
96
|
-
export interface ScenarioResponse {
|
|
97
|
-
success: boolean;
|
|
98
|
-
steps: ScenarioStep[];
|
|
99
|
-
generatedScript: string;
|
|
100
|
-
executionLog: string;
|
|
101
|
-
executionTime: number;
|
|
102
|
-
testName?: string;
|
|
103
|
-
preferredFileName?: string;
|
|
104
|
-
error?: string;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Individual sub-action within a step
|
|
109
|
-
*/
|
|
110
|
-
export interface SubAction {
|
|
111
|
-
command: string;
|
|
112
|
-
success: boolean;
|
|
113
|
-
error?: string;
|
|
114
|
-
retryCount: number;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Individual scenario step
|
|
119
|
-
*/
|
|
120
|
-
export interface ScenarioStep {
|
|
121
|
-
stepNumber: number;
|
|
122
|
-
description: string;
|
|
123
|
-
playwrightCommand?: string; // For backward compatibility - last successful command or aggregated command
|
|
124
|
-
playwrightCommands?: string[]; // Multiple commands for complex steps
|
|
125
|
-
subActions?: SubAction[]; // Detailed tracking of all sub-actions
|
|
126
|
-
success?: boolean;
|
|
127
|
-
error?: string;
|
|
128
|
-
retryCount?: number;
|
|
129
|
-
attempts?: Array<{
|
|
130
|
-
attemptNumber: number;
|
|
131
|
-
command?: string;
|
|
132
|
-
success: boolean;
|
|
133
|
-
error?: string;
|
|
134
|
-
timestamp: number;
|
|
135
|
-
}>;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Legacy scenario job interface (for backward compatibility)
|
|
140
|
-
*/
|
|
141
|
-
export interface ScenarioJob {
|
|
142
|
-
id: string;
|
|
143
|
-
scenario: string;
|
|
144
|
-
config?: PlaywrightConfig;
|
|
145
|
-
resolve: (result: ScenarioResponse) => void;
|
|
146
|
-
reject: (error: Error) => void;
|
|
147
|
-
|
|
148
|
-
// Optional: Provide existing browser/page/context (for server-side usage)
|
|
149
|
-
existingBrowser?: any;
|
|
150
|
-
existingContext?: any;
|
|
151
|
-
existingPage?: any;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// ============================================================================
|
|
155
|
-
// AI REPAIR TYPES
|
|
156
|
-
// ============================================================================
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Execution mode for script execution
|
|
160
|
-
*/
|
|
161
|
-
export enum ExecutionMode {
|
|
162
|
-
RUN_EXACTLY = 'RUN_EXACTLY',
|
|
163
|
-
RUN_WITH_AI_REPAIR = 'RUN_WITH_AI_REPAIR'
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Script execution request with AI repair capabilities
|
|
168
|
-
*/
|
|
169
|
-
export interface ScriptExecutionRequest {
|
|
170
|
-
script?: string; // Optional if scriptFilePath is provided
|
|
171
|
-
scriptFilePath?: string; // Path to script file (alternative to script content)
|
|
172
|
-
mode: ExecutionMode;
|
|
173
|
-
repairFlexibility?: number; // 0-5, defaults to 3
|
|
174
|
-
playwrightConfig?: PlaywrightConfig;
|
|
175
|
-
playwrightConfigFilePath?: string; // Path to playwright config file (alternative to playwrightConfig content)
|
|
176
|
-
model?: string;
|
|
177
|
-
headless?: boolean; // defaults to false (headed)
|
|
178
|
-
deflakeRunCount?: number; // Number of deflake attempts (defaults to 0, no deflaking)
|
|
179
|
-
jobId?: string; // Optional job ID for progress tracking
|
|
180
|
-
|
|
181
|
-
// For RUN_WITH_AI_REPAIR mode: whether to attempt runExactly first
|
|
182
|
-
attemptRunExactlyFirst?: boolean; // defaults to false
|
|
183
|
-
|
|
184
|
-
// For RUN_WITH_AI_REPAIR mode: pre-parsed steps (if provided, skip parsing)
|
|
185
|
-
// This preserves step IDs from sources like canonical trees
|
|
186
|
-
steps?: ScriptStep[]; // Optional pre-parsed steps with IDs
|
|
187
|
-
|
|
188
|
-
// Optional: Provide existing browser/page/context (for server-side usage)
|
|
189
|
-
// If not provided, runner-core will create its own
|
|
190
|
-
existingBrowser?: any; // Browser instance
|
|
191
|
-
existingContext?: any; // BrowserContext instance
|
|
192
|
-
existingPage?: any; // Page instance
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Script execution response with repair information
|
|
197
|
-
*/
|
|
198
|
-
export interface ScriptExecutionResponse {
|
|
199
|
-
runStatus: 'success' | 'failed';
|
|
200
|
-
repairStatus?: 'success' | 'failed' | 'partial';
|
|
201
|
-
repairConfidence?: number; // 0-5
|
|
202
|
-
repairAdvice?: string;
|
|
203
|
-
updatedScript?: string;
|
|
204
|
-
executionTime: number;
|
|
205
|
-
numDeflakeRuns?: number; // Number of deflaking runs made (excluding original run)
|
|
206
|
-
error?: string;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Individual script step for AI repair
|
|
211
|
-
*/
|
|
212
|
-
export interface ScriptStep {
|
|
213
|
-
id?: string; // Optional step ID (preserved from source, e.g., canonical tree)
|
|
214
|
-
description: string;
|
|
215
|
-
code: string;
|
|
216
|
-
success?: boolean;
|
|
217
|
-
error?: string;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Step operation types for AI repair
|
|
222
|
-
*/
|
|
223
|
-
export enum StepOperation {
|
|
224
|
-
MODIFY = 'MODIFY',
|
|
225
|
-
INSERT = 'INSERT',
|
|
226
|
-
REMOVE = 'REMOVE'
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Step repair action
|
|
231
|
-
*/
|
|
232
|
-
export interface StepRepairAction {
|
|
233
|
-
operation: StepOperation;
|
|
234
|
-
stepIndex?: number; // For MODIFY and REMOVE operations
|
|
235
|
-
newStep?: ScriptStep; // For MODIFY and INSERT operations
|
|
236
|
-
insertAfterIndex?: number; // For INSERT operation
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// Repair suggestion and confidence interfaces are now in llm-facade.ts
|