@bigbinary/neeto-playwright-reporter 1.0.2 → 1.1.0
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/index.cjs.js +31 -18
- package/index.cjs.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +30 -17
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var require$$6 = require('fs');
|
|
3
4
|
var require$$1 = require('util');
|
|
4
5
|
var stream = require('stream');
|
|
5
6
|
var require$$1$1 = require('path');
|
|
6
7
|
var require$$3 = require('http');
|
|
7
8
|
var require$$4 = require('https');
|
|
8
9
|
var require$$0$1 = require('url');
|
|
9
|
-
var require$$6 = require('fs');
|
|
10
10
|
var require$$4$1 = require('assert');
|
|
11
11
|
var require$$1$2 = require('tty');
|
|
12
12
|
var require$$0$2 = require('os');
|
|
@@ -16,13 +16,13 @@ var childProcess = require('child_process');
|
|
|
16
16
|
|
|
17
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
18
|
|
|
19
|
+
var require$$6__default = /*#__PURE__*/_interopDefaultLegacy(require$$6);
|
|
19
20
|
var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
|
|
20
21
|
var stream__default = /*#__PURE__*/_interopDefaultLegacy(stream);
|
|
21
22
|
var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
|
|
22
23
|
var require$$3__default = /*#__PURE__*/_interopDefaultLegacy(require$$3);
|
|
23
24
|
var require$$4__default = /*#__PURE__*/_interopDefaultLegacy(require$$4);
|
|
24
25
|
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
|
|
25
|
-
var require$$6__default = /*#__PURE__*/_interopDefaultLegacy(require$$6);
|
|
26
26
|
var require$$4__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$4$1);
|
|
27
27
|
var require$$1__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$1$2);
|
|
28
28
|
var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
|
|
@@ -18457,12 +18457,8 @@ const HEADERS_KEYS = {
|
|
|
18457
18457
|
};
|
|
18458
18458
|
const API_BASE_URL = "/api/v1";
|
|
18459
18459
|
|
|
18460
|
-
const create$2 = (ciBuildId, history_id, payload) => axios.post(`${API_BASE_URL}/reporter/runs/${ciBuildId}/test_entities/${history_id}/attempts`, {
|
|
18461
|
-
|
|
18462
|
-
});
|
|
18463
|
-
const update$1 = (ciBuildId, history_id, id, payload) => axios.put(`${API_BASE_URL}/reporter/runs/${ciBuildId}/test_entities/${history_id}/attempts/${id}`, {
|
|
18464
|
-
attempt: payload,
|
|
18465
|
-
});
|
|
18460
|
+
const create$2 = (ciBuildId, history_id, payload) => axios.post(`${API_BASE_URL}/reporter/runs/${ciBuildId}/test_entities/${history_id}/attempts`, payload, { headers: { "Content-Type": "multipart/form-data" } });
|
|
18461
|
+
const update$1 = (ciBuildId, history_id, id, payload) => axios.put(`${API_BASE_URL}/reporter/runs/${ciBuildId}/test_entities/${history_id}/attempts/${id}`, payload, { headers: { "Content-Type": "multipart/form-data" } });
|
|
18466
18462
|
const attemptsApi = { create: create$2, update: update$1 };
|
|
18467
18463
|
|
|
18468
18464
|
const ERRORS = {
|
|
@@ -18514,6 +18510,7 @@ const executeCommandLine = ({ command, messageOnError, shouldThrowError = false,
|
|
|
18514
18510
|
const createShardObject = ({ currentShard = 0, status = "running", duration = null, }) => ({
|
|
18515
18511
|
[currentShard]: { status, duration },
|
|
18516
18512
|
});
|
|
18513
|
+
const convertBufferToBlob = (buffer, contentType) => new Blob([buffer], { type: contentType });
|
|
18517
18514
|
|
|
18518
18515
|
const getDescribePath = ({ titlePath, title, project, spec, }) => titlePath.filter((item, index) => index !== 0 && item !== title && item !== project && item !== spec);
|
|
18519
18516
|
const getCurrentCommitSha = () => executeCommandLine({
|
|
@@ -18580,7 +18577,8 @@ class MyReporter {
|
|
|
18580
18577
|
test_entities: getInitializerData(config, rootSuite),
|
|
18581
18578
|
}));
|
|
18582
18579
|
}
|
|
18583
|
-
catch (
|
|
18580
|
+
catch (error) {
|
|
18581
|
+
consoleLogFormatted.error(error);
|
|
18584
18582
|
throw new Error(ERRORS.onBegin.failedToInitializeRun);
|
|
18585
18583
|
}
|
|
18586
18584
|
consoleLogFormatted.underline(MESSAGES.onBegin.testStarted);
|
|
@@ -18595,28 +18593,42 @@ class MyReporter {
|
|
|
18595
18593
|
};
|
|
18596
18594
|
this.onTestBegin = async ({ id, title }, { retry }) => {
|
|
18597
18595
|
try {
|
|
18596
|
+
const formData = new FormData();
|
|
18597
|
+
formData.append("attempt[status]", "running");
|
|
18598
18598
|
retry === 0 &&
|
|
18599
|
-
(await attemptsApi.update(this.ciBuildId, id, this.attempts[id],
|
|
18600
|
-
status: "running",
|
|
18601
|
-
}));
|
|
18599
|
+
(await attemptsApi.update(this.ciBuildId, id, this.attempts[id], formData));
|
|
18602
18600
|
}
|
|
18603
|
-
catch (
|
|
18601
|
+
catch (error) {
|
|
18604
18602
|
consoleLogFormatted.error(ERRORS.onTestBegin.failedToReportTest(title, id));
|
|
18603
|
+
console.log(error);
|
|
18605
18604
|
}
|
|
18606
18605
|
};
|
|
18607
|
-
this.onTestEnd = async ({ id, title }, { status, duration, errors, retry }) => {
|
|
18606
|
+
this.onTestEnd = async ({ id, title }, { status, duration, errors, retry, attachments }) => {
|
|
18608
18607
|
try {
|
|
18609
18608
|
const testResult = {
|
|
18610
18609
|
status,
|
|
18611
18610
|
duration,
|
|
18612
18611
|
log: errors.map(error => { var _a; return (_a = error.message) !== null && _a !== void 0 ? _a : ""; }).join("\n"),
|
|
18613
18612
|
};
|
|
18613
|
+
consoleLogFormatted.underline(title);
|
|
18614
|
+
const formData = new FormData();
|
|
18615
|
+
attachments.map(({ name, path, body, contentType }) => {
|
|
18616
|
+
consoleLogFormatted.dim(`${name}: ${path}`);
|
|
18617
|
+
if (["screenshot", "video", "trace"].includes(name)) {
|
|
18618
|
+
const buffer = path ? require$$6__default["default"].readFileSync(path) : body;
|
|
18619
|
+
formData.append(`attempt[${name}s][]`, convertBufferToBlob(buffer, contentType));
|
|
18620
|
+
}
|
|
18621
|
+
});
|
|
18622
|
+
Object.entries(testResult).map(([resultKey, resultValue]) => {
|
|
18623
|
+
formData.append(`attempt[${resultKey}]`, resultValue.toString());
|
|
18624
|
+
});
|
|
18614
18625
|
retry === 0
|
|
18615
|
-
? await attemptsApi.update(this.ciBuildId, id, this.attempts[id],
|
|
18616
|
-
: await attemptsApi.create(this.ciBuildId, id,
|
|
18626
|
+
? await attemptsApi.update(this.ciBuildId, id, this.attempts[id], formData)
|
|
18627
|
+
: await attemptsApi.create(this.ciBuildId, id, formData);
|
|
18617
18628
|
}
|
|
18618
|
-
catch (
|
|
18629
|
+
catch (error) {
|
|
18619
18630
|
consoleLogFormatted.error(ERRORS.onTestBegin.failedToReportTest(title, id));
|
|
18631
|
+
console.log(error);
|
|
18620
18632
|
}
|
|
18621
18633
|
};
|
|
18622
18634
|
this.onEnd = async ({ status, duration }) => {
|
|
@@ -18629,7 +18641,8 @@ class MyReporter {
|
|
|
18629
18641
|
}),
|
|
18630
18642
|
});
|
|
18631
18643
|
}
|
|
18632
|
-
catch (
|
|
18644
|
+
catch (error) {
|
|
18645
|
+
console.log(error);
|
|
18633
18646
|
throw new Error(ERRORS.onEnd.failedToReportRunStatus);
|
|
18634
18647
|
}
|
|
18635
18648
|
};
|