@empiricalrun/test-gen 0.45.0 → 0.46.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/actions/assert.d.ts +2 -2
  3. package/dist/actions/assert.d.ts.map +1 -1
  4. package/dist/actions/assert.js +1 -2
  5. package/dist/actions/click.d.ts +2 -2
  6. package/dist/actions/click.d.ts.map +1 -1
  7. package/dist/actions/click.js +1 -2
  8. package/dist/actions/done.d.ts +2 -2
  9. package/dist/actions/done.d.ts.map +1 -1
  10. package/dist/actions/fill.d.ts +2 -2
  11. package/dist/actions/fill.d.ts.map +1 -1
  12. package/dist/actions/fill.js +1 -2
  13. package/dist/actions/goto.d.ts +2 -2
  14. package/dist/actions/goto.d.ts.map +1 -1
  15. package/dist/actions/hover.d.ts +2 -2
  16. package/dist/actions/hover.d.ts.map +1 -1
  17. package/dist/actions/hover.js +3 -3
  18. package/dist/actions/index.d.ts +2 -2
  19. package/dist/actions/index.d.ts.map +1 -1
  20. package/dist/actions/press.d.ts +2 -2
  21. package/dist/actions/press.d.ts.map +1 -1
  22. package/dist/actions/skill.d.ts +2 -2
  23. package/dist/actions/skill.d.ts.map +1 -1
  24. package/dist/actions/skill.js +2 -3
  25. package/dist/actions/text-content.d.ts +3 -3
  26. package/dist/actions/text-content.d.ts.map +1 -1
  27. package/dist/actions/text-content.js +12 -13
  28. package/dist/agent/master/browser-tests/index.spec.js +8 -1
  29. package/dist/agent/master/element-annotation.d.ts +2 -1
  30. package/dist/agent/master/element-annotation.d.ts.map +1 -1
  31. package/dist/agent/master/element-annotation.js +45 -12
  32. package/dist/agent/master/icon-descriptor/index.d.ts +22 -0
  33. package/dist/agent/master/icon-descriptor/index.d.ts.map +1 -0
  34. package/dist/agent/master/icon-descriptor/index.js +211 -0
  35. package/dist/agent/master/icon-descriptor/normalize-svg.d.ts +2 -0
  36. package/dist/agent/master/icon-descriptor/normalize-svg.d.ts.map +1 -0
  37. package/dist/agent/master/icon-descriptor/normalize-svg.js +248 -0
  38. package/dist/agent/master/run.d.ts.map +1 -1
  39. package/dist/agent/master/run.js +2 -1
  40. package/dist/agent/master/scroller.d.ts.map +1 -1
  41. package/dist/agent/master/scroller.js +1 -0
  42. package/dist/agent/planner/run-time-planner.d.ts +2 -9
  43. package/dist/agent/planner/run-time-planner.d.ts.map +1 -1
  44. package/dist/agent/planner/run-time-planner.js +9 -46
  45. package/dist/index.d.ts +0 -1
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +0 -26
  48. package/dist/types/index.d.ts +46 -5
  49. package/dist/types/index.d.ts.map +1 -1
  50. package/package.json +3 -1
@@ -1,22 +1,23 @@
1
1
  import { TraceClient } from "@empiricalrun/llm";
2
2
  import OpenAI from "openai";
3
3
  import { TestGenPage } from "../page";
4
- export type PlaywrightActionGenerator = (page: TestGenPage, options: {
4
+ export type { TestGenPage };
5
+ export type PlaywrightActionGenerator<T extends BaseActionArgs = ActionArgs> = (page: TestGenPage, options: {
5
6
  stateVariables: Record<string, any>;
6
7
  setStateVariables: (stateVariables: Record<string, any>) => void;
7
- }) => Action;
8
+ }) => Action<T>;
8
9
  export type ActionSchema = OpenAI.Chat.Completions.ChatCompletionTool;
9
- export type Action = {
10
+ export type Action<T extends BaseActionArgs = ActionArgs> = {
10
11
  name: string;
11
12
  schema: ActionSchema;
12
13
  execute: (options: {
13
- args: Record<string, any>;
14
+ args: T;
14
15
  trace?: TraceClient;
15
16
  }) => Promise<{
16
17
  locator: string;
17
18
  testCaseLine?: string;
18
19
  } | void>;
19
- template: (args: Record<string, any>, options: {
20
+ template: (args: T, options: {
20
21
  locator: string;
21
22
  testCaseLine?: string;
22
23
  }) => {
@@ -25,4 +26,44 @@ export type Action = {
25
26
  };
26
27
  };
27
28
  export type ScopeVars = Record<string, any>;
29
+ export type BaseActionArgs = {
30
+ reason: string;
31
+ elementAnnotation?: string;
32
+ };
33
+ export type ClickActionArgs = BaseActionArgs & {
34
+ xpath: string;
35
+ css_selector: string;
36
+ };
37
+ export type FillActionArgs = BaseActionArgs & {
38
+ text: string;
39
+ variable_name: string;
40
+ xpath: string;
41
+ css_selector: string;
42
+ };
43
+ export type GotoActionArgs = BaseActionArgs & {
44
+ url: string;
45
+ };
46
+ export type PressActionArgs = BaseActionArgs & {
47
+ key: string;
48
+ xpath: string;
49
+ css_selector: string;
50
+ };
51
+ export type AssertTextVisibilityActionArgs = BaseActionArgs & {
52
+ xpath: string;
53
+ css_selector: string;
54
+ };
55
+ export type TextContentActionArgs = BaseActionArgs & {
56
+ variable_name: string;
57
+ xpath: string;
58
+ css_selector: string;
59
+ };
60
+ export type HoverActionArgs = BaseActionArgs & {
61
+ xpath: string;
62
+ css_selector: string;
63
+ };
64
+ export type SkillActionArgs = BaseActionArgs & {
65
+ skill: string;
66
+ action: string;
67
+ };
68
+ export type ActionArgs = ClickActionArgs | FillActionArgs | GotoActionArgs | PressActionArgs | AssertTextVisibilityActionArgs | TextContentActionArgs | HoverActionArgs | SkillActionArgs;
28
69
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,MAAM,MAAM,yBAAyB,GAAG,CACtC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE;IACP,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,iBAAiB,EAAE,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;CAClE,KACE,MAAM,CAAC;AAEZ,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,kBAAk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AAM,eAAe,GAAG,cAAc,GAAG;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,cAAc,GAAG;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,cAAc,GAAG;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB,eAAe,GACf,cAAc,GACd,cAAc,GACd,eAAe,GACf,8BAA8B,GAC9B,qBAAqB,GACrB,eAAe,GACf,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.45.0",
3
+ "version": "0.46.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -59,6 +59,7 @@
59
59
  "google-spreadsheet": "^4.1.2",
60
60
  "ignore": "^5.3.1",
61
61
  "inquirer": "^12.4.2",
62
+ "jsdom": "^26.0.0",
62
63
  "lodash.isequal": "^4.5.0",
63
64
  "md5": "^2.3.0",
64
65
  "mime": "^4.0.4",
@@ -84,6 +85,7 @@
84
85
  "@types/fs-extra": "^11.0.4",
85
86
  "@types/http-server": "^0.12.4",
86
87
  "@types/js-levenshtein": "^1.1.3",
88
+ "@types/jsdom": "^21.1.7",
87
89
  "@types/lodash.isequal": "^4.5.8",
88
90
  "@types/md5": "^2.3.5",
89
91
  "http-server": "^14.1.1",