@orangebeard-io/playwright-orangebeard-reporter 1.0.1 → 1.0.3
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/LICENSE +202 -661
- package/dist/reporter/OrangebeardReporter.js +283 -0
- package/dist/reporter/utils.js +177 -0
- package/package.json +4 -1
- package/.eslintignore +0 -5
- package/.eslintrc +0 -22
- package/.github/logo.svg +0 -66
- package/.github/workflows/release.yml +0 -144
- package/.prettierrc +0 -7
- package/changelog-template.hbs +0 -29
- package/src/index.ts +0 -3
- package/src/reporter/OrangebeardReporter.ts +0 -265
- package/src/reporter/utils.ts +0 -160
- package/tsconfig.json +0 -20
@@ -0,0 +1,283 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
19
|
+
var ownKeys = function(o) {
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
21
|
+
var ar = [];
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
23
|
+
return ar;
|
24
|
+
};
|
25
|
+
return ownKeys(o);
|
26
|
+
};
|
27
|
+
return function (mod) {
|
28
|
+
if (mod && mod.__esModule) return mod;
|
29
|
+
var result = {};
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
31
|
+
__setModuleDefault(result, mod);
|
32
|
+
return result;
|
33
|
+
};
|
34
|
+
})();
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
42
|
+
});
|
43
|
+
};
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
46
|
+
};
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
48
|
+
exports.OrangebeardReporter = void 0;
|
49
|
+
const utils_1 = require("./utils");
|
50
|
+
const OrangebeardAsyncV3Client_1 = __importDefault(require("@orangebeard-io/javascript-client/dist/client/OrangebeardAsyncV3Client"));
|
51
|
+
const StartTest_1 = require("@orangebeard-io/javascript-client/dist/client/models/StartTest");
|
52
|
+
const Log_1 = require("@orangebeard-io/javascript-client/dist/client/models/Log");
|
53
|
+
const FinishStep_1 = require("@orangebeard-io/javascript-client/dist/client/models/FinishStep");
|
54
|
+
var TestType = StartTest_1.StartTest.TestType;
|
55
|
+
var LogFormat = Log_1.Log.LogFormat;
|
56
|
+
var LogLevel = Log_1.Log.LogLevel;
|
57
|
+
var Status = FinishStep_1.FinishStep.Status;
|
58
|
+
const path = __importStar(require("node:path"));
|
59
|
+
class OrangebeardReporter {
|
60
|
+
constructor() {
|
61
|
+
this.suites = new Map(); //suiteNames , uuid
|
62
|
+
this.tests = new Map(); //testId, uuid
|
63
|
+
this.steps = new Map(); //testId_stepPath, uuid
|
64
|
+
this.promises = [];
|
65
|
+
this.client = new OrangebeardAsyncV3Client_1.default();
|
66
|
+
this.config = this.client.config;
|
67
|
+
}
|
68
|
+
onBegin() {
|
69
|
+
this.testRunId = this.client.startTestRun({
|
70
|
+
testSetName: this.config.testset,
|
71
|
+
description: this.config.description,
|
72
|
+
startTime: (0, utils_1.getTime)(),
|
73
|
+
attributes: this.config.attributes
|
74
|
+
});
|
75
|
+
}
|
76
|
+
onEnd() {
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
78
|
+
yield Promise.all(this.promises);
|
79
|
+
return this.client.finishTestRun(this.testRunId, { endTime: (0, utils_1.getTime)() });
|
80
|
+
});
|
81
|
+
}
|
82
|
+
onStdErr(chunk, test, _result) {
|
83
|
+
//log error level
|
84
|
+
if (typeof test === 'object' && test !== null) {
|
85
|
+
const testUUID = this.tests.get(test.id);
|
86
|
+
const message = chunk.toString();
|
87
|
+
this.client.log({
|
88
|
+
logFormat: LogFormat.PLAIN_TEXT,
|
89
|
+
logLevel: LogLevel.ERROR,
|
90
|
+
logTime: (0, utils_1.getTime)(),
|
91
|
+
message: message,
|
92
|
+
testRunUUID: this.testRunId,
|
93
|
+
testUUID: testUUID
|
94
|
+
});
|
95
|
+
}
|
96
|
+
}
|
97
|
+
onStdOut(chunk, test, _result) {
|
98
|
+
if (typeof test === 'object' && test !== null) {
|
99
|
+
const testUUID = this.tests.get(test.id);
|
100
|
+
const message = chunk.toString();
|
101
|
+
this.client.log({
|
102
|
+
logFormat: LogFormat.PLAIN_TEXT,
|
103
|
+
logLevel: LogLevel.INFO,
|
104
|
+
logTime: (0, utils_1.getTime)(),
|
105
|
+
message: message,
|
106
|
+
testRunUUID: this.testRunId,
|
107
|
+
testUUID: testUUID
|
108
|
+
});
|
109
|
+
}
|
110
|
+
}
|
111
|
+
onStepBegin(test, _result, step) {
|
112
|
+
//start step
|
113
|
+
const testUUID = this.tests.get(test.id);
|
114
|
+
const stepUUID = this.client.startStep({
|
115
|
+
startTime: (0, utils_1.getTime)(),
|
116
|
+
stepName: step.title || step.titlePath().toString() || 'Untitled step',
|
117
|
+
description: step.location ? `${path.basename(step.location.file)}:${step.location.line}` : undefined,
|
118
|
+
testRunUUID: this.testRunId,
|
119
|
+
testUUID: testUUID,
|
120
|
+
parentStepUUID: step.parent ? this.steps.get(test.id + "|" + step.parent.titlePath()) : undefined,
|
121
|
+
});
|
122
|
+
this.steps.set(test.id + "|" + step.titlePath(), stepUUID);
|
123
|
+
if (step.location) {
|
124
|
+
this.client.log({
|
125
|
+
logFormat: LogFormat.MARKDOWN,
|
126
|
+
logLevel: LogLevel.INFO,
|
127
|
+
logTime: (0, utils_1.getTime)(),
|
128
|
+
message: (0, utils_1.getCodeSnippet)(step.location.file, step.location.line),
|
129
|
+
testRunUUID: this.testRunId,
|
130
|
+
testUUID: testUUID,
|
131
|
+
stepUUID: stepUUID
|
132
|
+
});
|
133
|
+
}
|
134
|
+
}
|
135
|
+
onStepEnd(test, _result, step) {
|
136
|
+
const testUUID = this.tests.get(test.id);
|
137
|
+
const stepUUID = this.steps.get(test.id + "|" + step.titlePath());
|
138
|
+
if (step.error) {
|
139
|
+
const message = step.error.message;
|
140
|
+
this.client.log({
|
141
|
+
logFormat: LogFormat.MARKDOWN,
|
142
|
+
logLevel: LogLevel.ERROR,
|
143
|
+
logTime: (0, utils_1.getTime)(),
|
144
|
+
message: (0, utils_1.ansiToMarkdown)(message),
|
145
|
+
testRunUUID: this.testRunId,
|
146
|
+
testUUID: testUUID,
|
147
|
+
stepUUID: stepUUID
|
148
|
+
});
|
149
|
+
if (step.error.snippet) {
|
150
|
+
this.client.log({
|
151
|
+
logFormat: LogFormat.MARKDOWN,
|
152
|
+
logLevel: LogLevel.ERROR,
|
153
|
+
logTime: (0, utils_1.getTime)(),
|
154
|
+
message: `\`\`\`js\n${(0, utils_1.removeAnsi)(step.error.snippet)}\n\`\`\``,
|
155
|
+
testRunUUID: this.testRunId,
|
156
|
+
testUUID: testUUID,
|
157
|
+
stepUUID: stepUUID
|
158
|
+
});
|
159
|
+
}
|
160
|
+
}
|
161
|
+
this.client.finishStep(this.steps.get(test.id + "|" + step.titlePath()), {
|
162
|
+
endTime: (0, utils_1.getTime)(),
|
163
|
+
status: step.error ? Status.FAILED : Status.PASSED,
|
164
|
+
testRunUUID: this.testRunId
|
165
|
+
});
|
166
|
+
this.steps.delete(test.id + "|" + step.titlePath());
|
167
|
+
}
|
168
|
+
onTestBegin(test) {
|
169
|
+
//check suite
|
170
|
+
const suiteUUID = this.getOrStartSuite(test.parent.titlePath());
|
171
|
+
const attributes = [];
|
172
|
+
for (const tag of test.tags) {
|
173
|
+
attributes.push({ value: tag });
|
174
|
+
}
|
175
|
+
const testUUID = this.client.startTest({
|
176
|
+
testType: TestType.TEST,
|
177
|
+
testRunUUID: this.testRunId,
|
178
|
+
suiteUUID: suiteUUID,
|
179
|
+
testName: test.title,
|
180
|
+
startTime: (0, utils_1.getTime)(),
|
181
|
+
description: this.getTestDescription(test),
|
182
|
+
attributes: attributes
|
183
|
+
});
|
184
|
+
this.tests.set(test.id, testUUID);
|
185
|
+
}
|
186
|
+
onTestEnd(test, result) {
|
187
|
+
return __awaiter(this, void 0, void 0, function* () {
|
188
|
+
const testUUID = this.tests.get(test.id);
|
189
|
+
if (result.attachments.length > 0) {
|
190
|
+
let message = "";
|
191
|
+
for (const attachment of result.attachments) {
|
192
|
+
message += `- ${attachment.name} (${attachment.contentType})\n`;
|
193
|
+
}
|
194
|
+
const attachmentsLogUUID = this.client.log({
|
195
|
+
logFormat: LogFormat.MARKDOWN,
|
196
|
+
logLevel: LogLevel.INFO,
|
197
|
+
logTime: (0, utils_1.getTime)(),
|
198
|
+
message: message,
|
199
|
+
testRunUUID: this.testRunId,
|
200
|
+
testUUID: testUUID
|
201
|
+
});
|
202
|
+
for (const attachment of result.attachments) {
|
203
|
+
this.promises.push(this.logAttachment(attachment, testUUID, attachmentsLogUUID));
|
204
|
+
}
|
205
|
+
}
|
206
|
+
//determine status
|
207
|
+
const status = utils_1.testStatusMap[result.status];
|
208
|
+
//finish test
|
209
|
+
this.client.finishTest(testUUID, {
|
210
|
+
testRunUUID: this.testRunId,
|
211
|
+
status: status,
|
212
|
+
endTime: (0, utils_1.getTime)()
|
213
|
+
});
|
214
|
+
this.tests.delete(test.id);
|
215
|
+
});
|
216
|
+
}
|
217
|
+
printsToStdio() {
|
218
|
+
return false;
|
219
|
+
}
|
220
|
+
getOrStartSuite(suitePath) {
|
221
|
+
const filteredSuitePath = suitePath.filter(name => name !== "");
|
222
|
+
let currentPath = [];
|
223
|
+
let parentSuiteUUID = undefined;
|
224
|
+
for (const suiteName of filteredSuitePath) {
|
225
|
+
currentPath.push(suiteName);
|
226
|
+
const existingSuiteUUID = this.suites.get(currentPath.join('|'));
|
227
|
+
if (existingSuiteUUID) {
|
228
|
+
parentSuiteUUID = existingSuiteUUID;
|
229
|
+
}
|
230
|
+
else {
|
231
|
+
const newSuitesUUIDs = this.client.startSuite({
|
232
|
+
testRunUUID: this.testRunId,
|
233
|
+
parentSuiteUUID: parentSuiteUUID,
|
234
|
+
suiteNames: [suiteName],
|
235
|
+
});
|
236
|
+
if (newSuitesUUIDs && newSuitesUUIDs.length > 0) {
|
237
|
+
parentSuiteUUID = newSuitesUUIDs[0];
|
238
|
+
this.suites.set(currentPath.join('|'), parentSuiteUUID);
|
239
|
+
}
|
240
|
+
else {
|
241
|
+
console.error(`Failed to create suite for path: ${currentPath.join(' > ')}`);
|
242
|
+
}
|
243
|
+
}
|
244
|
+
}
|
245
|
+
return parentSuiteUUID;
|
246
|
+
}
|
247
|
+
getTestDescription(test) {
|
248
|
+
let description = `${path.basename(test.location.file)}:${test.location.line}\n`;
|
249
|
+
for (const annotation of test.annotations) {
|
250
|
+
description = `${description + annotation.type}: ${annotation.description}\n`;
|
251
|
+
}
|
252
|
+
return description;
|
253
|
+
}
|
254
|
+
logAttachment(attachment, testUUID, logUUID) {
|
255
|
+
return __awaiter(this, void 0, void 0, function* () {
|
256
|
+
let content;
|
257
|
+
if (attachment.body) {
|
258
|
+
content = attachment.body;
|
259
|
+
}
|
260
|
+
else if (attachment.path) {
|
261
|
+
content = yield (0, utils_1.getBytes)(attachment.path);
|
262
|
+
}
|
263
|
+
else {
|
264
|
+
throw new Error("Attachment must have either body or path defined.");
|
265
|
+
}
|
266
|
+
const orangebeardAttachment = {
|
267
|
+
file: {
|
268
|
+
name: path.basename(attachment.path),
|
269
|
+
content: content,
|
270
|
+
contentType: attachment.contentType,
|
271
|
+
},
|
272
|
+
metaData: {
|
273
|
+
testRunUUID: this.testRunId,
|
274
|
+
testUUID: testUUID,
|
275
|
+
logUUID: logUUID,
|
276
|
+
attachmentTime: (0, utils_1.getTime)()
|
277
|
+
},
|
278
|
+
};
|
279
|
+
this.client.sendAttachment(orangebeardAttachment);
|
280
|
+
});
|
281
|
+
}
|
282
|
+
}
|
283
|
+
exports.OrangebeardReporter = OrangebeardReporter;
|
@@ -0,0 +1,177 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
19
|
+
var ownKeys = function(o) {
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
21
|
+
var ar = [];
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
23
|
+
return ar;
|
24
|
+
};
|
25
|
+
return ownKeys(o);
|
26
|
+
};
|
27
|
+
return function (mod) {
|
28
|
+
if (mod && mod.__esModule) return mod;
|
29
|
+
var result = {};
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
31
|
+
__setModuleDefault(result, mod);
|
32
|
+
return result;
|
33
|
+
};
|
34
|
+
})();
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
42
|
+
});
|
43
|
+
};
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
45
|
+
exports.getBytes = exports.testStatusMap = void 0;
|
46
|
+
exports.getTime = getTime;
|
47
|
+
exports.removeAnsi = removeAnsi;
|
48
|
+
exports.ansiToMarkdown = ansiToMarkdown;
|
49
|
+
exports.getCodeSnippet = getCodeSnippet;
|
50
|
+
const core_1 = require("@js-joda/core");
|
51
|
+
const FinishTest_1 = require("@orangebeard-io/javascript-client/dist/client/models/FinishTest");
|
52
|
+
const fs = __importStar(require("node:fs"));
|
53
|
+
const util_1 = require("util");
|
54
|
+
var Status = FinishTest_1.FinishTest.Status;
|
55
|
+
const stat = (0, util_1.promisify)(fs.stat);
|
56
|
+
const access = (0, util_1.promisify)(fs.access);
|
57
|
+
function getTime() {
|
58
|
+
return core_1.ZonedDateTime.now().withFixedOffsetZone().toString();
|
59
|
+
}
|
60
|
+
exports.testStatusMap = {
|
61
|
+
"passed": Status.PASSED,
|
62
|
+
"failed": Status.FAILED,
|
63
|
+
"timedOut": Status.TIMED_OUT,
|
64
|
+
"skipped": Status.SKIPPED,
|
65
|
+
"interrupted": Status.STOPPED
|
66
|
+
};
|
67
|
+
function removeAnsi(ansiString) {
|
68
|
+
const parts = ansiString.split(/(\u001b\[[0-9;]*[mG])/);
|
69
|
+
let result = "";
|
70
|
+
for (const part of parts) {
|
71
|
+
if (!part.startsWith("\u001b[")) {
|
72
|
+
result += part;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
return result;
|
76
|
+
}
|
77
|
+
function ansiToMarkdown(ansiString) {
|
78
|
+
let markdown = "";
|
79
|
+
let currentStyle = {};
|
80
|
+
const ansiCodes = {
|
81
|
+
"31": { italic: true },
|
82
|
+
"32": { italic: true },
|
83
|
+
"39": { italic: false }, // Reset styles
|
84
|
+
"2": { code: true },
|
85
|
+
"22": { code: false },
|
86
|
+
};
|
87
|
+
const parts = ansiString.split(/(\u001b\[[0-9;]*[mG])/);
|
88
|
+
for (const part of parts) {
|
89
|
+
if (part.startsWith("\u001b[")) {
|
90
|
+
const code = part.slice(2, -1);
|
91
|
+
const codes = code.split(';');
|
92
|
+
for (const c of codes) {
|
93
|
+
const style = ansiCodes[c]; // Type guard
|
94
|
+
if (style) {
|
95
|
+
currentStyle = Object.assign(Object.assign({}, currentStyle), style);
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
else {
|
100
|
+
let formattedPart = part.replace(/\n/g, " \n");
|
101
|
+
if (currentStyle.italic) {
|
102
|
+
formattedPart = formattedPart.endsWith(" ") ? `*${formattedPart.trim()}* ` : `*${formattedPart}*`;
|
103
|
+
}
|
104
|
+
if (currentStyle.code) {
|
105
|
+
formattedPart = `${formattedPart}`;
|
106
|
+
}
|
107
|
+
markdown += formattedPart;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
return markdown;
|
111
|
+
}
|
112
|
+
/**
|
113
|
+
* Reads a 3-line snippet from a file, centered around the specified line number.
|
114
|
+
*
|
115
|
+
* @param filePath - The path to the file.
|
116
|
+
* @param lineNumber - The line number to center the snippet around (1-based index).
|
117
|
+
* @returns A promise that resolves with the 3-line snippet or an error message if the line is out of range.
|
118
|
+
*/
|
119
|
+
function getCodeSnippet(filePath, lineNumber) {
|
120
|
+
if (lineNumber < 1) {
|
121
|
+
throw new Error('Line number must be 1 or greater.');
|
122
|
+
}
|
123
|
+
const fileContent = fs.readFileSync(filePath, 'utf8');
|
124
|
+
const lines = fileContent.split(/\r?\n/); // Support both Unix and Windows line endings
|
125
|
+
const startLine = Math.max(0, lineNumber - 2); // Zero-based index for one line before
|
126
|
+
const endLine = Math.min(lines.length, lineNumber + 1); // One line after
|
127
|
+
if (startLine >= lines.length) {
|
128
|
+
throw new Error('Line number is out of range.');
|
129
|
+
}
|
130
|
+
let snippet = lines.slice(startLine, endLine);
|
131
|
+
if (snippet.length > 0 && snippet[0].trim() === "") {
|
132
|
+
snippet = snippet.slice(1);
|
133
|
+
}
|
134
|
+
return `\`\`\`js\n${snippet.join('\n')}\n\`\`\``;
|
135
|
+
}
|
136
|
+
const fileExists = (filepath) => __awaiter(void 0, void 0, void 0, function* () {
|
137
|
+
try {
|
138
|
+
yield access(filepath, fs.constants.F_OK);
|
139
|
+
return true;
|
140
|
+
}
|
141
|
+
catch (_a) {
|
142
|
+
return false;
|
143
|
+
}
|
144
|
+
});
|
145
|
+
const waitForFile = (filepath_1, ...args_1) => __awaiter(void 0, [filepath_1, ...args_1], void 0, function* (filepath, interval = 1000, timeout = 60000) {
|
146
|
+
const start = Date.now();
|
147
|
+
while (true) {
|
148
|
+
const now = Date.now();
|
149
|
+
if (now - start > timeout) {
|
150
|
+
throw new Error(`Timeout: ${filepath} did not become available within ${timeout}ms`);
|
151
|
+
}
|
152
|
+
if (yield fileExists(filepath)) {
|
153
|
+
const stats = [];
|
154
|
+
for (let i = 0; i < 2; i++) {
|
155
|
+
stats.push(yield stat(filepath));
|
156
|
+
yield new Promise((resolve) => setTimeout(resolve, interval));
|
157
|
+
}
|
158
|
+
const [first, second] = stats;
|
159
|
+
if (first.mtimeMs === second.mtimeMs &&
|
160
|
+
first.size === second.size) {
|
161
|
+
return;
|
162
|
+
}
|
163
|
+
}
|
164
|
+
yield new Promise((resolve) => setTimeout(resolve, interval));
|
165
|
+
}
|
166
|
+
});
|
167
|
+
const getBytes = (filePath) => __awaiter(void 0, void 0, void 0, function* () {
|
168
|
+
try {
|
169
|
+
yield waitForFile(filePath, 100, 5000);
|
170
|
+
return fs.readFileSync(filePath);
|
171
|
+
}
|
172
|
+
catch (err) {
|
173
|
+
console.error('Error reading file:', err);
|
174
|
+
throw err;
|
175
|
+
}
|
176
|
+
});
|
177
|
+
exports.getBytes = getBytes;
|
package/package.json
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orangebeard-io/playwright-orangebeard-reporter",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.3",
|
4
4
|
"description": "A Playwright reporter to report to Orangebeard.io",
|
5
5
|
"main": "dist/index.js",
|
6
|
+
"files": [
|
7
|
+
"dist"
|
8
|
+
],
|
6
9
|
"scripts": {
|
7
10
|
"build": "rimraf ./dist && tsc",
|
8
11
|
"lint": "eslint . --ext .ts",
|
package/.eslintignore
DELETED
package/.eslintrc
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"parser": "@typescript-eslint/parser",
|
3
|
-
"parserOptions": {
|
4
|
-
"ecmaVersion": 12,
|
5
|
-
"sourceType": "module",
|
6
|
-
"project": "./tsconfig.json"
|
7
|
-
},
|
8
|
-
"plugins": ["@typescript-eslint", "prettier"],
|
9
|
-
"extends": ["airbnb-base", "airbnb-typescript/base", "prettier", "eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
10
|
-
"rules": {
|
11
|
-
"@typescript-eslint/no-unused-vars": "error",
|
12
|
-
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
13
|
-
"@typescript-eslint/no-explicit-any": "off",
|
14
|
-
"@typescript-eslint/no-namespace": "off",
|
15
|
-
"@typescript-eslint/no-redeclare": "off",
|
16
|
-
"prettier/prettier": 2
|
17
|
-
},
|
18
|
-
"env": {
|
19
|
-
"browser": true,
|
20
|
-
"es2021": true
|
21
|
-
}
|
22
|
-
}
|
package/.github/logo.svg
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
-
<svg
|
3
|
-
id="Layer_1"
|
4
|
-
data-name="Layer 1"
|
5
|
-
viewBox="0 0 348.01517 196.99"
|
6
|
-
version="1.1"
|
7
|
-
xml:space="preserve"
|
8
|
-
width="348.01517"
|
9
|
-
height="196.99001"
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
11
|
-
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
12
|
-
id="defs4"><style
|
13
|
-
id="style2">.cls-1{fill:#99425b;}.cls-2{fill:#fff;}.cls-3{fill:#e9551d;}.cls-4{fill:#ef7c10;}.cls-5{fill:#f6a307;}.cls-6{fill:#b91d1b;}.cls-7{fill:#020203;}</style></defs><path
|
14
|
-
class="cls-3"
|
15
|
-
d="M 132.43,25 A 67,67 0 0 1 144.27,62 62.44,62.44 0 0 0 127.81,43.48 72.41,72.41 0 0 1 136.37,79.81 32.55,32.55 0 0 0 122.56,60 c 4.3,10.75 8.43,23.54 2.07,33.22 a 93.11,93.11 0 0 0 -6,-15 81.23,81.23 0 0 1 -10.92,46 59.53,59.53 0 0 0 -8.2,-29.47 126.3,126.3 0 0 1 -5.71,38.43 101.78,101.78 0 0 0 -13.14,-33.15 133.18,133.18 0 0 1 -9.84,28.19 125.09,125.09 0 0 0 -9.87,-28 c -5.64,9.15 -4.66,20.73 -3.44,31.38 A 90.38,90.38 0 0 1 45.87,79.83 34.75,34.75 0 0 0 37.8,98 C 30.16,88.1 31.31,74.3 32.8,61.87 A 61.76,61.76 0 0 0 17.02,81.77 C 15.67,65 23.87,49.14 31.84,34.29 A 60.08,60.08 0 0 1 14.29,50.42 270.55,270.55 0 0 0 24.79,19 23.19,23.19 0 0 1 17.28,29.82 7.66,7.66 0 0 1 16.75,31.89 C 12.16,42.06 0.62,55.51 0,56.69 c 0,0 7.28,-0.82 12.33,-5.51 -7.81,14.92 5.05,42.72 11.21,49.74 -1.18,-3.18 -0.92,-7.67 1.84,-9.67 -1.35,29.05 22.88,46 22.88,46 0,0 -3.32,-6.56 -0.52,-10.25 1.57,8 35.9,19.14 35.9,35.14 0,-16.23 36.92,-28 40.76,-50.29 0.62,0 1.57,6.59 -0.33,9 17.58,-10.33 29.18,-43.12 27.9,-52.6 2.76,3 4.37,9.78 4.37,9.78 0,0 10.59,-24.5 -0.33,-45.12 C 151.88,25 147.94,21.5 144.5,19 c 1.11,5 3.64,9.58 6.13,14.07 A 26.36,26.36 0 0 0 132.43,25 Z"
|
16
|
-
id="path10" /><path
|
17
|
-
class="cls-4"
|
18
|
-
d="M 78.56,22 C 40.72,21.08 26.2,9.63 26.2,0 c 0,17.83 -8.23,24 -8.92,29.83 A 23.19,23.19 0 0 0 24.79,19 270.55,270.55 0 0 1 14.29,50.38 60.08,60.08 0 0 0 31.84,34.29 C 23.87,49.14 15.67,65 17.02,81.77 A 61.35,61.35 0 0 1 32.79,61.9 c -1.48,12.43 -2.59,26.26 5,36.23 a 34.7,34.7 0 0 1 8.15,-18.2 90.45,90.45 0 0 0 11.61,51.84 c -1.18,-10.65 -2.2,-22.23 3.44,-31.38 a 124.08,124.08 0 0 1 9.87,28 133.07,133.07 0 0 0 9.84,-28.2 101.58,101.58 0 0 1 13.15,33.15 126.2,126.2 0 0 0 5.7,-38.43 59.88,59.88 0 0 1 8.2,29.48 81.17,81.17 0 0 0 10.92,-46 94.68,94.68 0 0 1 6,15 c 6.36,-9.7 2.23,-22.49 -2.06,-33.21 A 32.7,32.7 0 0 1 136.4,80 a 72.41,72.41 0 0 0 -8.56,-36.33 62.44,62.44 0 0 1 16.46,18.52 67.06,67.06 0 0 0 -11.83,-37 26.13,26.13 0 0 1 18.19,8.07 c -2.49,-4.49 -5,-9.08 -6.13,-14.07 -5.54,-3.93 -9.93,-5.44 -12.43,-19 C 132.07,9.63 116.43,22.91 78.56,22 Z"
|
19
|
-
id="path12" /><path
|
20
|
-
class="cls-5"
|
21
|
-
d="m 57.94,28.22 c -6.69,5.81 -7.93,18.3 -6.65,27 a 21.76,21.76 0 0 1 6.25,-10.6 c -1.67,5 0.17,10.46 2.17,15.38 2.39,5.9 5.08,11.74 9,16.72 a 35.1,35.1 0 0 1 1.37,-20.53 c 0,2.46 1.32,4.73 2.5,6.89 a 119.6,119.6 0 0 1 11.8,31.58 c 5.34,-10.63 3.61,-23.38 7,-34.76 4.85,4.85 6.06,12.13 6.82,18.92 a 49.92,49.92 0 0 0 4.59,-28.53 29,29 0 0 1 7.9,12.71 46.24,46.24 0 0 0 -1,-23.38 c -1.48,-4.75 -4.07,-9.6 -8.63,-11.74 a 18.79,18.79 0 0 0 -5.54,-1.44 c -3.28,-0.46 -6.59,-0.72 -9.9,-1 A 64.1,64.1 0 0 0 73.39,25.34 21.75,21.75 0 0 0 62.14,29.7"
|
22
|
-
id="path14" /><path
|
23
|
-
class="cls-6"
|
24
|
-
d="M 58.94,27.11 C 57.05,44 93.28,54.85 102.4,28.55 105.22,20.42 59.38,22.78 58.94,27.11 Z"
|
25
|
-
id="path16" /><path
|
26
|
-
class="cls-2"
|
27
|
-
d="m 61.74,33.34 c 0,2.66 37.25,1.77 37.18,-0.66 0,-0.52 0.26,-6.13 0.3,-6.75 -10.46,0.56 -28.36,0.29 -37.51,3.08 v 4.33 z"
|
28
|
-
id="path18" /><path
|
29
|
-
class="cls-5"
|
30
|
-
d="m 80.3,20.36 c 6.59,6.85 41.41,8.06 50.3,-2.53 -6.07,5.08 -14.14,4.56 -16.89,3.54 a 7.67,7.67 0 0 0 5.64,-5.9 C 104.17,30.78 99.71,4.52 80.5,18.55 64.63,7 54.2,23.37 42.1,17.7 l 5.15,3.67 c 0,0 -7.58,5 -16.89,-3.54 a 21.39,21.39 0 0 0 4.23,4.69 C 47.57,27 74.13,25.27 80.3,20.36 Z"
|
31
|
-
id="path20" /><path
|
32
|
-
class="cls-3"
|
33
|
-
d="m 80.5,26.42 c 11.67,6.49 40.42,6.2 50.1,-8.56 v 0 c -8.89,10.56 -43.71,9.35 -50.3,2.5 -6.17,4.91 -32.73,6.64 -45.71,2.16 12.1,10.07 35.61,9.64 45.91,3.9 z"
|
34
|
-
id="path22" /><path
|
35
|
-
class="cls-3"
|
36
|
-
d="m 84.46,156.66 c -6.75,3.77 -15.9,24.2 1.31,40.33 -1.31,-15.15 14.3,-23.81 -1.31,-40.33"
|
37
|
-
id="path24" /><path
|
38
|
-
class="cls-4"
|
39
|
-
d="m 84.07,156.66 c -3.31,3.77 -6.72,24.2 1.74,40.33 -0.66,-15.15 5.9,-23.81 -1.74,-40.33"
|
40
|
-
id="path26" /><path
|
41
|
-
class="cls-7"
|
42
|
-
d="m 64.53,153.41 c 1.34,-2.65 18.72,2.66 18.72,2.66 0,0 15.31,-6.1 18.1,-5.15 2.79,0.95 1.87,15.71 0,15.71 -1.87,0 -18.07,-8.27 -18.07,-8.27 0,0 -15.64,8.5 -17.18,8.27 C 64.56,166.4 63.74,155 64.53,153.41 Z"
|
43
|
-
id="path28" /><g
|
44
|
-
id="g7"
|
45
|
-
transform="matrix(0.72207957,0,0,0.76886303,163.1628,22.418349)"><path
|
46
|
-
d="m 84.380258,108.35161 c -9.556409,2.71207 -15.825994,7.46729 -19.95603,12.21879 3.955757,-3.46184 9.254573,-6.63891 16.402227,-8.66499 7.310808,-2.07206 13.547762,-2.05723 18.701222,-1.06273 v -4.02992 c -4.396274,-0.40195 -9.436267,-0.0816 -15.147419,1.53885 z M 63.987419,74.474785 28.496478,83.825026 c 0,0 0.646834,0.913665 1.844537,2.132875 l 30.091859,-7.929313 c 0,0 -0.426427,5.494602 -4.129516,10.410004 7.004745,-5.299557 7.684061,-13.963807 7.684061,-13.963807 z M 93.695643,157.8846 C 43.750467,171.33669 17.3261,113.45538 9.3258895,83.412689 5.6296968,69.545292 4.0161722,59.042587 3.5861115,52.264997 3.5399091,51.561208 3.5612675,50.967919 3.6110297,50.424317 1.020135,50.580797 -0.22028475,51.927564 0.03208571,55.819542 0.46214634,62.593424 2.075671,73.095387 5.7718637,86.967234 13.768515,117.00548 40.196441,174.88679 90.141839,161.43469 c 10.871291,-2.92862 19.038651,-8.26304 25.169561,-15.07252 -5.65108,5.10378 -12.72383,9.12331 -21.615757,11.52243 z M 103.08148,39.05096 v 3.554545 h 19.59042 c -0.40196,-1.258515 -0.80688,-2.392439 -1.20883,-3.554545 z"
|
47
|
-
fill="#2d4552"
|
48
|
-
id="path1" /><path
|
49
|
-
d="m 127.05037,68.325341 c 8.81035,2.502198 13.46989,8.679082 15.93279,14.145502 l 9.82339,2.789943 c 0,0 -1.3401,-19.131357 -18.64486,-24.04676 -16.18865,-4.599476 -26.15072,8.995009 -27.36251,10.754111 4.70923,-3.355051 11.5862,-6.101981 20.25119,-3.642796 z m 78.19628,14.233753 c -16.20347,-4.620241 -26.16184,9.002425 -27.35583,10.737055 4.71294,-3.351344 11.5862,-6.099015 20.24748,-3.628706 8.79626,2.505906 13.4521,8.675373 15.92241,14.145497 l 9.83748,2.80033 c 0,0 -1.3616,-19.135065 -18.65154,-24.054176 z m -9.75961,50.442946 -81.71819,-22.84535 c 0,0 0.88474,4.48527 4.2791,10.29283 l 68.80302,19.23444 c 5.66443,-3.27718 8.63607,-6.68192 8.63607,-6.68192 z m -56.65543,49.17405 C 74.126734,164.82831 81.949255,82.385557 92.419329,43.318935 96.730318,27.219287 101.16219,15.252863 104.83762,7.2313679 102.64467,6.7799488 100.82846,7.9350832 99.033764,11.585074 95.131403,19.49985 90.141098,32.386837 85.311722,50.427284 74.844615,89.493164 67.022094,171.93295 131.72401,189.28073 c 30.4973,8.17033 54.25557,-4.24721 71.966,-23.74863 -16.81086,15.22603 -38.27384,23.76272 -64.8584,16.64399 z"
|
50
|
-
fill="#2d4552"
|
51
|
-
id="path2" /><path
|
52
|
-
d="m 103.08148,138.56487 v -16.63658 l -46.223619,13.10725 c 0,0 3.415567,-19.84553 27.522397,-26.68393 7.310808,-2.07206 13.548504,-2.05797 18.701222,-1.06273 V 39.05096 h 23.14422 c -2.52,-7.786923 -4.95768,-13.782112 -7.00527,-17.947745 -3.38694,-6.894764 -6.85916,-2.324211 -14.74175,4.268717 C 98.926972,30.009972 84.895678,39.904555 63.781251,45.5942 42.666527,51.287553 25.596406,49.777632 18.474115,48.544332 8.3769974,46.802286 3.0956837,44.584867 3.5897454,52.264997 4.0197319,59.038879 5.6333307,69.541584 9.3295234,83.412689 17.3261,113.45167 43.754027,171.33298 93.699351,157.88089 106.74578,154.36565 115.95438,147.41749 122.33743,138.56116 H 103.08148 Z M 28.492993,83.825026 63.987419,74.474785 c 0,0 -1.034548,13.654555 -14.340768,17.162378 -13.309928,3.504116 -21.153658,-7.812137 -21.153658,-7.812137 z"
|
53
|
-
fill="#e2574c"
|
54
|
-
id="path3" /><path
|
55
|
-
d="M 236.66429,39.840035 C 227.4379,41.45749 205.30301,43.472449 177.94792,36.140134 150.58542,28.812269 132.43076,15.996032 125.23787,9.9719198 115.04145,1.4315193 110.55619,-4.5037476 106.14211,4.473833 102.23975,12.392244 97.249446,25.27923 92.419329,43.319677 81.952963,82.385557 74.130442,164.82534 138.83161,182.17312 c 64.68783,17.33295 99.12605,-57.97772 109.59316,-97.047308 4.83012,-18.036738 6.94816,-31.695001 7.53107,-40.50164 0.66448,-9.976161 -6.18801,-7.080167 -19.29155,-4.784137 z M 106.66791,72.160957 c 0,0 10.19642,-15.858625 27.49007,-10.943223 17.30477,4.915403 18.64486,24.04676 18.64486,24.04676 z m 42.21477,71.162833 c -30.41869,-8.91046 -35.11013,-33.1671 -35.11013,-33.1671 l 81.71449,22.84609 c 0,-0.004 -16.49418,19.12023 -46.60436,10.32101 z m 28.89097,-49.849654 c 0,0 10.18232,-15.847501 27.473,-10.918008 17.28994,4.922819 18.65154,24.054172 18.65154,24.054172 z"
|
56
|
-
fill="#2ead33"
|
57
|
-
id="path4" /><path
|
58
|
-
d="m 86.928436,126.50923 -30.070575,8.5226 c 0,0 3.266503,-18.60852 25.418445,-25.98311 L 65.248901,45.147008 63.777543,45.5942 C 42.662968,51.288295 25.592846,49.777632 18.470555,48.544332 8.3735118,46.803027 3.0921981,44.584867 3.5861857,52.265739 4.0162463,59.03962 5.6297709,69.541584 9.3259637,83.413431 17.322614,113.45167 43.750541,171.33298 93.695643,157.88089 L 95.167,157.41886 Z M 28.492993,83.825767 63.987419,74.474785 c 0,0 -1.034548,13.654555 -14.340768,17.162378 -13.309854,3.504116 -21.153658,-7.811396 -21.153658,-7.811396 z"
|
59
|
-
fill="#d65348"
|
60
|
-
id="path5" /><path
|
61
|
-
d="m 150.25466,143.65752 -1.37569,-0.33447 c -30.41869,-8.90972 -35.11012,-33.16636 -35.11012,-33.16636 l 42.13689,11.77828 22.30842,-85.723641 -0.26994,-0.07119 C 150.58171,28.812269 132.4278,15.996032 125.23416,9.9719198 115.03775,1.4315193 110.55248,-4.5037476 106.1384,4.473833 102.23975,12.392244 97.249446,25.27923 92.419329,43.319677 81.952963,82.385557 74.130442,164.82534 138.83161,182.17238 l 1.32601,0.29887 z M 106.66791,72.160957 c 0,0 10.19642,-15.858625 27.49007,-10.943223 17.30477,4.915403 18.64486,24.04676 18.64486,24.04676 z"
|
62
|
-
fill="#1d8d22"
|
63
|
-
id="path6" /><path
|
64
|
-
d="m 88.460606,126.07242 -8.064286,2.28861 c 1.9052,10.74002 5.263218,21.04694 10.533853,30.15245 0.917373,-0.20246 1.827331,-0.37674 2.761762,-0.63259 2.448802,-0.66078 4.719617,-1.47878 6.905885,-2.37094 -5.889136,-8.73915 -9.784822,-18.8043 -12.137214,-29.43753 z M 85.311722,50.428025 c -4.144126,15.467054 -7.851443,37.729496 -6.830985,60.059425 1.82659,-0.79278 3.756263,-1.53143 5.899521,-2.13955 l 1.492864,-0.33373 c -1.819915,-23.851711 2.114335,-48.157293 6.546207,-64.694493 1.123542,-4.183432 2.25005,-8.074668 3.37285,-11.703374 -1.808791,1.150981 -3.756263,2.330885 -5.974424,3.546387 -1.495831,4.617274 -3.006494,9.663942 -4.506033,15.265335 z"
|
65
|
-
fill="#c04b41"
|
66
|
-
id="path7" /></g></svg>
|