@empiricalrun/test-gen 0.37.3 → 0.38.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/browser-injected-scripts/annotate-elements.js +2 -1
  3. package/dist/actions/index.d.ts +1 -1
  4. package/dist/actions/index.d.ts.map +1 -1
  5. package/dist/actions/index.js +2 -4
  6. package/dist/agent/browsing/index.d.ts +1 -1
  7. package/dist/agent/browsing/index.d.ts.map +1 -1
  8. package/dist/agent/browsing/index.js +14 -2
  9. package/dist/agent/browsing/o1-completion.d.ts.map +1 -1
  10. package/dist/agent/browsing/o1-completion.js +1 -0
  11. package/dist/agent/browsing/run.js +1 -1
  12. package/dist/agent/browsing/utils.d.ts.map +1 -1
  13. package/dist/agent/browsing/utils.js +3 -2
  14. package/dist/agent/codegen/skills-retriever.d.ts +2 -0
  15. package/dist/agent/codegen/skills-retriever.d.ts.map +1 -1
  16. package/dist/agent/codegen/utils.d.ts +1 -0
  17. package/dist/agent/codegen/utils.d.ts.map +1 -1
  18. package/dist/agent/codegen/utils.js +3 -2
  19. package/dist/agent/master/run.d.ts.map +1 -1
  20. package/dist/agent/master/run.js +21 -8
  21. package/dist/agent/planner/run.d.ts +8 -0
  22. package/dist/agent/planner/run.d.ts.map +1 -0
  23. package/dist/agent/planner/run.js +75 -0
  24. package/dist/bin/index.js +14 -3
  25. package/dist/bin/utils/context.d.ts +1 -0
  26. package/dist/bin/utils/context.d.ts.map +1 -1
  27. package/dist/bin/utils/context.js +16 -1
  28. package/dist/bin/utils/platform/web/index.d.ts.map +1 -1
  29. package/dist/bin/utils/platform/web/index.js +10 -11
  30. package/dist/bin/utils/scenarios/index.d.ts.map +1 -1
  31. package/dist/bin/utils/scenarios/index.js +1 -0
  32. package/dist/browser-injected-scripts/annotate-elements.js +2 -1
  33. package/dist/evals/fetch-pom-skills-agent.evals.js +1 -1
  34. package/dist/types/index.d.ts +2 -1
  35. package/dist/types/index.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/dist/actions/reload-page.d.ts +0 -4
  38. package/dist/actions/reload-page.d.ts.map +0 -1
  39. package/dist/actions/reload-page.js +0 -41
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.38.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c2cf877: fix: get appropriate skill should return correct file path
8
+
9
+ ## 0.38.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 2444057: feat: add support for planner agent
14
+
15
+ ### Patch Changes
16
+
17
+ - 96bc299: fix: extract page vars is failing
18
+ - edce85d: fix: annotate elements where opacity is not set
19
+
20
+ ## 0.37.4
21
+
22
+ ### Patch Changes
23
+
24
+ - 46e6f61: test: added test for fetch pom skills
25
+ - 5315b91: fix: remove support for page.reload action
26
+ - 9b4894a: fix: identification of agent stuck in loop
27
+ - 8c6bab2: fix: regex for extracting test steps suggestion
28
+ - 0128934: fix: added code in trace for master agent
29
+
3
30
  ## 0.37.3
4
31
 
5
32
  ### Patch Changes
