@empiricalrun/test-gen 0.42.3 → 0.42.8

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 (28) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/agent/codegen/repo-edit.js +1 -1
  3. package/dist/agent/master/action-tool-calls.d.ts +35 -0
  4. package/dist/agent/master/action-tool-calls.d.ts.map +1 -0
  5. package/dist/agent/master/action-tool-calls.js +70 -0
  6. package/dist/agent/master/element-annotation.d.ts +7 -2
  7. package/dist/agent/master/element-annotation.d.ts.map +1 -1
  8. package/dist/agent/master/element-annotation.js +2 -1
  9. package/dist/agent/master/next-action.d.ts +3 -10
  10. package/dist/agent/master/next-action.d.ts.map +1 -1
  11. package/dist/agent/master/next-action.js +4 -53
  12. package/dist/agent/master/run.d.ts.map +1 -1
  13. package/dist/agent/master/run.js +58 -41
  14. package/dist/agent/master/with-hints.d.ts.map +1 -1
  15. package/dist/agent/master/with-hints.js +4 -1
  16. package/dist/bin/utils/platform/web/index.d.ts.map +1 -1
  17. package/dist/bin/utils/platform/web/index.js +2 -0
  18. package/dist/browser-injected-scripts/annotate-elements.js +84 -43
  19. package/dist/browser-injected-scripts/annotate-elements.spec.d.ts +2 -0
  20. package/dist/browser-injected-scripts/annotate-elements.spec.d.ts.map +1 -0
  21. package/dist/browser-injected-scripts/annotate-elements.spec.js +201 -0
  22. package/dist/browser-injected-scripts/annotate-elements.spec.ts +50 -9
  23. package/dist/evals/master-agent.evals.d.ts.map +1 -1
  24. package/dist/evals/master-agent.evals.js +2 -0
  25. package/package.json +3 -3
  26. package/playwright.config.ts +1 -1
  27. package/browser-injected-scripts/annotate-elements.js +0 -491
  28. package/browser-injected-scripts/annotate-elements.spec.ts +0 -277
