refactor(scenario): remove validateCode — assertions live in execCode
- drop validateCode column, DTOs, service mappings, and scheduler branch - remove parseValidateResult helper and ValidateResult interface - inject playwright expect into code executor for direct use in execCode - strip validateCode from MCP tool schemas, client types, and UI forms
This commit is contained in:
1 parent
29e91b0078
commit
238c52610a
16 files changed
+32
-123
No files matched your search
@@ -6,6 +6,7 @@ import {
|
||||
import { TraceLogger } from "../common/trace-logger";
|
||||
import { parse } from "acorn";
|
||||
import type { Page, BrowserContext } from "playwright";
|
||||
import { expect as playwrightExpect } from "@playwright/test";
|
||||
import { dumpDom } from "./dom-helpers";
|
||||
import type { EnvironmentData } from "../environment/environment.entity";
|
||||
|
||||
@@ -123,19 +124,28 @@ export class CodeExecutorService {
|
||||
"helpers",
|
||||
"console",
|
||||
"snippetArgs",
|
||||
"expect",
|
||||
`return (async (page, context, helpers, ...args) => { ${snippetCode} })(page, context, helpers, ...snippetArgs)`,
|
||||
);
|
||||
return snippetFn(page, context, pageHelpers, fakeConsole, args);
|
||||
return snippetFn(
|
||||
page,
|
||||
context,
|
||||
pageHelpers,
|
||||
fakeConsole,
|
||||
args,
|
||||
playwrightExpect,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
// Passing `console` as a named parameter shadows the global in the script scope.
|
||||
// Passing `console` and `expect` as named parameters exposes them in script scope.
|
||||
const fn = new Function(
|
||||
"page",
|
||||
"context",
|
||||
"helpers",
|
||||
"console",
|
||||
"result",
|
||||
"expect",
|
||||
`return (async (page, context, helpers) => { ${code} })(page, context, helpers)`,
|
||||
);
|
||||
this.logger.debug("Executing user code");
|
||||
@@ -145,6 +155,7 @@ export class CodeExecutorService {
|
||||
pageHelpers,
|
||||
fakeConsole,
|
||||
result,
|
||||
playwrightExpect,
|
||||
);
|
||||
return { result: execResult };
|
||||
} catch (err) {
|
||||
|
||||
Reference in new issue
Block a user