@empiricalrun/test-gen 0.10.2 → 0.10.4
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
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @empiricalrun/test-gen
|
|
2
2
|
|
|
3
|
+
## 0.10.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5400dfa: fix: prepare files in subdirectory for browsing agent
|
|
8
|
+
|
|
9
|
+
## 0.10.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 08f12e9: fix: browsing agent output works with ci reporter
|
|
14
|
+
|
|
3
15
|
## 0.10.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIlC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,wBAAsB,2BAA2B,CAAC,SAAS,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIlC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,wBAAsB,2BAA2B,CAAC,SAAS,EAAE,aAAa,iBAkBzE;AAWD,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,iBAMxD;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,QA4BnD"}
|
|
@@ -13,6 +13,7 @@ async function prepareFileForBrowsingAgent(genConfig) {
|
|
|
13
13
|
const { name, steps, assert } = scenarios[0];
|
|
14
14
|
const mergedSteps = `${steps.join("\n")}\n${assert}`;
|
|
15
15
|
if (!fs_extra_1.default.existsSync(specPath)) {
|
|
16
|
+
await fs_extra_1.default.createFile(specPath);
|
|
16
17
|
await fs_extra_1.default.writeFile(specPath, (0, web_1.addNewImport)("", ["test", "expect"], "@playwright/test"));
|
|
17
18
|
}
|
|
18
19
|
// TODO: this assumes that test code repo has `page` as the main entrypoint fixture
|
package/dist/bin/index.js
CHANGED
|
@@ -17,6 +17,7 @@ dotenv_1.default.config({
|
|
|
17
17
|
});
|
|
18
18
|
const logger = new logger_1.CustomLogger();
|
|
19
19
|
async function runAgent(sourceFile, isUpdate, testGenConfigs) {
|
|
20
|
+
const generatedTestScenarios = [];
|
|
20
21
|
const compatibleWithBrowsing = !sourceFile.endsWith(".yaml") &&
|
|
21
22
|
!sourceFile.startsWith("https://docs.google.com/spreadsheets") &&
|
|
22
23
|
!isUpdate;
|
|
@@ -29,14 +30,14 @@ async function runAgent(sourceFile, isUpdate, testGenConfigs) {
|
|
|
29
30
|
else {
|
|
30
31
|
fileForBrowsingAgent = testGenConfig.specPath;
|
|
31
32
|
await (0, utils_1.prepareFileForBrowsingAgent)(testGenConfig);
|
|
33
|
+
generatedTestScenarios.push(...testGenConfig.scenarios);
|
|
32
34
|
}
|
|
33
35
|
if (fileForBrowsingAgent) {
|
|
34
36
|
logger.success("Generating tests using browsing agent");
|
|
35
37
|
await (0, run_1.generateTestsUsingBrowsingAgent)(fileForBrowsingAgent);
|
|
36
|
-
|
|
38
|
+
return generatedTestScenarios;
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
|
-
const generatedTestScenarios = [];
|
|
40
41
|
for (const testGenConfig of testGenConfigs) {
|
|
41
42
|
const { specPath, scenarios } = testGenConfig;
|
|
42
43
|
if (!fs_extra_1.default.existsSync(specPath)) {
|
|
@@ -82,6 +83,6 @@ async function parseArgs() {
|
|
|
82
83
|
}
|
|
83
84
|
const { sourceFile, testGenConfigs, isUpdate } = await parseArgs();
|
|
84
85
|
const generated = await runAgent(sourceFile, isUpdate, testGenConfigs);
|
|
85
|
-
// TODO: make this work with browsing agent
|
|
86
86
|
await (0, ci_1.reportOnCI)(generated);
|
|
87
|
+
process.exit(0);
|
|
87
88
|
})();
|