@@ -135,7 +135,8 @@ window.annotateClickableElements = function annotateClickableElements(
135
135
  if (
136
136
  style.display === "none" ||
137
137
  style.visibility === "hidden" ||
138
- parseFloat(style.opacity) === 0 ||
138
+ // This is done for cases where opacity is undefined
139
+ // parseFloat(style.opacity) === 0
139
140
  style.pointerEvents === "none"
140
141
  ) {
141
142
  return false;
@@ -7,7 +7,7 @@ export declare class PlaywrightActions {
7
7
  private actionGenerators;
8
8
  private recordedActions;
9
9
  constructor(page: Page, stateVariables?: Record<string, any>);
10
- executeAction(name: string | undefined, args: Record<string, any>, trace?: TraceClient): Promise<void>;
10
+ executeAction(name: string | undefined, args: Record<string, any>, trace?: TraceClient): Promise<string | undefined>;
11
11
  getBrowsingActionSchemas(): ActionSchema[];
12
12
  getMasterActionSchemas(): ActionSchema[];
13
13
  generateCode(): {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIlC,OAAO,EAAE,YAAY,EAA6B,MAAM,UAAU,CAAC;AAYnE,qBAAa,iBAAiB;IAQ1B,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,cAAc;IARxB,OAAO,CAAC,gBAAgB,CAA8B;IACtD,OAAO,CAAC,eAAe,CAInB;gBAEM,IAAI,EAAE,IAAI,EACV,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IAiB5C,aAAa,CACjB,IAAI,oBAAa,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,KAAK,CAAC,EAAE,WAAW;IAgDrB,wBAAwB,IAAI,YAAY,EAAE;IAmB1C,sBAAsB,IAAI,YAAY,EAAE;IAUxC,YAAY,IAAI;QACd,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB;IAUD,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAO9B;;;;;;OAMG;IACH,aAAa,IAAI,OAAO;IAQxB,UAAU;CAUX"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIlC,OAAO,EAAE,YAAY,EAA6B,MAAM,UAAU,CAAC;AAWnE,qBAAa,iBAAiB;IAQ1B,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,cAAc;IARxB,OAAO,CAAC,gBAAgB,CAA8B;IACtD,OAAO,CAAC,eAAe,CAInB;gBAEM,IAAI,EAAE,IAAI,EACV,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IAgB5C,aAAa,CACjB,IAAI,oBAAa,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAgD9B,wBAAwB,IAAI,YAAY,EAAE;IAkB1C,sBAAsB,IAAI,YAAY,EAAE;IAUxC,YAAY,IAAI;QACd,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB;IAUD,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAK9B;;;;;;OAMG;IACH,aAAa,IAAI,OAAO;IAQxB,UAAU;CAUX"}
@@ -10,7 +10,6 @@ const fill_1 = require("./fill");
10
10
  const goto_1 = require("./goto");
11
11
  const hover_1 = require("./hover");
12
12
  const press_1 = require("./press");
13
- const reload_page_1 = require("./reload-page");
14
13
  const skill_1 = require("./skill");
15
14
  const text_content_1 = require("./text-content");
16
15
  class PlaywrightActions {
@@ -29,7 +28,6 @@ class PlaywrightActions {
29
28
  press_1.pressActionGenerator,
30
29
  done_1.doneActionGenerator,
31
30
  assert_1.assertTextVisibilityActionGenerator,
32
- reload_page_1.reloadActionGenerator,
33
31
  text_content_1.textContentActionGenerator,
34
32
  skill_1.skillActionGenerator,
35
33
  ];
@@ -71,6 +69,7 @@ class PlaywrightActions {
71
69
  logger.log(`action: ${name} \ncode: ${code} \nreason: ${args.reason}`);
72
70
  void testgenUpdatesReporter.sendMessage("```ts\n" + code + "\n```");
73
71
  }
72
+ return code;
74
73
  }
75
74
  catch (e) {
76
75
  actionSpan?.end({
@@ -90,7 +89,6 @@ class PlaywrightActions {
90
89
  press_1.pressActionGenerator,
91
90
  done_1.doneActionGenerator,
92
91
  assert_1.assertTextVisibilityActionGenerator,
93
- reload_page_1.reloadActionGenerator,
94
92
  text_content_1.textContentActionGenerator,
95
93
  ]
96
94
  .map((a) => a(this.page, {
@@ -115,7 +113,7 @@ class PlaywrightActions {
115
113
  };
116
114
  }
117
115
  getLastCodeLines(count) {
118
- const actions = this.recordedActions.filter((a) => a.name !== done_1.PLAYWRIGHT_DONE_ACTION_NAME);
116
+ const actions = this.recordedActions;
119
117
  return actions.slice(-count).map((a) => a.code);
120
118
  }
121
119
  /**
@@ -16,5 +16,5 @@ export declare function executeTaskUsingBrowsingAgent({ trace, action, logger, p
16
16
  options: BrowsingAgentOptions;
17
17
  llm: LLM;
18
18
  actions: PlaywrightActions;
19
- }): Promise<void>;
19
+ }): Promise<string[] | undefined>;
20
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAMnD,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,GAAG;IACjE,YAAY,CAAC,EAAE;QACb,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;CACH,CAAC;AAEF,wBAAsB,6BAA6B,CAAC,EAClD,KAAK,EACL,MAAM,EACN,MAAM,EACN,IAAI,EACJ,OAAO,EACP,GAAG,EACH,OAAO,GACR,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,oBAAoB,CAAC;IAC9B,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,iBAAiB,CAAC;CAC5B,iBAqIA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAMnD,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,GAAG;IACjE,YAAY,CAAC,EAAE;QACb,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;CACH,CAAC;AAEF,wBAAsB,6BAA6B,CAAC,EAClD,KAAK,EACL,MAAM,EACN,MAAM,EACN,IAAI,EACJ,OAAO,EACP,GAAG,EACH,OAAO,GACR,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,oBAAoB,CAAC;IAC9B,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,iBAAiB,CAAC;CAC5B,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAiJhC"}
@@ -12,11 +12,15 @@ async function executeTaskUsingBrowsingAgent({ trace, action, logger, page, opti
12
12
  let isTaskDone = false;
13
13
  const executedActions = [];
14
14
  let lastActionExecTrace = "";
15
+ let generatedCodeSteps = [];
15
16
  const tools = actions.getBrowsingActionSchemas();
16
17
  const testgenUpdatesReporter = new reporter_1.TestGenUpdatesReporter();
17
18
  while (!isTaskDone) {
18
19
  const browsingAgentSpan = trace?.span({
19
20
  name: `browsing-agent`,
21
+ input: {
22
+ action,
23
+ },
20
24
  });
21
25
  if (await (0, session_1.shouldStopSession)()) {
22
26
  break;
@@ -48,7 +52,11 @@ async function executeTaskUsingBrowsingAgent({ trace, action, logger, page, opti
48
52
  if (isTaskDone) {
49
53
  browsingAgentSpan?.event({ name: "task-done" });
50
54
  browsingAgentSpan?.end({
51
- output: { taskDone: true, reason: verificationAgentResp.reason },
55
+ output: {
56
+ taskDone: true,
57
+ reason: verificationAgentResp.reason,
58
+ code: generatedCodeSteps,
59
+ },
52
60
  });
53
61
  break;
54
62
  }
@@ -98,7 +106,10 @@ async function executeTaskUsingBrowsingAgent({ trace, action, logger, page, opti
98
106
  break;
99
107
  }
100
108
  try {
101
- await actions.executeAction(toolCall.function.name, JSON.parse(toolCall.function.arguments), toolCallsSpan);
109
+ const code = await actions.executeAction(toolCall.function.name, JSON.parse(toolCall.function.arguments), toolCallsSpan);
110
+ if (code) {
111
+ generatedCodeSteps.push(code);
112
+ }
102
113
  executedActions.push({
103
114
  isError: false,
104
115
  action: JSON.parse(toolCall.function.arguments)?.reason,
@@ -132,5 +143,6 @@ async function executeTaskUsingBrowsingAgent({ trace, action, logger, page, opti
132
143
  }
133
144
  }
134
145
  }
146
+ return generatedCodeSteps;
135
147
  }
136
148
  exports.executeTaskUsingBrowsingAgent = executeTaskUsingBrowsingAgent;
@@ -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,CA6D7C"}
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,CA8D7C"}
@@ -33,6 +33,7 @@ async function getO1Completion({ messages, tools, trace, }) {
33
33
  - Do not respond with any backticks.
34
34
  - The reason for action should also include what was been executed in the action.
35
35
  `;
36
+ o1Span?.update({ input: [userInstruction] });
36
37
  const response = (await llm.createChatCompletion({
37
38
  messages: [userInstruction],
38
39
  modelParameters: {
@@ -35,7 +35,7 @@ async function generateTestsUsingMasterAgent({ testFilePath, filePathToUpdate, p
35
35
  const playwrightConfig = await (0, utils_2.readPlaywrightConfig)();
36
36
  // detect the playwright project name for the given test file and playwright config
37
37
  const project = await (0, utils_2.detectProjectName)(testFilePath, playwrightConfig, pwProjectsFilter);
38
- const pageVar = await (0, web_1.getPageVariableNameFromCreateTest)(testFilePath);
38
+ const pageVar = await (0, web_1.getPageVariableNameFromCreateTest)(filePathToUpdate);
39
39
  console.log(`Detected playwright project name: ${project}`);
40
40
  // run playwright test which will internally run the master agent
41
41
  const teardownFileRegex = /.*\.teardown\.ts/;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAK3D,OAAO,EAAE,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SAAS;gBAAT,SAAS,EAAE,MAAM;IACrC,OAAO,CAAC,aAAa,CAAqB;YAE5B,mBAAmB;YAUnB,gBAAgB;IAsBjB,OAAO;IAuBb,SAAS;CAKjB"}
@@ -101,6 +101,7 @@ async function prepareFileForUpdateScenario(genConfig, trace) {
101
101
  const updatedTestFileContent = newContentsWithTestOnly(testFileContent, testBlock, testBlock, parentDescribe?.getText() || "");
102
102
  await fs_extra_1.default.writeFile(specPath, updatedTestFileContent);
103
103
  }
104
+ return createTestFilePath;
104
105
  }
105
106
  /**
106
107
  * Function to prepare test file for master agent to run
@@ -147,8 +148,8 @@ async function prepareFileForMasterAgent(genConfig, trace) {
147
148
  });
148
149
  await fs_extra_1.default.writeFile(specPath, updatedContent, "utf-8");
149
150
  }
150
- await prepareFileForUpdateScenario(genConfig, prepareFileSpan);
151
- return specPath;
151
+ const updatePath = await prepareFileForUpdateScenario(genConfig, prepareFileSpan);
152
+ return updatePath;
152
153
  }
153
154
  exports.prepareFileForMasterAgent = prepareFileForMasterAgent;
154
155
  function newContentsWithTestOnly(existingContents, originalTestBlock, updatedTestBlock, parentDescribeBlock) {
@@ -10,6 +10,7 @@ export declare const fetchPomSkills: ({ testCase, pomFiles, options, trace, }: {
10
10
  filePath: string;
11
11
  usageExample: string;
12
12
  reason: string;
13
+ methodName: string;
13
14
  }[]>;
14
15
  export declare function getAppropriateSkills({ testCase, options, trace, }: {
15
16
  testCase: TestCase;
@@ -20,5 +21,6 @@ export declare function getAppropriateSkills({ testCase, options, trace, }: {
20
21
  filePath: string;
21
22
  usageExample: string;
22
23
  reason: string;
24
+ methodName: string;
23
25
  }[]>;
24
26
  //# sourceMappingURL=skills-retriever.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"skills-retriever.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/skills-retriever.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAYhE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAG7D,eAAO,MAAM,cAAc;cAMf,QAAQ;;;;;;;;;IA8CnB,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,EACzC,QAAQ,EACR,OAAO,EACP,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;;;;;KA6BA"}
1
+ {"version":3,"file":"skills-retriever.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/skills-retriever.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAYhE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAG7D,eAAO,MAAM,cAAc;cAMf,QAAQ;;;;;;;;;;IA8CnB,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,EACzC,QAAQ,EACR,OAAO,EACP,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;;;;;;KA6BA"}
@@ -43,5 +43,6 @@ export declare function extractTestStepsSuggestions(input: string): {
43
43
  filePath: string;
44
44
  usageExample: string;
45
45
  reason: string;
46
+ methodName: string;
46
47
  }[];
47
48
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG;IACjD,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE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CAAC;IAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,EAAE,CA8BF;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,EAAE,CAgBF"}
@@ -66,15 +66,16 @@ function extractAppendTestUpdates(input) {
66
66
  exports.extractAppendTestUpdates = extractAppendTestUpdates;
67
67
  function extractTestStepsSuggestions(input) {
68
68
  const result = [];
69
- const regex = /<subtask>(.*?)<\/subtask>[\s\S]*?<file_import_path>([\s\S]*?)<\/file_import_path>[\s\S]*?<usage_example>([\s\S]*?)<\/usage_example>[\s\S]*?<reason>([\s\S]*?)<\/reason>/g;
69
+ const regex = /<subtask>(.*?)<\/subtask>[\s\S]*?<reason>([\s\S]*?)<\/reason>[\s\S]*?<file_import_path>([\s\S]*?)<\/file_import_path>[\s\S]*?<usage_example>([\s\S]*?)<\/usage_example>[\s\S]*?<method_name>([\s\S]*?)<\/method_name>/g;
70
70
  let match;
71
71
  while ((match = regex.exec(input)) !== null) {
72
- const [, testStep, filePath, usageExample, reason] = match;
72
+ const [, testStep, reason, filePath, usageExample, methodName] = match;
73
73
  result.push({
74
74
  testStep: testStep?.trim() || "",
75
75
  filePath: filePath?.trim() || "",
76
76
  usageExample: usageExample?.trim() || "",
77
77
  reason: reason?.trim() || "",
78
+ methodName: methodName?.trim() || "",
78
79
  });
79
80
  }
80
81
  return result.filter((r) => !!r.filePath && !!r.usageExample);
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/master/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,GAAG,EACH,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,IAAI,EAAE,MAAM,YAA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C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAYlD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EACL,oBAAoB,EAErB,MAAM,aAAa,CAAC;AAQrB,wBAAsB,aAAa,CAAC,EAClC,IAAI,EACJ,eAAe,EACf,aAAa,EACb,OAAO,EACP,KAAK,EACL,GAAG,EACH,OAAO,EACP,cAAc,EACd,uBAAuB,EACvB,OAAO,EACP,aAAa,EACb,QAAgB,GACjB,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,aAAa,EAAE,GAAG,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;CACnB,2FAwFA;AAGD,wBAAsB,0BAA0B,CAAC,EAC/C,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,SAAS,GACV,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;;;GA0TA"}
@@ -171,13 +171,15 @@ async function createTestUsingMasterAgent({ task, page, testCase, options, scope
171
171
  }
172
172
  }
173
173
  const buffer = await page.screenshot({
174
- fullPage: true,
175
- // path: `screenshots/screenshot-${screenshotIndex++}.png`, // enable this and screenshotIndex var for local debugging
174
+ //This is done to improve element annotation accuracy, anyways it doesn't annotate elements which are out of viewport
175
+ // fullPage: true,
176
+ // path: `screenshots/screenshot-${screenshotIndex++}.png`, // enable this and screenshotIndex var for local debugging
176
177
  });
177
178
  const testGenReporter = new reporter_1.TestGenUpdatesReporter();
178
179
  const testGenSnapshotUpdatePromise = testGenReporter.sendCurrentView(buffer);
179
180
  const pageScreenshot = buffer.toString("base64");
180
181
  let output;
182
+ let generatedCodeSteps = [];
181
183
  let annotations;
182
184
  let testGenAnnotatedSnapshotUpdatePromise;
183
185
  let annotatedPageScreenshot;
@@ -192,8 +194,9 @@ async function createTestUsingMasterAgent({ task, page, testCase, options, scope
192
194
  annotations = annotationResult?.annotations || {};
193
195
  await page.waitForTimeout(2000);
194
196
  const annonationBuffer = await page.screenshot({
195
- fullPage: true,
196
- // path: `screenshots/screenshot-${screenshotIndex++}.png`,
197
+ //This is done to improve element annotation accuracy, anyways it doesn't annotate elements which are out of viewport
198
+ // fullPage: true,
199
+ // path: `screenshots/screenshot-${screenshotIndex++}.png`,
197
200
  });
198
201
  await page.evaluate(() => {
199
202
  console.log({
@@ -269,23 +272,29 @@ async function createTestUsingMasterAgent({ task, page, testCase, options, scope
269
272
  void testGenReporter.sendMessage(output.reason);
270
273
  logger.log(`Next Action: ${output.action}`);
271
274
  if (toolCall.function.name === skill_1.SKILL_USAGE) {
272
- await actions.executeAction(toolCall.function.name, args, masterAgentActionSpan);
275
+ const code = await actions.executeAction(toolCall.function.name, args, masterAgentActionSpan);
276
+ if (code) {
277
+ generatedCodeSteps.push(code);
278
+ }
273
279
  }
274
280
  else if (shouldTriggerHintsFlow && hintsExecutionCompletion) {
275
281
  const toolCalls = hintsExecutionCompletion?.tool_calls || [];
276
282
  for (const i in toolCalls) {
277
283
  const currentToolCall = toolCalls[i];
278
- await actions.executeAction(currentToolCall.function.name, {
284
+ const code = await actions.executeAction(currentToolCall.function.name, {
279
285
  ...JSON.parse(currentToolCall.function.arguments),
280
286
  ...args,
281
287
  }, masterAgentActionSpan);
288
+ if (code) {
289
+ generatedCodeSteps.push(code);
290
+ }
282
291
  }
283
292
  if (actions.isStuckInLoop()) {
284
293
  throw new Error("Agent is not able to figure out next action when using hints");
285
294
  }
286
295
  }
287
296
  else {
288
- await (0, browsing_1.executeTaskUsingBrowsingAgent)({
297
+ generatedCodeSteps = await (0, browsing_1.executeTaskUsingBrowsingAgent)({
289
298
  trace: masterAgentActionSpan,
290
299
  action: output.action,
291
300
  logger,
@@ -343,7 +352,11 @@ async function createTestUsingMasterAgent({ task, page, testCase, options, scope
343
352
  await testGenAnnotatedSnapshotUpdatePromise;
344
353
  }
345
354
  masterAgentSpan?.end({
346
- output: { action: output.action, reason: output.reason },
355
+ output: {
356
+ action: output.action,
357
+ reason: output.reason,
358
+ code: generatedCodeSteps,
359
+ },
347
360
  });
348
361
  }
349
362
  const { code, importPaths } = actions.generateCode();
@@ -0,0 +1,8 @@
1
+ import { TraceClient } from "@empiricalrun/llm";
2
+ import { TestCase } from "../../types";
3
+ export declare function planTask({ testCase, specPath, trace, }: {
4
+ testCase: TestCase;
5
+ specPath: string;
6
+ trace?: TraceClient;
7
+ }): Promise<string>;
8
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/planner/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMhE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAsBvC,wBAAsB,QAAQ,CAAC,EAC7B,QAAQ,EACR,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,mBA0DA"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.planTask = void 0;
4
+ const llm_1 = require("@empiricalrun/llm");
5
+ const context_1 = require("../../bin/utils/context");
6
+ function extractTestPlan(input) {
7
+ const result = {
8
+ createSubTasks: "",
9
+ verfiedSubTasks: "",
10
+ enrichedSubTasks: "",
11
+ finalPlan: "",
12
+ };
13
+ const regex = /<create_sub_tasks>([\s\S]*?)<\/create_sub_tasks>[\s\S]*?<enriched_sub_tasks>([\s\S]*?)<\/enriched_sub_tasks>[\s\S]*?<final_plan>([\s\S]*?)<\/final_plan>/g;
14
+ let match;
15
+ while ((match = regex.exec(input)) !== null) {
16
+ const [, createSubTasks, enrichedSubTasks, finalPlan] = match;
17
+ result.createSubTasks = createSubTasks?.trim() || "";
18
+ result.enrichedSubTasks = enrichedSubTasks?.trim() || "";
19
+ result.finalPlan = finalPlan?.trim() || "";
20
+ }
21
+ return result;
22
+ }
23
+ async function planTask({ testCase, specPath, trace, }) {
24
+ const task = testCase.steps.join("\n");
25
+ // TODO: fix this
26
+ let fileContext = "";
27
+ try {
28
+ const { pomPrompt, testFileContent } = await (0, context_1.contextForGeneration)(specPath);
29
+ fileContext = `
30
+ ${testFileContent}
31
+ ${pomPrompt}
32
+ `;
33
+ }
34
+ catch (e) {
35
+ console.warn("Failed to generate file context for planner", e);
36
+ }
37
+ const plannerSpan = trace?.span({
38
+ name: "planner",
39
+ input: {
40
+ testCase,
41
+ },
42
+ });
43
+ const appKnowledge = await (0, context_1.fetchAppKnowledge)();
44
+ const promptSpan = plannerSpan?.span({
45
+ name: "planner-prompt",
46
+ input: {
47
+ appKnowledge,
48
+ fileContext,
49
+ testCase,
50
+ },
51
+ });
52
+ const messages = await (0, llm_1.getPrompt)("planner", {
53
+ appKnowledge,
54
+ fileContext,
55
+ task,
56
+ }, 2);
57
+ promptSpan?.end({ output: { messages } });
58
+ const llm = new llm_1.LLM({
59
+ provider: "openai",
60
+ //TODO: change to o1
61
+ defaultModel: "gpt-4o",
62
+ });
63
+ const response = await llm.createChatCompletion({
64
+ trace: plannerSpan,
65
+ traceName: "planner-llm",
66
+ messages,
67
+ modelParameters: {
68
+ temperature: 0.5,
69
+ },
70
+ });
71
+ const plan = extractTestPlan(response?.content || "");
72
+ plannerSpan?.end({ output: plan?.finalPlan });
73
+ return plan?.finalPlan;
74
+ }
75
+ exports.planTask = planTask;
package/dist/bin/index.js CHANGED
@@ -10,6 +10,7 @@ const run_1 = require("../agent/browsing/run");
10
10
  const utils_1 = require("../agent/browsing/utils");
11
11
  const run_2 = require("../agent/codegen/run");
12
12
  const infer_agent_1 = require("../agent/infer-agent");
13
+ const run_3 = require("../agent/planner/run");
13
14
  const reporter_1 = require("../reporter");
14
15
  const ci_1 = require("../reporter/ci");
15
16
  const session_1 = require("../session");
@@ -77,9 +78,19 @@ async function runAgent(testGenConfig) {
77
78
  });
78
79
  testGenConfig.options.agent = agent;
79
80
  }
81
+ logger.success(`Generating test using ${testGenConfig.options?.agent} agent. ${process.env.LOG_URL ? `[view log](${process.env.LOG_URL})` : ""}`);
82
+ if (agent === "plan") {
83
+ const plan = await (0, run_3.planTask)({
84
+ testCase,
85
+ specPath,
86
+ trace,
87
+ });
88
+ new logger_1.CustomLogger({ useReporter: false }).log("Generated Plan:", plan);
89
+ await new reporter_1.TestGenUpdatesReporter().sendMessage(plan);
90
+ return;
91
+ }
80
92
  if (agent !== "code") {
81
93
  // this assumes we have only one scenario in test config
82
- logger.success(`Generating test using ${testGenConfig.options?.agent} agent. ${process.env.LOG_URL ? `[view log](${process.env.LOG_URL})` : ""}`);
83
94
  const filePathToUpdate = await (0, utils_1.prepareFileForMasterAgent)(testGenConfig, trace);
84
95
  await (0, run_1.generateTestsUsingMasterAgent)({
85
96
  testFilePath: specPath,
@@ -88,7 +99,6 @@ async function runAgent(testGenConfig) {
88
99
  });
89
100
  }
90
101
  else {
91
- logger.success(`Generating test using coding agent. ${process.env.LOG_URL ? `[view log](${process.env.LOG_URL})` : ""}`);
92
102
  await (0, run_2.generateTest)(testCase, specPath, testGenConfig.options, trace);
93
103
  }
94
104
  }
@@ -123,7 +133,8 @@ async function runAgent(testGenConfig) {
123
133
  testGenFailed = true;
124
134
  new logger_1.CustomLogger().error(`Failed to generate test for the scenario. ${process.env.LOG_URL ? `[view log](${process.env.LOG_URL})` : ""}`, e?.message, e?.stack);
125
135
  }
126
- if (testGenConfig.options?.agent !== "code") {
136
+ if (testGenConfig.options?.agent !== "code" &&
137
+ testGenConfig.options?.agent !== "plan") {
127
138
  await new reporter_1.TestGenUpdatesReporter().reportGenAssets({
128
139
  projectRepoName: testGenConfig.options.metadata.projectRepoName,
129
140
  testName: testGenConfig.testCase.name,
@@ -4,4 +4,5 @@ export declare function contextForGeneration(file: string): Promise<{
4
4
  pomPrompt: string | undefined;
5
5
  testFileContent: string;
6
6
  }>;
7
+ export declare function fetchAppKnowledge(): Promise<string>;
7
8
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/context.ts"],"names":[],"mappings":"AAKA,wBAAsB,yBAAyB,2CAS9C;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM;;;;GAOtD"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/context.ts"],"names":[],"mappings":"AAKA,wBAAsB,yBAAyB,2CAS9C;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM;;;;GAOtD;AAED,wBAAsB,iBAAiB,oBAYtC"}
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.contextForGeneration = exports.createGitIgnoreFileFilter = void 0;
6
+ exports.fetchAppKnowledge = exports.contextForGeneration = exports.createGitIgnoreFileFilter = void 0;
7
7
  const fs_extra_1 = __importDefault(require("fs-extra"));
8
8
  const ignore_1 = __importDefault(require("ignore"));
9
9
  const fs_1 = require("./fs");
@@ -27,3 +27,18 @@ async function contextForGeneration(file) {
27
27
  };
28
28
  }
29
29
  exports.contextForGeneration = contextForGeneration;
30
+ async function fetchAppKnowledge() {
31
+ let fileExists = true;
32
+ const appKnowledgePath = "./app_knowledge.md";
33
+ try {
34
+ await fs_extra_1.default.access(appKnowledgePath);
35
+ }
36
+ catch (e) {
37
+ fileExists = false;
38
+ }
39
+ if (!fileExists) {
40
+ return "";
41
+ }
42
+ return await fs_extra_1.default.readFile(appKnowledgePath, "utf-8");
43
+ }
44
+ exports.fetchAppKnowledge = fetchAppKnowledge;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/bin/utils/platform/web/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,IAAI,EAEJ,UAAU,EAEX,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,eAAO,MAAM,gCAAgC,eAC/B,UAAU,KACrB,MAgBF,CAAC;AAEF;;;;;;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;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG;IACF,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;CACnB,CA2CA;AAwBD,wBAAsB,0CAA0C,CAC9D,QAAQ,EAAE,MAAM,oBA+BjB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,IAAI,GAAG,SAAS,GACrB,IAAI,GAAG,SAAS,CA4BlB;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAG5E;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EA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,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,UAE5E;AAED,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,iBAMpD;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,UAcpD;AAED,wBAAsB,iCAAiC,CAAC,QAAQ,EAAE,MAAM,+BAoBvE;AAED,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,UA0CtB;AAED,eAAO,MAAM,6BAA6B;qBAKvB,MAAM;iBACV,MAAM;YACX,MAAM,EAAE;YA2DjB,CAAC;AAEF,eAAO,MAAM,iCAAiC,cACjC,MAAM,EAAE,gBACL,MAAM,sBAyBrB,CAAC;AAEF,wBAAsB,qBAAqB,CAAC,EAC1C,YAAY,EACZ,QAAQ,EACR,MAAM,GACP,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,iBAsDA;AAED,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EAAE,iBA2BzB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;CACpB,WAYA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,MAAM,GACP,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,UAOA"}
@@ -307,17 +307,16 @@ function replaceCreateTestWithNewCode(filePath, contents, generatedCode) {
307
307
  });
308
308
  const fixtureImportNode = sourceFile.getFirstDescendant((node) => !!(node.isKind(ts_morph_1.SyntaxKind.ImportDeclaration) &&
309
309
  node.getText().includes("fixtures")));
310
- if (!fixtureImportNode) {
311
- throw new Error("No import from fixtures found.");
312
- }
313
- const importClause = fixtureImportNode.getImportClause();
314
- const namedImports = importClause
315
- .getNamedImports()
316
- .map((imp) => imp.getName());
317
- const isComplete = namedImports.includes(testAlias) && namedImports.includes("expect");
318
- if (!isComplete) {
319
- const expectedImports = `import { test, expect } from "${getFixtureImportPath(filePath)}";`;
320
- updatedTestFile = updatedTestFile.replace(fixtureImportNode.getText(), expectedImports);
310
+ if (fixtureImportNode) {
311
+ const importClause = fixtureImportNode.getImportClause();
312
+ const namedImports = importClause
313
+ .getNamedImports()
314
+ .map((imp) => imp.getName());
315
+ const isComplete = namedImports.includes(testAlias) && namedImports.includes("expect");
316
+ if (!isComplete) {
317
+ const expectedImports = `import { test, expect } from "${getFixtureImportPath(filePath)}";`;
318
+ updatedTestFile = updatedTestFile.replace(fixtureImportNode.getText(), expectedImports);
319
+ }
321
320
  }
322
321
  return updatedTestFile;
323
322
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/utils/scenarios/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EAEd,MAAM,gBAAgB,CAAC;AAaxB,iBAAe,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAiB3E;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/utils/scenarios/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EAEd,MAAM,gBAAgB,CAAC;AAcxB,iBAAe,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAkB3E;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -13,6 +13,7 @@ async function loadTestConfigs(testGenToken) {
13
13
  steps: config.steps.filter((s) => !!s),
14
14
  filePath: config.filePath,
15
15
  suites: config.suites,
16
+ ai_gist: config.ai_gist,
16
17
  },
17
18
  build: config.build,
18
19
  options: config.options,
@@ -135,7 +135,8 @@ window.annotateClickableElements = function annotateClickableElements(
135
135
  if (
136
136
  style.display === "none" ||
137
137
  style.visibility === "hidden" ||
138
- parseFloat(style.opacity) === 0 ||
138
+ // This is done for cases where opacity is undefined
139
+ // parseFloat(style.opacity) === 0
139
140
  style.pointerEvents === "none"
140
141
  ) {
141
142
  return false;
@@ -24,7 +24,7 @@ const fetchSkillsAgentEvaluator = async ({ item, trace }) => {
24
24
  {
25
25
  name: "equality",
26
26
  value: output.some((o) => {
27
- return item.expectedOutput.some((e) => e.usageExample === o.usageExample);
27
+ return item.expectedOutput.some((e) => e.methodName === o.methodName);
28
28
  })
29
29
  ? 1
30
30
  : 0,
@@ -10,7 +10,7 @@ export type Environment = {
10
10
  slug: string;
11
11
  playwrightProjects: string[];
12
12
  };
13
- export type Agent = "code" | "master" | "auto";
13
+ export type Agent = "code" | "master" | "auto" | "plan";
14
14
  export type TestGenConfigOptions = {
15
15
  agent: Agent;
16
16
  model: LLMModel;
@@ -42,6 +42,7 @@ export type TestCase = {
42
42
  steps: string[];
43
43
  filePath: string;
44
44
  suites: string[];
45
+ ai_gist?: string;
45
46
  };
46
47
  export type PlaywrightActionGenerator = (page: Page, options: {
47
48
  stateVariables: Record<string, any>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,WAAW,EACX,eAAe,EACf,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;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,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,CAAC,OAAO,EAAE;QACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC1B,KAAK,CAAC,EAAE,WAAW,CAAC;KACrB,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IAC1C,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KACzB;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.37.3",
3
+ "version": "0.38.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -1,4 +0,0 @@
1
- import { PlaywrightActionGenerator } from "../types";
2
- export declare const PLAYWRIGHT_RELOAD_ACTION_NAME = "page_reload";
3
- export declare const reloadActionGenerator: PlaywrightActionGenerator;
4
- //# sourceMappingURL=reload-page.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reload-page.d.ts","sourceRoot":"","sources":["../../src/actions/reload-page.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAIrD,eAAO,MAAM,6BAA6B,gBAAgB,CAAC;AAE3D,eAAO,MAAM,qBAAqB,EAAE,yBAiCnC,CAAC"}
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reloadActionGenerator = exports.PLAYWRIGHT_RELOAD_ACTION_NAME = void 0;
4
- const utils_1 = require("../agent/browsing/utils");
5
- const constants_1 = require("./constants");
6
- const utils_2 = require("./utils");
7
- exports.PLAYWRIGHT_RELOAD_ACTION_NAME = "page_reload";
8
- const reloadActionGenerator = (page) => {
9
- return {
10
- execute: async () => {
11
- await page.reload();
12
- await page.waitForTimeout(3000);
13
- await (0, utils_1.injectPwLocatorGenerator)(page);
14
- },
15
- template: () => {
16
- const code = `await ${(0, utils_2.getPageVarName)()}.reload();`;
17
- return {
18
- code,
19
- };
20
- },
21
- name: exports.PLAYWRIGHT_RELOAD_ACTION_NAME,
22
- schema: {
23
- type: "function",
24
- function: {
25
- name: exports.PLAYWRIGHT_RELOAD_ACTION_NAME,
26
- description: "reload the page by calling this method. Call this method only when a page reload is requested in the task.",
27
- parameters: {
28
- type: "object",
29
- properties: {
30
- reason: {
31
- type: "string",
32
- description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
33
- },
34
- },
35
- required: ["reason"],
36
- },
37
- },
38
- },
39
- };
40
- };
41
- exports.reloadActionGenerator = reloadActionGenerator;