@empiricalrun/playwright-utils 0.18.12 → 0.18.14
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/dist/reporter/custom.d.ts.map +1 -1
- package/dist/reporter/custom.js +5 -2
- package/dist/reporter/types.d.ts +4 -2
- package/dist/reporter/types.d.ts.map +1 -1
- package/dist/reporter/util.d.ts +5 -0
- package/dist/reporter/util.d.ts.map +1 -1
- package/dist/reporter/util.js +27 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @empiricalrun/playwright-utils
|
|
2
2
|
|
|
3
|
+
## 0.18.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @empiricalrun/test-gen@0.38.40
|
|
8
|
+
|
|
9
|
+
## 0.18.13
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- ba27307: feat: add suites and project to test case run event
|
|
14
|
+
|
|
3
15
|
## 0.18.12
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/reporter/custom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EAMV,KAAK,EACL,QAAQ,IAAI,cAAc,EAC1B,SAAS,EACT,UAAU,IAAI,gBAAgB,EAE/B,MAAM,2BAA2B,CAAC;AAInC,OAAO,EAML,UAAU,EAMX,MAAM,2BAA2B,CAAC;AAiBnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/reporter/custom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,KAAK,EAC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mB;IAIxC,aAAa;IAIb,QAAQ;IAER,QAAQ;IAER,WAAW;IAEX,SAAS;IAET,WAAW,CAAC,IAAI,EAAE,cAAc;IAIhC,OAAO,IAAI,IAAI;IAIf,SAAS,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB;YA0D1C,qBAAqB;IAuDnC,WAAW,CAAC,MAAM,EAAE,UAAU;IAI9B,OAAO,CAAC,KAAK,EAAE,KAAK;IAYpB,eAAe,IAAI;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,oBAAoB,CAAC;QAC3B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;QACzB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;KAC1B;IAsBD,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IASxD,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAIzB,KAAK,CAAC,MAAM,EAAE,UAAU;IA+IxB,MAAM;CA8Bb;AAwED,wBAAsB,cAAc,CAClC,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,IAAI,GAAE,MAAoB,EAC1B,IAAI,CAAC,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,iBAqBhB;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAsBhE;AAsiBD,eAAe,YAAY,CAAC"}
|
package/dist/reporter/custom.js
CHANGED
|
@@ -137,13 +137,16 @@ class HtmlReporter {
|
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
139
|
logger_1.logger.info(`All attachments processed, test data sent for test: ${test.title}`);
|
|
140
|
+
const { suites, projectName } = (0, util_1.suitesAndProjectForTest)(test);
|
|
140
141
|
let params = {
|
|
142
|
+
test,
|
|
143
|
+
result,
|
|
141
144
|
assetsURL: {
|
|
142
145
|
trace: "",
|
|
143
146
|
videos: [],
|
|
144
147
|
},
|
|
145
|
-
|
|
146
|
-
|
|
148
|
+
suites,
|
|
149
|
+
projectName,
|
|
147
150
|
runId: process.env.TEST_RUN_GITHUB_ACTION_ID || "",
|
|
148
151
|
};
|
|
149
152
|
uploadedAttachments.forEach((attachment) => {
|
package/dist/reporter/types.d.ts
CHANGED
|
@@ -4,12 +4,14 @@ export type VideoURL = {
|
|
|
4
4
|
url: string;
|
|
5
5
|
};
|
|
6
6
|
export type TestCaseRunEndEvent = {
|
|
7
|
+
test: TestCase;
|
|
8
|
+
result: TestResult;
|
|
7
9
|
assetsURL: {
|
|
8
10
|
trace: string;
|
|
9
11
|
videos: VideoURL[];
|
|
10
12
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
suites: string[];
|
|
14
|
+
projectName: string;
|
|
13
15
|
runId: string;
|
|
14
16
|
};
|
|
15
17
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/reporter/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE;QACT,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,QAAQ,EAAE,CAAC;KACpB,CAAC;IACF,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/reporter/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE;QACT,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,QAAQ,EAAE,CAAC;KACpB,CAAC;IACF,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
|
package/dist/reporter/util.d.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
/// <reference types="node" />
|
|
19
|
+
import { TestCase } from "@playwright/test/reporter";
|
|
19
20
|
import { TestCaseRunEndEvent } from "./types";
|
|
20
21
|
export declare function getPackageJsonPath(folderPath: string): string;
|
|
21
22
|
export declare function resolveReporterOutputPath(defaultValue: string, configDir: string, configValue: string | undefined): string;
|
|
@@ -29,6 +30,10 @@ export declare function normalizeAndSaveAttachment(outputPath: string, name: str
|
|
|
29
30
|
body?: Buffer | undefined;
|
|
30
31
|
contentType: string;
|
|
31
32
|
}>;
|
|
33
|
+
export declare function suitesAndProjectForTest(test: TestCase): {
|
|
34
|
+
suites: string[];
|
|
35
|
+
projectName: string;
|
|
36
|
+
};
|
|
32
37
|
export declare function sendTestCaseUpdateToDashboard(params: TestCaseRunEndEvent): Promise<void>;
|
|
33
38
|
export declare function safelySerialiseJSON(obj: any, keyFilter?: (key: string) => boolean): any;
|
|
34
39
|
//# sourceMappingURL=util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/reporter/util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;;
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/reporter/util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;;AAEH,OAAO,EAAS,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAgB5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAK9C,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAmB7D;AAED,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAAG,SAAS,UAMhC;AAED,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GAC5E,OAAO,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CAyCD;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,QAAQ;;;EAwBrD;AAED,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAqDf;AAED,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,GAAG,EACR,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,GACnC,GAAG,CAIL"}
|
package/dist/reporter/util.js
CHANGED
|
@@ -20,7 +20,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
20
20
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.safelySerialiseJSON = exports.sendTestCaseUpdateToDashboard = exports.normalizeAndSaveAttachment = exports.resolveReporterOutputPath = exports.getPackageJsonPath = void 0;
|
|
23
|
+
exports.safelySerialiseJSON = exports.sendTestCaseUpdateToDashboard = exports.suitesAndProjectForTest = exports.normalizeAndSaveAttachment = exports.resolveReporterOutputPath = exports.getPackageJsonPath = void 0;
|
|
24
24
|
const async_retry_1 = __importDefault(require("async-retry"));
|
|
25
25
|
const fs_1 = __importDefault(require("fs"));
|
|
26
26
|
const path_1 = __importDefault(require("path"));
|
|
@@ -90,6 +90,32 @@ async function normalizeAndSaveAttachment(outputPath, name, options = {}) {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
exports.normalizeAndSaveAttachment = normalizeAndSaveAttachment;
|
|
93
|
+
function suitesAndProjectForTest(test) {
|
|
94
|
+
let rawSuites = [];
|
|
95
|
+
if (test.parent) {
|
|
96
|
+
let parent = test.parent;
|
|
97
|
+
while (parent) {
|
|
98
|
+
rawSuites.push(parent.title);
|
|
99
|
+
parent = parent.parent;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// rawSuites looks like [ 'describe 3', 'describe 1', 'home.spec.ts', 'chromium', '' ]
|
|
103
|
+
// For suites, we will extract suites and then reverse them, since we expect top-to-bottom ordering for suites
|
|
104
|
+
let suites = [];
|
|
105
|
+
let iteratorIdx = 0;
|
|
106
|
+
for (; iteratorIdx < rawSuites.length; iteratorIdx++) {
|
|
107
|
+
if (rawSuites[iteratorIdx].endsWith(".ts")) {
|
|
108
|
+
suites = rawSuites.slice(0, iteratorIdx);
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const projectName = rawSuites[iteratorIdx + 1];
|
|
113
|
+
return {
|
|
114
|
+
suites: suites.reverse(),
|
|
115
|
+
projectName: projectName,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
exports.suitesAndProjectForTest = suitesAndProjectForTest;
|
|
93
119
|
async function sendTestCaseUpdateToDashboard(params) {
|
|
94
120
|
const DOMAIN = process.env.DASHBOARD_DOMAIN || "https://dash.empirical.run";
|
|
95
121
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/playwright-utils",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.14",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"playwright-extra": "^4.3.6",
|
|
44
44
|
"puppeteer-extra-plugin-recaptcha": "^3.6.8",
|
|
45
45
|
"rimraf": "^6.0.1",
|
|
46
|
-
"@empiricalrun/
|
|
47
|
-
"@empiricalrun/
|
|
48
|
-
"@empiricalrun/
|
|
46
|
+
"@empiricalrun/test-gen": "^0.38.40",
|
|
47
|
+
"@empiricalrun/r2-uploader": "^0.3.7",
|
|
48
|
+
"@empiricalrun/llm": "^0.9.28"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"dev": "tsc --build --watch",
|