@empiricalrun/test-gen 0.81.0 → 0.81.2

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 (75) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/file-info/adapters/github/reader.d.ts +1 -1
  3. package/dist/file-info/adapters/github/reader.d.ts.map +1 -1
  4. package/dist/file-info/adapters/github/reader.js +7 -5
  5. package/dist/tools/create-pull-request/index.d.ts.map +1 -1
  6. package/dist/tools/create-pull-request/index.js +1 -3
  7. package/dist/tools/create-pull-request/utils.d.ts +1 -0
  8. package/dist/tools/create-pull-request/utils.d.ts.map +1 -1
  9. package/dist/tools/create-pull-request/utils.js +4 -0
  10. package/dist/tools/executor/utils/git.d.ts +2 -1
  11. package/dist/tools/executor/utils/git.d.ts.map +1 -1
  12. package/dist/tools/executor/utils/git.js +3 -2
  13. package/dist/tools/executor/utils/index.d.ts.map +1 -1
  14. package/dist/tools/executor/utils/index.js +4 -0
  15. package/package.json +9 -9
  16. package/tsconfig.tsbuildinfo +1 -1
  17. package/dist/agent/browsing/index.d.ts +0 -15
  18. package/dist/agent/browsing/index.d.ts.map +0 -1
  19. package/dist/agent/browsing/index.js +0 -60
  20. package/dist/agent/master/action-tool-calls.d.ts +0 -42
  21. package/dist/agent/master/action-tool-calls.d.ts.map +0 -1
  22. package/dist/agent/master/action-tool-calls.js +0 -87
  23. package/dist/agent/master/element-annotation.d.ts +0 -30
  24. package/dist/agent/master/element-annotation.d.ts.map +0 -1
  25. package/dist/agent/master/element-annotation.js +0 -175
  26. package/dist/agent/master/execute-browser-action.d.ts +0 -24
  27. package/dist/agent/master/execute-browser-action.d.ts.map +0 -1
  28. package/dist/agent/master/execute-browser-action.js +0 -121
  29. package/dist/agent/master/next-action.d.ts +0 -22
  30. package/dist/agent/master/next-action.d.ts.map +0 -1
  31. package/dist/agent/master/next-action.js +0 -97
  32. package/dist/agent/master/planner.d.ts +0 -15
  33. package/dist/agent/master/planner.d.ts.map +0 -1
  34. package/dist/agent/master/planner.js +0 -142
  35. package/dist/agent/master/run.d.ts +0 -17
  36. package/dist/agent/master/run.d.ts.map +0 -1
  37. package/dist/agent/master/run.js +0 -156
  38. package/dist/agent/master/scroller.d.ts +0 -15
  39. package/dist/agent/master/scroller.d.ts.map +0 -1
  40. package/dist/agent/master/scroller.js +0 -369
  41. package/dist/agent/master/with-hints.d.ts +0 -17
  42. package/dist/agent/master/with-hints.d.ts.map +0 -1
  43. package/dist/agent/master/with-hints.js +0 -103
  44. package/dist/agent/planner/run-time-planner.d.ts +0 -15
  45. package/dist/agent/planner/run-time-planner.d.ts.map +0 -1
  46. package/dist/agent/planner/run-time-planner.js +0 -98
  47. package/dist/agent/planner/run.d.ts +0 -7
  48. package/dist/agent/planner/run.d.ts.map +0 -1
  49. package/dist/agent/planner/run.js +0 -128
  50. package/dist/browser-injected-scripts/annotate-elements.js +0 -612
  51. package/dist/browser-injected-scripts/annotate-elements.spec.d.ts +0 -2
  52. package/dist/browser-injected-scripts/annotate-elements.spec.d.ts.map +0 -1
  53. package/dist/browser-injected-scripts/annotate-elements.spec.js +0 -202
  54. package/dist/browser-injected-scripts/annotate-elements.spec.ts +0 -327
  55. package/dist/generate-summary/frame-sampling.d.ts +0 -12
  56. package/dist/generate-summary/frame-sampling.d.ts.map +0 -1
  57. package/dist/generate-summary/frame-sampling.js +0 -72
  58. package/dist/generate-summary/generate-error-stack-summary.d.ts +0 -11
  59. package/dist/generate-summary/generate-error-stack-summary.d.ts.map +0 -1
  60. package/dist/generate-summary/generate-error-stack-summary.js +0 -41
  61. package/dist/generate-summary/generate-failed-step-screenshot-diff-summary.d.ts +0 -58
  62. package/dist/generate-summary/generate-failed-step-screenshot-diff-summary.d.ts.map +0 -1
  63. package/dist/generate-summary/generate-failed-step-screenshot-diff-summary.js +0 -460
  64. package/dist/generate-summary/generate-grouped-summary.d.ts +0 -18
  65. package/dist/generate-summary/generate-grouped-summary.d.ts.map +0 -1
  66. package/dist/generate-summary/generate-grouped-summary.js +0 -88
  67. package/dist/generate-summary/merge-summary.d.ts +0 -16
  68. package/dist/generate-summary/merge-summary.d.ts.map +0 -1
  69. package/dist/generate-summary/merge-summary.js +0 -43
  70. package/dist/generate-summary/pick-videos-for-comparison.d.ts +0 -9
  71. package/dist/generate-summary/pick-videos-for-comparison.d.ts.map +0 -1
  72. package/dist/generate-summary/pick-videos-for-comparison.js +0 -54
  73. package/dist/utils/env.d.ts +0 -2
  74. package/dist/utils/env.d.ts.map +0 -1
  75. package/dist/utils/env.js +0 -7