@@ -1,277 +0,0 @@
1
- // @ts-nocheck
2
-
3
- import { test } from "@playwright/test";
4
- import path from "path";
5
-
6
- test("should annotate all links on empirical landing page", async ({
7
- page,
8
- }) => {
9
- await page.goto(
10
- "https://assets-test.empirical.run/selector-hints-testing/dom-1.html",
11
- );
12
-
13
- await page.addScriptTag({
14
- path: path.resolve(__dirname, "./annotate-elements.js"),
15
- });
16
-
17
- const annotations = await page.evaluate(() => {
18
- const { annotations } = annotateClickableElements();
19
-
20
- return Object.entries(annotations).map(([hint, config]) => ({
21
- innerText: config.node.innerText,
22
- tagName: config.node.tagName,
23
- href: config.node.href,
24
- }));
25
- });
26
-
27
- test.expect(annotations).toEqual([
28
- {
29
- innerText: "Empirical",
30
- tagName: "A",
31
- href: "https://assets-test.empirical.run/",
32
- },
33
- {
34
- innerText: "Blog",
35
- tagName: "A",
36
- href: "https://assets-test.empirical.run/blog",
37
- },
38
- {
39
- innerText: "Contact us",
40
- tagName: "A",
41
- href: "https://assets-test.empirical.run/contact",
42
- },
43
- {
44
- href: "https://dash.empirical.run/",
45
- innerText: "Login ↗\n(opens in a new tab)",
46
- tagName: "A",
47
- },
48
- {
49
- innerText: "Get early access",
50
- tagName: "A",
51
- href: "https://assets-test.empirical.run/contact",
52
- },
53
- {
54
- innerText: "Playwright\n(opens in a new tab)",
55
- tagName: "A",
56
- href: "https://github.com/microsoft/playwright",
57
- },
58
- {
59
- innerText: "Meet with us",
60
- tagName: "A",
61
- href: "https://assets-test.empirical.run/contact",
62
- },
63
- {
64
- innerText: "Privacy Policy",
65
- tagName: "A",
66
- href: "https://assets-test.empirical.run/privacy.html",
67
- },
68
- ]);
69
- });
70
-
71
- test("should annotate all important items on quizizz page", async ({
72
- page,
73
- }) => {
74
- await page.goto(
75
- "https://assets-test.empirical.run/selector-hints-testing/dom-2/index.html",
76
- );
77
-
78
- await page.addScriptTag({
79
- path: path.resolve(__dirname, "./annotate-elements.js"),
80
- });
81
-
82
- const annotations = await page.evaluate(() => {
83
- const { annotations } = annotateClickableElements();
84
-
85
- return Object.entries(annotations).map(([hint, config]) => ({
86
- hint,
87
- innerText: config.node.innerText.toLowerCase().trim(),
88
- tagName: config.node.tagName,
89
- testId: config.node.getAttribute("data-testid"),
90
- href: config.node.href,
91
- }));
92
- });
93
-
94
- test
95
- .expect(annotations.find((item) => item.innerText.includes("enter code")))
96
- .toBeTruthy();
97
- test
98
- .expect(annotations.find((item) => item.innerText.includes("get help")))
99
- .toBeTruthy();
100
- test
101
- .expect(
102
- annotations.find(
103
- (item) =>
104
- item.innerText.includes("create") &&
105
- item.testId === "create-content-button",
106
- ),
107
- )
108
- .toBeTruthy();
109
- test
110
- .expect(
111
- annotations.find(
112
- (item) =>
113
- item.innerText.includes("explore") &&
114
- item.href === "https://quizizz.com/admin",
115
- ),
116
- )
117
- .toBeTruthy();
118
- test
119
- .expect(
120
- annotations.find(
121
- (item) =>
122
- item.innerText.includes("library") &&
123
- item.href === "https://quizizz.com/admin/my-library/createdByMe",
124
- ),
125
- )
126
- .toBeTruthy();
127
- test
128
- .expect(
129
- annotations.find(
130
- (item) =>
131
- item.innerText.includes("reports") &&
132
- item.href === "https://quizizz.com/admin/reports",
133
- ),
134
- )
135
- .toBeTruthy();
136
- test
137
- .expect(
138
- annotations.find(
139
- (item) =>
140
- item.innerText.includes("classes") &&
141
- item.href === "https://quizizz.com/admin/classes",
142
- ),
143
- )
144
- .toBeTruthy();
145
- test
146
- .expect(
147
- annotations.find(
148
- (item) =>
149
- item.innerText.includes("accommodations") &&
150
- item.href ===
151
- "https://quizizz.com/admin/differentiation/accommodations",
152
- ),
153
- )
154
- .toBeTruthy();
155
- test
156
- .expect(
157
- annotations.find(
158
- (item) =>
159
- item.innerText.includes("quizizz ai") &&
160
- item.href === "https://quizizz.com/admin/quizizz-ai",
161
- ),
162
- )
163
- .toBeTruthy();
164
- test
165
- .expect(
166
- annotations.find(
167
- (item) =>
168
- item.innerText.includes("start your free trial") &&
169
- item.href === "https://quizizz.com/super-pricing",
170
- ),
171
- )
172
- .toBeTruthy();
173
- test
174
- .expect(
175
- annotations.find(
176
- (item) =>
177
- item.innerText.includes("upgrade") &&
178
- item.href === "https://quizizz.com/super-pricing?backto=/admin",
179
- ),
180
- )
181
- .toBeTruthy();
182
-
183
- test
184
- .expect(
185
- annotations.find(
186
- (item) =>
187
- item.tagName === "INPUT" &&
188
- item.testId === "emphasized-search-bar-input",
189
- ),
190
- )
191
- .toBeTruthy();
192
-
193
- test
194
- .expect(
195
- annotations.find(
196
- (item) =>
197
- item.tagName === "BUTTON" &&
198
- item.innerText.includes("verify details") &&
199
- item.testId === "verify-profile-cta",
200
- ),
201
- )
202
- .toBeTruthy();
203
-
204
- test
205
- .expect(
206
- annotations.find(
207
- (item) =>
208
- item.tagName === "BUTTON" && item.innerText.includes("for you"),
209
- ),
210
- )
211
- .toBeTruthy();
212
-
213
- test
214
- .expect(
215
- annotations.find(
216
- (item) =>
217
- item.tagName === "BUTTON" && item.innerText.includes("assessments"),
218
- ),
219
- )
220
- .toBeTruthy();
221
-
222
- test
223
- .expect(
224
- annotations.find(
225
- (item) =>
226
- item.tagName === "BUTTON" && item.innerText.includes("lessons"),
227
- ),
228
- )
229
- .toBeTruthy();
230
-
231
- test
232
- .expect(
233
- annotations.find(
234
- (item) =>
235
- item.tagName === "BUTTON" &&
236
- item.innerText.includes("interactive videos"),
237
- ),
238
- )
239
- .toBeTruthy();
240
-
241
- test
242
- .expect(
243
- annotations.find(
244
- (item) =>
245
- item.tagName === "BUTTON" && item.innerText.includes("passages"),
246
- ),
247
- )
248
- .toBeTruthy();
249
- });
250
-
251
- test("should only annotate input fields on quizizz page", async ({
252
- page,
253
- }) => {
254
- await page.goto(
255
- "https://assets-test.empirical.run/selector-hints-testing/dom-2/index.html",
256
- );
257
-
258
- await page.addScriptTag({
259
- path: path.resolve(__dirname, "./annotate-elements.js"),
260
- });
261
-
262
- const preference = "fill";
263
- const annotations = await page.evaluate((preference) => {
264
- const { annotations } = annotateClickableElements({preference: preference});
265
-
266
- return Object.entries(annotations).map(([hint, config]) => ({
267
- hint,
268
- innerText: config.node.innerText.toLowerCase().trim(),
269
- tagName: config.node.tagName,
270
- testId: config.node.getAttribute("data-testid"),
271
- href: config.node.href,
272
- }));
273
- },preference);
274
-
275
- test.expect(annotations.length).toBe(1);
276
- test.expect(annotations[0].testId).toBe('emphasized-search-bar-input');
277
- });