@empiricalrun/playwright-utils 0.18.11 → 0.18.13

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.18.13
4
+
5
+ ### Patch Changes
6
+
7
+ - ba27307: feat: add suites and project to test case run event
8
+
9
+ ## 0.18.12
10
+
11
+ ### Patch Changes
12
+
13
+ - 97f2b70: feat: send test case run event on onTestEnd
14
+
3
15
  ## 0.18.11
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;AAGnC,OAAO,EAML,UAAU,EAMX,MAAM,2BAA2B,CAAC;AAiBnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAiC/C,QAAA,MAAM,iBAAiB,UAAoC,CAAC;AAC5D,KAAK,oBAAoB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAM/D,KAAK,mBAAmB,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AA6BF,cAAM,YAAa,Y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;AAsiBD,eAAe,YAAY,CAAC"}
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.startHtmlReportServer = exports.showHTMLReport = void 0;
24
24
  const code_frame_1 = require("@babel/code-frame");
25
25
  const r2_uploader_1 = require("@empiricalrun/r2-uploader");
26
+ const crypto_1 = require("crypto");
26
27
  const fs_1 = __importDefault(require("fs"));
27
28
  const path_1 = __importDefault(require("path"));
28
29
  const utils_1 = require("playwright-core/lib/utils");
@@ -127,15 +128,53 @@ class HtmlReporter {
127
128
  }
