browsermation 0.0.56
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/README.md +25 -0
- package/dist/bin/cli.d.ts +2 -0
- package/dist/bin/cli.js +46925 -0
- package/dist/core.d.ts +8 -0
- package/dist/defineConfig.d.ts +2 -0
- package/dist/esbuild.d.ts +1 -0
- package/dist/http.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +796 -0
- package/dist/playwright.d.ts +3 -0
- package/dist/reporter/reporter.d.ts +11 -0
- package/dist/reporter.js +128 -0
- package/dist/test.d.ts +1 -0
- package/dist/tunnel.d.ts +5 -0
- package/dist/zip.d.ts +6 -0
- package/package.json +68 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FullConfig, FullResult, Reporter, Suite, TestCase, TestError, TestResult } from '@playwright/test/reporter';
|
|
2
|
+
export default class BrowsermationReporter implements Reporter {
|
|
3
|
+
log(message: string): void;
|
|
4
|
+
sendData(data: Record<string, any>): Promise<void>;
|
|
5
|
+
onBegin(_config: FullConfig, suite: Suite): Promise<void>;
|
|
6
|
+
onEnd(result: FullResult): Promise<void>;
|
|
7
|
+
onTestBegin(test: TestCase): Promise<void>;
|
|
8
|
+
onTestEnd(test: TestCase, result: TestResult): Promise<void>;
|
|
9
|
+
onError(error: TestError): Promise<void>;
|
|
10
|
+
onExit(): Promise<void>;
|
|
11
|
+
}
|
package/dist/reporter.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/reporter/reporter.ts
|
|
20
|
+
var reporter_exports = {};
|
|
21
|
+
__export(reporter_exports, {
|
|
22
|
+
default: () => BrowsermationReporter
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(reporter_exports);
|
|
25
|
+
var regex = (({ onlyFirst = false } = {}) => {
|
|
26
|
+
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
27
|
+
const pattern = [
|
|
28
|
+
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
|
|
29
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
|
|
30
|
+
].join("|");
|
|
31
|
+
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
32
|
+
})();
|
|
33
|
+
var stripAnsi = (str) => str.replace(regex, "");
|
|
34
|
+
var BrowsermationReporter = class {
|
|
35
|
+
log(message) {
|
|
36
|
+
if (process.env.BM_REPORTER_LOGS) {
|
|
37
|
+
console.log(message);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async sendData(data) {
|
|
41
|
+
try {
|
|
42
|
+
await fetch(
|
|
43
|
+
process.env.BM_REPORTING_URL || "https://browsermation.com/api/v1/playwright/reporting",
|
|
44
|
+
{
|
|
45
|
+
method: "POST",
|
|
46
|
+
headers: {
|
|
47
|
+
Accept: "application/json",
|
|
48
|
+
"Content-Type": "application/json",
|
|
49
|
+
Authorization: `Bearer ${process.env.BM_API_TOKEN}`
|
|
50
|
+
},
|
|
51
|
+
body: JSON.stringify(data)
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error("Error sending data to Browsermation:", error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async onBegin(_config, suite) {
|
|
59
|
+
const data = {
|
|
60
|
+
type: "begin",
|
|
61
|
+
title: suite.title,
|
|
62
|
+
file: suite.location?.file,
|
|
63
|
+
timestamp: Date.now()
|
|
64
|
+
};
|
|
65
|
+
this.log(`${JSON.stringify(data)}
|
|
66
|
+
`);
|
|
67
|
+
await this.sendData(data);
|
|
68
|
+
}
|
|
69
|
+
async onEnd(result) {
|
|
70
|
+
const data = {
|
|
71
|
+
type: "end",
|
|
72
|
+
startTime: result.startTime,
|
|
73
|
+
duration: result.duration,
|
|
74
|
+
status: result.status,
|
|
75
|
+
timestamp: Date.now()
|
|
76
|
+
};
|
|
77
|
+
this.log(`${JSON.stringify(data)}
|
|
78
|
+
`);
|
|
79
|
+
await this.sendData(data);
|
|
80
|
+
}
|
|
81
|
+
async onTestBegin(test) {
|
|
82
|
+
const data = {
|
|
83
|
+
id: test.id,
|
|
84
|
+
type: "test-start",
|
|
85
|
+
title: test.title,
|
|
86
|
+
file: test.location.file,
|
|
87
|
+
timestamp: Date.now()
|
|
88
|
+
};
|
|
89
|
+
this.log(`${JSON.stringify(data)}
|
|
90
|
+
`);
|
|
91
|
+
await this.sendData(data);
|
|
92
|
+
}
|
|
93
|
+
async onTestEnd(test, result) {
|
|
94
|
+
const data = {
|
|
95
|
+
id: test.id,
|
|
96
|
+
type: "test-end",
|
|
97
|
+
title: test.title,
|
|
98
|
+
titlePath: test.titlePath,
|
|
99
|
+
status: result.status,
|
|
100
|
+
duration: result.duration,
|
|
101
|
+
errors: stripAnsi(result.error?.message || ""),
|
|
102
|
+
timestamp: Date.now()
|
|
103
|
+
};
|
|
104
|
+
this.log(`${JSON.stringify(data)}
|
|
105
|
+
`);
|
|
106
|
+
await this.sendData(data);
|
|
107
|
+
}
|
|
108
|
+
async onError(error) {
|
|
109
|
+
const data = {
|
|
110
|
+
type: "error",
|
|
111
|
+
message: error.message,
|
|
112
|
+
stack: error.stack,
|
|
113
|
+
timestamp: Date.now()
|
|
114
|
+
};
|
|
115
|
+
console.error(`${JSON.stringify(data)}
|
|
116
|
+
`);
|
|
117
|
+
await this.sendData(data);
|
|
118
|
+
}
|
|
119
|
+
async onExit() {
|
|
120
|
+
const data = {
|
|
121
|
+
type: "exit",
|
|
122
|
+
timestamp: Date.now()
|
|
123
|
+
};
|
|
124
|
+
this.log(`${JSON.stringify(data)}
|
|
125
|
+
`);
|
|
126
|
+
await this.sendData(data);
|
|
127
|
+
}
|
|
128
|
+
};
|
package/dist/test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
|
package/dist/tunnel.d.ts
ADDED
package/dist/zip.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zips a folder to a Buffer. it keeps the folder structure intact.
|
|
3
|
+
* @param folder the folder where the testFiles are located
|
|
4
|
+
* @param testFiles Array of file paths to include in the zip.
|
|
5
|
+
*/
|
|
6
|
+
export declare function zipFolderToBuffer(folder: string, testFiles: string[]): Promise<Buffer>;
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "browsermation",
|
|
3
|
+
"version": "0.0.56",
|
|
4
|
+
"description": "The testing platform for Playwright by Browsermation.",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"require": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./reporter": {
|
|
15
|
+
"import": "./dist/reporter.js",
|
|
16
|
+
"require": "./dist/reporter.js",
|
|
17
|
+
"types": "./dist/reporter.d.ts",
|
|
18
|
+
"default": "./dist/reporter.js"
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
"bin": {
|
|
23
|
+
"browsermation": "dist/bin/cli.js"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build:cli": "esbuild src/bin/cli.ts --bundle --platform=node --external:playwright --target=node22 --outfile=dist/bin/cli.js",
|
|
30
|
+
"build:reporter": "esbuild src/reporter/reporter.ts --bundle --platform=node --external:playwright --target=node22 --outfile=dist/reporter.js",
|
|
31
|
+
"build:index": "esbuild src/index.ts --bundle --platform=node --external:playwright --target=node22 --outfile=dist/index.js",
|
|
32
|
+
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
33
|
+
"build": "rm -rf dist && npm run build:cli && npm run build:index && npm run build:reporter && npm run build:types",
|
|
34
|
+
"start": "node dist/bin/cli.js",
|
|
35
|
+
"build:start": "npm run build && npm start",
|
|
36
|
+
"publishPackage": "npm run build && npm publish --access public"
|
|
37
|
+
},
|
|
38
|
+
"keywords": [
|
|
39
|
+
"cli",
|
|
40
|
+
"playwright",
|
|
41
|
+
"automation",
|
|
42
|
+
"browsermation"
|
|
43
|
+
],
|
|
44
|
+
"author": "Browsermation Team",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/archiver": "^6.0.3",
|
|
48
|
+
"@types/node": "^24.0.13",
|
|
49
|
+
"esbuild": "^0.25.6",
|
|
50
|
+
"typescript": "^5.9.2"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"browsermation": "^0.0.36",
|
|
54
|
+
"@playwright/test": "^1.55.0",
|
|
55
|
+
"archiver": "^7.0.1",
|
|
56
|
+
"axios": "^1.10.0",
|
|
57
|
+
"chalk": "^5.4.1",
|
|
58
|
+
"commander": "^14.0.0",
|
|
59
|
+
"form-data": "^4.0.3",
|
|
60
|
+
"ora": "^8.2.0",
|
|
61
|
+
"tiny-invariant": "^1.3.3",
|
|
62
|
+
"ts-morph": "^26.0.0",
|
|
63
|
+
"ts-node": "^10.9.2"
|
|
64
|
+
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"playwright": "^1.40.0"
|
|
67
|
+
}
|
|
68
|
+
}
|