@skyramp/mcp 0.0.33 → 0.0.34
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,5 +1,6 @@
|
|
|
1
1
|
import { SkyrampClient } from "@skyramp/skyramp";
|
|
2
2
|
import { analyzeOpenAPIWithGivenEndpoint } from "../utils/analyze-openapi.js";
|
|
3
|
+
import * as fs from "fs";
|
|
3
4
|
import { getPathParameterValidationError, OUTPUT_DIR_FIELD_NAME, PATH_PARAMS_FIELD_NAME, QUERY_PARAMS_FIELD_NAME, FORM_PARAMS_FIELD_NAME, validateParams, validatePath, validateRequestData, TELEMETRY_entrypoint_FIELD_NAME, } from "../utils/utils.js";
|
|
4
5
|
import { getLanguageSteps } from "../utils/language-helper.js";
|
|
5
6
|
import { logger } from "../utils/logger.js";
|
|
@@ -26,6 +27,11 @@ export class TestGenerationService {
|
|
|
26
27
|
if (apiAnalysisResult) {
|
|
27
28
|
return apiAnalysisResult;
|
|
28
29
|
}
|
|
30
|
+
if (params.scenarioFile) {
|
|
31
|
+
//read file and convert and pass to generateOptions as `rawTrace`
|
|
32
|
+
const scenarioFile = await fs.promises.readFile(params.scenarioFile, "utf8");
|
|
33
|
+
generateOptions.rawTrace = scenarioFile;
|
|
34
|
+
}
|
|
29
35
|
const result = await this.executeGeneration(generateOptions);
|
|
30
36
|
const testType = this.getTestType();
|
|
31
37
|
const languageSteps = getLanguageSteps({
|
|
@@ -9,9 +9,10 @@ const integrationTestSchema = z
|
|
|
9
9
|
exclude: baseTraceSchema.shape.exclude.optional(),
|
|
10
10
|
endpointURL: baseTestSchema.endpointURL.default(""),
|
|
11
11
|
...codeRefactoringSchema.shape,
|
|
12
|
-
|
|
12
|
+
scenarioFile: z
|
|
13
13
|
.string()
|
|
14
|
-
.describe("
|
|
14
|
+
.describe("Path to the scenario file to be used for test generation. This file is generated by the skyramp_scenario_test_generation tool.")
|
|
15
|
+
.optional(),
|
|
15
16
|
})
|
|
16
17
|
.omit({ method: true }).shape;
|
|
17
18
|
export class IntegrationTestService extends TestGenerationService {
|
|
@@ -23,7 +24,7 @@ export class IntegrationTestService extends TestGenerationService {
|
|
|
23
24
|
...super.buildBaseGenerationOptions(params),
|
|
24
25
|
responseData: params.responseData,
|
|
25
26
|
playwrightInput: params.playwrightInput,
|
|
26
|
-
|
|
27
|
+
scenarioFile: params.scenarioFile,
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
30
|
async handleApiAnalysis(params, generateOptions) {
|