@cutleryapp/agent 1.0.26 → 1.0.28
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/mcp-executor.js +25 -1
- package/package.json +1 -1
package/dist/mcp-executor.js
CHANGED
|
@@ -14,11 +14,35 @@ class TestExecutor {
|
|
|
14
14
|
this.activeBrowser = null;
|
|
15
15
|
}
|
|
16
16
|
async execute(testCase) {
|
|
17
|
+
// Data-driven: run once per row, merging row into test_variables
|
|
18
|
+
const dataRows = testCase.test_data || [];
|
|
19
|
+
if (dataRows.length > 1) {
|
|
20
|
+
console.log(`[executor] 🗂️ Data-driven: ${dataRows.length} rows`);
|
|
21
|
+
const allResults = [];
|
|
22
|
+
for (let i = 0; i < dataRows.length; i++) {
|
|
23
|
+
console.log(`[executor] 🗂️ Row ${i + 1}/${dataRows.length}:`, JSON.stringify(dataRows[i]));
|
|
24
|
+
const rowResult = await this.execute({
|
|
25
|
+
...testCase,
|
|
26
|
+
test_variables: { ...(testCase.test_variables || {}), ...dataRows[i] },
|
|
27
|
+
test_data: [],
|
|
28
|
+
});
|
|
29
|
+
allResults.push(rowResult);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
success: allResults.every(r => r.success),
|
|
33
|
+
steps: allResults.flatMap((r, i) => r.steps.map(s => ({ ...s, step: `[Row ${i + 1}] ${s.step}` }))),
|
|
34
|
+
screenshots: allResults.flatMap(r => r.screenshots),
|
|
35
|
+
error: allResults.find(r => r.error)?.error,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
17
38
|
const result = { success: true, steps: [], screenshots: [] };
|
|
18
39
|
if (!(0, fs_1.existsSync)(this.options.outputDir)) {
|
|
19
40
|
(0, fs_1.mkdirSync)(this.options.outputDir, { recursive: true });
|
|
20
41
|
}
|
|
21
|
-
|
|
42
|
+
// Merge single data row into variables if present
|
|
43
|
+
const variables = dataRows.length === 1
|
|
44
|
+
? { ...(testCase.test_variables || {}), ...dataRows[0] }
|
|
45
|
+
: testCase.test_variables || {};
|
|
22
46
|
const baseUrlValue = this.options.baseUrl;
|
|
23
47
|
console.log('[executor] test_variables received:', JSON.stringify(variables));
|
|
24
48
|
console.log('[executor] baseUrl option:', baseUrlValue);
|