donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
56 lines • 2.27 kB
TypeScript
/**
* A class that handles the updating of test files based on test failures.
*/
export declare class TestFileUpdater {
/**
* Updates a specific test case in a test file with new test code.
*
* @param testFilePath The path to the test file to update
* @param testName The name of the test case to update
* @param newTestCode The new test code to replace the old test with
* @param options Options for updating the file
* @returns True if the update was successful, false otherwise
*/
static updateTestCase(testFilePath: string, testName: string, newTestCode: string): Promise<boolean>;
/**
* Extracts a specific test case from source code.
*
* @param sourceFile The TypeScript source file
* @param sourceCode The original source code string
* @param testName The name of the test to extract
* @returns The extracted test code or null if not found
*/
private static extractTestCase;
/**
* Finds a specific test case in the original code and replaces it with new code.
*
* @param sourceFile The TypeScript source file
* @param sourceCode The original source code string
* @param testName The name of the test to replace
* @param newTestCode The new test code to insert
* @returns The updated source code
*/
private static findAndReplaceTestCase;
/**
* Checks if a node is a test definition (test or it function call).
*/
private static isTestNode;
/**
* Gets the title string from a test node.
*/
private static getTestTitle;
/**
* Checks if a test title matches the target test name.
*/
private static testTitleMatches;
/**
* Updates a test file based on a Playwright JSON reporter output.
*
* @param jsonReportPath Path to the Playwright JSON report
* @param testFilePath Path to the test file to update (if not specified, will be extracted from the report)
* @param newTestCode The new test code
* @returns True if the update was successful, false otherwise
*/
static updateFromPlaywrightReport(jsonReportPath: string, newTestCode: string, testFilePath?: string): Promise<boolean>;
}
//# sourceMappingURL=TestFileUpdater.d.ts.map