@empiricalrun/playwright-utils 0.65.0 → 0.65.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 +11 -0
- package/dist/generated/api-worker-openapi.d.ts +1979 -1272
- package/dist/generated/api-worker-openapi.d.ts.map +1 -1
- package/dist/overlay-tests/typesafe.spec.js +5 -3
- package/dist/overlay-tests/visual.spec.js +1 -1
- package/dist/reporter/attachment-cleanup-test-reporter.d.ts +3 -1
- package/dist/reporter/attachment-cleanup-test-reporter.d.ts.map +1 -1
- package/dist/reporter/attachment-cleanup-test-reporter.js +5 -1
- package/dist/reporter/attachment-cleanup.d.ts +1 -1
- package/dist/reporter/attachment-cleanup.d.ts.map +1 -1
- package/dist/reporter/attachment-cleanup.js +14 -7
- package/dist/reporter/attachment-key.d.ts +3 -0
- package/dist/reporter/attachment-key.d.ts.map +1 -0
- package/dist/reporter/attachment-key.js +31 -0
- package/dist/reporter/empirical-reporter.d.ts +1 -1
- package/dist/reporter/empirical-reporter.d.ts.map +1 -1
- package/dist/reporter/empirical-reporter.js +7 -6
- package/dist/reporter/harness.d.ts +6 -1
- package/dist/reporter/harness.d.ts.map +1 -1
- package/dist/reporter/harness.js +22 -13
- package/dist/reporter/incremental-blob-reporter.d.ts +1 -0
- package/dist/reporter/incremental-blob-reporter.d.ts.map +1 -1
- package/dist/reporter/incremental-blob-reporter.js +8 -4
- package/dist/reporter/util.d.ts +3 -3
- package/dist/reporter/util.d.ts.map +1 -1
- package/dist/reporter/util.js +10 -8
- package/dist/test/expect/visual.d.ts.map +1 -1
- package/dist/test/expect/visual.js +6 -2
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/index.d.ts.map +1 -1
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/index.js +0 -2
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/utils.d.ts +0 -1
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/utils.d.ts.map +1 -1
- package/dist/test/scripts/pw-locator-patch/dismiss-overlays/utils.js +0 -20
- package/dist/test/scripts/pw-locator-patch/vision/query.d.ts.map +1 -1
- package/dist/test/scripts/pw-locator-patch/vision/query.js +57 -5
- package/package.json +3 -4
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -10,7 +10,9 @@ const typesafe_1 = require("../test/scripts/pw-locator-patch/dismiss-overlays/ty
|
|
|
10
10
|
const utils_1 = require("../test/scripts/pw-locator-patch/dismiss-overlays/utils");
|
|
11
11
|
const fixtures_1 = require("./fixtures");
|
|
12
12
|
fixtures_1.test.skip(!process.env.TYPESAFE_API_KEY, "TYPESAFE_API_KEY is not set");
|
|
13
|
-
|
|
13
|
+
function resultsFile() {
|
|
14
|
+
return node_path_1.default.join(fixtures_1.test.info().project.outputDir, "typesafe-overlay-results.jsonl");
|
|
15
|
+
}
|
|
14
16
|
const DISMISS_ATTEMPTS = 3;
|
|
15
17
|
async function actWithTypeSafeDismissal(page, target, action) {
|
|
16
18
|
const results = [];
|
|
@@ -30,8 +32,8 @@ async function actWithTypeSafeDismissal(page, target, action) {
|
|
|
30
32
|
target: await target.elementHandle(),
|
|
31
33
|
});
|
|
32
34
|
results.push(result);
|
|
33
|
-
node_fs_1.default.mkdirSync(node_path_1.default.dirname(
|
|
34
|
-
node_fs_1.default.appendFileSync(
|
|
35
|
+
node_fs_1.default.mkdirSync(node_path_1.default.dirname(resultsFile()), { recursive: true });
|
|
36
|
+
node_fs_1.default.appendFileSync(resultsFile(), JSON.stringify({
|
|
35
37
|
test: fixtures_1.test.info().title,
|
|
36
38
|
attempt,
|
|
37
39
|
overlayText: text,
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const test_1 = require("../test");
|
|
4
4
|
const fixtures_1 = require("./fixtures");
|
|
5
5
|
const expect = (0, test_1.extendExpect)(fixtures_1.expect);
|
|
6
|
-
|
|
6
|
+
fixtures_1.test.skip("toLookRight on page attaches screenshot", async ({ page, server, }, testInfo) => {
|
|
7
7
|
await page.goto(`${server.baseURL}/visual-test.html`);
|
|
8
8
|
await expect(page).toLookRight("A welcome page with a heading and a paragraph of text");
|
|
9
9
|
const pageAttachment = testInfo.attachments.find((a) => a.name.startsWith("toLookRight-"));
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import type { FullResult, Reporter, TestCase, TestResult } from "@playwright/test/reporter";
|
|
1
|
+
import type { FullConfig, FullResult, Reporter, TestCase, TestResult } from "@playwright/test/reporter";
|
|
2
2
|
declare class AttachmentCleanupTestReporter implements Reporter {
|
|
3
3
|
private _timeline;
|
|
4
4
|
private _cleanup;
|
|
5
5
|
private _allAttachmentPaths;
|
|
6
6
|
private _pendingUploads;
|
|
7
7
|
private _queue;
|
|
8
|
+
private _outputDirs;
|
|
8
9
|
constructor();
|
|
9
10
|
onTestEnd(_test: TestCase, result: TestResult): void;
|
|
11
|
+
onBegin(config: FullConfig): void;
|
|
10
12
|
onEnd(_result: FullResult): Promise<void>;
|
|
11
13
|
}
|
|
12
14
|
export default AttachmentCleanupTestReporter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-cleanup-test-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/attachment-cleanup-test-reporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AA0CnC,cAAM,6BAA8B,YAAW,QAAQ;IACrD,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,mBAAmB,CAAgB;IAC3C,OAAO,CAAC,eAAe,CAAuB;IAC9C,OAAO,CAAC,MAAM,CAAkC;
|
|
1
|
+
{"version":3,"file":"attachment-cleanup-test-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/attachment-cleanup-test-reporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AA0CnC,cAAM,6BAA8B,YAAW,QAAQ;IACrD,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,mBAAmB,CAAgB;IAC3C,OAAO,CAAC,eAAe,CAAuB;IAC9C,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,WAAW,CAAgB;IAEnC,cAQC;IAED,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,QAyB5C;IAED,OAAO,CAAC,MAAM,EAAE,UAAU,QAEzB;IAEK,KAAK,CAAC,OAAO,EAAE,UAAU,iBAyB9B;CACF;eAEc,6BAA6B"}
|
|
@@ -39,6 +39,7 @@ class AttachmentCleanupTestReporter {
|
|
|
39
39
|
_allAttachmentPaths = [];
|
|
40
40
|
_pendingUploads = [];
|
|
41
41
|
_queue = new AsyncQueue(MAX_CONCURRENT);
|
|
42
|
+
_outputDirs = [];
|
|
42
43
|
constructor() {
|
|
43
44
|
this._cleanup.onEvict = (evictedPath) => {
|
|
44
45
|
this._timeline.push({
|
|
@@ -72,9 +73,12 @@ class AttachmentCleanupTestReporter {
|
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
}
|
|
76
|
+
onBegin(config) {
|
|
77
|
+
this._outputDirs = config.projects.map((project) => project.outputDir);
|
|
78
|
+
}
|
|
75
79
|
async onEnd(_result) {
|
|
76
80
|
await Promise.allSettled(this._pendingUploads);
|
|
77
|
-
this._cleanup.logSummary();
|
|
81
|
+
this._cleanup.logSummary(this._outputDirs);
|
|
78
82
|
const stats = this._cleanup.stats;
|
|
79
83
|
const existingPaths = this._allAttachmentPaths.filter((p) => fs_1.default.existsSync(p));
|
|
80
84
|
const deletedPaths = this._allAttachmentPaths.filter((p) => !fs_1.default.existsSync(p));
|
|
@@ -17,7 +17,7 @@ export declare class AttachmentCleanup {
|
|
|
17
17
|
markUploaded(attachmentPath: string): void;
|
|
18
18
|
private _evict;
|
|
19
19
|
private _logDiskStatus;
|
|
20
|
-
logSummary(): void;
|
|
20
|
+
logSummary(outputDirs: string[]): void;
|
|
21
21
|
set onEvict(callback: (path: string) => void);
|
|
22
22
|
get stats(): {
|
|
23
23
|
registeredCount: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-cleanup.d.ts","sourceRoot":"","sources":["../../src/reporter/attachment-cleanup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"attachment-cleanup.d.ts","sourceRoot":"","sources":["../../src/reporter/attachment-cleanup.ts"],"names":[],"mappings":"AAqEA,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,SAAS,CAAwC;IACzD,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,aAAa,CAA+C;IACpE,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,QAAQ,CAAyC;IAEzD,YAAY,UAAU,GAAE,MAAmC,EAM1D;IAED,QAAQ,CAAC,UAAU,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,QAejD;IAED,YAAY,CAAC,cAAc,EAAE,MAAM,QASlC;IAED,OAAO,CAAC,MAAM;IA4Bd,OAAO,CAAC,cAAc;IAItB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,QAW9B;IAED,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAE3C;IAED,IAAI,KAAK;QAEL,eAAe;QACf,aAAa;QACb,YAAY;QACZ,YAAY;QACZ,YAAY;QACZ,WAAW;QACX,SAAS;QACT,UAAU;MAEb;CACF"}
|
|
@@ -40,16 +40,23 @@ function getDiskUsage() {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
const WORKER_REPO_DIR = "/app/source-repo";
|
|
43
|
-
function
|
|
43
|
+
function shellQuote(value) {
|
|
44
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
45
|
+
}
|
|
46
|
+
function getDiskBreakdown(outputDirs) {
|
|
47
|
+
const outputDirTargets = outputDirs.flatMap((dir) => [
|
|
48
|
+
`${shellQuote(dir)}/.playwright-artifacts-*`,
|
|
49
|
+
shellQuote(dir),
|
|
50
|
+
]);
|
|
44
51
|
try {
|
|
45
|
-
const output = (0, child_process_1.execSync)(
|
|
52
|
+
const output = (0, child_process_1.execSync)(`du -sh ${outputDirTargets.join(" ")} blob-report/ blob-report-incremental/ playwright-report/ /tmp/playwright-artifacts-* /tmp 2>/dev/null | sort -rh`, { encoding: "utf8", timeout: 8000, cwd: WORKER_REPO_DIR }).trim();
|
|
46
53
|
if (!output) {
|
|
47
54
|
return "none";
|
|
48
55
|
}
|
|
49
|
-
|
|
56
|
+
return output
|
|
50
57
|
.split("\n")
|
|
51
|
-
.map((l) => l.replace(
|
|
52
|
-
|
|
58
|
+
.map((l) => l.replace(/\t/g, " "))
|
|
59
|
+
.join(", ");
|
|
53
60
|
}
|
|
54
61
|
catch {
|
|
55
62
|
return "none";
|
|
@@ -129,7 +136,7 @@ class AttachmentCleanup {
|
|
|
129
136
|
_logDiskStatus() {
|
|
130
137
|
this._diskLogTick++;
|
|
131
138
|
}
|
|
132
|
-
logSummary() {
|
|
139
|
+
logSummary(outputDirs) {
|
|
133
140
|
if (this._diskLogTimer) {
|
|
134
141
|
clearInterval(this._diskLogTimer);
|
|
135
142
|
this._diskLogTimer = null;
|
|
@@ -137,7 +144,7 @@ class AttachmentCleanup {
|
|
|
137
144
|
if (!fs_1.default.existsSync(WORKER_REPO_DIR)) {
|
|
138
145
|
return;
|
|
139
146
|
}
|
|
140
|
-
logger_1.logger.info(`[AttachmentCleanup] Summary: registered=${this._registeredCount}, pending=${this._pending.size}, uploaded=${this._uploadedCount}, evicted=${this._evictedCount} (${formatBytes(this._evictedBytes)}), totalSize=${formatBytes(this._totalSize)}, disk=${getDiskUsage()}, breakdown=${getDiskBreakdown()}`);
|
|
147
|
+
logger_1.logger.info(`[AttachmentCleanup] Summary: registered=${this._registeredCount}, pending=${this._pending.size}, uploaded=${this._uploadedCount}, evicted=${this._evictedCount} (${formatBytes(this._evictedBytes)}), totalSize=${formatBytes(this._totalSize)}, disk=${getDiskUsage()}, breakdown=${getDiskBreakdown(outputDirs)}`);
|
|
141
148
|
}
|
|
142
149
|
set onEvict(callback) {
|
|
143
150
|
this._onEvict = callback;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment-key.d.ts","sourceRoot":"","sources":["../../src/reporter/attachment-key.ts"],"names":[],"mappings":"AAWA,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAE7D;AAED,wBAAgB,aAAa,CAC3B,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAAE,GACnB,MAAM,CAaR"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
exports.sortOutputDirs = sortOutputDirs;
|
|
7
|
+
exports.attachmentKey = attachmentKey;
|
|
8
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
function isInside(relative) {
|
|
11
|
+
return (relative !== ".." &&
|
|
12
|
+
!relative.startsWith(`..${path_1.default.sep}`) &&
|
|
13
|
+
!path_1.default.isAbsolute(relative));
|
|
14
|
+
}
|
|
15
|
+
function sortOutputDirs(outputDirs) {
|
|
16
|
+
return [...new Set(outputDirs)].sort((a, b) => b.length - a.length);
|
|
17
|
+
}
|
|
18
|
+
function attachmentKey(attachmentPath, outputDirs) {
|
|
19
|
+
for (const dir of outputDirs) {
|
|
20
|
+
const relative = path_1.default.relative(dir, attachmentPath);
|
|
21
|
+
if (isInside(relative)) {
|
|
22
|
+
return relative;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const hash = crypto_1.default
|
|
26
|
+
.createHash("sha1")
|
|
27
|
+
.update(attachmentPath)
|
|
28
|
+
.digest("hex")
|
|
29
|
+
.slice(0, 12);
|
|
30
|
+
return path_1.default.join("external", hash, path_1.default.basename(attachmentPath));
|
|
31
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FullConfig, FullResult, Reporter, TestCase, TestResult } from "@playwright/test/reporter";
|
|
2
2
|
declare class EmpiricalReporter implements Reporter {
|
|
3
3
|
private _currentWorkingDir;
|
|
4
|
-
private
|
|
4
|
+
private _outputDirs;
|
|
5
5
|
private _pendingTestCaseEvents;
|
|
6
6
|
private _hasSharding;
|
|
7
7
|
private _attachmentUrlMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAyBnC,cAAM,iBAAkB,YAAW,QAAQ;IACzC,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,sBAAsB,CAAuB;IACrD,OAAO,CAAC,YAAY,CAAgD;IACpE,OAAO,CAAC,iBAAiB,CAAyC;IAClE,OAAO,CAAC,gBAAgB,CAAkC;IAC1D,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,kBAAkB,CAA2B;IACrD,OAAO,CAAC,YAAY,CAAqB;IAEzC,cAEC;IAED,OAAO,CAAC,MAAM,EAAE,UAAU,QAKzB;IAED,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,6BAA6B,CAuCnC;IAEF,OAAO,CAAC,WAAW;IAMnB,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,QAyB7C;IAED,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,QA4I3C;IAEK,KAAK,CAAC,MAAM,EAAE,UAAU,iBAkH7B;IAED,OAAO,CAAC,qBAAqB;YAkBf,gBAAgB;YAOhB,iBAAiB;CAqChC;eAEc,iBAAiB"}
|
|
@@ -8,6 +8,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
8
8
|
const logger_1 = require("../logger");
|
|
9
9
|
const telemetry_1 = require("../telemetry");
|
|
10
10
|
const attachment_cleanup_1 = require("./attachment-cleanup");
|
|
11
|
+
const attachment_key_1 = require("./attachment-key");
|
|
11
12
|
const blob_utils_1 = require("./blob-utils");
|
|
12
13
|
const failing_line_1 = require("./failing-line");
|
|
13
14
|
const incremental_blob_reporter_1 = require("./incremental-blob-reporter");
|
|
@@ -16,7 +17,7 @@ const uploader_1 = require("./uploader");
|
|
|
16
17
|
const util_1 = require("./util");
|
|
17
18
|
class EmpiricalReporter {
|
|
18
19
|
_currentWorkingDir = process.cwd();
|
|
19
|
-
|
|
20
|
+
_outputDirs = [];
|
|
20
21
|
_pendingTestCaseEvents = [];
|
|
21
22
|
_hasSharding = process.env.HAS_SHARDING === "true";
|
|
22
23
|
_attachmentUrlMap = new Map();
|
|
@@ -29,6 +30,7 @@ class EmpiricalReporter {
|
|
|
29
30
|
}
|
|
30
31
|
onBegin(config) {
|
|
31
32
|
this._maxFailures = config.maxFailures;
|
|
33
|
+
this._outputDirs = (0, attachment_key_1.sortOutputDirs)(config.projects.map((project) => project.outputDir));
|
|
32
34
|
}
|
|
33
35
|
_piSandboxLog(message) {
|
|
34
36
|
const runningInsidePiSandbox = process.env.RUNNING_INSIDE_PI_SANDBOX === "true";
|
|
@@ -51,8 +53,7 @@ class EmpiricalReporter {
|
|
|
51
53
|
return;
|
|
52
54
|
}
|
|
53
55
|
this._attachmentCleanup.register(attachment);
|
|
54
|
-
const
|
|
55
|
-
const destinationPath = `data/${relativePath}`;
|
|
56
|
+
const destinationPath = `data/${(0, attachment_key_1.attachmentKey)(attachment.path, this._outputDirs)}`;
|
|
56
57
|
const publicUrl = await this._uploader.uploadFile(attachment.path, destinationPath, keepHot ? "STANDARD" : undefined);
|
|
57
58
|
if (publicUrl) {
|
|
58
59
|
this._attachmentCleanup.markUploaded(attachment.path);
|
|
@@ -225,7 +226,7 @@ class EmpiricalReporter {
|
|
|
225
226
|
}
|
|
226
227
|
if (htmlExists && jsonExists) {
|
|
227
228
|
logger_1.logger.debug("[Empirical Reporter] Patching HTML with attachment URLs");
|
|
228
|
-
await (0, util_1.updateHtmlZipFileAttachmentPaths)(jsonFilePath, htmlFilePath, this.
|
|
229
|
+
await (0, util_1.updateHtmlZipFileAttachmentPaths)(jsonFilePath, htmlFilePath, this._outputDirs);
|
|
229
230
|
const htmlReportUrl = await this._uploader.uploadFile(htmlFilePath, "index.html");
|
|
230
231
|
this._piSandboxLog(`[Empirical Reporter] HTML report URL: ${htmlReportUrl}`);
|
|
231
232
|
}
|
|
@@ -234,7 +235,7 @@ class EmpiricalReporter {
|
|
|
234
235
|
}
|
|
235
236
|
if (jsonExists) {
|
|
236
237
|
logger_1.logger.debug("[Empirical Reporter] Patching summary.json with attachment URLs");
|
|
237
|
-
await (0, util_1.updateSummaryJsonAttachmentPaths)(jsonFilePath, this.
|
|
238
|
+
await (0, util_1.updateSummaryJsonAttachmentPaths)(jsonFilePath, this._outputDirs, `${this._uploader.urlPrefix}/data`);
|
|
238
239
|
const summaryJsonUrl = await this._uploader.uploadFile(jsonFilePath, "summary.json");
|
|
239
240
|
this._piSandboxLog(`[Empirical Reporter] summary.json URL: ${summaryJsonUrl}`);
|
|
240
241
|
}
|
|
@@ -266,7 +267,7 @@ class EmpiricalReporter {
|
|
|
266
267
|
else {
|
|
267
268
|
logger_1.logger.info(`[Empirical Reporter] Sharding not enabled (HAS_SHARDING=${process.env.HAS_SHARDING})`);
|
|
268
269
|
}
|
|
269
|
-
this._attachmentCleanup.logSummary();
|
|
270
|
+
this._attachmentCleanup.logSummary(this._outputDirs);
|
|
270
271
|
logger_1.logger.debug("[Empirical Reporter] All uploads finished");
|
|
271
272
|
const timeDiff = Date.now() - startTime;
|
|
272
273
|
logger_1.logger.debug("[Empirical Reporter] Time taken to upload after tests ended: ", timeDiff, "ms");
|
|
@@ -37,6 +37,7 @@ export interface SignalRunOptions {
|
|
|
37
37
|
workers: number;
|
|
38
38
|
waitForMarker?: string;
|
|
39
39
|
waitFor?: WaitFor;
|
|
40
|
+
waitForPattern?: RegExp;
|
|
40
41
|
delayBeforeSignalMs?: number;
|
|
41
42
|
signal?: NodeJS.Signals;
|
|
42
43
|
secondSignalAfterMs?: number;
|
|
@@ -81,8 +82,12 @@ export declare function runPlaywrightClean(ctx: ParityTestContext, opts: {
|
|
|
81
82
|
export declare function mergeBlobDirToSummary(cwd: string, blobDir: string, outputName: string): Record<string, unknown>;
|
|
82
83
|
export interface DashboardStub {
|
|
83
84
|
testCaseEvents: () => Array<Record<string, any>>;
|
|
85
|
+
completedUploadPaths: () => string[];
|
|
84
86
|
env: NodeJS.ProcessEnv;
|
|
85
87
|
close: () => Promise<void>;
|
|
86
88
|
}
|
|
87
|
-
export declare function startDashboardStub(
|
|
89
|
+
export declare function startDashboardStub({ slowUploadPathSuffix, slowUploadMs, }?: {
|
|
90
|
+
slowUploadPathSuffix?: string;
|
|
91
|
+
slowUploadMs?: number;
|
|
92
|
+
}): Promise<DashboardStub>;
|
|
88
93
|
//# sourceMappingURL=harness.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../../src/reporter/harness.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAErD;AAED,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IACzD,GAAG,EAAE,cAAc,CAAC;IACpB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC,CAaD;AA2CD,wBAAsB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IACrE,GAAG,EAAE,uBAAuB,CAAC;IAC7B,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC,CAaD;AAED,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAI3E;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,OAAO,GAAG,cAAc,GAAG,cAAc,CAAC;AAOtD,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,QAAQ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AAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACpE,OAAO,CAAC,cAAc,CAAC,CA8BzB;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgBzB;AAED,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACjD,oBAAoB,EAAE,MAAM,MAAM,EAAE,CAAC;IACrC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,wBAAsB,kBAAkB,CAAC,EACvC,oBAAoB,EACpB,YAAgB,GACjB,GAAE;IACD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,aAAa,CAAC,CA2E9B"}
|
package/dist/reporter/harness.js
CHANGED
|
@@ -96,7 +96,7 @@ const WAIT_FOR_PATTERNS = {
|
|
|
96
96
|
};
|
|
97
97
|
const MARKER_RE = /@@ ([A-Z0-9-]+) @@/g;
|
|
98
98
|
async function runPlaywrightWithSignal(ctx, opts) {
|
|
99
|
-
const { workers, waitForMarker, waitFor, delayBeforeSignalMs = 0, signal = "SIGINT", secondSignalAfterMs, killAfterMs, triggerTimeoutMs = 30_000, env, } = opts;
|
|
99
|
+
const { workers, waitForMarker, waitFor, waitForPattern, delayBeforeSignalMs = 0, signal = "SIGINT", secondSignalAfterMs, killAfterMs, triggerTimeoutMs = 30_000, env, } = opts;
|
|
100
100
|
const startedAt = Date.now();
|
|
101
101
|
const since = () => Date.now() - startedAt;
|
|
102
102
|
const child = (0, child_process_1.spawn)(PLAYWRIGHT_BIN, ["test", `--workers=${workers}`], {
|
|
@@ -149,7 +149,7 @@ async function runPlaywrightWithSignal(ctx, opts) {
|
|
|
149
149
|
}
|
|
150
150
|
catch { }
|
|
151
151
|
};
|
|
152
|
-
const pattern = waitFor ? WAIT_FOR_PATTERNS[waitFor] : undefined;
|
|
152
|
+
const pattern = waitForPattern ?? (waitFor ? WAIT_FOR_PATTERNS[waitFor] : undefined);
|
|
153
153
|
const isTriggered = () => waitForMarker
|
|
154
154
|
? markers.some((m) => m.name === waitForMarker)
|
|
155
155
|
: pattern
|
|
@@ -311,8 +311,22 @@ function mergeBlobDirToSummary(cwd, blobDir, outputName) {
|
|
|
311
311
|
});
|
|
312
312
|
return JSON.parse(fs_1.default.readFileSync(outputPath, "utf8"));
|
|
313
313
|
}
|
|
314
|
-
async function startDashboardStub() {
|
|
314
|
+
async function startDashboardStub({ slowUploadPathSuffix, slowUploadMs = 0, } = {}) {
|
|
315
315
|
const events = [];
|
|
316
|
+
const completedUploadPaths = [];
|
|
317
|
+
const respondToUpload = (req, res, uploadPath) => {
|
|
318
|
+
completedUploadPaths.push(uploadPath);
|
|
319
|
+
res.writeHead(200, { "content-type": "application/xml", etag: '"etag"' });
|
|
320
|
+
if (req.method === "POST" && req.url?.includes("?uploads")) {
|
|
321
|
+
res.end("<InitiateMultipartUploadResult><UploadId>upload</UploadId></InitiateMultipartUploadResult>");
|
|
322
|
+
}
|
|
323
|
+
else if (req.method === "POST") {
|
|
324
|
+
res.end('<CompleteMultipartUploadResult><ETag>"etag"</ETag></CompleteMultipartUploadResult>');
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
res.end();
|
|
328
|
+
}
|
|
329
|
+
};
|
|
316
330
|
const server = http_1.default.createServer((req, res) => {
|
|
317
331
|
const chunks = [];
|
|
318
332
|
req.on("data", (c) => chunks.push(c));
|
|
@@ -328,22 +342,17 @@ async function startDashboardStub() {
|
|
|
328
342
|
res.end("{}");
|
|
329
343
|
return;
|
|
330
344
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
else if (req.method === "POST") {
|
|
336
|
-
res.end('<CompleteMultipartUploadResult><ETag>"etag"</ETag></CompleteMultipartUploadResult>');
|
|
337
|
-
}
|
|
338
|
-
else {
|
|
339
|
-
res.end();
|
|
340
|
-
}
|
|
345
|
+
const uploadPath = (req.url ?? "").split("?")[0];
|
|
346
|
+
const isSlow = slowUploadPathSuffix !== undefined &&
|
|
347
|
+
uploadPath.endsWith(slowUploadPathSuffix);
|
|
348
|
+
setTimeout(() => respondToUpload(req, res, uploadPath), isSlow ? slowUploadMs : 0);
|
|
341
349
|
});
|
|
342
350
|
});
|
|
343
351
|
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
344
352
|
const url = `http://127.0.0.1:${server.address().port}`;
|
|
345
353
|
return {
|
|
346
354
|
testCaseEvents: () => [...events],
|
|
355
|
+
completedUploadPaths: () => [...completedUploadPaths],
|
|
347
356
|
env: {
|
|
348
357
|
PROJECT_NAME: "reporter-test",
|
|
349
358
|
TEST_RUN_GITHUB_ACTION_ID: "1",
|
|
@@ -46,6 +46,7 @@ declare class IncrementalBlobReporter implements Reporter {
|
|
|
46
46
|
onStepBegin(test: TestCase, result: TestResult, step: TestStep): void;
|
|
47
47
|
onStepEnd(test: TestCase, result: TestResult, step: TestStep): void;
|
|
48
48
|
onEnd(result: FullResult): Promise<void>;
|
|
49
|
+
private _finalizeOnEnd;
|
|
49
50
|
addAttachmentUrl(localPath: string, remoteUrl: string): void;
|
|
50
51
|
printsToStdio(): boolean;
|
|
51
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incremental-blob-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/incremental-blob-reporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,SAAS,EACT,UAAU,EACV,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC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,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAI3E;IAED,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAI3E;IAED,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,CAEvD;IAED,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAWpE;IAED,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAalE;IAEK,KAAK,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAM7C;YAEa,cAAc;IA2B5B,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAE3D;IAED,aAAa,IAAI,OAAO,CAEvB;CACF;AAID,wBAAgB,0BAA0B,IAAI,uBAAuB,GAAG,IAAI,CAE3E;AAED,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,uBAAuB,GAChC,IAAI,CAEN;eAEc,uBAAuB"}
|
|
@@ -65,9 +65,6 @@ class IncrementalBlobReporter {
|
|
|
65
65
|
})
|
|
66
66
|
.catch((err) => {
|
|
67
67
|
console.error("[IncrementalBlobReporterFailure] Finalize/upload failed on SIGINT:", err);
|
|
68
|
-
})
|
|
69
|
-
.finally(() => {
|
|
70
|
-
this._removeSignalHandler();
|
|
71
68
|
});
|
|
72
69
|
};
|
|
73
70
|
process.on("SIGINT", this._sigintHandler);
|
|
@@ -264,7 +261,14 @@ class IncrementalBlobReporter {
|
|
|
264
261
|
this._appendEvents((0, lifecycle_events_1.buildOnStepEndEvents)(test, result, step, this._resultIdMap, this._stepIdMap, this._rootDir, this._stagingDir, this._knownAttachmentCounts));
|
|
265
262
|
}
|
|
266
263
|
async onEnd(result) {
|
|
267
|
-
|
|
264
|
+
try {
|
|
265
|
+
await this._finalizeOnEnd(result);
|
|
266
|
+
}
|
|
267
|
+
finally {
|
|
268
|
+
this._removeSignalHandler();
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
async _finalizeOnEnd(result) {
|
|
268
272
|
if (this._finalizePromise) {
|
|
269
273
|
await this._finalizePromise;
|
|
270
274
|
this._finalizePromise = this._finalizeAndMaybeUpload({
|
package/dist/reporter/util.d.ts
CHANGED
|
@@ -20,8 +20,8 @@ export declare function suitesAndProjectForTest(test: TestCase): {
|
|
|
20
20
|
export declare function sendTestCaseUpdateToDashboard(params: TestCaseRunEndEventV2): Promise<void>;
|
|
21
21
|
export declare function sendTestCaseBeginToDashboard(params: TestCaseRunBeginEvent): Promise<void>;
|
|
22
22
|
export declare function safelySerialiseJSON(obj: any, keyFilter?: (key: string) => boolean): any;
|
|
23
|
-
export declare function updateHtmlZipFileAttachmentPaths(jsonFilePath: string, htmlFilePath: string,
|
|
24
|
-
export declare function buildTestAttachmentMapFromSummary(summaryJsonFilePath: string,
|
|
23
|
+
export declare function updateHtmlZipFileAttachmentPaths(jsonFilePath: string, htmlFilePath: string, outputDirs: string[]): Promise<void>;
|
|
24
|
+
export declare function buildTestAttachmentMapFromSummary(summaryJsonFilePath: string, outputDirs: string[], doNotNormalize?: boolean): TestAttachmentMap;
|
|
25
25
|
export declare function checkFileExistsAsync(filePath: string): Promise<boolean>;
|
|
26
|
-
export declare function updateSummaryJsonAttachmentPaths(filePath: string,
|
|
26
|
+
export declare function updateSummaryJsonAttachmentPaths(filePath: string, outputDirs: string[], urlPrefix: string): Promise<PlaywrightJSONReport | undefined>;
|
|
27
27
|
//# sourceMappingURL=util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/reporter/util.ts"],"names":[],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AI,CAAC,CA2Bf;AAED,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAoBf;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,UAAU,EAAE,MAAM,EAAE,iBAkFrB;AAED,wBAAgB,iCAAiC,CAC/C,mBAAmB,EAAE,MAAM,EAC3B,UAAU,EAAE,MAAM,EAAE,EACpB,cAAc,GAAE,OAAe,GAC9B,iBAAiB,CAkBnB;AAED,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO7E;AAED,wBAAsB,gCAAgC,CACpD,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,EAAE,MAAM,6CA8BlB"}
|
package/dist/reporter/util.js
CHANGED
|
@@ -22,6 +22,7 @@ const mime_1 = __importDefault(require("mime"));
|
|
|
22
22
|
const path_1 = __importDefault(require("path"));
|
|
23
23
|
const api_worker_client_1 = require("../api-worker-client");
|
|
24
24
|
const logger_1 = require("../logger");
|
|
25
|
+
const attachment_key_1 = require("./attachment-key");
|
|
25
26
|
// Mirrors https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/tools/cli-client/program.ts#L440
|
|
26
27
|
function calculateSha1(buffer) {
|
|
27
28
|
const hash = crypto_1.default.createHash("sha1");
|
|
@@ -173,8 +174,8 @@ async function sendTestCaseBeginToDashboard(params) {
|
|
|
173
174
|
function safelySerialiseJSON(obj, keyFilter) {
|
|
174
175
|
return JSON.parse(JSON.stringify(obj, (key, value) => (keyFilter?.(key) ? undefined : value)));
|
|
175
176
|
}
|
|
176
|
-
async function updateHtmlZipFileAttachmentPaths(jsonFilePath, htmlFilePath,
|
|
177
|
-
const testAttachmentMap = buildTestAttachmentMapFromSummary(jsonFilePath,
|
|
177
|
+
async function updateHtmlZipFileAttachmentPaths(jsonFilePath, htmlFilePath, outputDirs) {
|
|
178
|
+
const testAttachmentMap = buildTestAttachmentMapFromSummary(jsonFilePath, outputDirs);
|
|
178
179
|
let htmlFile;
|
|
179
180
|
try {
|
|
180
181
|
htmlFile = await fs_1.default.promises.readFile(htmlFilePath, "utf8");
|
|
@@ -232,7 +233,7 @@ async function updateHtmlZipFileAttachmentPaths(jsonFilePath, htmlFilePath, repo
|
|
|
232
233
|
finally {
|
|
233
234
|
}
|
|
234
235
|
}
|
|
235
|
-
function buildTestAttachmentMapFromSummary(summaryJsonFilePath,
|
|
236
|
+
function buildTestAttachmentMapFromSummary(summaryJsonFilePath, outputDirs, doNotNormalize = false) {
|
|
236
237
|
const summaryJson = JSON.parse(fs_1.default.readFileSync(summaryJsonFilePath, "utf8"));
|
|
237
238
|
return (0, reporter_1.buildTestAttachmentMap)(summaryJson, {
|
|
238
239
|
transformAttachment: doNotNormalize
|
|
@@ -241,8 +242,10 @@ function buildTestAttachmentMapFromSummary(summaryJsonFilePath, repoPath, doNotN
|
|
|
241
242
|
if (!attachment?.path) {
|
|
242
243
|
return attachment;
|
|
243
244
|
}
|
|
244
|
-
|
|
245
|
-
|
|
245
|
+
return {
|
|
246
|
+
...attachment,
|
|
247
|
+
path: path_1.default.join("data", (0, attachment_key_1.attachmentKey)(attachment.path, outputDirs)),
|
|
248
|
+
};
|
|
246
249
|
},
|
|
247
250
|
});
|
|
248
251
|
}
|
|
@@ -255,7 +258,7 @@ async function checkFileExistsAsync(filePath) {
|
|
|
255
258
|
return false;
|
|
256
259
|
}
|
|
257
260
|
}
|
|
258
|
-
async function updateSummaryJsonAttachmentPaths(filePath,
|
|
261
|
+
async function updateSummaryJsonAttachmentPaths(filePath, outputDirs, urlPrefix) {
|
|
259
262
|
if (!process.env.PROJECT_NAME || !process.env.TEST_RUN_GITHUB_ACTION_ID) {
|
|
260
263
|
console.error("PROJECT_NAME and TEST_RUN_GITHUB_ACTION_ID must be set");
|
|
261
264
|
return;
|
|
@@ -266,8 +269,7 @@ async function updateSummaryJsonAttachmentPaths(filePath, repoPath, urlPrefix) {
|
|
|
266
269
|
for (const result of test.results || []) {
|
|
267
270
|
for (const attachment of result.attachments || []) {
|
|
268
271
|
if (attachment?.path) {
|
|
269
|
-
|
|
270
|
-
attachment.path = `${urlPrefix}/${relativePath}`;
|
|
272
|
+
attachment.path = `${urlPrefix}/${(0, attachment_key_1.attachmentKey)(attachment.path, outputDirs)}`;
|
|
271
273
|
}
|
|
272
274
|
}
|
|
273
275
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual.d.ts","sourceRoot":"","sources":["../../../src/test/expect/visual.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"visual.d.ts","sourceRoot":"","sources":["../../../src/test/expect/visual.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAY,MAAM,kBAAkB,CAAC;AAOhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAsE7C,wBAAsB,WAAW,CAC/B,MAAM,EAAE,IAAI,GAAG,OAAO,EACtB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,aAAa,CAAC,CAsFxB"}
|
|
@@ -4,13 +4,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.toLookRight = toLookRight;
|
|
7
|
-
const vision_1 = require("@empiricalrun/llm/vision");
|
|
8
7
|
const fs_1 = __importDefault(require("fs"));
|
|
9
8
|
const openai_1 = __importDefault(require("openai"));
|
|
10
9
|
const os_1 = __importDefault(require("os"));
|
|
11
10
|
const path_1 = __importDefault(require("path"));
|
|
12
11
|
const api_worker_client_1 = require("../../api-worker-client");
|
|
13
12
|
const telemetry_1 = require("../../telemetry");
|
|
13
|
+
function asImageDataUrl(image) {
|
|
14
|
+
return image.startsWith("data:image")
|
|
15
|
+
? image
|
|
16
|
+
: `data:image/png;base64,${image}`;
|
|
17
|
+
}
|
|
14
18
|
function getCallerLine() {
|
|
15
19
|
const stack = new Error().stack;
|
|
16
20
|
if (!stack) {
|
|
@@ -91,7 +95,7 @@ async function toLookRight(target, pageDescription) {
|
|
|
91
95
|
{
|
|
92
96
|
type: "image_url",
|
|
93
97
|
image_url: {
|
|
94
|
-
url: (
|
|
98
|
+
url: asImageDataUrl(base64Image),
|
|
95
99
|
},
|
|
96
100
|
},
|
|
97
101
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/dismiss-overlays/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAIxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/dismiss-overlays/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAIxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAU9C,wBAAgB,gBAAgB,IAAI,SAAS,CAI5C;AAED,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,WAKhE;AAED,qBAAa,mBAAmB;IAOlB,OAAO,CAAC,QAAQ,CAAC,IAAI;IANjC,OAAO,CAAC,iBAAiB,CAIhB;IAET,YAA6B,IAAI,EAAE,IAAI,EAAI;IAErC,WAAW,kBAIhB;IAEK,GAAG,CACP,aAAa,EAAE,GAAG,EAClB,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,EACvC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAUf;YAEa,OAAO;YAwDP,QAAQ;CAgCvB;AAED,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,GACnB,cAAc,GAAG,SAAS,CAiC5B"}
|
|
@@ -91,11 +91,9 @@ class OverlayDismissAgent {
|
|
|
91
91
|
}
|
|
92
92
|
async runAgent(element, text, testFn) {
|
|
93
93
|
const task = await (0, prompt_1.getTask)(this.page, element, text);
|
|
94
|
-
const trace = (0, utils_1.traceThis)(task, testFn);
|
|
95
94
|
const result = await testFn.step(utils_1.DISMISSAL_AGENT_STEP, () => (0, cua_1.createTestUsingComputerUseAgent)({
|
|
96
95
|
page: this.page,
|
|
97
96
|
task,
|
|
98
|
-
trace,
|
|
99
97
|
// We don't want to use page.pause approach here because
|
|
100
98
|
// overlay dismissal can kick in during a browser agent tool call
|
|
101
99
|
// and we need app to be able to use page.pause for agent actions.
|
|
@@ -8,5 +8,4 @@ export declare function dismissOverlayStepTitle(element: OverlayElement | undefi
|
|
|
8
8
|
export declare function isProductFruitsOverlay(element: OverlayElement | undefined): boolean | undefined;
|
|
9
9
|
export declare function textContent(pageRef: Page, element: OverlayElement | undefined): Promise<string | undefined>;
|
|
10
10
|
export declare function annotateForReport(testFn: TestFn, description: string): void;
|
|
11
|
-
export declare function traceThis(task: string, testFn: TestFn): import("@empiricalrun/llm").TraceClient | undefined;
|
|
12
11
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/dismiss-overlays/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/dismiss-overlays/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,SAAS,sBASrE;AAED,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AACtD,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAElE,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,cAAc,GAAG,SAAS,UAO1E;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,cAAc,GAAG,SAAS,uBAKzE;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,cAAc,GAAG,SAAS,+BAgDpC;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAMpE"}
|
|
@@ -6,8 +6,6 @@ exports.dismissOverlayStepTitle = dismissOverlayStepTitle;
|
|
|
6
6
|
exports.isProductFruitsOverlay = isProductFruitsOverlay;
|
|
7
7
|
exports.textContent = textContent;
|
|
8
8
|
exports.annotateForReport = annotateForReport;
|
|
9
|
-
exports.traceThis = traceThis;
|
|
10
|
-
const llm_1 = require("@empiricalrun/llm");
|
|
11
9
|
function overlayDescription(element) {
|
|
12
10
|
if (element) {
|
|
13
11
|
const { interceptor, parent } = element;
|
|
@@ -85,21 +83,3 @@ function annotateForReport(testFn, description) {
|
|
|
85
83
|
description,
|
|
86
84
|
});
|
|
87
85
|
}
|
|
88
|
-
function traceThis(task, testFn) {
|
|
89
|
-
const metadata = {
|
|
90
|
-
projectName: process.env.PROJECT_NAME ?? "",
|
|
91
|
-
testRunId: process.env.TEST_RUN_GITHUB_ACTION_ID ?? "",
|
|
92
|
-
testCase: testFn.info().title,
|
|
93
|
-
};
|
|
94
|
-
const trace = (0, llm_1.createLangfuseTrace)({
|
|
95
|
-
name: "overlay_dismiss",
|
|
96
|
-
input: task,
|
|
97
|
-
tags: ["overlay_dismiss"],
|
|
98
|
-
metadata,
|
|
99
|
-
});
|
|
100
|
-
if (trace) {
|
|
101
|
-
const traceUrl = trace.getTraceUrl();
|
|
102
|
-
console.log(`Starting computer use agent: ${traceUrl}`);
|
|
103
|
-
}
|
|
104
|
-
return trace;
|
|
105
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/vision/query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/vision/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAiEhD,wBAAgB,UAAU,CAAC,YAAY,EAAE,QAAQ,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,QAMzE"}
|