@empiricalrun/test-gen 0.66.0 → 0.66.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,20 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.66.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 1a6bb19: chore: upgrade playwright in devDependencies
8
+ - d3639c0: fix: update browsing agent artifact path for 1.53
9
+ - 881e856: fix: update system prompt to get PRs as output
10
+ - cfb157a: fix: follow-ups for playwright reporter upgrade
11
+ - 4062787: feat: update page.pause codegen to work with playwright 1.53
12
+ - Updated dependencies [cfb157a]
13
+ - Updated dependencies [a533ee5]
14
+ - Updated dependencies [4062787]
15
+ - @empiricalrun/test-run@0.10.3
16
+ - @empiricalrun/llm@0.18.2
17
+
3
18
  ## 0.66.0
4
19
 
5
20
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAkEpC,wBAAsB,kBAAkB,CAAC,EACvC,mBAAmB,EACnB,aAAa,EACb,oBAAoB,GACrB,EAAE;IACD,aAAa,EAAE,mBAAmB,CAAC;IACnC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C,iBA4HA;AAuBD,wBAAsB,wBAAwB,CAAC,EAC7C,aAAa,EACb,aAAa,GACd,EAAE;IACD,aAAa,EAAE,mBAAmB,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;CACvB,iBA6DA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAkEpC,wBAAsB,kBAAkB,CAAC,EACvC,mBAAmB,EACnB,aAAa,EACb,oBAAoB,GACrB,EAAE;IACD,aAAa,EAAE,mBAAmB,CAAC;IACnC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C,iBA6HA;AAuBD,wBAAsB,wBAAwB,CAAC,EAC7C,aAAa,EACb,aAAa,GACd,EAAE;IACD,aAAa,EAAE,mBAAmB,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;CACvB,iBA6DA"}
@@ -51,6 +51,7 @@ async function runChatAgentForCLI({ useDiskForChatState, selectedModel, initialP
51
51
  await (0, git_1.checkoutBranch)(branchName, process.cwd());
52
52
  let messagesLoadedFromDisk = chatState?.messages || [];
53
53
  let chatModel = (0, chat_1.createChatModel)(messagesLoadedFromDisk, selectedModel);
54
+ chatModel.validateEnvVarsForAuth();
54
55
  if (initialPromptContent && chatModel.messages.length === 0) {
55
56
  chatModel.pushUserMessage(initialPromptContent);
56
57
  chatModel.askUserForInput = false;
@@ -1,3 +1,3 @@
1
- import { FileInfo } from "../../types";
1
+ import { FileInfo } from "../../../types";
2
2
  export declare function buildSystemPrompt(fileInfo: FileInfo): Promise<string>;
3
- //# sourceMappingURL=prompt.d.ts.map
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/prompt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI1C,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,mBA0GzD"}
@@ -1,70 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildSystemPrompt = buildSystemPrompt;
4
+ const pw_utils_docs_1 = require("./pw-utils-docs");
4
5
  const repo_1 = require("./repo");
5
- const emailRecipe = `
6
- # Email automation
7
-
8
- ## Example usage
9
-
10
- ### Dynamic email
11
-
12
- This dynamically generates a random email address that can
13
- be used for the test (e.g. invite a new user).
14
-
15
- \`\`\`ts
16
- import { EmailClient } from "@empiricalrun/playwright-utils";
17
- import { expect } from "@playwright/test";
18
-
19
- const client = new EmailClient();
20
- const address = client.getAddress();
21
-
22
- // Input the \`address\` in the application
23
- // that sends the email.
24
-
25
- // Get email received on the \`address\`
26
- const email = await client.waitForEmail();
27
- expect(
28
- email.links.find((l) => l.text === "Join your team")
29
- ).toBeTruthy();
30
- \`\`\`
31
-
32
- ### Static email
33
-
34
- This uses a known (static) email that can be used to login
35
- into an application.
36
-
37
- This needs an email id (e.g. \`test-login-user\`). The email id
38
- is appended with the domain (managed internally) to get the full
39
- email address.
40
-
41
- \`\`\`ts
42
- import { EmailClient } from "@empiricalrun/playwright-utils";
43
-
44
- const emailId = \`test-login-user\`;
45
-
46
- const client = new EmailClient({ emailId });
47
- const address = client.getAddress(); // Returns full address with domain
48
-
49
- // Get email received on the \`address\`
50
- const email = await client.waitForEmail();
51
-
52
- // Get login OTP
53
- const loginCode = email.codes[0];
54
- \`\`\`
55
- `;
56
6
  async function buildSystemPrompt(fileInfo) {
57
- const repoContext = await (0, repo_1.getRepoInfoPrompt)(fileInfo);
58
- return `
59
- You are a helpful assistant that can answer questions and help with tasks related to writing
60
- and maintaining Playwright tests.
7
+ const preamble = `
8
+ You are a helpful assistant that can answer questions and help with tasks related to writing and maintaining Playwright tests.
9
+
10
+ You are working on a test code repository that contains Playwright tests and other related files. If you have modified
11
+ any files, your end output should be a pull request that will be reviewed and merged by a human.
61
12
 
62
- # Supported capabilities
13
+ # Your capabilities
63
14
 
64
15
  - Adding new Playwright tests or helper methods
65
16
  - Going through test reports and identifying app issues versus test issues
66
- - Modifying existing tests
67
- - Modifying repo configuration (e.g. in playwright.config.ts and other)
17
+ - Modifying existing tests to adapt to changes in the application
18
+ - Modifying repo configuration (e.g. in playwright.config.ts) and dependencies (e.g. in package.json)
68
19
 
69
20
  # Going through test reports
70
21
 
@@ -147,12 +98,12 @@ if (await saveButton.isVisible()) {
147
98
  }
148
99
  \`\`\`
149
100
 
150
- # Recipes
151
- You can refer to the following recipes to learn how to write tests for different scenarios.
101
+ `;
102
+ const repoContext = await (0, repo_1.getRepoInfoPrompt)(fileInfo);
103
+ return `${preamble}
152
104
 
153
- <email-automation>
154
- ${emailRecipe}
155
- </email-automation>
105
+ # Recipes
106
+ ${pw_utils_docs_1.playwrightUtilsDocs}
156
107
 
157
108
  # Repo context
158
109
  ${repoContext}
@@ -0,0 +1,2 @@
1
+ export declare const playwrightUtilsDocs = "\nYou can refer to the following recipes to learn how to write tests for different scenarios.\n\n<email-automation>\n\n# Email automation\n\n## Example usage\n\n### Dynamic email\n\nThis dynamically generates a random email address that can \nbe used for the test (e.g. invite a new user).\n\n```ts\nimport { EmailClient } from \"@empiricalrun/playwright-utils\";\nimport { expect } from \"@playwright/test\";\n\nconst client = new EmailClient();\nconst address = client.getAddress();\n\n// Input the `address` in the application\n// that sends the email.\n\n// Get email received on the `address`\nconst email = await client.waitForEmail();\nexpect(\n email.links.find((l) => l.text === \"Join your team\")\n).toBeTruthy();\n```\n\n### Static email\n\nThis uses a known (static) email that can be used to login\ninto an application.\n\nThis needs an email id (e.g. `test-login-user`). The email id\nis appended with the domain (managed internally) to get the full\nemail address.\n\n```ts\nimport { EmailClient } from \"@empiricalrun/playwright-utils\";\n\nconst emailId = `test-login-user`;\n\nconst client = new EmailClient({ emailId });\nconst address = client.getAddress(); // Returns full address with domain\n\n// Get email received on the `address`\nconst email = await client.waitForEmail();\n\n// Get login OTP\nconst loginCode = email.codes[0];\n```\n\n</email-automation>\n\n";
2
+ //# sourceMappingURL=pw-utils-docs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pw-utils-docs.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/prompt/pw-utils-docs.ts"],"names":[],"mappings":"AAoDA,eAAO,MAAM,mBAAmB,i3CAO/B,CAAC"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.playwrightUtilsDocs = void 0;
4
+ const emailRecipe = `
5
+ # Email automation
6
+
7
+ ## Example usage
8
+
9
+ ### Dynamic email
10
+
11
+ This dynamically generates a random email address that can
12
+ be used for the test (e.g. invite a new user).
13
+
14
+ \`\`\`ts
15
+ import { EmailClient } from "@empiricalrun/playwright-utils";
16
+ import { expect } from "@playwright/test";
17
+
18
+ const client = new EmailClient();
19
+ const address = client.getAddress();
20
+
21
+ // Input the \`address\` in the application
22
+ // that sends the email.
23
+
24
+ // Get email received on the \`address\`
25
+ const email = await client.waitForEmail();
26
+ expect(
27
+ email.links.find((l) => l.text === "Join your team")
28
+ ).toBeTruthy();
29
+ \`\`\`
30
+
31
+ ### Static email
32
+
33
+ This uses a known (static) email that can be used to login
34
+ into an application.
35
+
36
+ This needs an email id (e.g. \`test-login-user\`). The email id
37
+ is appended with the domain (managed internally) to get the full
38
+ email address.
39
+
40
+ \`\`\`ts
41
+ import { EmailClient } from "@empiricalrun/playwright-utils";
42
+
43
+ const emailId = \`test-login-user\`;
44
+
45
+ const client = new EmailClient({ emailId });
46
+ const address = client.getAddress(); // Returns full address with domain
47
+
48
+ // Get email received on the \`address\`
49
+ const email = await client.waitForEmail();
50
+
51
+ // Get login OTP
52
+ const loginCode = email.codes[0];
53
+ \`\`\`
54
+ `;
55
+ exports.playwrightUtilsDocs = `
56
+ You can refer to the following recipes to learn how to write tests for different scenarios.
57
+
58
+ <email-automation>
59
+ ${emailRecipe}
60
+ </email-automation>
61
+
62
+ `;
@@ -1,3 +1,3 @@
1
- import { FileInfo } from "../../types";
1
+ import { FileInfo } from "../../../types";
2
2
  export declare function getRepoInfoPrompt(directory: FileInfo): Promise<string>;
3
3
  //# sourceMappingURL=repo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/prompt/repo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAwC1C,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,QAAQ,mBAyC1D"}
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getRepoInfoPrompt = getRepoInfoPrompt;
7
7
  const path_1 = __importDefault(require("path"));
8
- const repo_tree_1 = require("../../utils/repo-tree");
8
+ const repo_tree_1 = require("../../../utils/repo-tree");
9
9
  async function getAllMarkdownFiles(directory) {
10
10
  if (!directory.isDirectory) {
11
11
  return [];
@@ -1,9 +1,12 @@
1
1
  export declare function preparePlaywrightForCodegen(repoDir: string): Promise<void>;
2
- export declare function getPathToRecorderApp(repoDir: string): Promise<string | undefined>;
2
+ export declare function getPathToRecorderApp(pwCorePath: string): Promise<string>;
3
3
  export declare function runNpmList(repoDir: string): Promise<string | undefined>;
4
- export declare function getPlaywrightCoreFromNpmList(output: string): any;
5
- export declare function hasPatchedRecorderApp(repoDir: string): Promise<boolean>;
4
+ export declare function getPlaywrightCoreFromNpmList(output: string): {
5
+ path: string;
6
+ version: "1.47" | "1.53";
7
+ };
8
+ export declare function hasPatchedRecorderApp(repoDir: string): Promise<boolean | undefined>;
6
9
  export declare function revertToOriginalPwCode(repoDir: string): Promise<void>;
7
10
  export declare function createFileBackup(pathToFile: string): Promise<void>;
8
- export declare function patchPwCode(pathToRecorderApp: string, port: number): Promise<void>;
11
+ export declare function patchPwCode(pwVersion: "1.47" | "1.53", pathToRecorderApp: string, port: number): Promise<void>;
9
12
  //# sourceMappingURL=patch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../../../../src/agent/cua/pw-codegen/pw-pause/patch.ts"],"names":[],"mappings":"AAmBA,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,MAAM,iBAgBhE;AAED,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,MAAM,+BAczD;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,+BAiB/C;AAED,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,OAuB1D;AAED,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,MAAM,oBAY1D;AAED,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,iBAoB3D;AAED,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,iBAGxD;AAED,wBAAsB,WAAW,CAAC,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAkBxE"}
1
+ {"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../../../../src/agent/cua/pw-codegen/pw-pause/patch.ts"],"names":[],"mappings":"AAmBA,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,MAAM,iBAehE;AAED,wBAAsB,oBAAoB,CAAC,UAAU,EAAE,MAAM,mBAgB5D;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,+BAiB/C;AAED,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B,CA8BA;AAED,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,MAAM,gCAkB1D;AAED,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,iBAoB3D;AAED,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,iBAGxD;AAED,wBAAsB,WAAW,CAC/B,SAAS,EAAE,MAAM,GAAG,MAAM,EAC1B,iBAAiB,EAAE,MAAM,EACzB,IAAI,EAAE,MAAM,iBA2Bb"}
@@ -28,29 +28,30 @@ const ipc_1 = require("./ipc");
28
28
  const CUSTOM_PATCH_COMMENT = `// Custom patch code set by @empiricalrun/test-gen`;
29
29
  async function preparePlaywrightForCodegen(repoDir) {
30
30
  try {
31
- const pathToRecorderApp = await getPathToRecorderApp(repoDir);
32
- if (!pathToRecorderApp) {
33
- throw new Error("Cannot find path to recorder app");
34
- }
35
- if (!fs_1.default.existsSync(pathToRecorderApp)) {
36
- const errMsg = `Cannot patch Playwright: ${pathToRecorderApp} does not exist`;
37
- throw new Error(errMsg);
31
+ const npmListOutput = await runNpmList(repoDir);
32
+ if (!npmListOutput) {
33
+ return;
38
34
  }
35
+ const pwCore = getPlaywrightCoreFromNpmList(npmListOutput);
36
+ const { path: pwCorePath, version: pwVersion } = pwCore;
37
+ const pathToRecorderApp = await getPathToRecorderApp(pwCorePath);
39
38
  await createFileBackup(pathToRecorderApp);
40
- await patchPwCode(pathToRecorderApp, ipc_1.PW_PAUSE_IPC_PORT);
39
+ await patchPwCode(pwVersion, pathToRecorderApp, ipc_1.PW_PAUSE_IPC_PORT);
41
40
  }
42
41
  catch (error) {
43
42
  console.error("Error patching Playwright", error);
44
43
  throw error;
45
44
  }
46
45
  }
47
- async function getPathToRecorderApp(repoDir) {
48
- const npmListOutput = await runNpmList(repoDir);
49
- if (!npmListOutput) {
50
- return;
46
+ async function getPathToRecorderApp(pwCorePath) {
47
+ // Both supported versions have the same path structure
48
+ const pathToRecorderApp = path_1.default.join(pwCorePath, "lib", "server", "recorder", "recorderApp.js");
49
+ if (!pathToRecorderApp) {
50
+ throw new Error("Cannot find path to recorder app");
51
+ }
52
+ if (!fs_1.default.existsSync(pathToRecorderApp)) {
53
+ throw new Error(`${pathToRecorderApp} does not exist`);
51
54
  }
52
- const playwrightCorePath = getPlaywrightCoreFromNpmList(npmListOutput);
53
- const pathToRecorderApp = path_1.default.join(playwrightCorePath, "lib", "server", "recorder", "recorderApp.js");
54
55
  return pathToRecorderApp;
55
56
  }
56
57
  async function runNpmList(repoDir) {
@@ -78,20 +79,37 @@ function getPlaywrightCoreFromNpmList(output) {
78
79
  if (!playwrightTest) {
79
80
  throw new Error("Could not find @playwright/test in npm dependencies");
80
81
  }
81
- const playwrightTestVersion = playwrightTest.version;
82
- if (playwrightTestVersion !== "1.47.1") {
83
- throw new Error("Unsupported playwright-test version: ${playwrightTestVersion}");
84
- }
85
82
  const playwrightDeps = playwrightTest.dependencies["playwright"];
86
83
  const playwrightCoreDep = playwrightDeps.dependencies["playwright-core"];
87
84
  if (!playwrightCoreDep) {
88
85
  throw new Error("Could not find playwright-core in @playwright/test dependencies");
89
86
  }
90
- return playwrightCoreDep.path;
87
+ function extractMinorVersion(version) {
88
+ const minorVersion = version.split(".").slice(0, 2).join(".");
89
+ if (minorVersion === "1.47") {
90
+ return "1.47";
91
+ }
92
+ else if (minorVersion === "1.53") {
93
+ return "1.53";
94
+ }
95
+ else {
96
+ throw new Error(`Unsupported Playwright version: ${minorVersion}`);
97
+ }
98
+ }
99
+ return {
100
+ path: playwrightCoreDep.path,
101
+ version: extractMinorVersion(playwrightCoreDep.version),
102
+ };
91
103
  }
92
104
  async function hasPatchedRecorderApp(repoDir) {
93
105
  try {
94
- const pathToRecorderApp = await getPathToRecorderApp(repoDir);
106
+ const npmListOutput = await runNpmList(repoDir);
107
+ if (!npmListOutput) {
108
+ return;
109
+ }
110
+ const pwCore = getPlaywrightCoreFromNpmList(npmListOutput);
111
+ const { path: pwCorePath } = pwCore;
112
+ const pathToRecorderApp = await getPathToRecorderApp(pwCorePath);
95
113
  if (!pathToRecorderApp) {
96
114
  return false;
97
115
  }
@@ -109,8 +127,8 @@ async function revertToOriginalPwCode(repoDir) {
109
127
  if (!npmListOutput) {
110
128
  return;
111
129
  }
112
- const playwrightCorePath = getPlaywrightCoreFromNpmList(npmListOutput);
113
- const pathToRecorderApp = path_1.default.join(playwrightCorePath, "lib", "server", "recorder", "recorderApp.js");
130
+ const { path: pwCorePath } = getPlaywrightCoreFromNpmList(npmListOutput);
131
+ const pathToRecorderApp = path_1.default.join(pwCorePath, "lib", "server", "recorder", "recorderApp.js");
114
132
  const backupPath = `${pathToRecorderApp}.backup`;
115
133
  fs_1.default.copyFileSync(backupPath, pathToRecorderApp);
116
134
  fs_1.default.unlinkSync(backupPath);
@@ -123,9 +141,18 @@ async function createFileBackup(pathToFile) {
123
141
  const backupPath = `${pathToFile}.backup`;
124
142
  fs_1.default.copyFileSync(pathToFile, backupPath);
125
143
  }
126
- async function patchPwCode(pathToRecorderApp, port) {
144
+ async function patchPwCode(pwVersion, pathToRecorderApp, port) {
127
145
  const currentFileContents = fs_1.default.readFileSync(pathToRecorderApp, "utf-8");
128
- const original = `async setSources(sources) {}`;
146
+ let original;
147
+ if (pwVersion === "1.47") {
148
+ original = `async setSources(sources) {}`;
149
+ }
150
+ else if (pwVersion === "1.53") {
151
+ original = `async setSources(sources, primaryPageURL) {\n }`;
152
+ }
153
+ else {
154
+ throw new Error(`Unsupported Playwright version: ${pwVersion}`);
155
+ }
129
156
  const replacement = `async setSources(sources) {
130
157
  ${CUSTOM_PATCH_COMMENT}
131
158
  const payload = JSON.stringify(sources.filter(source => source.isRecorded).filter(source => source.id === "javascript"));
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/artifacts/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EACL,UAAU,IAAI,oBAAoB,EAGnC,MAAM,2BAA2B,CAAC;AAGnC;;;;GAIG;AACH,wBAAgB,0CAA0C,CACxD,MAAM,EAAE,oBAAoB,GAC3B,iBAAiB,EAAE,CAqErB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,EAAE,CAmBxE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/artifacts/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EACL,UAAU,IAAI,oBAAoB,EAGnC,MAAM,2BAA2B,CAAC;AAInC;;;;GAIG;AACH,wBAAgB,0CAA0C,CACxD,MAAM,EAAE,oBAAoB,GAC3B,iBAAiB,EAAE,CAqErB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,EAAE,CAmCxE"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.extractAttachmentsFromPlaywrightJSONReport = extractAttachmentsFromPlaywrightJSONReport;
7
7
  exports.findPlaywrightArtifacts = findPlaywrightArtifacts;
8
8
  const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
9
10
  /**
10
11
  * Extracts attachment information from a Playwright JSON report.
11
12
  * @param report The Playwright JSON report to extract attachments from
@@ -84,9 +85,19 @@ function extractAttachmentsFromPlaywrightJSONReport(report) {
84
85
  */
85
86
  function findPlaywrightArtifacts(repoDir) {
86
87
  const artifacts = [];
87
- const reportPath = require("path").join(repoDir, "playwright-report");
88
- const summaryJsonPath = require("path").join(reportPath, "summary.json");
89
- if (fs_1.default.existsSync(summaryJsonPath)) {
88
+ const pathForPlaywright147 = path_1.default.join(repoDir, "playwright-report", "summary.json");
89
+ const pathForPlaywright153 = path_1.default.join(repoDir, "summary.json");
90
+ let summaryJsonPath;
91
+ if (fs_1.default.existsSync(pathForPlaywright147)) {
92
+ summaryJsonPath = pathForPlaywright147;
93
+ }
94
+ else if (fs_1.default.existsSync(pathForPlaywright153)) {
95
+ summaryJsonPath = pathForPlaywright153;
96
+ }
97
+ else {
98
+ console.warn(`[findPlaywrightArtifacts] No Playwright report found in ${repoDir}`);
99
+ }
100
+ if (summaryJsonPath) {
90
101
  try {
91
102
  const summaryJson = JSON.parse(fs_1.default.readFileSync(summaryJsonPath, "utf-8"));
92
103
  const found = extractAttachmentsFromPlaywrightJSONReport(summaryJson);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/uploader/index.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,aAAa,gBAAgB,CAAC;AAC3C,eAAO,MAAM,aAAa,kCAAkC,CAAC;AAG7D,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,UAKlB;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAEtE;AAED;;;;;;;;;GASG;AACH,wBAAsB,6BAA6B,CAAC,EAClD,eAAe,EACf,QAAQ,EACR,OAAO,GACR,EAAE;IACD,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC;IACV,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC,CAgED;AAED,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,MAAM,UAM1D;AAED,wBAAgB,2BAA2B,uBAQ1C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/uploader/index.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,aAAa,gBAAgB,CAAC;AAC3C,eAAO,MAAM,aAAa,kCAAkC,CAAC;AAG7D,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,UAKlB;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAEtE;AAED;;;;;;;;;GASG;AACH,wBAAsB,6BAA6B,CAAC,EAClD,eAAe,EACf,QAAQ,EACR,OAAO,GACR,EAAE;IACD,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC;IACV,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC,CAiED;AAED,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,MAAM,UAM1D;AAED,wBAAgB,2BAA2B,uBAQ1C"}
@@ -50,6 +50,7 @@ async function uploadTestResultsUsingPrjRepo({ projectRepoName, testName, repoDi
50
50
  // upload summary.json
51
51
  await (0, r2_uploader_1.uploadDirectory)({
52
52
  sourceDir: path_1.default.join(repoDir, "playwright-report"),
53
+ // TODO: this will only work for repos that use playwright 1.47.1
53
54
  fileList: [path_1.default.join(repoDir, "playwright-report", "summary.json")],
54
55
  destinationDir: uploadDir,
55
56
  uploadBucket: exports.UPLOAD_BUCKET,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.66.0",
3
+ "version": "0.66.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -62,12 +62,12 @@
62
62
  "tsx": "^4.16.2",
63
63
  "typescript": "^5.3.3",
64
64
  "zod": "^3.23.8",
65
- "@empiricalrun/llm": "^0.18.1",
65
+ "@empiricalrun/llm": "^0.18.2",
66
66
  "@empiricalrun/r2-uploader": "^0.3.9",
67
- "@empiricalrun/test-run": "^0.10.2"
67
+ "@empiricalrun/test-run": "^0.10.3"
68
68
  },
69
69
  "devDependencies": {
70
- "@playwright/test": "1.47.1",
70
+ "@playwright/test": "1.53.0",
71
71
  "@types/async-retry": "^1.4.8",
72
72
  "@types/detect-port": "^1.3.5",
73
73
  "@types/express": "^4.17.21",
@@ -76,10 +76,10 @@
76
76
  "@types/mime": "3.0.0",
77
77
  "@types/serve-handler": "^6.1.4",
78
78
  "js-levenshtein": "^1.1.6",
79
- "playwright": "1.47.1",
79
+ "playwright": "1.53.0",
80
80
  "serve-handler": "^6.1.6",
81
81
  "ts-patch": "^3.3.0",
82
- "@empiricalrun/shared-types": "0.5.1"
82
+ "@empiricalrun/shared-types": "0.5.2"
83
83
  },
84
84
  "scripts": {
85
85
  "dev": "tspc --build --watch",
@@ -1 +1 @@
1
- {"root":["./src/index.ts","./src/actions/assert.ts","./src/actions/click.ts","./src/actions/done.ts","./src/actions/fill.ts","./src/actions/goto.ts","./src/actions/hover.ts","./src/actions/index.ts","./src/actions/next-task.ts","./src/actions/press.ts","./src/actions/skill.ts","./src/actions/text-content.ts","./src/actions/constants/index.ts","./src/actions/utils/index.ts","./src/agent/browsing/index.ts","./src/agent/browsing/run.ts","./src/agent/browsing/utils.ts","./src/agent/chat/agent-loop.ts","./src/agent/chat/exports.ts","./src/agent/chat/index.ts","./src/agent/chat/models.ts","./src/agent/chat/prompt.ts","./src/agent/chat/repo.ts","./src/agent/chat/state.ts","./src/agent/chat/types.ts","./src/agent/chat/utils.ts","./src/agent/codegen/create-test-block.ts","./src/agent/codegen/fix-ts-errors.ts","./src/agent/codegen/generate-code-apply-changes.ts","./src/agent/codegen/lexical-scoped-vars.ts","./src/agent/codegen/repo-edit.ts","./src/agent/codegen/run.ts","./src/agent/codegen/skills-retriever.ts","./src/agent/codegen/test-update-feedback.ts","./src/agent/codegen/types.ts","./src/agent/codegen/update-flow.ts","./src/agent/codegen/use-skill.ts","./src/agent/codegen/utils.ts","./src/agent/cua/computer.ts","./src/agent/cua/index.ts","./src/agent/cua/model.ts","./src/agent/cua/pw-codegen/element-from-point.ts","./src/agent/cua/pw-codegen/types.ts","./src/agent/cua/pw-codegen/pw-pause/index.ts","./src/agent/cua/pw-codegen/pw-pause/ipc.ts","./src/agent/cua/pw-codegen/pw-pause/patch.ts","./src/agent/diagnosis-agent/index.ts","./src/agent/diagnosis-agent/strict-mode-violation.ts","./src/agent/enrich-prompt/index.ts","./src/agent/enrich-prompt/utils.ts","./src/agent/infer-agent/index.ts","./src/agent/master/action-tool-calls.ts","./src/agent/master/element-annotation.ts","./src/agent/master/execute-browser-action.ts","./src/agent/master/execute-skill-action.ts","./src/agent/master/next-action.ts","./src/agent/master/planner.ts","./src/agent/master/run.ts","./src/agent/master/scroller.ts","./src/agent/master/with-hints.ts","./src/agent/master/browser-tests/cua.spec.ts","./src/agent/master/browser-tests/fixtures.ts","./src/agent/master/browser-tests/index.spec.ts","./src/agent/master/browser-tests/skills.spec.ts","./src/agent/master/icon-descriptor/index.ts","./src/agent/master/icon-descriptor/normalize-svg.ts","./src/agent/planner/run-time-planner.ts","./src/agent/planner/run.ts","./src/artifacts/index.ts","./src/artifacts/utils.ts","./src/bin/index.ts","./src/bin/logger/index.ts","./src/bin/utils/context.ts","./src/bin/utils/index.ts","./src/bin/utils/fs/index.ts","./src/bin/utils/platform/web/index.ts","./src/bin/utils/platform/web/test-files/ts-path-import-validate.ts","./src/bin/utils/scenarios/index.ts","./src/browser-injected-scripts/annotate-elements.spec.ts","./src/constants/index.ts","./src/errors/index.ts","./src/evals/add-scenario-agent.evals.ts","./src/evals/append-create-test-agent.evals.ts","./src/evals/fetch-pom-skills-agent.evals.ts","./src/evals/infer-master-or-code-agent.evals.ts","./src/evals/master-agent.evals.ts","./src/evals/type.ts","./src/evals/update-scenario-agent.evals.ts","./src/file/client.ts","./src/file/server.ts","./src/human-in-the-loop/cli.ts","./src/human-in-the-loop/index.ts","./src/human-in-the-loop/ipc.ts","./src/page/index.ts","./src/prompts/lib/ts-transformer.ts","./src/reporter/index.ts","./src/reporter/lib.ts","./src/session/index.ts","./src/test-build/index.ts","./src/tool-call-service/index.ts","./src/tool-call-service/utils.ts","./src/tools/commit-and-create-pr.ts","./src/tools/diagnosis-fetcher.ts","./src/tools/download-build.ts","./src/tools/list-environments.ts","./src/tools/str_replace_editor.ts","./src/tools/test-gen-browser.ts","./src/tools/test-run.ts","./src/tools/grep/index.ts","./src/tools/grep/ripgrep/index.ts","./src/tools/grep/ripgrep/types.ts","./src/tools/test-run-fetcher/index.ts","./src/tools/test-run-fetcher/types.ts","./src/tools/upgrade-packages/index.ts","./src/tools/upgrade-packages/utils.ts","./src/tools/utils/index.ts","./src/types/handlebars.d.ts","./src/types/index.ts","./src/uploader/index.ts","./src/uploader/utils.ts","./src/utils/checkpoint.ts","./src/utils/env.ts","./src/utils/exec.ts","./src/utils/file-tree.ts","./src/utils/file.ts","./src/utils/git.ts","./src/utils/html.ts","./src/utils/index.ts","./src/utils/json.ts","./src/utils/repo-tree.ts","./src/utils/slug.ts","./src/utils/string.ts","./src/utils/stripAnsi.ts"],"version":"5.8.3"}
1
+ {"root":["./src/index.ts","./src/actions/assert.ts","./src/actions/click.ts","./src/actions/done.ts","./src/actions/fill.ts","./src/actions/goto.ts","./src/actions/hover.ts","./src/actions/index.ts","./src/actions/next-task.ts","./src/actions/press.ts","./src/actions/skill.ts","./src/actions/text-content.ts","./src/actions/constants/index.ts","./src/actions/utils/index.ts","./src/agent/browsing/index.ts","./src/agent/browsing/run.ts","./src/agent/browsing/utils.ts","./src/agent/chat/agent-loop.ts","./src/agent/chat/exports.ts","./src/agent/chat/index.ts","./src/agent/chat/models.ts","./src/agent/chat/state.ts","./src/agent/chat/types.ts","./src/agent/chat/utils.ts","./src/agent/chat/prompt/index.ts","./src/agent/chat/prompt/pw-utils-docs.ts","./src/agent/chat/prompt/repo.ts","./src/agent/codegen/create-test-block.ts","./src/agent/codegen/fix-ts-errors.ts","./src/agent/codegen/generate-code-apply-changes.ts","./src/agent/codegen/lexical-scoped-vars.ts","./src/agent/codegen/repo-edit.ts","./src/agent/codegen/run.ts","./src/agent/codegen/skills-retriever.ts","./src/agent/codegen/test-update-feedback.ts","./src/agent/codegen/types.ts","./src/agent/codegen/update-flow.ts","./src/agent/codegen/use-skill.ts","./src/agent/codegen/utils.ts","./src/agent/cua/computer.ts","./src/agent/cua/index.ts","./src/agent/cua/model.ts","./src/agent/cua/pw-codegen/element-from-point.ts","./src/agent/cua/pw-codegen/types.ts","./src/agent/cua/pw-codegen/pw-pause/index.ts","./src/agent/cua/pw-codegen/pw-pause/ipc.ts","./src/agent/cua/pw-codegen/pw-pause/patch.ts","./src/agent/diagnosis-agent/index.ts","./src/agent/diagnosis-agent/strict-mode-violation.ts","./src/agent/enrich-prompt/index.ts","./src/agent/enrich-prompt/utils.ts","./src/agent/infer-agent/index.ts","./src/agent/master/action-tool-calls.ts","./src/agent/master/element-annotation.ts","./src/agent/master/execute-browser-action.ts","./src/agent/master/execute-skill-action.ts","./src/agent/master/next-action.ts","./src/agent/master/planner.ts","./src/agent/master/run.ts","./src/agent/master/scroller.ts","./src/agent/master/with-hints.ts","./src/agent/master/browser-tests/cua.spec.ts","./src/agent/master/browser-tests/fixtures.ts","./src/agent/master/browser-tests/index.spec.ts","./src/agent/master/browser-tests/skills.spec.ts","./src/agent/master/icon-descriptor/index.ts","./src/agent/master/icon-descriptor/normalize-svg.ts","./src/agent/planner/run-time-planner.ts","./src/agent/planner/run.ts","./src/artifacts/index.ts","./src/artifacts/utils.ts","./src/bin/index.ts","./src/bin/logger/index.ts","./src/bin/utils/context.ts","./src/bin/utils/index.ts","./src/bin/utils/fs/index.ts","./src/bin/utils/platform/web/index.ts","./src/bin/utils/platform/web/test-files/ts-path-import-validate.ts","./src/bin/utils/scenarios/index.ts","./src/browser-injected-scripts/annotate-elements.spec.ts","./src/constants/index.ts","./src/errors/index.ts","./src/evals/add-scenario-agent.evals.ts","./src/evals/append-create-test-agent.evals.ts","./src/evals/fetch-pom-skills-agent.evals.ts","./src/evals/infer-master-or-code-agent.evals.ts","./src/evals/master-agent.evals.ts","./src/evals/type.ts","./src/evals/update-scenario-agent.evals.ts","./src/file/client.ts","./src/file/server.ts","./src/human-in-the-loop/cli.ts","./src/human-in-the-loop/index.ts","./src/human-in-the-loop/ipc.ts","./src/page/index.ts","./src/prompts/lib/ts-transformer.ts","./src/reporter/index.ts","./src/reporter/lib.ts","./src/session/index.ts","./src/test-build/index.ts","./src/tool-call-service/index.ts","./src/tool-call-service/utils.ts","./src/tools/commit-and-create-pr.ts","./src/tools/diagnosis-fetcher.ts","./src/tools/download-build.ts","./src/tools/list-environments.ts","./src/tools/str_replace_editor.ts","./src/tools/test-gen-browser.ts","./src/tools/test-run.ts","./src/tools/grep/index.ts","./src/tools/grep/ripgrep/index.ts","./src/tools/grep/ripgrep/types.ts","./src/tools/test-run-fetcher/index.ts","./src/tools/test-run-fetcher/types.ts","./src/tools/upgrade-packages/index.ts","./src/tools/upgrade-packages/utils.ts","./src/tools/utils/index.ts","./src/types/handlebars.d.ts","./src/types/index.ts","./src/uploader/index.ts","./src/uploader/utils.ts","./src/utils/checkpoint.ts","./src/utils/env.ts","./src/utils/exec.ts","./src/utils/file-tree.ts","./src/utils/file.ts","./src/utils/git.ts","./src/utils/html.ts","./src/utils/index.ts","./src/utils/json.ts","./src/utils/repo-tree.ts","./src/utils/slug.ts","./src/utils/string.ts","./src/utils/stripAnsi.ts"],"version":"5.8.3"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAuDvC,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,mBAwGzD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/repo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAwCvC,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,QAAQ,mBAyC1D"}