@empiricalrun/test-gen 0.43.0 → 0.43.1
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 +3 -3
- package/dist/bin/index.js +2 -2
- package/dist/bin/utils/index.d.ts +1 -1
- package/dist/bin/utils/index.d.ts.map +1 -1
- package/dist/bin/utils/index.js +16 -3
- package/dist/bin/utils/scenarios/index.d.ts +1 -2
- package/dist/bin/utils/scenarios/index.d.ts.map +1 -1
- package/dist/bin/utils/scenarios/index.js +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -8,13 +8,13 @@ Our agents that generate Playwright tests. There are 2 agents
|
|
|
8
8
|
## Usage
|
|
9
9
|
|
|
10
10
|
```sh
|
|
11
|
-
npx @empiricalrun/test-gen TEST_GEN_TOKEN
|
|
11
|
+
npx @empiricalrun/test-gen --token TEST_GEN_TOKEN
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
### Add new test
|
|
15
15
|
|
|
16
16
|
```sh
|
|
17
|
-
npx @empiricalrun/test-gen TEST_GEN_TOKEN
|
|
17
|
+
npx @empiricalrun/test-gen --token TEST_GEN_TOKEN
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
- This will trigger browsing agent to write a new test for this scenario
|
|
@@ -23,7 +23,7 @@ npx @empiricalrun/test-gen TEST_GEN_TOKEN
|
|
|
23
23
|
### Update existing test
|
|
24
24
|
|
|
25
25
|
```sh
|
|
26
|
-
npx @empiricalrun/test-gen TEST_GEN_TOKEN
|
|
26
|
+
npx @empiricalrun/test-gen --token TEST_GEN_TOKEN
|
|
27
27
|
```
|
|
28
28
|
|
|
29
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
|
package/dist/bin/index.js
CHANGED
|
@@ -177,7 +177,7 @@ async function runAgent(testGenConfig, span) {
|
|
|
177
177
|
// this is where test gen starts executing on giving the command from ci
|
|
178
178
|
const logger = new logger_1.CustomLogger({ useReporter: false });
|
|
179
179
|
if (process.argv.length < 3) {
|
|
180
|
-
logger.error("Please provide path to scenarios using command:", "npx @empiricalrun/test-gen <TEST_GEN_TOKEN>");
|
|
180
|
+
logger.error("Please provide path to scenarios using command:", "npx @empiricalrun/test-gen --token <TEST_GEN_TOKEN>");
|
|
181
181
|
process.exit(1);
|
|
182
182
|
}
|
|
183
183
|
const { testGenConfig } = await (0, utils_2.parseCliArgs)();
|
|
@@ -187,9 +187,9 @@ async function runAgent(testGenConfig, span) {
|
|
|
187
187
|
generationId: testGenConfig.options?.metadata.generationId,
|
|
188
188
|
});
|
|
189
189
|
(0, session_1.setSessionDetails)({
|
|
190
|
+
testCaseId: testGenConfig.testCase.id,
|
|
190
191
|
sessionId: testGenConfig.options?.metadata.testSessionId,
|
|
191
192
|
generationId: testGenConfig.options?.metadata.generationId,
|
|
192
|
-
testCaseId: testGenConfig.testCase.id,
|
|
193
193
|
projectRepoName: testGenConfig.options?.metadata.projectRepoName,
|
|
194
194
|
});
|
|
195
195
|
let testGenFailed = false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TestGenConfig } from "@empiricalrun/shared-types";
|
|
2
|
-
export declare function parseCliArgs(
|
|
2
|
+
export declare function parseCliArgs(): Promise<{
|
|
3
3
|
testGenConfig: TestGenConfig;
|
|
4
4
|
}>;
|
|
5
5
|
export declare function getTestConfigCliArg(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAKhE,wBAAsB,YAAY;;GAMjC;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAc5C;AAED,eAAO,MAAM,WAAW,oBAA2B,CAAC;AACpD,eAAO,MAAM,OAAO,oBAA6B,CAAC"}
|
package/dist/bin/utils/index.js
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.baggage = exports.sentryTrace = exports.getTestConfigCliArg = exports.parseCliArgs = void 0;
|
|
4
|
+
const logger_1 = require("../logger");
|
|
4
5
|
const scenarios_1 = require("./scenarios");
|
|
5
|
-
async function parseCliArgs(
|
|
6
|
-
|
|
6
|
+
async function parseCliArgs() {
|
|
7
|
+
let rawToken = getTestConfigCliArg();
|
|
8
|
+
const testGenConfig = (0, scenarios_1.loadTestConfigs)(rawToken);
|
|
7
9
|
return {
|
|
8
10
|
testGenConfig,
|
|
9
11
|
};
|
|
10
12
|
}
|
|
11
13
|
exports.parseCliArgs = parseCliArgs;
|
|
12
14
|
function getTestConfigCliArg() {
|
|
13
|
-
|
|
15
|
+
// Check for --token parameter
|
|
16
|
+
const tokenIndex = process.argv.indexOf("--token");
|
|
17
|
+
if (tokenIndex !== -1 && process.argv[tokenIndex + 1]) {
|
|
18
|
+
const token = process.argv[tokenIndex + 1];
|
|
19
|
+
if (token)
|
|
20
|
+
return token;
|
|
21
|
+
}
|
|
22
|
+
// Fallback to legacy behavior (token as first argument)
|
|
23
|
+
const legacyToken = process.argv[2];
|
|
24
|
+
const logger = new logger_1.CustomLogger({ useReporter: false });
|
|
25
|
+
logger.warn("Using legacy token format. Consider using --token parameter instead: npx @empiricalrun/test-gen --token <TEST_GEN_TOKEN>");
|
|
26
|
+
return legacyToken;
|
|
14
27
|
}
|
|
15
28
|
exports.getTestConfigCliArg = getTestConfigCliArg;
|
|
16
29
|
exports.sentryTrace = process.env.SENTRY_TRACE;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { TestGenConfig } from "@empiricalrun/shared-types";
|
|
2
|
-
declare function loadTestConfigs(testGenToken: string):
|
|
3
|
-
export { loadTestConfigs };
|
|
2
|
+
export declare function loadTestConfigs(testGenToken: string): TestGenConfig;
|
|
4
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/utils/scenarios/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,aAAa,EAEd,MAAM,4BAA4B,CAAC;AAepC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/utils/scenarios/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,aAAa,EAEd,MAAM,4BAA4B,CAAC;AAepC,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,CAmBnE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadTestConfigs = void 0;
|
|
4
|
-
|
|
4
|
+
function loadTestConfigs(testGenToken) {
|
|
5
5
|
const str = decodeURIComponent(atob(testGenToken));
|
|
6
6
|
const config = JSON.parse(str);
|
|
7
7
|
const specPath = `./tests/${config.filePath || "index.spec.ts"}`;
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ require("./initSentry");
|
|
|
31
31
|
const llm_1 = require("@empiricalrun/llm");
|
|
32
32
|
const Sentry = __importStar(require("@sentry/node"));
|
|
33
33
|
const run_1 = require("./agent/master/run");
|
|
34
|
-
const
|
|
34
|
+
const scenarios_1 = require("./bin/utils/scenarios");
|
|
35
35
|
const client_1 = __importDefault(require("./file/client"));
|
|
36
36
|
const reporter_1 = require("./reporter");
|
|
37
37
|
const session_1 = require("./session");
|
|
@@ -47,7 +47,7 @@ process.on("SIGTERM", async () => await flushEvents());
|
|
|
47
47
|
async function createTest(task, page, scope) {
|
|
48
48
|
const port = process.env.APP_PORT || 3030;
|
|
49
49
|
const testConfigArg = process.env.TEST_GEN_TOKEN;
|
|
50
|
-
const
|
|
50
|
+
const testGenConfig = (0, scenarios_1.loadTestConfigs)(testConfigArg);
|
|
51
51
|
(0, reporter_1.setReporterConfig)({
|
|
52
52
|
projectRepoName: testGenConfig.options?.metadata.projectRepoName,
|
|
53
53
|
testSessionId: testGenConfig.options?.metadata.testSessionId,
|