@browsermation/test 0.0.23 → 0.0.24
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/bin/cli.js +2 -2
- package/dist/reporter/reporter.d.ts +1 -0
- package/dist/reporter.js +12 -27
- package/package.json +2 -2
package/dist/bin/cli.js
CHANGED
|
@@ -42871,7 +42871,7 @@ var {
|
|
|
42871
42871
|
// package.json
|
|
42872
42872
|
var package_default = {
|
|
42873
42873
|
name: "@browsermation/test",
|
|
42874
|
-
version: "0.0.
|
|
42874
|
+
version: "0.0.24",
|
|
42875
42875
|
description: "The testing platform for Playwright by Browsermation.",
|
|
42876
42876
|
main: "./dist/index.js",
|
|
42877
42877
|
types: "./dist/index.d.ts",
|
|
@@ -42904,7 +42904,7 @@ var package_default = {
|
|
|
42904
42904
|
build: "rm -rf dist && npm run build:cli && npm run build:index && npm run build:reporter && npm run build:types",
|
|
42905
42905
|
start: "node dist/bin/cli.js",
|
|
42906
42906
|
"build:start": "npm run build && npm start",
|
|
42907
|
-
|
|
42907
|
+
publishPackage: "npm run build && npm publish --access public"
|
|
42908
42908
|
},
|
|
42909
42909
|
keywords: [
|
|
42910
42910
|
"cli",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FullConfig, FullResult, Reporter, Suite, TestCase, TestError, TestResult } from '@playwright/test/reporter';
|
|
2
2
|
export default class BrowsermationReporter implements Reporter {
|
|
3
|
+
log(message: string): void;
|
|
3
4
|
sendData(data: Record<string, any>): Promise<void>;
|
|
4
5
|
onBegin(_config: FullConfig, suite: Suite): Promise<void>;
|
|
5
6
|
onEnd(result: FullResult): Promise<void>;
|
package/dist/reporter.js
CHANGED
|
@@ -32,15 +32,14 @@ var regex = (({ onlyFirst = false } = {}) => {
|
|
|
32
32
|
})();
|
|
33
33
|
var stripAnsi = (str) => str.replace(regex, "");
|
|
34
34
|
var BrowsermationReporter = class {
|
|
35
|
-
|
|
36
|
-
if (process.env.
|
|
37
|
-
console.log(
|
|
38
|
-
"Sending data to Browsermation:",
|
|
39
|
-
JSON.stringify(data, null, 2)
|
|
40
|
-
);
|
|
35
|
+
log(message) {
|
|
36
|
+
if (process.env.REPORTER_LOGS) {
|
|
37
|
+
console.log(message);
|
|
41
38
|
}
|
|
39
|
+
}
|
|
40
|
+
async sendData(data) {
|
|
42
41
|
try {
|
|
43
|
-
|
|
42
|
+
await fetch(
|
|
44
43
|
process.env.REPORTING_URL || "https://browsermation.com/api/v1/playwright/reporting",
|
|
45
44
|
{
|
|
46
45
|
method: "POST",
|
|
@@ -52,22 +51,8 @@ var BrowsermationReporter = class {
|
|
|
52
51
|
body: JSON.stringify(data)
|
|
53
52
|
}
|
|
54
53
|
);
|
|
55
|
-
if (process.env.REPORTER_DEBUG) {
|
|
56
|
-
console.log(
|
|
57
|
-
"Send data to Browsermation:",
|
|
58
|
-
JSON.stringify(
|
|
59
|
-
{
|
|
60
|
-
data,
|
|
61
|
-
response: await response.json(),
|
|
62
|
-
statusCode: response.status
|
|
63
|
-
},
|
|
64
|
-
null,
|
|
65
|
-
2
|
|
66
|
-
)
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
54
|
} catch (error) {
|
|
70
|
-
console.
|
|
55
|
+
console.error("Error sending data to Browsermation:", error);
|
|
71
56
|
}
|
|
72
57
|
}
|
|
73
58
|
async onBegin(_config, suite) {
|
|
@@ -77,7 +62,7 @@ var BrowsermationReporter = class {
|
|
|
77
62
|
file: suite.location?.file,
|
|
78
63
|
timestamp: Date.now()
|
|
79
64
|
};
|
|
80
|
-
|
|
65
|
+
this.log(`${JSON.stringify(data)}
|
|
81
66
|
`);
|
|
82
67
|
await this.sendData(data);
|
|
83
68
|
}
|
|
@@ -89,7 +74,7 @@ var BrowsermationReporter = class {
|
|
|
89
74
|
status: result.status,
|
|
90
75
|
timestamp: Date.now()
|
|
91
76
|
};
|
|
92
|
-
|
|
77
|
+
this.log(`${JSON.stringify(data)}
|
|
93
78
|
`);
|
|
94
79
|
await this.sendData(data);
|
|
95
80
|
}
|
|
@@ -101,7 +86,7 @@ var BrowsermationReporter = class {
|
|
|
101
86
|
file: test.location.file,
|
|
102
87
|
timestamp: Date.now()
|
|
103
88
|
};
|
|
104
|
-
|
|
89
|
+
this.log(`${JSON.stringify(data)}
|
|
105
90
|
`);
|
|
106
91
|
await this.sendData(data);
|
|
107
92
|
}
|
|
@@ -116,7 +101,7 @@ var BrowsermationReporter = class {
|
|
|
116
101
|
errors: stripAnsi(result.error?.message || ""),
|
|
117
102
|
timestamp: Date.now()
|
|
118
103
|
};
|
|
119
|
-
|
|
104
|
+
this.log(`${JSON.stringify(data)}
|
|
120
105
|
`);
|
|
121
106
|
await this.sendData(data);
|
|
122
107
|
}
|
|
@@ -136,7 +121,7 @@ var BrowsermationReporter = class {
|
|
|
136
121
|
type: "exit",
|
|
137
122
|
timestamp: Date.now()
|
|
138
123
|
};
|
|
139
|
-
|
|
124
|
+
this.log(`${JSON.stringify(data)}
|
|
140
125
|
`);
|
|
141
126
|
await this.sendData(data);
|
|
142
127
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@browsermation/test",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "The testing platform for Playwright by Browsermation.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"build": "rm -rf dist && npm run build:cli && npm run build:index && npm run build:reporter && npm run build:types",
|
|
34
34
|
"start": "node dist/bin/cli.js",
|
|
35
35
|
"build:start": "npm run build && npm start",
|
|
36
|
-
"
|
|
36
|
+
"publishPackage": "npm run build && npm publish --access public"
|
|
37
37
|
},
|
|
38
38
|
"keywords": [
|
|
39
39
|
"cli",
|