@empiricalrun/playwright-utils 0.52.1 → 0.54.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 +19 -0
- package/README.md +0 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +2 -1
- package/dist/inbox-client.d.ts.map +1 -1
- package/dist/inbox-client.js +8 -4
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/overlay-tests/cache.spec.js +2 -1
- package/dist/overlay-tests/click.spec.js +6 -3
- package/dist/reporter/attachment-cleanup-test-reporter.d.ts.map +1 -1
- package/dist/reporter/attachment-cleanup-test-reporter.js +2 -1
- package/dist/reporter/attachment-cleanup.d.ts.map +1 -1
- package/dist/reporter/attachment-cleanup.js +17 -8
- package/dist/reporter/blob-utils.d.ts.map +1 -1
- package/dist/reporter/blob-utils.js +4 -2
- package/dist/reporter/empirical-reporter.d.ts +1 -0
- package/dist/reporter/empirical-reporter.d.ts.map +1 -1
- package/dist/reporter/empirical-reporter.js +23 -8
- package/dist/reporter/ibr-utils.d.ts.map +1 -1
- package/dist/reporter/ibr-utils.js +4 -2
- package/dist/reporter/incremental-blob-reporter.d.ts.map +1 -1
- package/dist/reporter/incremental-blob-reporter.js +6 -3
- package/dist/reporter/lifecycle-events.d.ts.map +1 -1
- package/dist/reporter/lifecycle-events.js +2 -1
- package/dist/reporter/uploader.d.ts.map +1 -1
- package/dist/reporter/uploader.js +2 -1
- package/dist/reporter/util.d.ts.map +1 -1
- package/dist/reporter/util.js +13 -7
- package/dist/test/expect/visual.d.ts.map +1 -1
- package/dist/test/expect/visual.js +5 -3
- package/dist/test/expect/webhook.d.ts.map +1 -1
- package/dist/test/expect/webhook.js +2 -1
- package/dist/test/index.d.ts +0 -2
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +4 -7
- 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 +2 -1
- package/dist/webhook.d.ts.map +1 -1
- package/dist/webhook.js +4 -2
- package/package.json +3 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/postgres.d.ts +0 -22
- package/dist/postgres.d.ts.map +0 -1
- package/dist/postgres.js +0 -146
- package/docs/postgres.md +0 -78
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @empiricalrun/playwright-utils
|
|
2
2
|
|
|
3
|
+
## 0.54.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c28a815: feat: pi-sbx supports custom pw-utils
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- @empiricalrun/cua@0.4.1
|
|
12
|
+
- @empiricalrun/dashboard-client@0.3.0
|
|
13
|
+
- @empiricalrun/llm@0.27.0
|
|
14
|
+
- @empiricalrun/reporter@0.29.1
|
|
15
|
+
|
|
16
|
+
## 0.53.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 3848c83: chore: remove postgres related fixtures
|
|
21
|
+
|
|
3
22
|
## 0.52.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/README.md
CHANGED
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAI5D,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC,KAAK,OAAO,GAAG,SAAS,GAAG,kBAAkB,CAAC;AAE9C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,QAAQ,GAAG,cAAc,CAAC;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AW,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;WAIxC,eAAe,CAC1B,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC;CAoB5B"}
|
package/dist/auth/index.js
CHANGED
|
@@ -86,8 +86,9 @@ class AuthStore {
|
|
|
86
86
|
const tmp = await page.context().newPage();
|
|
87
87
|
try {
|
|
88
88
|
for (const origin of authState.origins) {
|
|
89
|
-
if (!origin.localStorage?.length)
|
|
89
|
+
if (!origin.localStorage?.length) {
|
|
90
90
|
continue;
|
|
91
|
+
}
|
|
91
92
|
await tmp.goto(origin.origin, {
|
|
92
93
|
waitUntil: "domcontentloaded",
|
|
93
94
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbox-client.d.ts","sourceRoot":"","sources":["../src/inbox-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,KAAK,IAAI,GAAG;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAmBF,KAAK,kBAAkB,GAAG;IACxB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,WAAW;IACtB,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,OAAO,CAAS;gBAEZ,IAAI,EAAE,kBAAkB;IAK9B,YAAY,CAChB,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAC1D,OAAO,CAAC,UAAU,CAAC;YASR,cAAc;
|
|
1
|
+
{"version":3,"file":"inbox-client.d.ts","sourceRoot":"","sources":["../src/inbox-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,KAAK,IAAI,GAAG;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAmBF,KAAK,kBAAkB,GAAG;IACxB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,WAAW;IACtB,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,OAAO,CAAS;gBAEZ,IAAI,EAAE,kBAAkB;IAK9B,YAAY,CAChB,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAC1D,OAAO,CAAC,UAAU,CAAC;YASR,cAAc;IA0D5B,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,YAAY;IAwBpB,OAAO,CAAC,YAAY;CAgBrB"}
|
package/dist/inbox-client.js
CHANGED
|
@@ -23,12 +23,15 @@ class InboxClient {
|
|
|
23
23
|
to: address,
|
|
24
24
|
received_after: receivedAfter.toISOString(),
|
|
25
25
|
});
|
|
26
|
-
if (filter?.from)
|
|
26
|
+
if (filter?.from) {
|
|
27
27
|
params.set("from", filter.from);
|
|
28
|
-
|
|
28
|
+
}
|
|
29
|
+
if (filter?.subject) {
|
|
29
30
|
params.set("subject", filter.subject);
|
|
30
|
-
|
|
31
|
+
}
|
|
32
|
+
if (filter?.body) {
|
|
31
33
|
params.set("body", filter.body);
|
|
34
|
+
}
|
|
32
35
|
const path = `/api/messages?${params.toString()}`;
|
|
33
36
|
let result;
|
|
34
37
|
try {
|
|
@@ -90,8 +93,9 @@ class InboxClient {
|
|
|
90
93
|
const codes = [];
|
|
91
94
|
const codeRegex = /\b(\d{4,8})\b/g;
|
|
92
95
|
for (const content of [text, html]) {
|
|
93
|
-
if (!content)
|
|
96
|
+
if (!content) {
|
|
94
97
|
continue;
|
|
98
|
+
}
|
|
95
99
|
let match;
|
|
96
100
|
while ((match = codeRegex.exec(content)) !== null) {
|
|
97
101
|
if (!codes.includes(match[1])) {
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC;AACrB,cAAc,yBAAyB,CAAC;AACxC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC;AACrB,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -28,5 +28,4 @@ Object.defineProperty(exports, "getProxyConfig", { enumerable: true, get: functi
|
|
|
28
28
|
__exportStar(require("./email"), exports);
|
|
29
29
|
__exportStar(require("./kv"), exports);
|
|
30
30
|
__exportStar(require("./playwright-extensions"), exports);
|
|
31
|
-
__exportStar(require("./postgres"), exports);
|
|
32
31
|
__exportStar(require("./webhook"), exports);
|
|
@@ -25,8 +25,9 @@ fixtures_1.test.beforeEach(async ({ page }) => {
|
|
|
25
25
|
});
|
|
26
26
|
fixtures_1.test.afterEach(() => {
|
|
27
27
|
// Delete overlay cache
|
|
28
|
-
if (fs_1.default.existsSync(cache_1.CACHE_FILE))
|
|
28
|
+
if (fs_1.default.existsSync(cache_1.CACHE_FILE)) {
|
|
29
29
|
fs_1.default.unlinkSync(cache_1.CACHE_FILE);
|
|
30
|
+
}
|
|
30
31
|
});
|
|
31
32
|
(0, fixtures_1.test)("overlay dismiss should not trigger recursively when executing from cache", async ({ page, server, }) => {
|
|
32
33
|
// Set up cache with a bad value: click on "Target" to dimiss the glass pane
|
|
@@ -12,22 +12,25 @@ fixtures_1.test.beforeEach(async ({ page }) => {
|
|
|
12
12
|
});
|
|
13
13
|
fixtures_1.test.afterAll(async () => {
|
|
14
14
|
// Delete overlay cache
|
|
15
|
-
if (fs_1.default.existsSync(cache_1.CACHE_FILE))
|
|
15
|
+
if (fs_1.default.existsSync(cache_1.CACHE_FILE)) {
|
|
16
16
|
fs_1.default.unlinkSync(cache_1.CACHE_FILE);
|
|
17
|
+
}
|
|
17
18
|
});
|
|
18
19
|
function getCacheDataWithDom({ dom }) {
|
|
19
20
|
const cacheData = JSON.parse(fs_1.default.readFileSync(cache_1.CACHE_FILE, "utf8"));
|
|
20
21
|
return cacheData.data.find(({ element }) => {
|
|
21
|
-
if (dom)
|
|
22
|
+
if (dom) {
|
|
22
23
|
return element.dom.includes(dom);
|
|
24
|
+
}
|
|
23
25
|
return false;
|
|
24
26
|
});
|
|
25
27
|
}
|
|
26
28
|
function getCacheDataWithTextContent({ textContent }) {
|
|
27
29
|
const cacheData = JSON.parse(fs_1.default.readFileSync(cache_1.CACHE_FILE, "utf8"));
|
|
28
30
|
return cacheData.data.find(({ element }) => {
|
|
29
|
-
if (textContent)
|
|
31
|
+
if (textContent) {
|
|
30
32
|
return element.textContent.includes(textContent);
|
|
33
|
+
}
|
|
31
34
|
return false;
|
|
32
35
|
});
|
|
33
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-cleanup-test-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/attachment-cleanup-test-reporter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"attachment-cleanup-test-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/attachment-cleanup-test-reporter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,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;;IAYhD,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;IA2BvC,KAAK,CAAC,OAAO,EAAE,UAAU;CA0BhC;AAED,eAAe,6BAA6B,CAAC"}
|
|
@@ -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":"AA2DA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,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;gBAE7C,UAAU,GAAE,MAAmC;IAY3D;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE;IAmBlD;;;OAGG;IACH,YAAY,CAAC,cAAc,EAAE,MAAM;IAWnC,OAAO,CAAC,MAAM;IA4Bd,OAAO,CAAC,cAAc;IAStB,UAAU;IAUV,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAE3C;IAED,IAAI,KAAK;;;;;;;;;MAWR;CACF"}
|
|
@@ -11,18 +11,21 @@ function getDefaultDiskLimitBytes() {
|
|
|
11
11
|
const raw = process.env.ATTACHMENT_CLEANUP_LIMIT_BYTES;
|
|
12
12
|
if (raw != null) {
|
|
13
13
|
const parsed = Number(raw);
|
|
14
|
-
if (Number.isSafeInteger(parsed) && parsed > 0)
|
|
14
|
+
if (Number.isSafeInteger(parsed) && parsed > 0) {
|
|
15
15
|
return parsed;
|
|
16
|
+
}
|
|
16
17
|
logger_1.logger.warn(`[AttachmentCleanup] Invalid ATTACHMENT_CLEANUP_LIMIT_BYTES=${raw}, using default`);
|
|
17
18
|
}
|
|
18
19
|
return 10 * 1024 * 1024 * 1024; // 10 GB
|
|
19
20
|
}
|
|
20
21
|
const DISK_LOG_INTERVAL_MS = 30_000;
|
|
21
22
|
function formatBytes(bytes) {
|
|
22
|
-
if (bytes < 1024 * 1024)
|
|
23
|
+
if (bytes < 1024 * 1024) {
|
|
23
24
|
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
24
|
-
|
|
25
|
+
}
|
|
26
|
+
if (bytes < 1024 * 1024 * 1024) {
|
|
25
27
|
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
28
|
+
}
|
|
26
29
|
return `${(bytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;
|
|
27
30
|
}
|
|
28
31
|
function getDiskUsage() {
|
|
@@ -39,8 +42,9 @@ function getDiskUsage() {
|
|
|
39
42
|
function getDiskBreakdown() {
|
|
40
43
|
try {
|
|
41
44
|
const output = (0, child_process_1.execSync)("du -sh test-results/.playwright-artifacts-* test-results/ blob-report/ playwright-report/ /tmp/playwright-artifacts-* 2>/dev/null | sort -rh", { encoding: "utf8", timeout: 8000, cwd: "/app/source-repo" }).trim();
|
|
42
|
-
if (!output)
|
|
45
|
+
if (!output) {
|
|
43
46
|
return "none";
|
|
47
|
+
}
|
|
44
48
|
const lines = output
|
|
45
49
|
.split("\n")
|
|
46
50
|
.map((l) => l.replace("test-results/", "").replace(/\t/g, " "));
|
|
@@ -89,7 +93,9 @@ class AttachmentCleanup {
|
|
|
89
93
|
_onEvict = null;
|
|
90
94
|
constructor(limitBytes = getDefaultDiskLimitBytes()) {
|
|
91
95
|
this._limitBytes = limitBytes;
|
|
92
|
-
|
|
96
|
+
// logger.debug(
|
|
97
|
+
// `[AttachmentCleanup] Initialized with limit: ${formatBytes(limitBytes)}`,
|
|
98
|
+
// );
|
|
93
99
|
this._diskLogTimer = setInterval(() => {
|
|
94
100
|
this._logDiskStatus();
|
|
95
101
|
}, DISK_LOG_INTERVAL_MS);
|
|
@@ -102,10 +108,12 @@ class AttachmentCleanup {
|
|
|
102
108
|
*/
|
|
103
109
|
register(attachment) {
|
|
104
110
|
try {
|
|
105
|
-
if (!attachment.path)
|
|
111
|
+
if (!attachment.path) {
|
|
106
112
|
return;
|
|
107
|
-
|
|
113
|
+
}
|
|
114
|
+
if (this._pending.has(attachment.path)) {
|
|
108
115
|
return;
|
|
116
|
+
}
|
|
109
117
|
const stat = fs_1.default.statSync(attachment.path);
|
|
110
118
|
const sizeBytes = stat.size;
|
|
111
119
|
this._pending.set(attachment.path, sizeBytes);
|
|
@@ -123,8 +131,9 @@ class AttachmentCleanup {
|
|
|
123
131
|
*/
|
|
124
132
|
markUploaded(attachmentPath) {
|
|
125
133
|
const size = this._pending.get(attachmentPath);
|
|
126
|
-
if (size === undefined)
|
|
134
|
+
if (size === undefined) {
|
|
127
135
|
return;
|
|
136
|
+
}
|
|
128
137
|
this._pending.delete(attachmentPath);
|
|
129
138
|
this._uploaded.push({ path: attachmentPath, size });
|
|
130
139
|
this._uploadedCount++;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob-utils.d.ts","sourceRoot":"","sources":["../../src/reporter/blob-utils.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,GACrB,aAAa,CAEf;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,GAC3C,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"blob-utils.d.ts","sourceRoot":"","sources":["../../src/reporter/blob-utils.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,GACrB,aAAa,CAEf;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,GAC3C,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAwEjC"}
|
|
@@ -28,8 +28,9 @@ async function patchBlobZip(zipPath, attachmentUrlMap) {
|
|
|
28
28
|
retryCounters.set(testId, retryIndex + 1);
|
|
29
29
|
testRetryMap.set(event.params.result.id, retryIndex);
|
|
30
30
|
for (const attachment of event.params.result?.attachments ?? []) {
|
|
31
|
-
if (!attachment.path)
|
|
31
|
+
if (!attachment.path) {
|
|
32
32
|
continue;
|
|
33
|
+
}
|
|
33
34
|
const key = makeAttachmentKey(testId, retryIndex, attachment.name);
|
|
34
35
|
const url = attachmentUrlMap.get(key);
|
|
35
36
|
if (url) {
|
|
@@ -42,8 +43,9 @@ async function patchBlobZip(zipPath, attachmentUrlMap) {
|
|
|
42
43
|
const resultId = event.params.resultId;
|
|
43
44
|
const retryIndex = testRetryMap.get(resultId) ?? retryCounters.get(testId) ?? 0;
|
|
44
45
|
for (const attachment of event.params.attachments ?? []) {
|
|
45
|
-
if (!attachment.path)
|
|
46
|
+
if (!attachment.path) {
|
|
46
47
|
continue;
|
|
48
|
+
}
|
|
47
49
|
const key = makeAttachmentKey(testId, retryIndex, attachment.name);
|
|
48
50
|
const url = attachmentUrlMap.get(key);
|
|
49
51
|
if (url) {
|
|
@@ -9,6 +9,7 @@ declare class EmpiricalReporter implements Reporter {
|
|
|
9
9
|
private _uploader;
|
|
10
10
|
private _attachmentCleanup;
|
|
11
11
|
constructor();
|
|
12
|
+
private _piSandboxLog;
|
|
12
13
|
private enqueTestAttachmentUploadTask;
|
|
13
14
|
onTestEnd(test: TestCase, result: TestResult): void;
|
|
14
15
|
onEnd(result: FullResult): Promise<void>;
|
|
@@ -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,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAuBnC,cAAM,iBAAkB,YAAW,QAAQ;IACzC,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,oBAAoB,CAG1B;IACF,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;;IAMrD,OAAO,CAAC,6BAA6B,
|
|
1
|
+
{"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAuBnC,cAAM,iBAAkB,YAAW,QAAQ;IACzC,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,oBAAoB,CAG1B;IACF,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;;IAMrD,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,6BAA6B,CAuCnC;IAEF,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU;IAmItC,KAAK,CAAC,MAAM,EAAE,UAAU;IAmH9B,OAAO,CAAC,qBAAqB;YAkBf,gBAAgB;YAOhB,iBAAiB;CAqChC;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -26,9 +26,17 @@ class EmpiricalReporter {
|
|
|
26
26
|
constructor() {
|
|
27
27
|
this._uploader = (0, uploader_1.getUploader)();
|
|
28
28
|
}
|
|
29
|
+
_piSandboxLog(message) {
|
|
30
|
+
const runningInsidePiSandbox = process.env.RUNNING_INSIDE_PI_SANDBOX === "true";
|
|
31
|
+
if (!runningInsidePiSandbox) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
console.log(message);
|
|
35
|
+
}
|
|
29
36
|
enqueTestAttachmentUploadTask = async (attachment) => {
|
|
30
|
-
if (!this._uploader)
|
|
37
|
+
if (!this._uploader) {
|
|
31
38
|
return;
|
|
39
|
+
}
|
|
32
40
|
if (!attachment.path) {
|
|
33
41
|
logger_1.logger.warn(`[Empirical Reporter] Skipping attachment without path: ${attachment.name}`);
|
|
34
42
|
return;
|
|
@@ -48,10 +56,12 @@ class EmpiricalReporter {
|
|
|
48
56
|
}
|
|
49
57
|
};
|
|
50
58
|
onTestEnd(test, result) {
|
|
51
|
-
if ((0, reporter_state_1.isFinalized)())
|
|
59
|
+
if ((0, reporter_state_1.isFinalized)()) {
|
|
52
60
|
return;
|
|
53
|
-
|
|
61
|
+
}
|
|
62
|
+
if (!this._uploader) {
|
|
54
63
|
return;
|
|
64
|
+
}
|
|
55
65
|
if (!process.env.TEST_RUN_GITHUB_ACTION_ID) {
|
|
56
66
|
logger_1.logger.debug("[Empirical Reporter] TEST_RUN_GITHUB_ACTION_ID is not set");
|
|
57
67
|
return;
|
|
@@ -154,10 +164,12 @@ class EmpiricalReporter {
|
|
|
154
164
|
}
|
|
155
165
|
}
|
|
156
166
|
async onEnd(result) {
|
|
157
|
-
if ((0, reporter_state_1.isFinalized)())
|
|
167
|
+
if ((0, reporter_state_1.isFinalized)()) {
|
|
158
168
|
return;
|
|
159
|
-
|
|
169
|
+
}
|
|
170
|
+
if (!this._uploader) {
|
|
160
171
|
return;
|
|
172
|
+
}
|
|
161
173
|
logger_1.logger.info(`[Empirical Reporter] Test run completed with status: ${result.status}`);
|
|
162
174
|
logger_1.logger.debug(`[Empirical Reporter] State: cwd=${this._currentWorkingDir}, hasSharding=${this._hasSharding}`);
|
|
163
175
|
const startTime = Date.now();
|
|
@@ -172,7 +184,8 @@ class EmpiricalReporter {
|
|
|
172
184
|
if (htmlExists && jsonExists) {
|
|
173
185
|
logger_1.logger.debug("[Empirical Reporter] Patching HTML with attachment URLs");
|
|
174
186
|
await (0, util_1.updateHtmlZipFileAttachmentPaths)(jsonFilePath, htmlFilePath, this._testResultSourceDir);
|
|
175
|
-
await this._uploader.uploadFile(htmlFilePath, "index.html");
|
|
187
|
+
const htmlReportUrl = await this._uploader.uploadFile(htmlFilePath, "index.html");
|
|
188
|
+
this._piSandboxLog(`[Empirical Reporter] HTML report URL: ${htmlReportUrl}`);
|
|
176
189
|
}
|
|
177
190
|
else if (!htmlExists) {
|
|
178
191
|
logger_1.logger.error(`[Empirical Reporter] index.html not found at: ${htmlFilePath}`);
|
|
@@ -180,7 +193,8 @@ class EmpiricalReporter {
|
|
|
180
193
|
if (jsonExists) {
|
|
181
194
|
logger_1.logger.debug("[Empirical Reporter] Patching summary.json with attachment URLs");
|
|
182
195
|
await (0, util_1.updateSummaryJsonAttachmentPaths)(jsonFilePath, this._testResultSourceDir, `${this._uploader.urlPrefix}/data`);
|
|
183
|
-
await this._uploader.uploadFile(jsonFilePath, "summary.json");
|
|
196
|
+
const summaryJsonUrl = await this._uploader.uploadFile(jsonFilePath, "summary.json");
|
|
197
|
+
this._piSandboxLog(`[Empirical Reporter] summary.json URL: ${summaryJsonUrl}`);
|
|
184
198
|
}
|
|
185
199
|
else {
|
|
186
200
|
logger_1.logger.error(`[Empirical Reporter] summary.json not found at: ${jsonFilePath}`);
|
|
@@ -237,8 +251,9 @@ class EmpiricalReporter {
|
|
|
237
251
|
}
|
|
238
252
|
}
|
|
239
253
|
async _uploadBlobReport(blobDir) {
|
|
240
|
-
if (!this._uploader)
|
|
254
|
+
if (!this._uploader) {
|
|
241
255
|
return;
|
|
256
|
+
}
|
|
242
257
|
const uploadStartTime = Date.now();
|
|
243
258
|
try {
|
|
244
259
|
const files = await fs_1.default.promises.readdir(blobDir);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ibr-utils.d.ts","sourceRoot":"","sources":["../../src/reporter/ibr-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAO3E,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACvC,CAAC;AAIF,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAChD,WAAW,EAAE,CAOf;AAED,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAO3E;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,EAC1B,IAAI,EAAE,QAAQ,GACb,MAAM,CAOR;AAID,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CA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AAC,GAC5B,SAAS,GAAG,IAAI,CAqBlB;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAK7D;AAED,wBAAgB,aAAa,CAC3B,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMxB;AAED,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAI3D;AAED,wBAAgB,eAAe,CAC7B,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,GAAG,IAAI,CAoBf"}
|
|
@@ -107,8 +107,9 @@ function filterSuiteByCompletedTests(suite, completedTestIds) {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
if (filteredEntries.length === 0)
|
|
110
|
+
if (filteredEntries.length === 0) {
|
|
111
111
|
return null;
|
|
112
|
+
}
|
|
112
113
|
return { ...suite, entries: filteredEntries };
|
|
113
114
|
}
|
|
114
115
|
function hasValidReport(reportLines) {
|
|
@@ -133,8 +134,9 @@ function toResourcePath(absolutePath) {
|
|
|
133
134
|
return `resources/${hash}${ext}`;
|
|
134
135
|
}
|
|
135
136
|
function embedAttachment(attachmentPath, resultId, stagingDir) {
|
|
136
|
-
if (!attachmentPath || !fs_1.default.existsSync(attachmentPath))
|
|
137
|
+
if (!attachmentPath || !fs_1.default.existsSync(attachmentPath)) {
|
|
137
138
|
return null;
|
|
139
|
+
}
|
|
138
140
|
if (!isLocalTesting()) {
|
|
139
141
|
return null;
|
|
140
142
|
}
|
|
@@ -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,UAAU,EACV,QAAQ,EACT,MAAM,2BAA2B,CAAC;AAwBnC;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEnD,cAAM,uBAAwB,YAAW,QAAQ;IAC/C,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,WAAW,CAIjB;IACF,OAAO,CAAC,UAAU,CAGhB;IACF,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,iBAAiB,CAA+B;IACxD,OAAO,CAAC,YAAY,CAAkC;IACtD,OAAO,CAAC,UAAU,CAAoC;IACtD,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,iBAAiB,CAA0B;IACnD,OAAO,CAAC,mBAAmB,CAA0B;IACrD,OAAO,CAAC,YAAY,CAAkC;IACtD,OAAO,CAAC,YAAY,CAGN;IACd,OAAO,CAAC,UAAU,CAAsB;IACxC,OAAO,CAAC,gBAAgB,CAA8B;;IAetD,OAAO,CAAC,cAAc,CAA6B;IAEnD,OAAO,CAAC,mBAAmB;IA+B3B,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,qBAAqB;YASf,uBAAuB;IAqErC,OAAO,CAAC,eAAe;IAoBvB,OAAO,CAAC,qBAAqB;IAY7B,OAAO,CAAC,8BAA8B;
|
|
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,UAAU,EACV,QAAQ,EACT,MAAM,2BAA2B,CAAC;AAwBnC;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM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,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI;IAYrE,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI;IAY7D,KAAK,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB9C;;OAEG;IACH,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAI5D,aAAa,IAAI,OAAO;CAGzB;AAID,wBAAgB,0BAA0B,IAAI,uBAAuB,GAAG,IAAI,CAE3E;AAED,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,uBAAuB,GAChC,IAAI,CAEN;AAED,eAAe,uBAAuB,CAAC"}
|
|
@@ -148,8 +148,9 @@ class IncrementalBlobReporter {
|
|
|
148
148
|
this._reportLines = this._reportLines.filter((line) => {
|
|
149
149
|
const parsed = JSON.parse(line);
|
|
150
150
|
const resultId = parsed.params?.resultId ?? parsed.params?.result?.id;
|
|
151
|
-
if (!resultId)
|
|
151
|
+
if (!resultId) {
|
|
152
152
|
return true;
|
|
153
|
+
}
|
|
153
154
|
return this._completedResultIds.has(resultId);
|
|
154
155
|
});
|
|
155
156
|
}
|
|
@@ -157,8 +158,9 @@ class IncrementalBlobReporter {
|
|
|
157
158
|
for (let i = 0; i < this._reportLines.length; i++) {
|
|
158
159
|
const line = this._reportLines[i];
|
|
159
160
|
const parsed = JSON.parse(line);
|
|
160
|
-
if (parsed.method !== "onProject")
|
|
161
|
+
if (parsed.method !== "onProject") {
|
|
161
162
|
continue;
|
|
163
|
+
}
|
|
162
164
|
const project = parsed.params.project;
|
|
163
165
|
const filteredSuites = project.suites
|
|
164
166
|
.map((suite) => (0, ibr_utils_1.filterSuiteByCompletedTests)(suite, this._completedTestIds))
|
|
@@ -181,8 +183,9 @@ class IncrementalBlobReporter {
|
|
|
181
183
|
fs_1.default.mkdirSync(this._outputDir, { recursive: true });
|
|
182
184
|
}
|
|
183
185
|
_appendEvent(event) {
|
|
184
|
-
if ((0, reporter_state_1.isFinalized)())
|
|
186
|
+
if ((0, reporter_state_1.isFinalized)()) {
|
|
185
187
|
return false;
|
|
188
|
+
}
|
|
186
189
|
this._reportLines.push(JSON.stringify(event));
|
|
187
190
|
return true;
|
|
188
191
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-events.d.ts","sourceRoot":"","sources":["../../src/reporter/lifecycle-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,KAAK,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,EACT,MAAM,2BAA2B,CAAC;AAgBnC,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,KAAK,EACZ,iBAAiB,EAAE,MAAM,EACzB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"lifecycle-events.d.ts","sourceRoot":"","sources":["../../src/reporter/lifecycle-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,KAAK,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,EACT,MAAM,2BAA2B,CAAC;AAgBnC,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,KAAK,EACZ,iBAAiB,EAAE,MAAM,EACzB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,SAAS,EAAE,CAqDb;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,WAAW,EACpB,YAAY,EAAE,KAAK,EACnB,iBAAiB,EAAE,MAAM,GACxB,SAAS,CA+BX;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,UAAU,EAClB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,SAAS,CAeX;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,UAAU,EAClB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,UAAU,EAAE,MAAM,GACjB,SAAS,EAAE,CAqDb;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,SAAS,EAAE,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,GAC/B,SAAS,CAsBX;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,SAAS,EAAE,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,GAC/B,SAAS,CAuBX;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAW7D"}
|
|
@@ -52,8 +52,9 @@ function buildOnBeginEvents(config, suite, currentWorkingDir, shardIndex, totalS
|
|
|
52
52
|
// 3. onProject for each project
|
|
53
53
|
for (const projectSuite of suite.suites) {
|
|
54
54
|
const project = config.projects.find((p) => p.name === projectSuite.title);
|
|
55
|
-
if (!project)
|
|
55
|
+
if (!project) {
|
|
56
56
|
continue;
|
|
57
|
+
}
|
|
57
58
|
events.push(buildOnProjectEvent(config, project, projectSuite, currentWorkingDir));
|
|
58
59
|
}
|
|
59
60
|
// 4. onBegin (empty params per Playwright format)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploader.d.ts","sourceRoot":"","sources":["../../src/reporter/uploader.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAGnB,MAAM,2BAA2B,CAAC;AAKnC,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,kBAAkB,CAAC;CACjC;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,YAAY,CAAqB;gBAE7B,MAAM,EAAE,cAAc;IAWlC,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAgBhC,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAUhC,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI;IAO1E,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAEK,UAAU,CACd,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IA6BnB,eAAe,CACnB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC;IAiBV,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAGtC;AAID,wBAAgB,WAAW,IAAI,QAAQ,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"uploader.d.ts","sourceRoot":"","sources":["../../src/reporter/uploader.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAGnB,MAAM,2BAA2B,CAAC;AAKnC,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,kBAAkB,CAAC;CACjC;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,YAAY,CAAqB;gBAE7B,MAAM,EAAE,cAAc;IAWlC,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAgBhC,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAUhC,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI;IAO1E,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAEK,UAAU,CACd,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IA6BnB,eAAe,CACnB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC;IAiBV,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAGtC;AAID,wBAAgB,WAAW,IAAI,QAAQ,GAAG,IAAI,CAM7C"}
|
|
@@ -102,8 +102,9 @@ class Uploader {
|
|
|
102
102
|
exports.Uploader = Uploader;
|
|
103
103
|
let _uploaderInstance = null;
|
|
104
104
|
function getUploader() {
|
|
105
|
-
if (_uploaderInstance)
|
|
105
|
+
if (_uploaderInstance) {
|
|
106
106
|
return _uploaderInstance;
|
|
107
|
+
}
|
|
107
108
|
_uploaderInstance = createUploader();
|
|
108
109
|
return _uploaderInstance;
|
|
109
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/reporter/util.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAQhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EACL,UAAU,IAAI,oBAAoB,EAElC,QAAQ,EACT,MAAM,2BAA2B,CAAC;AA0BnC,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/reporter/util.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAQhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EACL,UAAU,IAAI,oBAAoB,EAElC,QAAQ,EACT,MAAM,2BAA2B,CAAC;AA0BnC,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAqB7D;AAED,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAAG,SAAS,UAQhC;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,CA6CD;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,QAAQ;;;EAwBrD;AAED,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAiDf;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,iBAoFjB;AAED;;;;;;;;;;GAUG;AACH;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,mBAAmB,EAAE,MAAM,EAC3B,QAAQ,EAAE,MAAM,EAChB,cAAc,GAAE,OAAe,GAC9B,iBAAiB,CAgBnB;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,6CA+BlB"}
|
package/dist/reporter/util.js
CHANGED
|
@@ -38,8 +38,9 @@ function sanitizeForFilePath(s) {
|
|
|
38
38
|
const folderToPackageJsonPath = new Map();
|
|
39
39
|
function getPackageJsonPath(folderPath) {
|
|
40
40
|
const cached = folderToPackageJsonPath.get(folderPath);
|
|
41
|
-
if (cached !== undefined)
|
|
41
|
+
if (cached !== undefined) {
|
|
42
42
|
return cached;
|
|
43
|
+
}
|
|
43
44
|
const packageJsonPath = path_1.default.join(folderPath, "package.json");
|
|
44
45
|
if (fs_1.default.existsSync(packageJsonPath)) {
|
|
45
46
|
folderToPackageJsonPath.set(folderPath, packageJsonPath);
|
|
@@ -55,23 +56,27 @@ function getPackageJsonPath(folderPath) {
|
|
|
55
56
|
return result;
|
|
56
57
|
}
|
|
57
58
|
function resolveReporterOutputPath(defaultValue, configDir, configValue) {
|
|
58
|
-
if (configValue)
|
|
59
|
+
if (configValue) {
|
|
59
60
|
return path_1.default.resolve(configDir, configValue);
|
|
61
|
+
}
|
|
60
62
|
let basePath = getPackageJsonPath(configDir);
|
|
61
63
|
basePath = basePath ? path_1.default.dirname(basePath) : process.cwd();
|
|
62
64
|
return path_1.default.resolve(basePath, defaultValue);
|
|
63
65
|
}
|
|
64
66
|
async function normalizeAndSaveAttachment(outputPath, name, options = {}) {
|
|
65
|
-
if (options.path === undefined && options.body === undefined)
|
|
67
|
+
if (options.path === undefined && options.body === undefined) {
|
|
66
68
|
return { name, contentType: "text/plain" };
|
|
69
|
+
}
|
|
67
70
|
if ((options.path !== undefined ? 1 : 0) +
|
|
68
71
|
(options.body !== undefined ? 1 : 0) !==
|
|
69
|
-
1)
|
|
72
|
+
1) {
|
|
70
73
|
throw new Error(`Exactly one of "path" and "body" must be specified`);
|
|
74
|
+
}
|
|
71
75
|
if (options.path !== undefined) {
|
|
72
76
|
const hash = calculateSha1(options.path);
|
|
73
|
-
if (!isString(name))
|
|
77
|
+
if (!isString(name)) {
|
|
74
78
|
throw new Error('"name" should be string.');
|
|
79
|
+
}
|
|
75
80
|
const sanitizedNamePrefix = sanitizeForFilePath(name) + "-";
|
|
76
81
|
const dest = path_1.default.join(outputPath, "attachments", sanitizedNamePrefix + hash + path_1.default.extname(options.path));
|
|
77
82
|
await fs_1.default.promises.mkdir(path_1.default.dirname(dest), { recursive: true });
|
|
@@ -120,7 +125,7 @@ function suitesAndProjectForTest(test) {
|
|
|
120
125
|
};
|
|
121
126
|
}
|
|
122
127
|
async function sendTestCaseUpdateToDashboard(params) {
|
|
123
|
-
const DOMAIN = process.env.DASHBOARD_DOMAIN || "https://
|
|
128
|
+
const DOMAIN = process.env.DASHBOARD_DOMAIN || "https://api.empirical.run";
|
|
124
129
|
try {
|
|
125
130
|
const requestBody = {
|
|
126
131
|
name: "test_case_run_end",
|
|
@@ -247,8 +252,9 @@ function buildTestAttachmentMapFromSummary(summaryJsonFilePath, repoPath, doNotN
|
|
|
247
252
|
transformAttachment: doNotNormalize
|
|
248
253
|
? undefined
|
|
249
254
|
: (attachment) => {
|
|
250
|
-
if (!attachment?.path)
|
|
255
|
+
if (!attachment?.path) {
|
|
251
256
|
return attachment;
|
|
257
|
+
}
|
|
252
258
|
const relativePath = path_1.default.relative(repoPath, attachment.path);
|
|
253
259
|
return { ...attachment, path: path_1.default.join("data", relativePath) };
|
|
254
260
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual.d.ts","sourceRoot":"","sources":["../../../src/test/expect/visual.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAY,MAAM,kBAAkB,CAAC;AAShE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"visual.d.ts","sourceRoot":"","sources":["../../../src/test/expect/visual.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAY,MAAM,kBAAkB,CAAC;AAShE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AA0E7C,wBAAsB,WAAW,CAC/B,MAAM,EAAE,IAAI,GAAG,OAAO,EACtB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,aAAa,CAAC,CAyFxB"}
|
|
@@ -13,13 +13,15 @@ const path_1 = __importDefault(require("path"));
|
|
|
13
13
|
const mouse_pointer_1 = require("../scripts/mouse-pointer");
|
|
14
14
|
function getCallerLine() {
|
|
15
15
|
const stack = new Error().stack;
|
|
16
|
-
if (!stack)
|
|
16
|
+
if (!stack) {
|
|
17
17
|
return "unknown";
|
|
18
|
+
}
|
|
18
19
|
const frames = stack.split("\n").slice(1);
|
|
19
20
|
// Find the test file frame (e.g. .spec.ts, .test.ts)
|
|
20
21
|
const testFrame = frames.find((f) => /\.(spec|test)\.[jt]sx?:/.test(f));
|
|
21
|
-
if (!testFrame)
|
|
22
|
+
if (!testFrame) {
|
|
22
23
|
return "unknown";
|
|
24
|
+
}
|
|
23
25
|
const match = testFrame.match(/:(\d+):\d+\)?$/);
|
|
24
26
|
return match?.[1] ?? "unknown";
|
|
25
27
|
}
|
|
@@ -140,7 +142,7 @@ go through the reasons and pick the one that made you choose Fail`,
|
|
|
140
142
|
],
|
|
141
143
|
});
|
|
142
144
|
const response = completion.choices[0]?.message;
|
|
143
|
-
(0, llm_1.trackLLMResponseGenerated)({
|
|
145
|
+
await (0, llm_1.trackLLMResponseGenerated)({
|
|
144
146
|
modelName: model,
|
|
145
147
|
tokensInput: completion.usage?.prompt_tokens ?? 0,
|
|
146
148
|
tokensOutput: completion.usage?.completion_tokens ?? 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../src/test/expect/webhook.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../src/test/expect/webhook.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,aAAa,CAAC,CAqCxB"}
|
|
@@ -25,8 +25,9 @@ async function toHaveReceivedWebhook(webhookUrl, options) {
|
|
|
25
25
|
logger_1.logger.error("Webhook provider error during polling", e);
|
|
26
26
|
}
|
|
27
27
|
const remaining = deadline - Date.now();
|
|
28
|
-
if (remaining <= 0)
|
|
28
|
+
if (remaining <= 0) {
|
|
29
29
|
break;
|
|
30
|
+
}
|
|
30
31
|
await new Promise((r) => setTimeout(r, Math.min(POLL_INTERVAL, remaining)));
|
|
31
32
|
}
|
|
32
33
|
return {
|
package/dist/test/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { BrowserContext, BrowserContextOptions, expect, Page, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, TestType } from "@playwright/test";
|
|
2
2
|
import { KVClient } from "../kv";
|
|
3
|
-
import { PostgresClient } from "../postgres";
|
|
4
3
|
import { type WebhookMatcherOptions } from "./expect";
|
|
5
4
|
import { injectLocatorHighlightScripts } from "./scripts";
|
|
6
5
|
import { type BaseTestFixtureOpts } from "./types";
|
|
@@ -17,7 +16,6 @@ declare const extendExpect: (expectInstance: typeof expect) => import("@playwrig
|
|
|
17
16
|
type TestOptions = {
|
|
18
17
|
page: Page;
|
|
19
18
|
kv: KVClient;
|
|
20
|
-
postgres: PostgresClient;
|
|
21
19
|
customContextPageProvider: (options?: BrowserContextOptions) => Promise<{
|
|
22
20
|
context: BrowserContext;
|
|
23
21
|
page: Page;
|
package/dist/test/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,qB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;IACtD,UAAU,EAAE,IAAI,CAAC;CAClB,CAAC;AAYF,QAAA,MAAM,eAAe,GACnB,QAAQ,QAAQ,CACd,kBAAkB,GAAG,qBAAqB,EAC1C,oBAAoB,GAAG,uBAAuB,CAC/C,EACD,UAAS,mBAAoC,uHAqH9C,CAAC;AAEF,OAAO,EACL,eAAe,EACf,YAAY,EACZ,6BAA6B,EAC7B,aAAa,GACd,CAAC"}
|
package/dist/test/index.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.setVideoLabel = exports.injectLocatorHighlightScripts = exports.extendExpect = exports.baseTestFixture = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const kv_1 = require("../kv");
|
|
9
|
-
const postgres_1 = require("../postgres");
|
|
10
9
|
const coverage_1 = require("./coverage");
|
|
11
10
|
const expect_1 = require("./expect");
|
|
12
11
|
const scripts_1 = require("./scripts");
|
|
@@ -63,10 +62,6 @@ const baseTestFixture = function (testFn, options = defaultOptions) {
|
|
|
63
62
|
const client = new kv_1.KVClient();
|
|
64
63
|
await use(client);
|
|
65
64
|
},
|
|
66
|
-
postgres: async ({}, use) => {
|
|
67
|
-
const client = new postgres_1.PostgresClient();
|
|
68
|
-
await use(client);
|
|
69
|
-
},
|
|
70
65
|
customContextPageProvider: async ({ browser }, use, testInfo) => {
|
|
71
66
|
const contexts = [];
|
|
72
67
|
async function createContext(contextOptions = {}) {
|
|
@@ -104,11 +99,13 @@ const baseTestFixture = function (testFn, options = defaultOptions) {
|
|
|
104
99
|
// Save videos with custom labels using saveAs
|
|
105
100
|
for (let i = 0; i < pages.length; i++) {
|
|
106
101
|
const page = pages[i];
|
|
107
|
-
if (!page)
|
|
102
|
+
if (!page) {
|
|
108
103
|
continue;
|
|
104
|
+
}
|
|
109
105
|
const video = page.video();
|
|
110
|
-
if (!video)
|
|
106
|
+
if (!video) {
|
|
111
107
|
continue;
|
|
108
|
+
}
|
|
112
109
|
try {
|
|
113
110
|
const srcPath = await video.path();
|
|
114
111
|
const ext = path_1.default.extname(srcPath) || ".webm";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/dismiss-overlays/utils.ts"],"names":[],"mappings":"AACA,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,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,cAAc,GAAG,SAAS,uBAKzE;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,cAAc,GAAG,SAAS,+
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/test/scripts/pw-locator-patch/dismiss-overlays/utils.ts"],"names":[],"mappings":"AACA,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,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,cAAc,GAAG,SAAS,uBAKzE;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,cAAc,GAAG,SAAS,+BAmDpC;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAMpE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uDAiBrD"}
|
|
@@ -54,8 +54,9 @@ async function textContent(pageRef, element) {
|
|
|
54
54
|
}
|
|
55
55
|
// Add other attributes, being careful with escaping
|
|
56
56
|
Array.from(tempEl.attributes).forEach((attr) => {
|
|
57
|
-
if (attr.name === "id" || attr.name === "class")
|
|
57
|
+
if (attr.name === "id" || attr.name === "class") {
|
|
58
58
|
return;
|
|
59
|
+
}
|
|
59
60
|
selector += `[${attr.name}="${attr.value.replace(/"/g, '\\"')}"]`;
|
|
60
61
|
});
|
|
61
62
|
console.log("Generated selector:", selector);
|
package/dist/webhook.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../src/webhook.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,eAAe,GAAG,OAAO,GAAG,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../src/webhook.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,eAAe,GAAG,OAAO,GAAG,cAAc,CAAC;AA6QhD,wBAAsB,aAAa,CACjC,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,eAAe,CAAA;CAAO,GACnE,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GACzB,OAAO,CAAC,cAAc,EAAE,CAAC,CAO3B"}
|
package/dist/webhook.js
CHANGED
|
@@ -120,8 +120,9 @@ function inboxRowToWebhookRequest(row) {
|
|
|
120
120
|
let query = null;
|
|
121
121
|
try {
|
|
122
122
|
const parsed = JSON.parse(row.query_params || "{}");
|
|
123
|
-
if (Object.keys(parsed).length > 0)
|
|
123
|
+
if (Object.keys(parsed).length > 0) {
|
|
124
124
|
query = parsed;
|
|
125
|
+
}
|
|
125
126
|
}
|
|
126
127
|
catch { }
|
|
127
128
|
return {
|
|
@@ -194,8 +195,9 @@ function extractToken(webhookUrl) {
|
|
|
194
195
|
return token;
|
|
195
196
|
}
|
|
196
197
|
function detectProvider(webhookUrl) {
|
|
197
|
-
if (webhookUrl.includes("webhook.site"))
|
|
198
|
+
if (webhookUrl.includes("webhook.site")) {
|
|
198
199
|
return "webhook-site";
|
|
200
|
+
}
|
|
199
201
|
return "inbox";
|
|
200
202
|
}
|
|
201
203
|
async function getWebhookUrl(options = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/playwright-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -37,11 +37,10 @@
|
|
|
37
37
|
"@types/console-log-level": "^1.4.5",
|
|
38
38
|
"@types/mime": "3.0.0",
|
|
39
39
|
"@types/node": "^20.14.9",
|
|
40
|
-
"@types/pg": "^8.11.6",
|
|
41
40
|
"@types/serve-handler": "^6.1.4",
|
|
42
41
|
"playwright-core": "1.60.0",
|
|
43
42
|
"serve-handler": "^6.1.6",
|
|
44
|
-
"@empiricalrun/shared-types": "0.
|
|
43
|
+
"@empiricalrun/shared-types": "0.15.1"
|
|
45
44
|
},
|
|
46
45
|
"dependencies": {
|
|
47
46
|
"@babel/code-frame": "^7.24.7",
|
|
@@ -50,14 +49,13 @@
|
|
|
50
49
|
"console-log-level": "^1.4.1",
|
|
51
50
|
"mime": "3.0.0",
|
|
52
51
|
"openai": "^6.27.0",
|
|
53
|
-
"pg": "^8.13.1",
|
|
54
52
|
"puppeteer-extra-plugin-recaptcha": "^3.6.8",
|
|
55
53
|
"rimraf": "^6.0.1",
|
|
56
54
|
"ts-morph": "^23.0.0",
|
|
57
55
|
"@empiricalrun/cua": "^0.4.1",
|
|
58
56
|
"@empiricalrun/dashboard-client": "^0.3.0",
|
|
59
|
-
"@empiricalrun/r2-uploader": "^0.9.1",
|
|
60
57
|
"@empiricalrun/llm": "^0.27.0",
|
|
58
|
+
"@empiricalrun/r2-uploader": "^0.9.1",
|
|
61
59
|
"@empiricalrun/reporter": "^0.29.1"
|
|
62
60
|
},
|
|
63
61
|
"scripts": {
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/email.ts","./src/inbox-client.ts","./src/index.ts","./src/kv.ts","./src/logger.ts","./src/mailosaur-client.ts","./src/playwright-extensions.ts","./src/
|
|
1
|
+
{"root":["./src/email.ts","./src/inbox-client.ts","./src/index.ts","./src/kv.ts","./src/logger.ts","./src/mailosaur-client.ts","./src/playwright-extensions.ts","./src/telemetry.ts","./src/types.ts","./src/webhook.ts","./src/auth/google.ts","./src/auth/index.ts","./src/auth/types.ts","./src/captcha/index.ts","./src/config/index.ts","./src/config/proxy.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/overlay-tests/visual.spec.ts","./src/reporter/attachment-cleanup-test-reporter.ts","./src/reporter/attachment-cleanup.ts","./src/reporter/blob-utils.ts","./src/reporter/empirical-reporter.ts","./src/reporter/failing-line.ts","./src/reporter/harness.ts","./src/reporter/ibr-utils.ts","./src/reporter/incremental-blob-reporter.ts","./src/reporter/lifecycle-events.ts","./src/reporter/local-test.ts","./src/reporter/reporter-state.ts","./src/reporter/test-case-sync-reporter.ts","./src/reporter/test-case-sync.ts","./src/reporter/uploader.ts","./src/reporter/util.ts","./src/test/constants.ts","./src/test/coverage.ts","./src/test/index.ts","./src/test/types.ts","./src/test/video-labels.ts","./src/test/expect/index.ts","./src/test/expect/types.ts","./src/test/expect/visual.ts","./src/test/expect/webhook.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/postgres.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export type PostgresDatabase = {
|
|
2
|
-
projectId: string;
|
|
3
|
-
connectionUri: string;
|
|
4
|
-
};
|
|
5
|
-
type GetOptions = {
|
|
6
|
-
pgVersion?: number;
|
|
7
|
-
};
|
|
8
|
-
export declare class PostgresClient {
|
|
9
|
-
private client;
|
|
10
|
-
constructor();
|
|
11
|
-
get(name: string, options?: GetOptions): Promise<PostgresDatabase>;
|
|
12
|
-
private getConnectionUri;
|
|
13
|
-
delete(name: string): Promise<void>;
|
|
14
|
-
query<T = Record<string, unknown>>(connectionUri: string, sql: string): Promise<T[]>;
|
|
15
|
-
execute(connectionUri: string, sql: string): Promise<{
|
|
16
|
-
statement: string;
|
|
17
|
-
rowCount: number;
|
|
18
|
-
}[]>;
|
|
19
|
-
private parseStatements;
|
|
20
|
-
}
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=postgres.d.ts.map
|
package/dist/postgres.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../src/postgres.ts"],"names":[],"mappings":"AAgDA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAqB;;IAW7B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC;YAqD1D,gBAAgB;IAwBxB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoCnC,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,CAAC,EAAE,CAAC;IAWT,OAAO,CACX,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAsBrD,OAAO,CAAC,eAAe;CAsBxB"}
|
package/dist/postgres.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PostgresClient = void 0;
|
|
4
|
-
const dashboard_client_1 = require("@empiricalrun/dashboard-client");
|
|
5
|
-
const pg_1 = require("pg");
|
|
6
|
-
class PostgresClient {
|
|
7
|
-
client;
|
|
8
|
-
constructor() {
|
|
9
|
-
if (!process.env.EMPIRICALRUN_API_KEY) {
|
|
10
|
-
throw new Error("EMPIRICALRUN_API_KEY environment variable is required");
|
|
11
|
-
}
|
|
12
|
-
this.client = new dashboard_client_1.DashboardAPIClient({
|
|
13
|
-
authType: "project-api-key",
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
async get(name, options) {
|
|
17
|
-
const listResponse = await this.client.request("/api/neon/proxy", {
|
|
18
|
-
method: "POST",
|
|
19
|
-
body: {
|
|
20
|
-
action: "list",
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
if (listResponse.error) {
|
|
24
|
-
throw new Error(`Postgres list failed: ${listResponse.error}`);
|
|
25
|
-
}
|
|
26
|
-
const existingProject = listResponse.data.projects.find((p) => p.name === name);
|
|
27
|
-
if (existingProject) {
|
|
28
|
-
const connectionUri = await this.getConnectionUri(existingProject.id);
|
|
29
|
-
return { projectId: existingProject.id, connectionUri };
|
|
30
|
-
}
|
|
31
|
-
const createResponse = await this.client.request("/api/neon/proxy", {
|
|
32
|
-
method: "POST",
|
|
33
|
-
body: {
|
|
34
|
-
action: "create",
|
|
35
|
-
payload: {
|
|
36
|
-
name,
|
|
37
|
-
pg_version: options?.pgVersion,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
if (createResponse.error) {
|
|
42
|
-
throw new Error(`Postgres create failed: ${createResponse.error}`);
|
|
43
|
-
}
|
|
44
|
-
const projectId = createResponse.data.project.id;
|
|
45
|
-
const connectionUri = createResponse.data.connection_uris?.[0]?.connection_uri;
|
|
46
|
-
if (!connectionUri) {
|
|
47
|
-
throw new Error("No connection URI returned from Neon API");
|
|
48
|
-
}
|
|
49
|
-
return { projectId, connectionUri };
|
|
50
|
-
}
|
|
51
|
-
async getConnectionUri(projectId) {
|
|
52
|
-
const response = await this.client.request("/api/neon/proxy", {
|
|
53
|
-
method: "POST",
|
|
54
|
-
body: {
|
|
55
|
-
action: "getConnectionUri",
|
|
56
|
-
projectId,
|
|
57
|
-
payload: {
|
|
58
|
-
databaseName: "neondb",
|
|
59
|
-
roleName: "neondb_owner",
|
|
60
|
-
pooled: false,
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
if (response.error) {
|
|
65
|
-
throw new Error(`Postgres getConnectionUri failed: ${response.error}`);
|
|
66
|
-
}
|
|
67
|
-
return response.data.uri;
|
|
68
|
-
}
|
|
69
|
-
async delete(name) {
|
|
70
|
-
const listResponse = await this.client.request("/api/neon/proxy", {
|
|
71
|
-
method: "POST",
|
|
72
|
-
body: {
|
|
73
|
-
action: "list",
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
if (listResponse.error) {
|
|
77
|
-
throw new Error(`Postgres list failed: ${listResponse.error}`);
|
|
78
|
-
}
|
|
79
|
-
const project = listResponse.data.projects.find((p) => p.name === name);
|
|
80
|
-
if (!project) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const deleteResponse = await this.client.request("/api/neon/proxy", {
|
|
84
|
-
method: "POST",
|
|
85
|
-
body: {
|
|
86
|
-
action: "delete",
|
|
87
|
-
projectId: project.id,
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
if (deleteResponse.error) {
|
|
91
|
-
throw new Error(`Postgres delete failed: ${deleteResponse.error}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
async query(connectionUri, sql) {
|
|
95
|
-
const client = new pg_1.Client({ connectionString: connectionUri });
|
|
96
|
-
try {
|
|
97
|
-
await client.connect();
|
|
98
|
-
const result = await client.query(sql);
|
|
99
|
-
return result.rows;
|
|
100
|
-
}
|
|
101
|
-
finally {
|
|
102
|
-
await client.end();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
async execute(connectionUri, sql) {
|
|
106
|
-
const client = new pg_1.Client({ connectionString: connectionUri });
|
|
107
|
-
const results = [];
|
|
108
|
-
try {
|
|
109
|
-
await client.connect();
|
|
110
|
-
const statements = this.parseStatements(sql);
|
|
111
|
-
for (const statement of statements) {
|
|
112
|
-
const result = await client.query(statement);
|
|
113
|
-
results.push({
|
|
114
|
-
statement: statement.substring(0, 80),
|
|
115
|
-
rowCount: result.rowCount ?? 0,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
return results;
|
|
119
|
-
}
|
|
120
|
-
finally {
|
|
121
|
-
await client.end();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
parseStatements(sql) {
|
|
125
|
-
const lines = sql.split("\n");
|
|
126
|
-
const cleanedLines = [];
|
|
127
|
-
for (const line of lines) {
|
|
128
|
-
const trimmed = line.trim();
|
|
129
|
-
if (trimmed && !trimmed.startsWith("--")) {
|
|
130
|
-
const commentIndex = line.indexOf("--");
|
|
131
|
-
if (commentIndex > 0) {
|
|
132
|
-
cleanedLines.push(line.substring(0, commentIndex));
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
cleanedLines.push(line);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return cleanedLines
|
|
140
|
-
.join("\n")
|
|
141
|
-
.split(";")
|
|
142
|
-
.map((q) => q.trim())
|
|
143
|
-
.filter((q) => q.length > 0);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
exports.PostgresClient = PostgresClient;
|
package/docs/postgres.md
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# Postgres
|
|
2
|
-
|
|
3
|
-
A PostgreSQL client for creating and managing temporary Neon databases in tests.
|
|
4
|
-
|
|
5
|
-
## Fixture usage
|
|
6
|
-
|
|
7
|
-
```ts
|
|
8
|
-
test("example", async ({ page, postgres }) => {
|
|
9
|
-
// Get or create a database (cached via KV for 1 hour by default)
|
|
10
|
-
const { connectionUri } = await postgres.get("my-test-db");
|
|
11
|
-
|
|
12
|
-
// Run queries
|
|
13
|
-
const users = await postgres.query<{ id: number; name: string }>(
|
|
14
|
-
connectionUri,
|
|
15
|
-
"SELECT * FROM users",
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
// Execute multiple SQL statements
|
|
19
|
-
await postgres.execute(
|
|
20
|
-
connectionUri,
|
|
21
|
-
`
|
|
22
|
-
CREATE TABLE users (id SERIAL PRIMARY KEY, name TEXT);
|
|
23
|
-
INSERT INTO users (name) VALUES ('Alice');
|
|
24
|
-
`,
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
// Delete when done (optional - TTL will auto-expire)
|
|
28
|
-
await postgres.delete("my-test-db");
|
|
29
|
-
});
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Standalone usage
|
|
33
|
-
|
|
34
|
-
```ts
|
|
35
|
-
import { PostgresClient } from "@empiricalrun/playwright-utils";
|
|
36
|
-
|
|
37
|
-
const postgres = new PostgresClient();
|
|
38
|
-
|
|
39
|
-
// Get or create a database
|
|
40
|
-
const { projectId, connectionUri } = await postgres.get("my-db", {
|
|
41
|
-
pgVersion: 15,
|
|
42
|
-
ttl: 7200, // 2 hours
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// Run a query
|
|
46
|
-
const rows = await postgres.query(connectionUri, "SELECT NOW()");
|
|
47
|
-
|
|
48
|
-
// Delete when done
|
|
49
|
-
await postgres.delete("my-db");
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## API
|
|
53
|
-
|
|
54
|
-
### `postgres.get(name, options?)`
|
|
55
|
-
|
|
56
|
-
Gets an existing database or creates a new one. Uses KV store to cache the connection.
|
|
57
|
-
|
|
58
|
-
- `name` - Unique identifier for the database
|
|
59
|
-
- `options.pgVersion` - PostgreSQL version (default: 15)
|
|
60
|
-
- `options.ttl` - Cache TTL in seconds (default: 3600)
|
|
61
|
-
|
|
62
|
-
Returns `{ projectId, connectionUri }`.
|
|
63
|
-
|
|
64
|
-
### `postgres.delete(name)`
|
|
65
|
-
|
|
66
|
-
Deletes the database and removes it from cache.
|
|
67
|
-
|
|
68
|
-
### `postgres.query(connectionUri, sql)`
|
|
69
|
-
|
|
70
|
-
Runs a SQL query and returns rows.
|
|
71
|
-
|
|
72
|
-
### `postgres.execute(connectionUri, sql)`
|
|
73
|
-
|
|
74
|
-
Executes multiple SQL statements separated by `;`.
|
|
75
|
-
|
|
76
|
-
## Requirements
|
|
77
|
-
|
|
78
|
-
- `EMPIRICALRUN_API_KEY` environment variable must be set
|