@empiricalrun/test-gen 0.46.11 → 0.47.0
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 +6 -0
- package/README.md +8 -28
- package/dist/agent/browsing/utils.d.ts.map +1 -1
- package/dist/agent/browsing/utils.js +10 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,38 +1,12 @@
|
|
|
1
1
|
# test-gen
|
|
2
2
|
|
|
3
|
-
Our agents that generate Playwright tests. There are 2 agents
|
|
4
|
-
|
|
5
|
-
- browsing agent
|
|
6
|
-
- code editing agent
|
|
7
|
-
|
|
8
3
|
## Usage
|
|
9
4
|
|
|
10
5
|
```sh
|
|
11
|
-
npx @empiricalrun/test-gen --token TEST_GEN_TOKEN
|
|
6
|
+
npx @empiricalrun/test-gen@latest --token TEST_GEN_TOKEN
|
|
12
7
|
```
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
```sh
|
|
17
|
-
npx @empiricalrun/test-gen --token TEST_GEN_TOKEN
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
- This will trigger browsing agent to write a new test for this scenario
|
|
21
|
-
- See [Test gen token: Base64 payload](#test-gen-token-base64-payload)
|
|
22
|
-
|
|
23
|
-
### Update existing test
|
|
24
|
-
|
|
25
|
-
```sh
|
|
26
|
-
npx @empiricalrun/test-gen --token TEST_GEN_TOKEN
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
- If the test case is already present in the file, the test gen agent will update the existing test as per the steps provided in the payload
|
|
30
|
-
- This will trigger code editing agent to write a new test for this scenario
|
|
31
|
-
- See [Test gen token: Base64 payload](#test-gen-token-base64-payload)
|
|
32
|
-
|
|
33
|
-
### Test gen token: Base64 payload
|
|
34
|
-
|
|
35
|
-
Convert this object into a base64 payload - for new and update test.
|
|
9
|
+
To generate a token, use the below
|
|
36
10
|
|
|
37
11
|
```js
|
|
38
12
|
const scenario = {
|
|
@@ -46,3 +20,9 @@ const scenario = {
|
|
|
46
20
|
};
|
|
47
21
|
btoa(JSON.stringify(scenario));
|
|
48
22
|
```
|
|
23
|
+
|
|
24
|
+
### During development
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
npx /path/to/packages/test-gen/.
|
|
28
|
+
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI7E,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAsBvD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,CAKhD;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,UAIvD;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI7E,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAsBvD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,CAKhD;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,UAIvD;AAwGD;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,aAAa,EACxB,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC,CA0DjB;AAyBD,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,iBA2HxD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,QAIjD;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,oBAAoB,CAAC,CAM/B;AAWD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,oBAAoB,EACtC,gBAAgB,GAAE,MAAM,EAAU,GACjC,OAAO,CAAC,MAAM,CAAC,CA+CjB;AAED,qBAAa,eAAe;IACd,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,MAAM;IACrC,OAAO,CAAC,aAAa,CAAqB;YAE5B,mBAAmB;YAUnB,gBAAgB;IAsBjB,OAAO;IAuBb,SAAS;CAKjB"}
|
|
@@ -28,6 +28,15 @@ function prepareBrowsingAgentTask(steps) {
|
|
|
28
28
|
return task;
|
|
29
29
|
}
|
|
30
30
|
exports.prepareBrowsingAgentTask = prepareBrowsingAgentTask;
|
|
31
|
+
async function addImportForCreateTest(testFilePath) {
|
|
32
|
+
// Instead of using "@empiricalrun/test-gen", we use the local dist file
|
|
33
|
+
// This is to avoid assuming that the test-gen package is installed in the project
|
|
34
|
+
const importSource = path_1.default.join(__dirname, "../../../dist/index.js");
|
|
35
|
+
if (!fs_extra_1.default.existsSync(importSource)) {
|
|
36
|
+
throw new Error(`createTest import source not found at ${importSource}`);
|
|
37
|
+
}
|
|
38
|
+
await fs_extra_1.default.writeFile(testFilePath, (0, web_1.addNewImport)(await fs_extra_1.default.readFile(testFilePath, "utf-8"), ["createTest"], importSource));
|
|
39
|
+
}
|
|
31
40
|
/**
|
|
32
41
|
* Function to prepare test file for update scenarios for master agent to run
|
|
33
42
|
* @param {TestGenConfig} genConfig
|
|
@@ -76,7 +85,7 @@ async function prepareFileForUpdateScenario(genConfig, trace) {
|
|
|
76
85
|
createTestFilePath,
|
|
77
86
|
},
|
|
78
87
|
});
|
|
79
|
-
await
|
|
88
|
+
await addImportForCreateTest(createTestFilePath);
|
|
80
89
|
updateFileSpan?.end();
|
|
81
90
|
const { pomPrompt, nonSpecFilePrompt } = await (0, context_1.contextForGeneration)(createTestFilePath);
|
|
82
91
|
await (0, fix_ts_errors_1.validateAndFixTypescriptErrors)({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/test-gen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"tsx": "^4.16.2",
|
|
75
75
|
"typescript": "^5.3.3",
|
|
76
76
|
"@empiricalrun/llm": "^0.9.35",
|
|
77
|
-
"@empiricalrun/
|
|
78
|
-
"@empiricalrun/
|
|
77
|
+
"@empiricalrun/reporter": "^0.23.1",
|
|
78
|
+
"@empiricalrun/r2-uploader": "^0.3.8"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@playwright/test": "1.47.1",
|