@empiricalrun/playwright-utils 0.52.0 → 0.53.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 +12 -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.map +1 -1
- package/dist/reporter/empirical-reporter.js +12 -6
- package/dist/reporter/harness.d.ts +9 -0
- package/dist/reporter/harness.d.ts.map +1 -1
- package/dist/reporter/harness.js +58 -5
- 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/test-case-sync-reporter.d.ts +12 -0
- package/dist/reporter/test-case-sync-reporter.d.ts.map +1 -0
- package/dist/reporter/test-case-sync-reporter.js +28 -0
- package/dist/reporter/test-case-sync.d.ts +28 -0
- package/dist/reporter/test-case-sync.d.ts.map +1 -0
- package/dist/reporter/test-case-sync.js +134 -0
- 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 +12 -6
- 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 +10 -4
- 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
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FullConfig, Suite } from "@playwright/test/reporter";
|
|
2
|
+
export interface TestCaseSyncTestCase {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
file_path: string;
|
|
6
|
+
suites: string[];
|
|
7
|
+
playwright_project: string;
|
|
8
|
+
tags: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface TestCaseDependencyGroupMember {
|
|
11
|
+
test_case_id: string;
|
|
12
|
+
dependency_order: number;
|
|
13
|
+
}
|
|
14
|
+
export interface TestCaseDependencyGroup {
|
|
15
|
+
id: string;
|
|
16
|
+
kind: "playwright_serial";
|
|
17
|
+
file_path: string;
|
|
18
|
+
title_path: string[];
|
|
19
|
+
playwright_project: string;
|
|
20
|
+
members: TestCaseDependencyGroupMember[];
|
|
21
|
+
}
|
|
22
|
+
export interface TestCaseSyncManifest {
|
|
23
|
+
version: 1;
|
|
24
|
+
test_cases: TestCaseSyncTestCase[];
|
|
25
|
+
dependency_groups: TestCaseDependencyGroup[];
|
|
26
|
+
}
|
|
27
|
+
export declare function collectTestCaseSyncManifest(config: FullConfig, rootSuite: Suite): TestCaseSyncManifest;
|
|
28
|
+
//# sourceMappingURL=test-case-sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-case-sync.d.ts","sourceRoot":"","sources":["../../src/reporter/test-case-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAEV,KAAK,EAEN,MAAM,2BAA2B,CAAC;AAMnC,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,6BAA6B;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,mBAAmB,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,6BAA6B,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,CAAC,CAAC;IACX,UAAU,EAAE,oBAAoB,EAAE,CAAC;IACnC,iBAAiB,EAAE,uBAAuB,EAAE,CAAC;CAC9C;AA+JD,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,KAAK,GACf,oBAAoB,CAuBtB"}
|
|
@@ -0,0 +1,134 @@
|
|
|
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.collectTestCaseSyncManifest = collectTestCaseSyncManifest;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
function getSuiteParallelMode(suite) {
|
|
10
|
+
const mode = suite._parallelMode;
|
|
11
|
+
return mode === "none" ||
|
|
12
|
+
mode === "default" ||
|
|
13
|
+
mode === "serial" ||
|
|
14
|
+
mode === "parallel"
|
|
15
|
+
? mode
|
|
16
|
+
: "none";
|
|
17
|
+
}
|
|
18
|
+
function toPosixPath(value) {
|
|
19
|
+
return value.split(path_1.default.sep).join("/");
|
|
20
|
+
}
|
|
21
|
+
function relativePath(rootDir, file) {
|
|
22
|
+
return toPosixPath(path_1.default.relative(rootDir, file));
|
|
23
|
+
}
|
|
24
|
+
function normalizeTags(tags) {
|
|
25
|
+
return tags.map((tag) => (tag.startsWith("@") ? tag.slice(1) : tag));
|
|
26
|
+
}
|
|
27
|
+
function projectNameFor(test) {
|
|
28
|
+
return test.parent.project()?.name ?? "";
|
|
29
|
+
}
|
|
30
|
+
function filePathForTest(rootDir, test) {
|
|
31
|
+
return relativePath(rootDir, test.location.file);
|
|
32
|
+
}
|
|
33
|
+
function stableGroupId(input) {
|
|
34
|
+
const hash = crypto_1.default
|
|
35
|
+
.createHash("sha1")
|
|
36
|
+
.update(JSON.stringify([
|
|
37
|
+
input.projectName,
|
|
38
|
+
input.filePath,
|
|
39
|
+
input.titlePath,
|
|
40
|
+
input.line,
|
|
41
|
+
input.column,
|
|
42
|
+
]))
|
|
43
|
+
.digest("hex");
|
|
44
|
+
return `playwright_serial:${hash}`;
|
|
45
|
+
}
|
|
46
|
+
function collectDirectTestCases(rootDir, suite, state) {
|
|
47
|
+
return suite.tests.map((test) => ({
|
|
48
|
+
id: test.id,
|
|
49
|
+
name: test.title,
|
|
50
|
+
file_path: filePathForTest(rootDir, test),
|
|
51
|
+
suites: state.suites,
|
|
52
|
+
playwright_project: projectNameFor(test),
|
|
53
|
+
tags: normalizeTags(test.tags),
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
function collectOutermostSerialGroup(rootDir, suite, state) {
|
|
57
|
+
if (state.serialAncestor || getSuiteParallelMode(suite) !== "serial") {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const tests = suite.allTests();
|
|
61
|
+
if (tests.length < 2) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const firstTest = tests[0];
|
|
65
|
+
if (!firstTest) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const filePath = filePathForTest(rootDir, firstTest);
|
|
69
|
+
const projectName = projectNameFor(firstTest);
|
|
70
|
+
const titlePath = state.suites;
|
|
71
|
+
const location = suite.location ?? firstTest.location;
|
|
72
|
+
return {
|
|
73
|
+
id: stableGroupId({
|
|
74
|
+
projectName,
|
|
75
|
+
filePath,
|
|
76
|
+
titlePath,
|
|
77
|
+
line: location.line,
|
|
78
|
+
column: location.column,
|
|
79
|
+
}),
|
|
80
|
+
kind: "playwright_serial",
|
|
81
|
+
file_path: filePath,
|
|
82
|
+
title_path: titlePath,
|
|
83
|
+
playwright_project: projectName,
|
|
84
|
+
members: tests.map((test, index) => ({
|
|
85
|
+
test_case_id: test.id,
|
|
86
|
+
dependency_order: index,
|
|
87
|
+
})),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function walkSuite(rootDir, suite, state, testCases, dependencyGroups) {
|
|
91
|
+
const isDescribe = suite.type === "describe";
|
|
92
|
+
const suites = isDescribe ? [...state.suites, suite.title] : state.suites;
|
|
93
|
+
const nextState = { ...state, suites };
|
|
94
|
+
const serialGroup = collectOutermostSerialGroup(rootDir, suite, nextState);
|
|
95
|
+
if (serialGroup) {
|
|
96
|
+
dependencyGroups.push(serialGroup);
|
|
97
|
+
nextState.serialAncestor = suite;
|
|
98
|
+
}
|
|
99
|
+
testCases.push(...collectDirectTestCases(rootDir, suite, nextState));
|
|
100
|
+
for (const child of suite.suites) {
|
|
101
|
+
const childState = { ...nextState };
|
|
102
|
+
if (child.type === "project") {
|
|
103
|
+
const project = child.project();
|
|
104
|
+
childState.projectName = project?.name ?? child.title;
|
|
105
|
+
}
|
|
106
|
+
else if (child.type === "file") {
|
|
107
|
+
const firstTest = child.allTests()[0];
|
|
108
|
+
childState.filePath = firstTest
|
|
109
|
+
? filePathForTest(rootDir, firstTest)
|
|
110
|
+
: child.location
|
|
111
|
+
? relativePath(rootDir, child.location.file)
|
|
112
|
+
: "";
|
|
113
|
+
childState.suites = [];
|
|
114
|
+
childState.serialAncestor = null;
|
|
115
|
+
}
|
|
116
|
+
walkSuite(rootDir, child, childState, testCases, dependencyGroups);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function collectTestCaseSyncManifest(config, rootSuite) {
|
|
120
|
+
const testCases = [];
|
|
121
|
+
const dependencyGroups = [];
|
|
122
|
+
const rootProject = rootSuite.project();
|
|
123
|
+
walkSuite(config.rootDir, rootSuite, {
|
|
124
|
+
projectName: rootProject?.name ?? "",
|
|
125
|
+
filePath: "",
|
|
126
|
+
suites: [],
|
|
127
|
+
serialAncestor: null,
|
|
128
|
+
}, testCases, dependencyGroups);
|
|
129
|
+
return {
|
|
130
|
+
version: 1,
|
|
131
|
+
test_cases: testCases,
|
|
132
|
+
dependency_groups: dependencyGroups,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
@@ -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 });
|
|
@@ -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,qBAAqB,EACrB,MAAM,EACN,IAAI,EACJ,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,MAAM,EACN,IAAI,EACJ,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,6BAA6B,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,KAAK,mBAAmB,EAAwB,MAAM,SAAS,CAAC;AACzE,OAAO,EAA8B,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,cAAc,CAAC;QACvB,UAAU,QAAQ,CAAC,CAAC;YAClB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAC7C,qBAAqB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;SACnE;KACF;CACF;AAED,QAAA,MAAM,YAAY,GAAa,gBAAgB,OAAO,MAAM,0CAG3D,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,QAAQ,CAAC;IACb,yBAAyB,EAAE,CACzB,OAAO,CAAC,EAAE,qBAAqB,KAC5B,OAAO,CAAC;QAAE,OAAO,EAAE,cAAc,CAAC;QAAC,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;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.53.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -14,6 +14,14 @@
|
|
|
14
14
|
"./test": {
|
|
15
15
|
"types": "./dist/test/index.d.ts",
|
|
16
16
|
"default": "./dist/test/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./test-case-sync": {
|
|
19
|
+
"types": "./dist/reporter/test-case-sync.d.ts",
|
|
20
|
+
"default": "./dist/reporter/test-case-sync.js"
|
|
21
|
+
},
|
|
22
|
+
"./test-case-sync-reporter": {
|
|
23
|
+
"types": "./dist/reporter/test-case-sync-reporter.d.ts",
|
|
24
|
+
"default": "./dist/reporter/test-case-sync-reporter.js"
|
|
17
25
|
}
|
|
18
26
|
},
|
|
19
27
|
"repository": {
|
|
@@ -29,7 +37,6 @@
|
|
|
29
37
|
"@types/console-log-level": "^1.4.5",
|
|
30
38
|
"@types/mime": "3.0.0",
|
|
31
39
|
"@types/node": "^20.14.9",
|
|
32
|
-
"@types/pg": "^8.11.6",
|
|
33
40
|
"@types/serve-handler": "^6.1.4",
|
|
34
41
|
"playwright-core": "1.60.0",
|
|
35
42
|
"serve-handler": "^6.1.6",
|
|
@@ -42,13 +49,12 @@
|
|
|
42
49
|
"console-log-level": "^1.4.1",
|
|
43
50
|
"mime": "3.0.0",
|
|
44
51
|
"openai": "^6.27.0",
|
|
45
|
-
"pg": "^8.13.1",
|
|
46
52
|
"puppeteer-extra-plugin-recaptcha": "^3.6.8",
|
|
47
53
|
"rimraf": "^6.0.1",
|
|
48
54
|
"ts-morph": "^23.0.0",
|
|
49
55
|
"@empiricalrun/cua": "^0.4.1",
|
|
50
|
-
"@empiricalrun/llm": "^0.27.0",
|
|
51
56
|
"@empiricalrun/dashboard-client": "^0.3.0",
|
|
57
|
+
"@empiricalrun/llm": "^0.27.0",
|
|
52
58
|
"@empiricalrun/r2-uploader": "^0.9.1",
|
|
53
59
|
"@empiricalrun/reporter": "^0.29.1"
|
|
54
60
|
},
|
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;
|