@empiricalrun/test-gen 0.26.0 → 0.27.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.27.1
4
+
5
+ ### Patch Changes
6
+
7
+ - ef6b74a: fix: stop button becomes start if page is reloaded
8
+
9
+ ## 0.27.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 88067ed: fix: create test script remain in code after test gen error
14
+
3
15
  ## 0.26.0
4
16
 
5
17
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/run.ts"],"names":[],"mappings":"AAYA,KAAK,iBAAiB,GAAG;IACvB;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAsB,6BAA6B,CAAC,EAClD,YAAY,EACZ,gBAAgB,GACjB,EAAE,iBAAiB,iBAoCnB"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/run.ts"],"names":[],"mappings":"AAiBA,KAAK,iBAAiB,GAAG;IACvB;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAsB,6BAA6B,CAAC,EAClD,YAAY,EACZ,gBAAgB,GACjB,EAAE,iBAAiB,iBAqDnB"}
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.generateTestsUsingMasterAgent = void 0;
7
7
  const detect_port_1 = __importDefault(require("detect-port"));
8
+ const fs_extra_1 = __importDefault(require("fs-extra"));
8
9
  const utils_1 = require("../../bin/utils");
9
10
  const web_1 = require("../../bin/utils/platform/web");
10
11
  const server_1 = require("../../file/server");
@@ -40,6 +41,7 @@ async function generateTestsUsingMasterAgent({ testFilePath, filePathToUpdate, }
40
41
  if (!process.env.CI) {
41
42
  command = command.concat(` --headed`);
42
43
  }
44
+ let isError = false;
43
45
  try {
44
46
  await (0, exec_1.cmd)(command.split(" "), {
45
47
  env: {
@@ -52,9 +54,19 @@ async function generateTestsUsingMasterAgent({ testFilePath, filePathToUpdate, }
52
54
  }
53
55
  catch (e) {
54
56
  console.error(e);
57
+ isError = true;
58
+ }
59
+ if (isError) {
60
+ try {
61
+ const fileContent = await fs_extra_1.default.readFile(filePathToUpdate, "utf-8");
62
+ const updatedContent = (0, web_1.replaceCreateTestWithNewCode)(filePathToUpdate, fileContent, "");
63
+ await fs_extra_1.default.writeFile(filePathToUpdate, updatedContent, "utf-8");
64
+ await (0, web_1.lintErrors)(filePathToUpdate);
65
+ }
66
+ catch (e) {
67
+ console.error("Failed to remove extra scripts from files post test gen error", e);
68
+ }
55
69
  }
56
- // remove test only from the test file in case of any error
57
70
  await (0, web_1.removeTestOnly)(testFilePath);
58
- // TODO: remove the createTest function from the test file if its present
59
71
  }
60
72
  exports.generateTestsUsingMasterAgent = generateTestsUsingMasterAgent;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAeA,iBAAS,iBAAiB;;;;EAMzB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,YAAY,GACb,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB,QAGA;AAED,wBAAsB,eAAe,0DAkBpC;AAED,wBAAsB,UAAU,kBAmB/B;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAeA,iBAAS,iBAAiB;;;;EAMzB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,YAAY,GACb,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB,QAGA;AAED,wBAAsB,eAAe,0DAkBpC;AAED,wBAAsB,UAAU,kBAkB/B;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -25,7 +25,7 @@ function setSessionDetails({ sessionId, generationId, }) {
25
25
  }
26
26
  exports.setSessionDetails = setSessionDetails;
27
27
  async function getSessionState() {
28
- const apiPath = `${DASHBOARD_DOMAIN}/api/sessions/${sessionDetails.sessionId}/generation?generation_id=${sessionDetails.generationId}`;
28
+ const apiPath = `${DASHBOARD_DOMAIN}/api/sessions/${sessionDetails.sessionId}/generations/${sessionDetails.generationId}/state`;
29
29
  const response = await fetch(apiPath, {
30
30
  method: "GET",
31
31
  headers: {
@@ -39,7 +39,7 @@ async function getSessionState() {
39
39
  }
40
40
  exports.getSessionState = getSessionState;
41
41
  async function endSession() {
42
- const apiPath = `${DASHBOARD_DOMAIN}/api/sessions/${sessionDetails.sessionId}/generation?generation_id=${sessionDetails.generationId}`;
42
+ const apiPath = `${DASHBOARD_DOMAIN}/api/sessions/${sessionDetails.sessionId}/generations/${sessionDetails.generationId}/state`;
43
43
  try {
44
44
  await fetch(apiPath, {
45
45
  method: "POST",
@@ -48,7 +48,6 @@ async function endSession() {
48
48
  Authorization: "weQPMWKT",
49
49
  },
50
50
  body: JSON.stringify({
51
- generationId: sessionDetails.generationId,
52
51
  state: {
53
52
  state: "completed",
54
53
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.26.0",
3
+ "version": "0.27.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"