@empiricalrun/test-gen 0.31.7 → 0.31.10
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/CHANGELOG.md +18 -0
- package/dist/agent/browsing/index.d.ts.map +1 -1
- package/dist/agent/browsing/index.js +2 -0
- package/dist/agent/browsing/o1-completion.d.ts.map +1 -1
- package/dist/agent/browsing/o1-completion.js +10 -3
- package/dist/agent/master/run.d.ts.map +1 -1
- package/dist/agent/master/run.js +1 -0
- package/dist/bin/index.js +5 -5
- package/dist/bin/utils/platform/web/index.d.ts.map +1 -1
- package/dist/bin/utils/platform/web/index.js +2 -1
- package/dist/uploader/index.d.ts.map +1 -1
- package/dist/uploader/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @empiricalrun/test-gen
|
|
2
2
|
|
|
3
|
+
## 0.31.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c065064: fix: throw error for invalid response from o1
|
|
8
|
+
|
|
9
|
+
## 0.31.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- f2179f0: fix: upload test assets for error debugging
|
|
14
|
+
|
|
15
|
+
## 0.31.8
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 621c5f5: fix: spacing and format of browsing agent prompt
|
|
20
|
+
|
|
3
21
|
## 0.31.7
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAYlC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAOnD,KAAK,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,GAAG;IAC1D,YAAY,CAAC,EAAE;QACb,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;CACH,CAAC;AAEF,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAYlC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAOnD,KAAK,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,GAAG;IAC1D,YAAY,CAAC,EAAE;QACb,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;CACH,CAAC;AAEF,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,oBAAoB,mBAqP9B"}
|
|
@@ -19,6 +19,8 @@ const utils_1 = require("./utils");
|
|
|
19
19
|
async function browsingAgentUsingMasterAgent(task, page, options) {
|
|
20
20
|
const logger = new logger_1.CustomLogger({ useReporter: false });
|
|
21
21
|
const testgenUpdatesReporter = new reporter_1.TestGenUpdatesReporter();
|
|
22
|
+
// add timeout for the page to settle in
|
|
23
|
+
await page.waitForTimeout(3000);
|
|
22
24
|
const trace = llm_1.langfuseInstance.trace({
|
|
23
25
|
name: "test-generator",
|
|
24
26
|
id: crypto_1.default.randomUUID(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o1-completion.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/o1-completion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAKpC,wBAAsB,eAAe,CAAC,EACpC,QAAQ,EACR,KAAK,EACL,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,0BAA0B,EAAE,CAAC;IACvC,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"o1-completion.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/o1-completion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAKpC,wBAAsB,eAAe,CAAC,EACpC,QAAQ,EACR,KAAK,EACL,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,0BAA0B,EAAE,CAAC;IACvC,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAyD7C"}
|
|
@@ -24,10 +24,13 @@ async function getO1Completion({ messages, tools, trace, }) {
|
|
|
24
24
|
${userInstruction?.content}
|
|
25
25
|
|
|
26
26
|
You need to respond with one of the following tool call with provided schema:
|
|
27
|
-
${tools.map((tool) => JSON.stringify(tool)).join("\n --- \n")}
|
|
27
|
+
${tools.map((tool) => JSON.stringify(tool, null, 2)).join("\n --- \n")}
|
|
28
|
+
|
|
29
|
+
------
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
Do not respond with
|
|
31
|
+
Before responding, ensure the following:
|
|
32
|
+
- Do not respond with markdown, respond only with the JSON object.
|
|
33
|
+
- Do not respond with any backticks.
|
|
31
34
|
`;
|
|
32
35
|
const response = (await llm.createChatCompletion({
|
|
33
36
|
messages: [userInstruction],
|
|
@@ -38,6 +41,10 @@ async function getO1Completion({ messages, tools, trace, }) {
|
|
|
38
41
|
o1Span?.end({ output: response });
|
|
39
42
|
const toolResponseStr = (0, remove_markdown_1.default)(response.content);
|
|
40
43
|
const toolRespJSON = JSON.parse(toolResponseStr);
|
|
44
|
+
const parameters = toolRespJSON.function.parameters || toolRespJSON.function.arguments;
|
|
45
|
+
if (!parameters) {
|
|
46
|
+
throw new Error("No parameters found in tool response");
|
|
47
|
+
}
|
|
41
48
|
const tool = {
|
|
42
49
|
type: "function",
|
|
43
50
|
function: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/master/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AASlC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,KAAK,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE1D,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,IAAI,EACV,eAAe,EAAE,MAAM,EAAE,EACzB,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/master/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AASlC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,KAAK,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE1D,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,IAAI,EACV,eAAe,EAAE,MAAM,EAAE,EACzB,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,oBAAoB,gBA0E9B"}
|
package/dist/agent/master/run.js
CHANGED
package/dist/bin/index.js
CHANGED
|
@@ -33,10 +33,6 @@ async function runAgent(testGenConfig) {
|
|
|
33
33
|
testFilePath: specPath,
|
|
34
34
|
filePathToUpdate,
|
|
35
35
|
});
|
|
36
|
-
await new reporter_1.TestGenUpdatesReporter().reportGenAssets({
|
|
37
|
-
projectRepoName: testGenConfig.options.metadata.projectRepoName,
|
|
38
|
-
testName: testCase.name,
|
|
39
|
-
});
|
|
40
36
|
}
|
|
41
37
|
else {
|
|
42
38
|
logger.success("Generating test using coding agent");
|
|
@@ -71,8 +67,12 @@ async function runAgent(testGenConfig) {
|
|
|
71
67
|
}
|
|
72
68
|
catch (e) {
|
|
73
69
|
testGenFailed = true;
|
|
74
|
-
new logger_1.CustomLogger().error(`Failed to
|
|
70
|
+
new logger_1.CustomLogger().error(`Failed to generate test for the scenario. ${process.env.LOG_URL ? `[view log](${process.env.LOG_URL})` : ""}`);
|
|
75
71
|
}
|
|
72
|
+
await new reporter_1.TestGenUpdatesReporter().reportGenAssets({
|
|
73
|
+
projectRepoName: testGenConfig.options.metadata.projectRepoName,
|
|
74
|
+
testName: testGenConfig.testCase.name,
|
|
75
|
+
});
|
|
76
76
|
// TODO: move these reporters to a better lifecycle
|
|
77
77
|
await (0, ci_1.reportOnCI)(testGenConfig.testCase);
|
|
78
78
|
await (0, llm_1.flushAllTraces)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/bin/utils/platform/web/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,IAAI,EAIL,MAAM,UAAU,CAAC;AAGlB;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,YAAY,EACZ,MAAM,EACN,OAAO,GACR,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IA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=> d.getText());
|
|
269
269
|
const parameterSeparatorIdx = descendentTexts.findIndex((s) => s === ",");
|
|
270
270
|
const pageVariableName = descendentTexts[parameterSeparatorIdx + 1];
|
|
271
|
-
|
|
271
|
+
// handle cases like "page as Page"
|
|
272
|
+
return pageVariableName?.split(" ")[0];
|
|
272
273
|
}
|
|
273
274
|
exports.getPageVariableNameFromCreateTest = getPageVariableNameFromCreateTest;
|
|
274
275
|
function replaceCreateTestWithNewCode(filePath, contents, generatedCode) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/uploader/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,aAAa,gBAAgB,CAAC;AAC3C,eAAO,MAAM,aAAa,kCAAkC,CAAC;AAG7D,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,UAIpE;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,UAErD;AAED;;;;;;;;;GASG;AACH,wBAAsB,6BAA6B,CAAC,EAClD,eAAe,EACf,QAAQ,GACT,EAAE;IACD,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC;IACV,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/uploader/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,aAAa,gBAAgB,CAAC;AAC3C,eAAO,MAAM,aAAa,kCAAkC,CAAC;AAG7D,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,UAIpE;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,UAErD;AAED;;;;;;;;;GASG;AACH,wBAAsB,6BAA6B,CAAC,EAClD,eAAe,EACf,QAAQ,GACT,EAAE;IACD,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC;IACV,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC,CA8DD;AAED,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,MAAM,UAM1D;AAED,wBAAgB,2BAA2B,uBAQ1C"}
|
package/dist/uploader/index.js
CHANGED
|
@@ -53,7 +53,7 @@ async function uploadTestResultsUsingPrjRepo({ projectRepoName, testName, }) {
|
|
|
53
53
|
});
|
|
54
54
|
// fileNames are relative upload paths
|
|
55
55
|
const fileNames = Object.keys(files);
|
|
56
|
-
console.log("
|
|
56
|
+
console.log("Uploaded files", fileNames.map((f) => getFullUploadPath(f, uploadDir)));
|
|
57
57
|
const defaultLocation = path_1.default.join(process.cwd(), "playwright-report", "summary.json");
|
|
58
58
|
const results = (0, reporter_1.parseJsonReport)(defaultLocation);
|
|
59
59
|
const flatTestsList = (0, reporter_1.getFlattenedTestList)(results.suites);
|