@empiricalrun/playwright-utils 0.28.8 → 0.29.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.
- package/CHANGELOG.md +15 -0
- package/dist/reporter/empirical-reporter.d.ts.map +1 -1
- package/dist/reporter/empirical-reporter.js +37 -41
- package/dist/reporter/uploader.d.ts +1 -12
- package/dist/reporter/uploader.d.ts.map +1 -1
- package/dist/reporter/uploader.js +0 -42
- package/dist/reporter/util.d.ts +2 -3
- package/dist/reporter/util.d.ts.map +1 -1
- package/package.json +4 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/reporter/queue.d.ts +0 -8
- package/dist/reporter/queue.d.ts.map +0 -1
- package/dist/reporter/queue.js +0 -88
- package/dist/reporter/types.d.ts +0 -3
- package/dist/reporter/types.d.ts.map +0 -1
- package/dist/reporter/types.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @empiricalrun/playwright-utils
|
|
2
2
|
|
|
3
|
+
## 0.29.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b01be05: feat: move task queue to r2-uploader package
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 6920cda: feat: send all attachments from pw-utils to dash
|
|
12
|
+
- Updated dependencies [b01be05]
|
|
13
|
+
- Updated dependencies [e65313e]
|
|
14
|
+
- @empiricalrun/r2-uploader@0.4.0
|
|
15
|
+
- @empiricalrun/test-gen@0.78.0
|
|
16
|
+
- @empiricalrun/llm@0.24.0
|
|
17
|
+
|
|
3
18
|
## 0.28.8
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAanC,cAAM,iBAAkB,YAAW,QAAQ;IACzC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,aAAa,CAAyB;IAC9C,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,oBAAoB,CAAkB;IAC9C,OAAO,CAAC,oBAAoB,CAG1B;IACF,OAAO,CAAC,QAAQ,CAAmC;IACnD,OAAO,CAAC,UAAU,CACwE;IAE1F,OAAO,CAAC,YAAY;;IAyBpB,OAAO,CAAC,6BAA6B,CA4BnC;IAEF,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;IAsEtC,KAAK,CAAC,MAAM,EAAE,UAAU;CA+G/B;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -3,11 +3,10 @@ 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
|
-
const
|
|
6
|
+
const r2_uploader_1 = require("@empiricalrun/r2-uploader");
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const logger_1 = require("../logger");
|
|
10
|
-
const queue_1 = require("./queue");
|
|
11
10
|
const uploader_1 = require("./uploader");
|
|
12
11
|
const util_1 = require("./util");
|
|
13
12
|
class EmpiricalReporter {
|
|
@@ -37,8 +36,10 @@ class EmpiricalReporter {
|
|
|
37
36
|
this._willUploadArtifacts = this.checkR2Creds();
|
|
38
37
|
}
|
|
39
38
|
enqueTestAttachmentUploadTask = async (attachment) => {
|
|
40
|
-
if (!attachment.path)
|
|
39
|
+
if (!attachment.path) {
|
|
40
|
+
logger_1.logger.warn(`[Empirical Reporter] Skipping attachment without path: ${attachment.name}`);
|
|
41
41
|
return;
|
|
42
|
+
}
|
|
42
43
|
const exists = await (0, util_1.checkFileExistsAsync)(attachment.path);
|
|
43
44
|
if (exists) {
|
|
44
45
|
logger_1.logger.debug(`[Empirical Reporter] Processing attachment: File exists`);
|
|
@@ -54,7 +55,7 @@ class EmpiricalReporter {
|
|
|
54
55
|
uploadBucket: this._uploadBucket,
|
|
55
56
|
baseUrl: this._baseUrl,
|
|
56
57
|
});
|
|
57
|
-
return (0,
|
|
58
|
+
return (0, r2_uploader_1.sendTaskToQueue)(uploadTask);
|
|
58
59
|
};
|
|
59
60
|
onTestEnd(test, result) {
|
|
60
61
|
if (!this._willUploadArtifacts) {
|
|
@@ -65,55 +66,50 @@ class EmpiricalReporter {
|
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
68
|
try {
|
|
68
|
-
const attachmentPromises = result.attachments.map((attachment) => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
const attachmentPromises = result.attachments.map(async (attachment) => {
|
|
70
|
+
const fileMap = await this.enqueTestAttachmentUploadTask(attachment);
|
|
71
|
+
if (!fileMap) {
|
|
72
|
+
logger_1.logger.error(`No upload result for ${attachment}`);
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
// Since we are uploading a single attachmnet, the fileMap will have one entry
|
|
76
|
+
const url = Object.values(fileMap)[0];
|
|
77
|
+
if (!url) {
|
|
78
|
+
logger_1.logger.error(`No url in file map for ${attachment}`);
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
if (!attachment.path) {
|
|
82
|
+
// This should never happen because we only upload if attachment.path is there
|
|
83
|
+
logger_1.logger.error(`No path in file map for ${attachment}`);
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
name: attachment.name,
|
|
88
|
+
contentType: attachment.contentType,
|
|
89
|
+
path: attachment.path,
|
|
90
|
+
url,
|
|
91
|
+
};
|
|
73
92
|
});
|
|
74
93
|
const testCaseRunEventTask = async () => {
|
|
75
94
|
return Promise.all(attachmentPromises)
|
|
76
95
|
.then((uploadedAttachments) => {
|
|
77
96
|
logger_1.logger.debug(`[Empirical Reporter] Attachments for test ${test.title} are uploaded:`, uploadedAttachments);
|
|
78
97
|
const { suites, projectName } = (0, util_1.suitesAndProjectForTest)(test);
|
|
79
|
-
|
|
98
|
+
const params = {
|
|
80
99
|
test,
|
|
81
|
-
result,
|
|
82
|
-
assetsURL: {
|
|
83
|
-
trace: "",
|
|
84
|
-
videos: [],
|
|
85
|
-
errorContext: "",
|
|
86
|
-
},
|
|
87
100
|
suites,
|
|
101
|
+
result,
|
|
88
102
|
projectName,
|
|
89
|
-
|
|
103
|
+
attachments: uploadedAttachments.filter((a) => a !== undefined),
|
|
104
|
+
runId: process.env.TEST_RUN_GITHUB_ACTION_ID,
|
|
90
105
|
};
|
|
91
|
-
uploadedAttachments.forEach((item) => {
|
|
92
|
-
if (item.fileMap && item.originalAttachment) {
|
|
93
|
-
const { fileMap, originalAttachment } = item;
|
|
94
|
-
Object.entries(fileMap).forEach(([key, value]) => {
|
|
95
|
-
if (originalAttachment.contentType.startsWith("video/")) {
|
|
96
|
-
params.assetsURL.videos.push({
|
|
97
|
-
name: `test-${test.id}-slug-${(0, crypto_1.randomUUID)()}`,
|
|
98
|
-
url: value,
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
if (originalAttachment.name.includes("trace")) {
|
|
102
|
-
params.assetsURL.trace = value;
|
|
103
|
-
}
|
|
104
|
-
if (originalAttachment.name.includes("error-context")) {
|
|
105
|
-
params.assetsURL.errorContext = value;
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
106
|
return (0, util_1.sendTestCaseUpdateToDashboard)(params);
|
|
111
107
|
})
|
|
112
108
|
.catch((error) => {
|
|
113
109
|
logger_1.logger.error(`[Empirical Reporter] Error sending test case event for: ${test.title}:`, error);
|
|
114
110
|
});
|
|
115
111
|
};
|
|
116
|
-
void (0,
|
|
112
|
+
void (0, r2_uploader_1.sendTaskToQueue)(testCaseRunEventTask);
|
|
117
113
|
return;
|
|
118
114
|
}
|
|
119
115
|
catch (error) {
|
|
@@ -146,7 +142,7 @@ class EmpiricalReporter {
|
|
|
146
142
|
uploadBucket: this._uploadBucket,
|
|
147
143
|
baseUrl: this._baseUrl,
|
|
148
144
|
});
|
|
149
|
-
void (0,
|
|
145
|
+
void (0, r2_uploader_1.sendTaskToQueue)(uploadHtmlTask);
|
|
150
146
|
}
|
|
151
147
|
else {
|
|
152
148
|
logger_1.logger.error(`[Empirical Reporter] playwright-report/index.html does not exist at: ${htmlFilePath}`);
|
|
@@ -162,7 +158,7 @@ class EmpiricalReporter {
|
|
|
162
158
|
uploadBucket: this._uploadBucket,
|
|
163
159
|
baseUrl: this._baseUrl,
|
|
164
160
|
});
|
|
165
|
-
void (0,
|
|
161
|
+
void (0, r2_uploader_1.sendTaskToQueue)(uploadJsonTask);
|
|
166
162
|
}
|
|
167
163
|
else {
|
|
168
164
|
logger_1.logger.error(`[Empirical Reporter] summary.json does not exist at: ${jsonFilePath}`);
|
|
@@ -177,13 +173,13 @@ class EmpiricalReporter {
|
|
|
177
173
|
uploadBucket: this._uploadBucket,
|
|
178
174
|
baseUrl: this._baseUrl,
|
|
179
175
|
});
|
|
180
|
-
void (0,
|
|
176
|
+
void (0, r2_uploader_1.sendTaskToQueue)(uploadTraceTask);
|
|
181
177
|
}
|
|
182
178
|
else {
|
|
183
179
|
logger_1.logger.error(`[Empirical Reporter] playwright-report/trace does not exist at: ${traceFilePath}`);
|
|
184
180
|
return;
|
|
185
181
|
}
|
|
186
|
-
await (0,
|
|
182
|
+
await (0, r2_uploader_1.waitForTaskQueueToFinish)();
|
|
187
183
|
logger_1.logger.debug("[Empirical Reporter] All uploads finished");
|
|
188
184
|
const endTime = new Date().getTime();
|
|
189
185
|
logger_1.logger.debug("[Empirical Reporter] Finished final report upload at: ", new Intl.DateTimeFormat("en-US", {
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AsyncTask } from "./queue";
|
|
3
|
-
export declare function uploadFiles({ fileList, outputFolder, relativePath, }: {
|
|
4
|
-
outputFolder: string;
|
|
5
|
-
fileList?: string[];
|
|
6
|
-
relativePath: string;
|
|
7
|
-
}): Promise<FileMap | void>;
|
|
8
|
-
export declare function createUploadTask({ fileList, outputFolder, relativePath, }: {
|
|
9
|
-
outputFolder: string;
|
|
10
|
-
fileList?: string[];
|
|
11
|
-
relativePath?: string;
|
|
12
|
-
}): AsyncTask;
|
|
1
|
+
import { AsyncTask } from "@empiricalrun/r2-uploader";
|
|
13
2
|
/**
|
|
14
3
|
* Creates an async task for uploading files to R2 storage.
|
|
15
4
|
* This is an improved version of createUploadTask that:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploader.d.ts","sourceRoot":"","sources":["../../src/reporter/uploader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"uploader.d.ts","sourceRoot":"","sources":["../../src/reporter/uploader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA4B,MAAM,2BAA2B,CAAC;AAKhF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,OAAO,GACR,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,SAAS,CA8BZ"}
|
|
@@ -3,52 +3,10 @@ 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.uploadFiles = uploadFiles;
|
|
7
|
-
exports.createUploadTask = createUploadTask;
|
|
8
6
|
exports.createUploadTaskV2 = createUploadTaskV2;
|
|
9
7
|
const r2_uploader_1 = require("@empiricalrun/r2-uploader");
|
|
10
8
|
const path_1 = __importDefault(require("path"));
|
|
11
9
|
const logger_1 = require("../logger");
|
|
12
|
-
// TODO: Remove this once we have migrated to 1.53.X for all repos
|
|
13
|
-
const R2_BUCKET_NAME = "test-report";
|
|
14
|
-
const R2_BASE_URL = "https://reports.empirical.run";
|
|
15
|
-
// TODO: Remove this once we have migrated to 1.53.X for all repos
|
|
16
|
-
async function uploadFiles({ fileList, outputFolder, relativePath, }) {
|
|
17
|
-
if (!process.env.PROJECT_NAME || !process.env.TEST_RUN_GITHUB_ACTION_ID) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const urls = {};
|
|
21
|
-
const sourceDir = path_1.default.join(outputFolder, relativePath);
|
|
22
|
-
const destinationDir = path_1.default.join(process.env.PROJECT_NAME, process.env.TEST_RUN_GITHUB_ACTION_ID, relativePath);
|
|
23
|
-
const uploadedfiles = await (0, r2_uploader_1.uploadDirectory)({
|
|
24
|
-
sourceDir,
|
|
25
|
-
fileList,
|
|
26
|
-
destinationDir,
|
|
27
|
-
uploadBucket: R2_BUCKET_NAME,
|
|
28
|
-
});
|
|
29
|
-
Object.entries(uploadedfiles).forEach(([filePath]) => {
|
|
30
|
-
const fileName = filePath.split("/").pop() || "";
|
|
31
|
-
const fileUrl = new URL(path_1.default.join(destinationDir, fileName), R2_BASE_URL);
|
|
32
|
-
urls[fileName] = fileUrl.toString();
|
|
33
|
-
});
|
|
34
|
-
logger_1.logger.debug("Finished uploading files:", urls);
|
|
35
|
-
return urls;
|
|
36
|
-
}
|
|
37
|
-
// TODO: Remove this once we have migrated to 1.53.X for all repos
|
|
38
|
-
function createUploadTask({ fileList, outputFolder, relativePath = "", }) {
|
|
39
|
-
return async () => {
|
|
40
|
-
return uploadFiles({
|
|
41
|
-
fileList,
|
|
42
|
-
outputFolder,
|
|
43
|
-
relativePath,
|
|
44
|
-
})
|
|
45
|
-
.then((fileMap) => {
|
|
46
|
-
logger_1.logger.debug("Finished uploading files", fileMap);
|
|
47
|
-
return fileMap;
|
|
48
|
-
})
|
|
49
|
-
.catch((e) => logger_1.logger.error("Error uploading files", e));
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
10
|
/**
|
|
53
11
|
* Creates an async task for uploading files to R2 storage.
|
|
54
12
|
* This is an improved version of createUploadTask that:
|
package/dist/reporter/util.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { GenericPlaywrightAttachment } from "@empiricalrun/shared-types";
|
|
1
|
+
import { GenericPlaywrightAttachment, TestCaseRunEndEventV2 } from "@empiricalrun/shared-types";
|
|
2
2
|
import { JSONReportSpec, JSONReport as PlaywrightJSONReport, TestCase } from "@playwright/test/reporter";
|
|
3
|
-
import { TestCaseRunEndEvent } from "./types";
|
|
4
3
|
export declare function getPackageJsonPath(folderPath: string): string;
|
|
5
4
|
export declare function resolveReporterOutputPath(defaultValue: string, configDir: string, configValue: string | undefined): string;
|
|
6
5
|
export declare function normalizeAndSaveAttachment(outputPath: string, name: string, options?: {
|
|
@@ -17,7 +16,7 @@ export declare function suitesAndProjectForTest(test: TestCase): {
|
|
|
17
16
|
suites: string[];
|
|
18
17
|
projectName: string;
|
|
19
18
|
};
|
|
20
|
-
export declare function sendTestCaseUpdateToDashboard(params:
|
|
19
|
+
export declare function sendTestCaseUpdateToDashboard(params: TestCaseRunEndEventV2): Promise<void>;
|
|
21
20
|
export declare function safelySerialiseJSON(obj: any, keyFilter?: (key: string) => boolean): any;
|
|
22
21
|
export declare function updateHtmlZipFileAttachmentPaths(jsonFilePath: string, htmlFilePath: string, repoPath: string): Promise<void>;
|
|
23
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/reporter/util.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/reporter/util.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,cAAc,EAGd,UAAU,IAAI,oBAAoB,EAElC,QAAQ,EACT,MAAM,2BAA2B,CAAC;AAoBnC,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAmB7D;AAED,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAAG,SAAS,UAMhC;AAED,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GAC5E,OAAO,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CAyCD;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,QAAQ;;;EAwBrD;AAED,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAyDf;AAED,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,GAAG,EACR,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,GACnC,GAAG,CAIL;AAED,wBAAsB,gCAAgC,CACpD,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,iBAuFjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,GAAG,EACb,iBAAiB,EAAE,GAAG,CACpB,MAAM,EACN;IAAE,WAAW,EAAE,2BAA2B,EAAE,CAAA;CAAE,EAAE,CACjD,QA+BF;AAGD,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,oBAAoB,EACjC,MAAM,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,QAavC;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,mBAAmB,EAAE,MAAM,EAC3B,QAAQ,EAAE,MAAM,EAChB,cAAc,GAAE,OAAe,GAC9B,GAAG,CAAC,MAAM,EAAE;IAAE,WAAW,EAAE,2BAA2B,EAAE,CAAA;CAAE,EAAE,CAAC,CA4C/D;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO7E;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,gCAAgC,CACpD,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,6CAoClB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/playwright-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"mailosaur": "^8.6.1",
|
|
44
44
|
"puppeteer-extra-plugin-recaptcha": "^3.6.8",
|
|
45
45
|
"rimraf": "^6.0.1",
|
|
46
|
-
"@empiricalrun/llm": "^0.
|
|
47
|
-
"@empiricalrun/r2-uploader": "^0.
|
|
48
|
-
"@empiricalrun/test-gen": "^0.
|
|
46
|
+
"@empiricalrun/llm": "^0.24.0",
|
|
47
|
+
"@empiricalrun/r2-uploader": "^0.4.0",
|
|
48
|
+
"@empiricalrun/test-gen": "^0.78.0"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"dev": "tsc --build --watch",
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/email.ts","./src/index.ts","./src/logger.ts","./src/playwright-extensions.ts","./src/auth/google.ts","./src/auth/index.ts","./src/auth/types.ts","./src/captcha/index.ts","./src/captcha/vision.ts","./src/config/index.ts","./src/config/devices/types.ts","./src/overlay-tests/cache.spec.ts","./src/overlay-tests/click.spec.ts","./src/overlay-tests/fixtures.ts","./src/overlay-tests/patch.spec.ts","./src/reporter/empirical-reporter.ts","./src/reporter/
|
|
1
|
+
{"root":["./src/email.ts","./src/index.ts","./src/logger.ts","./src/playwright-extensions.ts","./src/auth/google.ts","./src/auth/index.ts","./src/auth/types.ts","./src/captcha/index.ts","./src/captcha/vision.ts","./src/config/index.ts","./src/config/devices/types.ts","./src/overlay-tests/cache.spec.ts","./src/overlay-tests/click.spec.ts","./src/overlay-tests/fixtures.ts","./src/overlay-tests/patch.spec.ts","./src/reporter/empirical-reporter.ts","./src/reporter/uploader.ts","./src/reporter/util.ts","./src/test/constants.ts","./src/test/expect.ts","./src/test/index.ts","./src/test/types.ts","./src/test/scripts/agent-capabilities.ts","./src/test/scripts/index.ts","./src/test/scripts/locator-highlights.ts","./src/test/scripts/locator-vision.ts","./src/test/scripts/mouse-pointer.ts","./src/test/scripts/types.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/cache.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/index.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/prompt.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/types.ts","./src/test/scripts/pw-locator-patch/dismiss-overlays/utils.ts","./src/test/scripts/pw-locator-patch/highlight/click.ts","./src/test/scripts/pw-locator-patch/highlight/expect.ts","./src/test/scripts/pw-locator-patch/highlight/hover.ts","./src/test/scripts/pw-locator-patch/highlight/inner-text.ts","./src/test/scripts/pw-locator-patch/highlight/input-value.ts","./src/test/scripts/pw-locator-patch/highlight/is-checked.ts","./src/test/scripts/pw-locator-patch/highlight/is-disabled.ts","./src/test/scripts/pw-locator-patch/highlight/is-editable.ts","./src/test/scripts/pw-locator-patch/highlight/text-content.ts","./src/test/scripts/pw-locator-patch/utils/index.ts","./src/test/scripts/pw-locator-patch/vision/query.ts"],"version":"5.8.3"}
|
package/dist/reporter/queue.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { FileMap } from "@empiricalrun/r2-uploader";
|
|
2
|
-
export type AsyncTask = () => Promise<FileMap | void>;
|
|
3
|
-
type AsyncTaskReturnType = FileMap | void;
|
|
4
|
-
type AsyncTaskResult = Promise<AsyncTaskReturnType>;
|
|
5
|
-
export declare function sendTaskToQueue(task: AsyncTask): AsyncTaskResult;
|
|
6
|
-
export declare function waitForTaskQueueToFinish(): Promise<void>;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/reporter/queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAIpD,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;AACtD,KAAK,mBAAmB,GAAG,OAAO,GAAG,IAAI,CAAC;AAC1C,KAAK,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAoGpD,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,eAAe,CAQhE;AAED,wBAAgB,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC,CAOxD"}
|
package/dist/reporter/queue.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendTaskToQueue = sendTaskToQueue;
|
|
4
|
-
exports.waitForTaskQueueToFinish = waitForTaskQueueToFinish;
|
|
5
|
-
const logger_1 = require("../logger");
|
|
6
|
-
class TaskQueue {
|
|
7
|
-
waitingQueue = [];
|
|
8
|
-
executingTasks = [];
|
|
9
|
-
maxConcurrent;
|
|
10
|
-
constructor() {
|
|
11
|
-
this.maxConcurrent = process.env.UPLOAD_MAX_QUEUE_SIZE
|
|
12
|
-
? parseInt(process.env.UPLOAD_MAX_QUEUE_SIZE)
|
|
13
|
-
: 2;
|
|
14
|
-
}
|
|
15
|
-
async processNextTask() {
|
|
16
|
-
logger_1.logger.debug("[queue] processing next task in queue, with queue lengths:", taskQueue.queueLength, taskQueue.executingTasksCount);
|
|
17
|
-
if (this.waitingQueue.length === 0 ||
|
|
18
|
-
this.executingTasks.length >= this.maxConcurrent) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const queuedTask = this.waitingQueue.shift();
|
|
22
|
-
if (!queuedTask)
|
|
23
|
-
return;
|
|
24
|
-
const { task, resolve, reject } = queuedTask;
|
|
25
|
-
// Create the promise first
|
|
26
|
-
let executingPromise;
|
|
27
|
-
const executeTask = async () => {
|
|
28
|
-
try {
|
|
29
|
-
const result = await task();
|
|
30
|
-
resolve(result);
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
logger_1.logger.error("Error in processing task", error);
|
|
34
|
-
reject(error);
|
|
35
|
-
}
|
|
36
|
-
finally {
|
|
37
|
-
// Remove this task from executing tasks
|
|
38
|
-
const index = this.executingTasks.indexOf(executingPromise);
|
|
39
|
-
if (index > -1) {
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
41
|
-
this.executingTasks.splice(index, 1);
|
|
42
|
-
}
|
|
43
|
-
// Try to process next task
|
|
44
|
-
await this.processNextTask();
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
// Assign the promise
|
|
48
|
-
executingPromise = executeTask();
|
|
49
|
-
this.executingTasks.push(executingPromise);
|
|
50
|
-
}
|
|
51
|
-
enqueue(task) {
|
|
52
|
-
return new Promise((resolve, reject) => {
|
|
53
|
-
this.waitingQueue.push({ task, resolve, reject });
|
|
54
|
-
this.processNextTask().catch((error) => {
|
|
55
|
-
logger_1.logger.error("Error processing queue", error);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
async waitForCompletion() {
|
|
60
|
-
if (this.waitingQueue.length === 0 && this.executingTasks.length === 0) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
// First wait for all currently executing tasks
|
|
64
|
-
if (this.executingTasks.length > 0) {
|
|
65
|
-
await Promise.all(this.executingTasks);
|
|
66
|
-
}
|
|
67
|
-
// If there are still tasks in the waiting queue, process them
|
|
68
|
-
if (this.waitingQueue.length > 0) {
|
|
69
|
-
await this.processNextTask();
|
|
70
|
-
}
|
|
71
|
-
await this.waitForCompletion();
|
|
72
|
-
}
|
|
73
|
-
get queueLength() {
|
|
74
|
-
return this.waitingQueue.length;
|
|
75
|
-
}
|
|
76
|
-
get executingTasksCount() {
|
|
77
|
-
return this.executingTasks.length;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
const taskQueue = new TaskQueue();
|
|
81
|
-
function sendTaskToQueue(task) {
|
|
82
|
-
logger_1.logger.debug("[queue] sending task to queue, with queue lengths:", taskQueue.queueLength, taskQueue.executingTasksCount, task);
|
|
83
|
-
return taskQueue.enqueue(task);
|
|
84
|
-
}
|
|
85
|
-
function waitForTaskQueueToFinish() {
|
|
86
|
-
logger_1.logger.debug("[queue] waiting for queue to finish, with queue lengths:", taskQueue.queueLength, taskQueue.executingTasksCount);
|
|
87
|
-
return taskQueue.waitForCompletion();
|
|
88
|
-
}
|
package/dist/reporter/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/reporter/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,IAAI,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEnG,MAAM,MAAM,mBAAmB,GAAG,yBAAyB,CAAC"}
|
package/dist/reporter/types.js
DELETED