/** * generate-test.ts * * Implements the pwpilot_generate_test MCP tool. * * Architecture: MCP does the heavy work locally, Claude only writes the spec. * * MCP produces: * - Complete POM (PlaywrightGenerationSkill) — Claude saves it verbatim * - Compact element table (key / action / locator / method) * - Ordered flow steps with ready-to-use assertions (AssertionGenerationSkill) * - Codebase profile (patterns from existing project, or PlayGen defaults) * * Claude does: * - Reads the compact structured context (~300-500 tokens) * - Writes ONLY the test spec using the provided POM methods and step list * - Calls pwpilot_save_test with spec + the MCP-generated POM * * Token budget target: <600 tokens in the prompt sent to Claude. * * Role in the overall flow: * pwpilot_analyze_page → PageAnalysis stored in memory * pwpilot_generate_test → generateTest() → specGenerationPrompt sent to Claude * Claude writes spec → pwpilot_save_test */ import { ElementContext, PageAnalysis } from '../../types'; import { SkillOrchestrator } from '../../skills/skill-orchestrator'; /** * The object returned to the MCP server after all skills have run and the * spec-generation prompt has been assembled. */ export interface GenerateTestOutput { /** Full DOM analysis of the page (passed through for reference). */ pageAnalysis: PageAnalysis; /** Element contexts produced by the PlaywrightGenerationSkill. */ elementContexts: ElementContext[]; /** Complete Page Object Model TypeScript code — MCP-generated, Claude saves verbatim. */ pomCode: string; /** Compact prompt for Claude to write ONLY the spec file. */ specGenerationPrompt: string; /** Detected or inferred codebase style information. */ codebaseProfile: { isNewCodebase: boolean; testStyle: string; testDirectory: string; pomDirectory: string; }; } /** * Run all relevant skills against the page analysis, generate the complete POM, * compress the element and step tables, and build a minimal prompt for Claude to * write only the Playwright spec file. * * @param pageAnalysis - The DOM analysis result from the previous analyze_page call. * @param userPrompt - The user's description of what to automate (verbatim). * @param orchestrator - The SkillOrchestrator that runs all local analysis skills. * @param cwd - Optional path to the target project root for codebase detection. * @returns A GenerateTestOutput containing the POM code, element contexts, and the * compact prompt that Claude should use to write the spec. */ export declare function generateTest(pageAnalysis: PageAnalysis, userPrompt: string, orchestrator: SkillOrchestrator, cwd?: string): Promise; //# sourceMappingURL=generate-test.d.ts.map