@@ -1,202 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- // @ts-nocheck
7
- const test_1 = require("@playwright/test");
8
- const path_1 = __importDefault(require("path"));
9
- const action_tool_calls_1 = require("../agent/master/action-tool-calls");
10
- (0, test_1.test)("should annotate all links on empirical landing page", async ({ page, }) => {
11
- await page.goto("https://assets-test.empirical.run/selector-hints-testing/dom-1.html");
12
- await page.addScriptTag({
13
- path: path_1.default.resolve(__dirname, "./annotate-elements.js"),
14
- });
15
- const annotations = await page.evaluate(() => {
16
- const { annotations } = annotateElementsWithPreference();
17
- return Object.entries(annotations).map(([, config]) => ({
18
- innerText: config.node.innerText,
19
- tagName: config.node.tagName,
20
- href: config.node.href,
21
- }));
22
- });
23
- test_1.test.expect(annotations).toEqual([
24
- {
25
- innerText: "Empirical",
26
- tagName: "A",
27
- href: "https://assets-test.empirical.run/",
28
- },
29
- {
30
- innerText: "Blog",
31
- tagName: "A",
32
- href: "https://assets-test.empirical.run/blog",
33
- },
34
- {
35
- innerText: "Contact us",
36
- tagName: "A",
37
- href: "https://assets-test.empirical.run/contact",
38
- },
39
- {
40
- href: "https://dash.empirical.run/",
41
- innerText: "Login ↗\n(opens in a new tab)",
42
- tagName: "A",
43
- },
44
- {
45
- innerText: "Get early access",
46
- tagName: "A",
47
- href: "https://assets-test.empirical.run/contact",
48
- },
49
- ]);
50
- });
51
- (0, test_1.test)("should annotate all important items on quizizz page", async ({ page, }) => {
52
- await page.goto("https://assets-test.empirical.run/selector-hints-testing/dom-2/index.html");
53
- await page.addScriptTag({
54
- path: path_1.default.resolve(__dirname, "./annotate-elements.js"),
55
- });
56
- const annotations = await page.evaluate(() => {
57
- const { annotations } = annotateElementsWithPreference();
58
- return Object.entries(annotations).map(([hint, config]) => ({
59
- hint,
60
- innerText: config.node.innerText.toLowerCase().trim(),
61
- tagName: config.node.tagName,
62
- testId: config.node.getAttribute("data-testid"),
63
- href: config.node.href,
64
- }));
65
- });
66
- test_1.test
67
- .expect(annotations.find((item) => item.innerText.includes("enter code")))
68
- .toBeTruthy();
69
- test_1.test
70
- .expect(annotations.find((item) => item.innerText.includes("get help")))
71
- .toBeTruthy();
72
- test_1.test
73
- .expect(annotations.find((item) => item.innerText.includes("create") &&
74
- item.testId === "create-content-button"))
75
- .toBeTruthy();
76
- test_1.test
77
- .expect(annotations.find((item) => item.innerText.includes("explore") &&
78
- item.href === "https://quizizz.com/admin"))
79
- .toBeTruthy();
80
- test_1.test
81
- .expect(annotations.find((item) => item.innerText.includes("library") &&
82
- item.href === "https://quizizz.com/admin/my-library/createdByMe"))
83
- .toBeTruthy();
84
- test_1.test
85
- .expect(annotations.find((item) => item.innerText.includes("reports") &&
86
- item.href === "https://quizizz.com/admin/reports"))
87
- .toBeTruthy();
88
- test_1.test
89
- .expect(annotations.find((item) => item.innerText.includes("classes") &&
90
- item.href === "https://quizizz.com/admin/classes"))
91
- .toBeTruthy();
92
- test_1.test
93
- .expect(annotations.find((item) => item.innerText.includes("accommodations") &&
94
- item.href ===
95
- "https://quizizz.com/admin/differentiation/accommodations"))
96
- .toBeTruthy();
97
- test_1.test
98
- .expect(annotations.find((item) => item.innerText.includes("quizizz ai") &&
99
- item.href === "https://quizizz.com/admin/quizizz-ai"))
100
- .toBeTruthy();
101
- test_1.test
102
- .expect(annotations.find((item) => item.innerText.includes("start your free trial") &&
103
- item.href === "https://quizizz.com/super-pricing"))
104
- .toBeTruthy();
105
- test_1.test
106
- .expect(annotations.find((item) => item.innerText.includes("upgrade") &&
107
- item.href === "https://quizizz.com/super-pricing?backto=/admin"))
108
- .toBeTruthy();
109
- test_1.test
110
- .expect(annotations.find((item) => item.tagName === "INPUT" &&
111
- item.testId === "emphasized-search-bar-input"))
112
- .toBeTruthy();
113
- test_1.test
114
- .expect(annotations.find((item) => item.tagName === "BUTTON" &&
115
- item.innerText.includes("verify details") &&
116
- item.testId === "verify-profile-cta"))
117
- .toBeTruthy();
118
- test_1.test
119
- .expect(annotations.find((item) => item.tagName === "BUTTON" && item.innerText.includes("for you")))
120
- .toBeTruthy();
121
- test_1.test
122
- .expect(annotations.find((item) => item.tagName === "BUTTON" && item.innerText.includes("assessments")))
123
- .toBeTruthy();
124
- test_1.test
125
- .expect(annotations.find((item) => item.tagName === "BUTTON" && item.innerText.includes("lessons")))
126
- .toBeTruthy();
127
- test_1.test
128
- .expect(annotations.find((item) => item.tagName === "BUTTON" &&
129
- item.innerText.includes("interactive videos")))
130
- .toBeTruthy();
131
- test_1.test
132
- .expect(annotations.find((item) => item.tagName === "BUTTON" && item.innerText.includes("passages")))
133
- .toBeTruthy();
134
- });
135
- (0, test_1.test)("should only annotate input fields on quizizz page", async ({ page }) => {
136
- await page.goto("https://assets-test.empirical.run/selector-hints-testing/dom-2/index.html");
137
- await page.addScriptTag({
138
- path: path_1.default.resolve(__dirname, "./annotate-elements.js"),
139
- });
140
- const preference = {
141
- actionType: action_tool_calls_1.ActionType.FILL,
142
- };
143
- const annotations = await page.evaluate((preference) => {
144
- const { annotations } = annotateElementsWithPreference({
145
- preference: preference,
146
- });
147
- return Object.entries(annotations).map(([hint, config]) => ({
148
- hint,
149
- innerText: config.node.innerText.toLowerCase().trim(),
150
- tagName: config.node.tagName,
151
- testId: config.node.getAttribute("data-testid"),
152
- href: config.node.href,
153
- }));
154
- }, preference);
155
- test_1.test.expect(annotations.length).toBe(1);
156
- test_1.test.expect(annotations[0].testId).toBe("emphasized-search-bar-input");
157
- });
158
- (0, test_1.test)("should only annotate given text on quizziz page", async ({ page }) => {
159
- await page.goto("https://assets-test.empirical.run/selector-hints-testing/dom-2/index.html");
160
- await page.addScriptTag({
161
- path: path_1.default.resolve(__dirname, "./annotate-elements.js"),
162
- });
163
- const preference = {
164
- actionType: action_tool_calls_1.ActionType.ASSERT_TEXT,
165
- assertionText: "What are you teaching today?",
166
- };
167
- const annotations = await page.evaluate((preference) => {
168
- const { annotations } = annotateElementsWithPreference({
169
- preference: preference,
170
- });
171
- return Object.entries(annotations).map(([hint, config]) => ({
172
- hint,
173
- innerText: config.node.innerText?.toLowerCase().trim(),
174
- tagName: config.node.tagName,
175
- testId: config.node.getAttribute("data-testid"),
176
- href: config.node.href,
177
- }));
178
- }, preference);
179
- test_1.test.expect(annotations.length).toBe(1);
180
- test_1.test.expect(annotations[0]?.tagName).toBe("DIV");
181
- });
182
- (0, test_1.test)("should not annotate children that don't have onClick handler", async ({ page, }) => {
183
- await page.setContent(`<div class="button-outer" onclick="alert('clicked')">
184
- <div class="button-inner">Click me</div>
185
- </div>`);
186
- await page.addScriptTag({
187
- path: path_1.default.resolve(__dirname, "./annotate-elements.js"),
188
- });
189
- const annotations = await page.evaluate(() => {
190
- const { annotations } = annotateElementsWithPreference();
191
- return Object.entries(annotations).map(([hint, config]) => ({
192
- hint,
193
- innerText: config.node.innerText?.toLowerCase().trim(),
194
- tagName: config.node.tagName,
195
- testId: config.node.getAttribute("data-testid"),
196
- className: config.node.className,
197
- }));
198
- });
199
- console.log(annotations);
200
- test_1.test.expect(annotations.length).toBe(1);
201
- test_1.test.expect(annotations[0].className).toBe("button-outer");
202
- });
@@ -1,327 +0,0 @@
1
- // @ts-nocheck
2
-
3
- import { test } from "@playwright/test";
4
- import path from "path";
5
-
6
- import { ActionType } from "../agent/master/action-tool-calls";
7
- import { AnnotationPreference } from "../agent/master/element-annotation";
8
-
9
- test("should annotate all links on empirical landing page", async ({
10
- page,
11
- }) => {
12
- await page.goto(
13
- "https://assets-test.empirical.run/selector-hints-testing/dom-1.html",
14
- );
15
-
16
- await page.addScriptTag({
17
- path: path.resolve(__dirname, "./annotate-elements.js"),
18
- });
19
-
20
- const annotations = await page.evaluate(() => {
21
- const { annotations } = annotateElementsWithPreference();
22
-
23
- return Object.entries(annotations).map(([, config]) => ({
24
- innerText: config.node.innerText,
25
- tagName: config.node.tagName,
26
- href: config.node.href,
27
- }));
28
- });
29
-
30
- test.expect(annotations).toEqual([
31
- {
32
- innerText: "Empirical",
33
- tagName: "A",
34
- href: "https://assets-test.empirical.run/",
35
- },
36
- {
37
- innerText: "Blog",
38
- tagName: "A",
39
- href: "https://assets-test.empirical.run/blog",
40
- },
41
- {
42
- innerText: "Contact us",
43
- tagName: "A",
44
- href: "https://assets-test.empirical.run/contact",
45
- },
46
- {
47
- href: "https://dash.empirical.run/",
48
- innerText: "Login ↗\n(opens in a new tab)",
49
- tagName: "A",
50
- },
51
- {
52
- innerText: "Get early access",
53
- tagName: "A",
54
- href: "https://assets-test.empirical.run/contact",
55
- },
56
- ]);
57
- });
58
-
59
- test("should annotate all important items on quizizz page", async ({
60
- page,
61
- }) => {
62
- await page.goto(
63
- "https://assets-test.empirical.run/selector-hints-testing/dom-2/index.html",
64
- );
65
-
66
- await page.addScriptTag({
67
- path: path.resolve(__dirname, "./annotate-elements.js"),
68
- });
69
-
70
- const annotations = await page.evaluate(() => {
71
- const { annotations } = annotateElementsWithPreference();
72
-
73
- return Object.entries(annotations).map(([hint, config]) => ({
74
- hint,
75
- innerText: config.node.innerText.toLowerCase().trim(),
76
- tagName: config.node.tagName,
77
- testId: config.node.getAttribute("data-testid"),
78
- href: config.node.href,
79
- }));
80
- });
81
-
82
- test
83
- .expect(annotations.find((item) => item.innerText.includes("enter code")))
84
- .toBeTruthy();
85
- test
86
- .expect(annotations.find((item) => item.innerText.includes("get help")))
87
- .toBeTruthy();
88
- test
89
- .expect(
90
- annotations.find(
91
- (item) =>
92
- item.innerText.includes("create") &&
93
- item.testId === "create-content-button",
94
- ),
95
- )
96
- .toBeTruthy();
97
- test
98
- .expect(
99
- annotations.find(
100
- (item) =>
101
- item.innerText.includes("explore") &&
102
- item.href === "https://quizizz.com/admin",
103
- ),
104
- )
105
- .toBeTruthy();
106
- test
107
- .expect(
108
- annotations.find(
109
- (item) =>
110
- item.innerText.includes("library") &&
111
- item.href === "https://quizizz.com/admin/my-library/createdByMe",
112
- ),
113
- )
114
- .toBeTruthy();
115
- test
116
- .expect(
117
- annotations.find(
118
- (item) =>
119
- item.innerText.includes("reports") &&
120
- item.href === "https://quizizz.com/admin/reports",
121
- ),
122
- )
123
- .toBeTruthy();
124
- test
125
- .expect(
126
- annotations.find(
127
- (item) =>
128
- item.innerText.includes("classes") &&
129
- item.href === "https://quizizz.com/admin/classes",
130
- ),
131
- )
132
- .toBeTruthy();
133
- test
134
- .expect(
135
- annotations.find(
136
- (item) =>
137
- item.innerText.includes("accommodations") &&
138
- item.href ===
139
- "https://quizizz.com/admin/differentiation/accommodations",
140
- ),
141
- )
142
- .toBeTruthy();
143
- test
144
- .expect(
145
- annotations.find(
146
- (item) =>
147
- item.innerText.includes("quizizz ai") &&
148
- item.href === "https://quizizz.com/admin/quizizz-ai",
149
- ),
150
- )
151
- .toBeTruthy();
152
- test
153
- .expect(
154
- annotations.find(
155
- (item) =>
156
- item.innerText.includes("start your free trial") &&
157
- item.href === "https://quizizz.com/super-pricing",
158
- ),
159
- )
160
- .toBeTruthy();
161
- test
162
- .expect(
163
- annotations.find(
164
- (item) =>
165
- item.innerText.includes("upgrade") &&
166
- item.href === "https://quizizz.com/super-pricing?backto=/admin",
167
- ),
168
- )
169
- .toBeTruthy();
170
-
171
- test
172
- .expect(
173
- annotations.find(
174
- (item) =>
175
- item.tagName === "INPUT" &&
176
- item.testId === "emphasized-search-bar-input",
177
- ),
178
- )
179
- .toBeTruthy();
180
-
181
- test
182
- .expect(
183
- annotations.find(
184
- (item) =>
185
- item.tagName === "BUTTON" &&
186
- item.innerText.includes("verify details") &&
187
- item.testId === "verify-profile-cta",
188
- ),
189
- )
190
- .toBeTruthy();
191
-
192
- test
193
- .expect(
194
- annotations.find(
195
- (item) =>
196
- item.tagName === "BUTTON" && item.innerText.includes("for you"),
197
- ),
198
- )
199
- .toBeTruthy();
200
-
201
- test
202
- .expect(
203
- annotations.find(
204
- (item) =>
205
- item.tagName === "BUTTON" && item.innerText.includes("assessments"),
206
- ),
207
- )
208
- .toBeTruthy();
209
-
210
- test
211
- .expect(
212
- annotations.find(
213
- (item) =>
214
- item.tagName === "BUTTON" && item.innerText.includes("lessons"),
215
- ),
216
- )
217
- .toBeTruthy();
218
-
219
- test
220
- .expect(
221
- annotations.find(
222
- (item) =>
223
- item.tagName === "BUTTON" &&
224
- item.innerText.includes("interactive videos"),
225
- ),
226
- )
227
- .toBeTruthy();
228
-
229
- test
230
- .expect(
231
- annotations.find(
232
- (item) =>
233
- item.tagName === "BUTTON" && item.innerText.includes("passages"),
234
- ),
235
- )
236
- .toBeTruthy();
237
- });
238
-
239
- test("should only annotate input fields on quizizz page", async ({ page }) => {
240
- await page.goto(
241
- "https://assets-test.empirical.run/selector-hints-testing/dom-2/index.html",
242
- );
243
-
244
- await page.addScriptTag({
245
- path: path.resolve(__dirname, "./annotate-elements.js"),
246
- });
247
-
248
- const preference = {
249
- actionType: ActionType.FILL,
250
- };
251
- const annotations = await page.evaluate((preference) => {
252
- const { annotations } = annotateElementsWithPreference({
253
- preference: preference,
254
- });
255
-
256
- return Object.entries(annotations).map(([hint, config]) => ({
257
- hint,
258
- innerText: config.node.innerText.toLowerCase().trim(),
259
- tagName: config.node.tagName,
260
- testId: config.node.getAttribute("data-testid"),
261
- href: config.node.href,
262
- }));
263
- }, preference);
264
-
265
- test.expect(annotations.length).toBe(1);
266
- test.expect(annotations[0].testId).toBe("emphasized-search-bar-input");
267
- });
268
-
269
- test("should only annotate given text on quizziz page", async ({ page }) => {
270
- await page.goto(
271
- "https://assets-test.empirical.run/selector-hints-testing/dom-2/index.html",
272
- );
273
-
274
- await page.addScriptTag({
275
- path: path.resolve(__dirname, "./annotate-elements.js"),
276
- });
277
-
278
- const preference: AnnotationPreference = {
279
- actionType: ActionType.ASSERT_TEXT,
280
- assertionText: "What are you teaching today?",
281
- };
282
- const annotations = await page.evaluate((preference) => {
283
- const { annotations } = annotateElementsWithPreference({
284
- preference: preference,
285
- });
286
-
287
- return Object.entries(annotations).map(([hint, config]) => ({
288
- hint,
289
- innerText: config.node.innerText?.toLowerCase().trim(),
290
- tagName: config.node.tagName,
291
- testId: config.node.getAttribute("data-testid"),
292
- href: config.node.href,
293
- }));
294
- }, preference);
295
- test.expect(annotations.length).toBe(1);
296
- test.expect(annotations[0]?.tagName).toBe("DIV");
297
- });
298
-
299
- test("should not annotate children that don't have onClick handler", async ({
300
- page,
301
- }) => {
302
- await page.setContent(
303
- `<div class="button-outer" onclick="alert('clicked')">
304
- <div class="button-inner">Click me</div>
305
- </div>`,
306
- );
307
-
308
- await page.addScriptTag({
309
- path: path.resolve(__dirname, "./annotate-elements.js"),
310
- });
311
-
312
- const annotations = await page.evaluate(() => {
313
- const { annotations } = annotateElementsWithPreference();
314
-
315
- return Object.entries(annotations).map(([hint, config]) => ({
316
- hint,
317
- innerText: config.node.innerText?.toLowerCase().trim(),
318
- tagName: config.node.tagName,
319
- testId: config.node.getAttribute("data-testid"),
320
- className: config.node.className,
321
- }));
322
- });
323
-
324
- console.log(annotations);
325
- test.expect(annotations.length).toBe(1);
326
- test.expect(annotations[0].className).toBe("button-outer");
327
- });
@@ -1,12 +0,0 @@
1
- /**
2
- * Samples two arrays proportionally to ensure their combined length does not exceed maxCombinedLength.
3
- * @param {any[]} list1 - The first array of base64 image strings.
4
- * @param {any[]} list2 - The second array of base64 image strings.
5
- * @param {number} maxCombinedLength - The maximum allowed combined length of both arrays.
6
- * @returns {{ list1: any[], list2: any[] }} - An object containing the sampled arrays.
7
- */
8
- export declare const sampleCombinedList: (list1: any[], list2: any[], maxCombinedLength: number) => {
9
- list1: any[];
10
- list2: any[];
11
- };
12
- //# sourceMappingURL=frame-sampling.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"frame-sampling.d.ts","sourceRoot":"","sources":["../../src/generate-summary/frame-sampling.ts"],"names":[],"mappings":"AAqBA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,GAAG,EAAE,EACZ,OAAO,GAAG,EAAE,EACZ,mBAAmB,MAAM,KACxB;IAAE,KAAK,EAAE,GAAG,EAAE,CAAC;IAAC,KAAK,EAAE,GAAG,EAAE,CAAA;CA+C9B,CAAC"}
@@ -1,72 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sampleCombinedList = void 0;
4
- /**
5
- * Samples an array to a desired size by selecting elements uniformly.
6
- * @param {string[]} list - The original array to sample from.
7
- * @param {number} size - The desired size of the sampled array.
8
- * @returns {string[]} - The sampled array.
9
- */
10
- const sampleList = (list, size) => {
11
- // Return a copy if no sampling needed
12
- if (size >= list.length) {
13
- return list;
14
- }
15
- const sampled = [];
16
- const step = list.length / size;
17
- for (let i = 0; i < size; i++) {
18
- const index = Math.floor(i * step);
19
- sampled.push(list[index]);
20
- }
21
- return sampled;
22
- };
23
- /**
24
- * Samples two arrays proportionally to ensure their combined length does not exceed maxCombinedLength.
25
- * @param {any[]} list1 - The first array of base64 image strings.
26
- * @param {any[]} list2 - The second array of base64 image strings.
27
- * @param {number} maxCombinedLength - The maximum allowed combined length of both arrays.
28
- * @returns {{ list1: any[], list2: any[] }} - An object containing the sampled arrays.
29
- */
30
- const sampleCombinedList = (list1, list2, maxCombinedLength) => {
31
- const len1 = list1.length;
32
- const len2 = list2.length;
33
- const total = len1 + len2;
34
- // If combined length is within the limit, return copies of the original arrays
35
- if (total <= maxCombinedLength) {
36
- return { list1: list1.slice(), list2: list2.slice() };
37
- }
38
- // Calculate scaling factor
39
- const scalingFactor = maxCombinedLength / total;
40
- // Determine new sizes based on scaling factor
41
- let newSize1 = Math.round(len1 * scalingFactor);
42
- let newSize2 = Math.round(len2 * scalingFactor);
43
- // Adjust sizes to ensure the combined length matches maxCombinedLength
44
- let adjustedTotal = newSize1 + newSize2;
45
- if (adjustedTotal > maxCombinedLength) {
46
- const excess = adjustedTotal - maxCombinedLength;
47
- // Reduce the larger array first
48
- if (newSize2 > newSize1) {
49
- newSize2 = Math.max(newSize2 - excess, 0);
50
- }
51
- else {
52
- newSize1 = Math.max(newSize1 - excess, 0);
53
- }
54
- }
55
- else if (adjustedTotal < maxCombinedLength) {
56
- const deficit = maxCombinedLength - adjustedTotal;
57
- // Increase the larger array first, if possible
58
- if (len2 > len1 && newSize2 < len2) {
59
- newSize2 = Math.min(newSize2 + deficit, len2);
60
- }
61
- else if (newSize1 < len1) {
62
- newSize1 = Math.min(newSize1 + deficit, len1);
63
- }
64
- }
65
- // Final safeguard to ensure sizes do not exceed original lengths
66
- newSize1 = Math.min(newSize1, len1);
67
- newSize2 = Math.min(newSize2, len2);
68
- const sampled1 = sampleList(list1, newSize1);
69
- const sampled2 = sampleList(list2, newSize2);
70
- return { list1: sampled1, list2: sampled2 };
71
- };
72
- exports.sampleCombinedList = sampleCombinedList;
@@ -1,11 +0,0 @@
1
- import { TraceClient } from "@empiricalrun/llm";
2
- import { TestGroup } from "@empiricalrun/shared-types/failure-workflow";
3
- type ArgsT = {
4
- testRunId: number;
5
- test: TestGroup;
6
- trace?: TraceClient;
7
- };
8
- type Summary = string;
9
- export declare const generateErrorStackSummary: ({ testRunId, test, trace, }: ArgsT) => Promise<Summary>;
10
- export {};
11
- //# sourceMappingURL=generate-error-stack-summary.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-error-stack-summary.d.ts","sourceRoot":"","sources":["../../src/generate-summary/generate-error-stack-summary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAGxE,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,CAAC;AACF,KAAK,OAAO,GAAG,MAAM,CAAC;AACtB,eAAO,MAAM,yBAAyB,GAAU,6BAI7C,KAAK,KAAG,OAAO,CAAC,OAAO,CAwCzB,CAAC"}
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateErrorStackSummary = void 0;
4
- const llm_1 = require("@empiricalrun/llm");
5
- const promptTemplate_0 = "{{#section \"system\"}}\nYou are a software test engineer who was given a task to write test case for a scenario.\n\nYou will be provided with 2 inputs\n- test name, which is already present in the test file code provided to you\n- an error stack of why this test is failing\n\nYou need to summarize why the test is breaking\n\nHere is the list of current tests and fixtures:\n{{testFileCode}}\n\n\nFollow these instructions before responding with output:\n- The output should be simple enough for a Product Manager to understand\n- Do not respond with markdown syntax or backticks or code\n- No need to mention the test name in the explanation\n- Respond with only the error in natural language\n- Retain key elements to debug the error\n- Do not provide any explanation on why it occurred\n{{/section}}\n\n{{#section \"user\"}}\nFollowing is the test scenario for which you need to extract the error in natural language with no explanation on why it errored\ntest name:\n{{testName}}\n\nHere is the error stack trace:\n{{errorStack}}\n{{/section}}";
6
- const generateErrorStackSummary = async ({ testRunId, test, trace, }) => {
7
- let output = "";
8
- try {
9
- const messages = (0, llm_1.compilePrompt)(promptTemplate_0, {
10
- testName: test.title,
11
- errorStack: test.failure.stack,
12
- testFileCode: test.testFileCode,
13
- });
14
- trace?.event({
15
- input: {
16
- testName: test.title,
17
- errorStack: test.failure.stack,
18
- testFileCode: test.testFileCode,
19
- },
20
- output: { messages },
21
- });
22
- const llm = new llm_1.LLM({
23
- trace,
24
- provider: "openai",
25
- defaultModel: "gpt-4o",
26
- });
27
- const llmResponse = await llm.createChatCompletion({
28
- messages,
29
- trace,
30
- modelParameters: {
31
- temperature: 0.5,
32
- },
33
- });
34
- output = llmResponse?.content ?? "";
35
- }
36
- catch (e) {
37
- console.error(`Error generating error stack summary for test - "${test.title}", testRunId - "${testRunId}"`, e);
38
- }
39
- return output;
40
- };
41
- exports.generateErrorStackSummary = generateErrorStackSummary;