@browsermation/test 0.0.63-beta.11 → 0.0.63-beta.12
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/dist/reporter/reporter.d.ts +2 -1
- package/dist/reporter.js +11 -1
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import type { FullConfig, FullResult, Reporter, Suite, TestCase, TestError, Test
|
|
|
2
2
|
export default class BrowsermationReporter implements Reporter {
|
|
3
3
|
browsermationURL: string;
|
|
4
4
|
apiToken: string;
|
|
5
|
+
suiteRunId: string | null;
|
|
5
6
|
log(message: string): void;
|
|
6
7
|
constructor(options?: {
|
|
7
8
|
reportingURL?: string;
|
|
@@ -12,7 +13,7 @@ export default class BrowsermationReporter implements Reporter {
|
|
|
12
13
|
getLatestCommitId(): Promise<string>;
|
|
13
14
|
getLatestCommitMessage(): Promise<string>;
|
|
14
15
|
gitRemoteOriginUrl(): Promise<string>;
|
|
15
|
-
sendData(data: Record<string, any>): Promise<
|
|
16
|
+
sendData(data: Record<string, any>): Promise<any>;
|
|
16
17
|
/**
|
|
17
18
|
* onBegin() is called once with a root suite that contains all other suites and tests. Learn more about suites hierarchy.
|
|
18
19
|
*
|
package/dist/reporter.js
CHANGED
|
@@ -35,6 +35,7 @@ var stripAnsi = (str) => str.replace(regex, "");
|
|
|
35
35
|
var BrowsermationReporter = class {
|
|
36
36
|
browsermationURL = "";
|
|
37
37
|
apiToken = "";
|
|
38
|
+
suiteRunId = null;
|
|
38
39
|
log(message) {
|
|
39
40
|
if (process.env.BM_REPORTER_LOGS) {
|
|
40
41
|
console.log(message);
|
|
@@ -137,6 +138,7 @@ var BrowsermationReporter = class {
|
|
|
137
138
|
`Failed to send data to Browsermation. Status: ${response.status} - ${response.statusText}`
|
|
138
139
|
);
|
|
139
140
|
}
|
|
141
|
+
return await response.json();
|
|
140
142
|
} catch (error) {
|
|
141
143
|
console.error("Error sending data to Browsermation:", error);
|
|
142
144
|
}
|
|
@@ -166,11 +168,16 @@ var BrowsermationReporter = class {
|
|
|
166
168
|
};
|
|
167
169
|
this.log(`${JSON.stringify(data)}
|
|
168
170
|
`);
|
|
169
|
-
await this.sendData(data);
|
|
171
|
+
const response = await this.sendData(data);
|
|
172
|
+
if (response && response.data.suite_run_id) {
|
|
173
|
+
this.suiteRunId = response.data.suite_run_id;
|
|
174
|
+
this.log(`Received suite_run_id: ${this.suiteRunId}`);
|
|
175
|
+
}
|
|
170
176
|
}
|
|
171
177
|
async onEnd(result) {
|
|
172
178
|
const data = {
|
|
173
179
|
type: "end",
|
|
180
|
+
suite_run_id: this.suiteRunId,
|
|
174
181
|
startTime: result.startTime,
|
|
175
182
|
duration: result.duration,
|
|
176
183
|
status: result.status,
|
|
@@ -199,6 +206,7 @@ var BrowsermationReporter = class {
|
|
|
199
206
|
async onTestEnd(test, result) {
|
|
200
207
|
const data = {
|
|
201
208
|
id: test.id,
|
|
209
|
+
suite_run_id: this.suiteRunId,
|
|
202
210
|
type: "test-end",
|
|
203
211
|
title: test.title,
|
|
204
212
|
titlePath: test.titlePath,
|
|
@@ -216,6 +224,7 @@ var BrowsermationReporter = class {
|
|
|
216
224
|
async onError(error) {
|
|
217
225
|
const data = {
|
|
218
226
|
type: "error",
|
|
227
|
+
suite_run_id: this.suiteRunId,
|
|
219
228
|
message: error.message,
|
|
220
229
|
stack: error.stack,
|
|
221
230
|
timestamp: Date.now()
|
|
@@ -227,6 +236,7 @@ var BrowsermationReporter = class {
|
|
|
227
236
|
async onExit() {
|
|
228
237
|
const data = {
|
|
229
238
|
type: "exit",
|
|
239
|
+
suite_run_id: this.suiteRunId,
|
|
230
240
|
timestamp: Date.now()
|
|
231
241
|
};
|
|
232
242
|
this.log(`${JSON.stringify(data)}
|