128
129
  onTestEnd(test, result) {
129
130
  try {
130
- result.attachments.forEach(async (attachment) => {
131
+ const attachmentPromises = result.attachments.map((attachment) => {
131
132
  return this.processTestAttachment(attachment);
132
133
  });
134
+ Promise.all(attachmentPromises)
135
+ .then((uploadedAttachments) => {
136
+ if (!uploadedAttachments) {
137
+ return;
138
+ }
139
+ logger_1.logger.info(`All attachments processed, test data sent for test: ${test.title}`);
140
+ const { suites, projectName } = (0, util_1.suitesAndProjectForTest)(test);
141
+ let params = {
142
+ test,
143
+ result,
144
+ assetsURL: {
145
+ trace: "",
146
+ videos: [],
147
+ },
148
+ suites,
149
+ projectName,
150
+ runId: process.env.TEST_RUN_GITHUB_ACTION_ID || "",
151
+ };
152
+ uploadedAttachments.forEach((attachment) => {
153
+ if (attachment) {
154
+ Object.entries(attachment).forEach(([key, value]) => {
155
+ if (key.includes("video")) {
156
+ params.assetsURL.videos.push({
157
+ name: `test-${test.id}-slug-${(0, crypto_1.randomUUID)()}`,
158
+ url: value,
159
+ });
160
+ }
161
+ if (key.includes("trace")) {
162
+ params.assetsURL.trace = value;
163
+ }
164
+ });
165
+ }
166
+ });
167
+ return (0, util_1.sendTestCaseUpdateToDashboard)(params);
168
+ })
169
+ .catch((error) => {
170
+ logger_1.logger.error(`Error processing attachments for test: ${test.title}:`, error);
171
+ });
133
172
  }
134
173
  catch (e) {
135
- logger_1.logger.error("Error while processing attachments for test", e);
174
+ logger_1.logger.error(`Error while processing attachments for test ${test.title}:`, e);
136
175
  }
137
176
  }
138
- processTestAttachment(attachment) {
177
+ async processTestAttachment(attachment) {
139
178
  if (!attachment.path)
140
179
  return;
141
180
  if (this.haveSeenAttachments.has(attachment.path))
@@ -148,16 +187,19 @@ class HtmlReporter {
148
187
  return;
149
188
  }
150
189
  try {
151
- const uploadTask = async () => (0, r2_uploader_1.uploadDirectory)({
152
- fileList: [attachment.path],
153
- sourceDir: this._outputFolder + "/data/" + folderName,
154
- destinationDir: process.env.PROJECT_NAME +
155
- "/" +
156
- process.env.TEST_RUN_GITHUB_ACTION_ID +
157
- "/data/" +
158
- folderName,
159
- uploadBucket: "test-report",
160
- });
190
+ const uploadTask = async () => {
191
+ const uploadedFiles = await (0, r2_uploader_1.uploadDirectory)({
192
+ fileList: [attachment.path],
193
+ sourceDir: this._outputFolder + "/data/" + folderName,
194
+ destinationDir: process.env.PROJECT_NAME +
195
+ "/" +
196
+ process.env.TEST_RUN_GITHUB_ACTION_ID +
197
+ "/data/" +
198
+ folderName,
199
+ uploadBucket: "test-report",
200
+ });
201
+ return uploadedFiles;
202
+ };
161
203
  if (this.uploadExecutionQueue.length <= this.uploadMaxQueueSize) {
162
204
  const promise = uploadTask()
163
205
  .catch((e) => {
@@ -171,6 +213,7 @@ class HtmlReporter {
171
213
  this.processQueue(); // Keep processing queue
172
214
  });
173
215
  this.uploadExecutionQueue.push(promise);
216
+ return promise;
174
217
  }
175
218
  else {
176
219
  logger_1.logger.debug("Queuing upload task ", attachment.path);
@@ -579,7 +622,8 @@ class HtmlBuilder {
579
622
  fs_1.default.appendFileSync(indexFile, '";</script>');
580
623
  let singleTestId;
581
624
  if (htmlReport.stats.total === 1) {
582
- const testFile = data.values().next().value?.testFile;
625
+ const testFile = data.values().next()
626
+ ?.value?.testFile;
583
627
  singleTestId = testFile?.tests[0]?.testId;
584
628
  }
585
629
  return { ok, singleTestId };
@@ -0,0 +1,17 @@
1
+ import { TestCase, TestResult } from "@playwright/test/reporter";
2
+ export type VideoURL = {
3
+ name: string;
4
+ url: string;
5
+ };
6
+ export type TestCaseRunEndEvent = {
7
+ test: TestCase;
8
+ result: TestResult;
9
+ assetsURL: {
10
+ trace: string;
11
+ videos: VideoURL[];
12
+ };
13
+ suites: string[];
14
+ projectName: string;
15
+ runId: string;
16
+ };
17
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +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,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"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -16,6 +16,8 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  /// <reference types="node" />
19
+ import { TestCase } from "@playwright/test/reporter";
20
+ import { TestCaseRunEndEvent } from "./types";
19
21
  export declare function getPackageJsonPath(folderPath: string): string;
20
22
  export declare function resolveReporterOutputPath(defaultValue: string, configDir: string, configValue: string | undefined): string;
21
23
  export declare function normalizeAndSaveAttachment(outputPath: string, name: string, options?: {
@@ -28,4 +30,10 @@ export declare function normalizeAndSaveAttachment(outputPath: string, name: str
28
30
  body?: Buffer | undefined;
29
31
  contentType: string;
30
32
  }>;
33
+ export declare function suitesAndProjectForTest(test: TestCase): {
34
+ suites: string[];
35
+ projectName: string;
36
+ };
37
+ export declare function sendTestCaseUpdateToDashboard(params: TestCaseRunEndEvent): Promise<void>;
38
+ export declare function safelySerialiseJSON(obj: any, keyFilter?: (key: string) => boolean): any;
31
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;;AAiBH,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"}
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"}
@@ -20,12 +20,15 @@ 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.normalizeAndSaveAttachment = exports.resolveReporterOutputPath = exports.getPackageJsonPath = void 0;
23
+ exports.safelySerialiseJSON = exports.sendTestCaseUpdateToDashboard = exports.suitesAndProjectForTest = exports.normalizeAndSaveAttachment = exports.resolveReporterOutputPath = exports.getPackageJsonPath = void 0;
24
+ const async_retry_1 = __importDefault(require("async-retry"));
24
25
  const fs_1 = __importDefault(require("fs"));
25
26
  const path_1 = __importDefault(require("path"));
26
27
  const utils_1 = require("playwright-core/lib/utils");
27
28
  const utilsBundle_1 = require("playwright-core/lib/utilsBundle");
29
+ const logger_1 = require("../logger");
28
30
  const folderToPackageJsonPath = new Map();
31
+ const API_TOKEN = "weQPMWKT";
29
32
  function getPackageJsonPath(folderPath) {
30
33
  const cached = folderToPackageJsonPath.get(folderPath);
31
34
  if (cached !== undefined)
@@ -87,3 +90,77 @@ async function normalizeAndSaveAttachment(outputPath, name, options = {}) {
87
90
  }
88
91
  }
89
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;
119
+ async function sendTestCaseUpdateToDashboard(params) {
120
+ const DOMAIN = process.env.DASHBOARD_DOMAIN || "https://dash.empirical.run";
121
+ try {
122
+ const keyFilter = (key) => key === "parent";
123
+ const payload = {
124
+ ...params,
125
+ test: safelySerialiseJSON(params.test, keyFilter),
126
+ result: safelySerialiseJSON(params.result, keyFilter),
127
+ };
128
+ const requestBody = {
129
+ name: "test_case_run_end",
130
+ data: {
131
+ ...payload,
132
+ },
133
+ };
134
+ if (!DOMAIN) {
135
+ console.warn("No dashboard domain found. Skipping send message to dashboard.");
136
+ return;
137
+ }
138
+ await (0, async_retry_1.default)(async () => {
139
+ const response = await fetch(`${DOMAIN}/api/test-runs/events`, {
140
+ method: "PUT",
141
+ headers: {
142
+ "Content-Type": "application/json",
143
+ Authorization: API_TOKEN,
144
+ },
145
+ body: JSON.stringify(requestBody),
146
+ });
147
+ if (!response.ok) {
148
+ throw new Error(`Failed to publish test case diagnois: ${response.status}`);
149
+ }
150
+ }, {
151
+ retries: 3,
152
+ minTimeout: 1000,
153
+ maxTimeout: 60000,
154
+ factor: 3,
155
+ });
156
+ logger_1.logger.info("Successfully sent test case update to dashboard");
157
+ }
158
+ catch (e) {
159
+ console.error(e.message);
160
+ }
161
+ }
162
+ exports.sendTestCaseUpdateToDashboard = sendTestCaseUpdateToDashboard;
163
+ function safelySerialiseJSON(obj, keyFilter) {
164
+ return JSON.parse(JSON.stringify(obj, (key, value) => (keyFilter?.(key) ? undefined : value)));
165
+ }
166
+ exports.safelySerialiseJSON = safelySerialiseJSON;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.18.11",
3
+ "version": "0.18.13",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -23,6 +23,7 @@
23
23
  "author": "Empirical Team <hey@empirical.run>",
24
24
  "devDependencies": {
25
25
  "@playwright/test": "1.47.1",
26
+ "@types/async-retry": "^1.4.8",
26
27
  "@types/babel__code-frame": "^7.0.6",
27
28
  "@types/console-log-level": "^1.4.5",
28
29
  "@types/md5": "^2.3.5",
@@ -33,6 +34,7 @@
33
34
  "@aws-sdk/client-s3": "^3.614.0",
34
35
  "@aws-sdk/s3-request-presigner": "^3.614.0",
35
36
  "@babel/code-frame": "^7.24.7",
37
+ "async-retry": "^1.3.3",
36
38
  "console-log-level": "^1.4.1",
37
39
  "mailosaur": "^8.6.1",
38
40
  "md5": "^2.3.0",
@@ -42,8 +44,8 @@
42
44
  "puppeteer-extra-plugin-recaptcha": "^3.6.8",
43
45
  "rimraf": "^6.0.1",
44
46
  "@empiricalrun/r2-uploader": "^0.3.7",
45
- "@empiricalrun/test-gen": "^0.38.39",
46
- "@empiricalrun/llm": "^0.9.28"
47
+ "@empiricalrun/llm": "^0.9.28",
48
+ "@empiricalrun/test-gen": "^0.38.39"
47
49
  },
48
50
  "scripts": {
49
51
  "dev": "tsc --build --watch",