@muuktest/amikoo-reporter 1.0.3 → 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/dist/amikooArtifacts.d.ts +22 -0
- package/dist/amikooArtifacts.d.ts.map +1 -0
- package/dist/amikooArtifacts.js +98 -0
- package/dist/amikooArtifacts.js.map +1 -0
- package/dist/apiUtils.d.ts +1 -0
- package/dist/apiUtils.d.ts.map +1 -1
- package/dist/apiUtils.js +8 -2
- package/dist/apiUtils.js.map +1 -1
- package/dist/controlHubReporter.d.ts +4 -0
- package/dist/controlHubReporter.d.ts.map +1 -1
- package/dist/controlHubReporter.js +124 -45
- package/dist/controlHubReporter.js.map +1 -1
- package/dist/reporterOrder.d.ts +2 -0
- package/dist/reporterOrder.d.ts.map +1 -0
- package/dist/reporterOrder.js +30 -0
- package/dist/reporterOrder.js.map +1 -0
- package/dist/s3Upload.d.ts +6 -0
- package/dist/s3Upload.d.ts.map +1 -0
- package/dist/s3Upload.js +39 -0
- package/dist/s3Upload.js.map +1 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +132 -0
- package/dist/utils.js.map +1 -1
- package/dist/videoUtils.js +8 -8
- package/dist/videoUtils.js.map +1 -1
- package/dist/zipUtils.d.ts +3 -0
- package/dist/zipUtils.d.ts.map +1 -0
- package/dist/zipUtils.js +165 -0
- package/dist/zipUtils.js.map +1 -0
- package/install.js +118 -22
- package/package.json +3 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface AmikooArtifact {
|
|
2
|
+
hash: string;
|
|
3
|
+
testTitle: string;
|
|
4
|
+
localPath: string;
|
|
5
|
+
attachmentName: string;
|
|
6
|
+
specFile: string;
|
|
7
|
+
}
|
|
8
|
+
interface UploadOptions {
|
|
9
|
+
token: string;
|
|
10
|
+
amikooKey: string;
|
|
11
|
+
signedUrlEndpoint?: string;
|
|
12
|
+
repoRoot: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function collectAmikooArtifacts(result: {
|
|
15
|
+
attachments?: Array<{
|
|
16
|
+
name?: string;
|
|
17
|
+
path?: string;
|
|
18
|
+
}>;
|
|
19
|
+
}, testId: string, fullTitle: string, specFile: string): AmikooArtifact[];
|
|
20
|
+
export declare function uploadAmikooArtifacts(files: AmikooArtifact[], opts: UploadOptions): Promise<void>;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=amikooArtifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amikooArtifacts.d.ts","sourceRoot":"","sources":["../controlHub/amikooArtifacts.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAcD,wBAAgB,sBAAsB,CACpC,MAAM,EAAE;IAAE,WAAW,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,EACjE,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,cAAc,EAAE,CAclB;AAED,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,cAAc,EAAE,EACvB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.collectAmikooArtifacts = collectAmikooArtifacts;
|
|
7
|
+
exports.uploadAmikooArtifacts = uploadAmikooArtifacts;
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const os_1 = __importDefault(require("os"));
|
|
11
|
+
const apiUtils_1 = require("./apiUtils");
|
|
12
|
+
const zipUtils_1 = require("./zipUtils");
|
|
13
|
+
const s3Upload_1 = require("./s3Upload");
|
|
14
|
+
const SIGNED_URL_ENDPOINTS = {
|
|
15
|
+
prod: 'https://prgm4fborb.execute-api.us-east-2.amazonaws.com/prod/mcp/getSignedUrl',
|
|
16
|
+
staging: 'https://prgm4fborb.execute-api.us-east-2.amazonaws.com/staging/mcp/getSignedUrl',
|
|
17
|
+
};
|
|
18
|
+
function resolveSignedUrlEndpoint() {
|
|
19
|
+
if (process.env.AMIKOO_SIGNED_URL_ENDPOINT)
|
|
20
|
+
return process.env.AMIKOO_SIGNED_URL_ENDPOINT;
|
|
21
|
+
return (0, apiUtils_1.getControlHubUrl)() === 'https://app.amikoo.ai'
|
|
22
|
+
? SIGNED_URL_ENDPOINTS.prod
|
|
23
|
+
: SIGNED_URL_ENDPOINTS.staging;
|
|
24
|
+
}
|
|
25
|
+
function collectAmikooArtifacts(result, testId, fullTitle, specFile) {
|
|
26
|
+
const out = [];
|
|
27
|
+
for (const att of result.attachments || []) {
|
|
28
|
+
if (typeof att?.name === 'string' && att.name.startsWith('amikoo-') && att.path) {
|
|
29
|
+
out.push({
|
|
30
|
+
hash: testId,
|
|
31
|
+
testTitle: fullTitle,
|
|
32
|
+
localPath: att.path,
|
|
33
|
+
attachmentName: att.name.slice('amikoo-'.length),
|
|
34
|
+
specFile,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
async function uploadAmikooArtifacts(files, opts) {
|
|
41
|
+
if (!files.length)
|
|
42
|
+
return;
|
|
43
|
+
if (!opts.amikooKey) {
|
|
44
|
+
console.warn('[amikoo-upload] AMIKOO_KEY missing; skipping artifact upload');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const groups = new Map();
|
|
48
|
+
for (const f of files) {
|
|
49
|
+
const bucket = groups.get(f.hash) || [];
|
|
50
|
+
bucket.push(f);
|
|
51
|
+
groups.set(f.hash, bucket);
|
|
52
|
+
}
|
|
53
|
+
console.log(`[amikoo-upload] uploading ${groups.size} test(s)`);
|
|
54
|
+
const results = await Promise.allSettled(Array.from(groups.entries()).map(([hash, group]) => uploadSingleTest(hash, group, opts)));
|
|
55
|
+
const succeeded = results.filter(r => r.status === 'fulfilled').length;
|
|
56
|
+
const failed = results.length - succeeded;
|
|
57
|
+
console.log(`[amikoo-upload] summary: ${succeeded}/${results.length} succeeded, ${failed} failed`);
|
|
58
|
+
}
|
|
59
|
+
async function uploadSingleTest(hash, group, opts) {
|
|
60
|
+
const testTitle = group[0].testTitle;
|
|
61
|
+
const specFile = group[0].specFile;
|
|
62
|
+
const slug = sanitizeSlug(testTitle);
|
|
63
|
+
const zipPath = path_1.default.join(os_1.default.tmpdir(), `amikoo-${hash.slice(0, 8)}-${Date.now()}.zip`);
|
|
64
|
+
try {
|
|
65
|
+
await (0, zipUtils_1.buildZipForTest)(zipPath, specFile, group, opts.repoRoot);
|
|
66
|
+
const endpoint = opts.signedUrlEndpoint ?? resolveSignedUrlEndpoint();
|
|
67
|
+
const { sourcePath, signedUrl } = await (0, s3Upload_1.requestSignedUrl)(endpoint, opts.amikooKey, slug);
|
|
68
|
+
await (0, s3Upload_1.uploadZipToS3)(zipPath, signedUrl);
|
|
69
|
+
const upsertResponse = await apiUtils_1.api.post('/test_execution_data/upsert', opts.token, {
|
|
70
|
+
hash,
|
|
71
|
+
failureFilesPathInS3: sourcePath,
|
|
72
|
+
});
|
|
73
|
+
if (!upsertResponse.success) {
|
|
74
|
+
throw new Error(`upsert failed: ${upsertResponse.error}`);
|
|
75
|
+
}
|
|
76
|
+
console.log(`[amikoo-upload] ${slug} uploaded to ${sourcePath}`);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
80
|
+
console.error(`[amikoo-upload] ${slug} failed: ${msg}`);
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
try {
|
|
85
|
+
fs_1.default.unlinkSync(zipPath);
|
|
86
|
+
}
|
|
87
|
+
catch { /* ignore */ }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function sanitizeSlug(title) {
|
|
91
|
+
return title
|
|
92
|
+
.toLowerCase()
|
|
93
|
+
.replace(/\s+/g, '_')
|
|
94
|
+
.replace(/[^a-z0-9_\-]/g, '_')
|
|
95
|
+
.replace(/_+/g, '_')
|
|
96
|
+
.replace(/^_+|_+$/g, '');
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=amikooArtifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amikooArtifacts.js","sourceRoot":"","sources":["../controlHub/amikooArtifacts.ts"],"names":[],"mappings":";;;;;AAkCA,wDAmBC;AAED,sDA6BC;AApFD,4CAAoB;AACpB,gDAAwB;AACxB,4CAAoB;AACpB,yCAAmD;AACnD,yCAA6C;AAC7C,yCAA6D;AAiB7D,MAAM,oBAAoB,GAAG;IAC3B,IAAI,EAAE,8EAA8E;IACpF,OAAO,EAAE,iFAAiF;CAC3F,CAAC;AAEF,SAAS,wBAAwB;IAC/B,IAAI,OAAO,CAAC,GAAG,CAAC,0BAA0B;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC;IAC1F,OAAO,IAAA,2BAAgB,GAAE,KAAK,uBAAuB;QACnD,CAAC,CAAC,oBAAoB,CAA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}
|
package/dist/apiUtils.d.ts
CHANGED
package/dist/apiUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiUtils.d.ts","sourceRoot":"","sources":["../controlHub/apiUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apiUtils.d.ts","sourceRoot":"","sources":["../controlHub/apiUtils.ts"],"names":[],"mappings":"AAKA,wBAAgB,gBAAgB,IAAI,MAAM,CAIzC;AAID,KAAK,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE9D,UAAU,iBAAiB;IACzB,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED,UAAU,WAAW,CAAC,CAAC,GAAG,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CA2C7F;AAGD,eAAO,MAAM,GAAG;UACR,CAAC,kBAAkB,MAAM,SAAS,MAAM;WAGvC,CAAC,kBAAkB,MAAM,SAAS,MAAM,SAAS,GAAG;UAGrD,CAAC,kBAAkB,MAAM,SAAS,MAAM,SAAS,GAAG;aAGjD,CAAC,kBAAkB,MAAM,SAAS,MAAM;CAElD,CAAC"}
|
package/dist/apiUtils.js
CHANGED
|
@@ -4,11 +4,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.api = void 0;
|
|
7
|
+
exports.getControlHubUrl = getControlHubUrl;
|
|
7
8
|
exports.apiRequest = apiRequest;
|
|
8
9
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
9
10
|
dotenv_1.default.config();
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
const DEFAULT_CONTROLHUB_URL = 'https://app.amikoo.ai';
|
|
12
|
+
function getControlHubUrl() {
|
|
13
|
+
const raw = (process.env.CONTROLHUB_URL || '').trim();
|
|
14
|
+
const url = raw || DEFAULT_CONTROLHUB_URL;
|
|
15
|
+
return url.replace(/\/+$/, '').toLowerCase();
|
|
16
|
+
}
|
|
17
|
+
const BASE_URL = getControlHubUrl();
|
|
12
18
|
/**
|
|
13
19
|
* Makes an API request to the amikoo-reporter backend
|
|
14
20
|
* @param options - The request options including method, endpoint, token, and optional body
|
package/dist/apiUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiUtils.js","sourceRoot":"","sources":["../controlHub/apiUtils.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"apiUtils.js","sourceRoot":"","sources":["../controlHub/apiUtils.ts"],"names":[],"mappings":";;;;;;AAKA,4CAIC;AAwBD,gCA2CC;AA5ED,oDAA4B;AAC5B,gBAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAEvD,SAAgB,gBAAgB;IAC9B,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACtD,MAAM,GAAG,GAAG,GAAG,IAAI,sBAAsB,CAAC;IAC1C,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AAC/C,CAAC;AAED,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;AAiBpC;;;;GAIG;AACI,KAAK,UAAU,UAAU,CAAU,OAA0B;IAClE,MAAM,EAAE,MAAM,EAAE,Q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CAAC;AACH,CAAC;AAED,sBAAsB;AACT,QAAA,GAAG,GAAG;IACjB,GAAG,EAAE,CAAU,QAAgB,EAAE,KAAa,EAAE,EAAE,CAChD,UAAU,CAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAEnD,IAAI,EAAE,CAAU,QAAgB,EAAE,KAAa,EAAE,IAAU,EAAE,EAAE,CAC7D,UAAU,CAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAE1D,GAAG,EAAE,CAAU,QAAgB,EAAE,KAAa,EAAE,IAAU,EAAE,EAAE,CAC5D,UAAU,CAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAEzD,MAAM,EAAE,CAAU,QAAgB,EAAE,KAAa,EAAE,EAAE,CACnD,UAAU,CAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;CACvD,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Reporter } from '@playwright/test/reporter';
|
|
2
|
+
import { AmikooArtifact } from './amikooArtifacts';
|
|
2
3
|
declare class MyReporter implements Reporter {
|
|
3
4
|
testExecutionData: any[];
|
|
4
5
|
videos: any[];
|
|
6
|
+
amikooFiles: AmikooArtifact[];
|
|
5
7
|
authInfo: any;
|
|
6
8
|
organizationId: string;
|
|
7
9
|
executionNumber: number;
|
|
@@ -18,6 +20,8 @@ declare class MyReporter implements Reporter {
|
|
|
18
20
|
private access_token;
|
|
19
21
|
private owner;
|
|
20
22
|
private key;
|
|
23
|
+
private testsInfo;
|
|
24
|
+
private onBeginDonePromises;
|
|
21
25
|
onBegin(config: any, suite: any): Promise<void>;
|
|
22
26
|
onTestBegin(test: any): Promise<void>;
|
|
23
27
|
onError(error: any): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controlHubReporter.d.ts","sourceRoot":"","sources":["../controlHub/controlHubReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"controlHubReporter.d.ts","sourceRoot":"","sources":["../controlHub/controlHubReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAKrD,OAAO,EAAyB,cAAc,EAA0B,MAAM,mBAAmB,CAAC;AAKlG,cAAM,UAAW,YAAW,QAAQ;IAElC,iBAAiB,EAAE,GAAG,EAAE,CAAM;IAC9B,MAAM,EAAE,GAAG,EAAE,CAAM;IACnB,WAAW,EAAE,cAAc,EAAE,CAAM;IACnC,QAAQ,EAAE,GAAG,CAAC;IACd,cAAc,EAAE,MAAM,CAAM;IAC5B,eAAe,EAAE,MAAM,CAAK;IAC5B,OAAO,EAAE,GAAG,EAAE,CAAM;IACpB,kBAAkB,EAAE,MAAM,CAAK;IAC/B,OAAO,EAAE,MAAM,CAAgB;IAC/B,gBAAgB,EAAE,OAAO,CAAS;IAClC,yBAAyB,EAAE,GAAG,EAAE,CAAM;IACtC,GAAG,EAAE,GAAG,CAAC;IACT,eAAe,EAAE,GAAG,EAAE,CAAM;IAE5B,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,GAAG,CAAU;IACrB,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,mBAAmB,CAAuB;IAE5C,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG;IA+C/B,WAAW,CAAC,IAAI,EAAE,GAAG;IAIrB,OAAO,CAAC,KAAK,EAAE,GAAG;IAalB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG;IA8EhC,KAAK,CAAC,MAAM,EAAE,GAAG;CA+ExB;AACD,eAAe,UAAU,CAAC"}
|
|
@@ -7,12 +7,15 @@ const gitUtils_1 = require("./gitUtils");
|
|
|
7
7
|
const apiUtils_1 = require("./apiUtils");
|
|
8
8
|
const videoUtils_1 = require("./videoUtils");
|
|
9
9
|
const utils_1 = require("./utils");
|
|
10
|
+
const amikooArtifacts_1 = require("./amikooArtifacts");
|
|
11
|
+
const reporterOrder_1 = require("./reporterOrder");
|
|
10
12
|
const path_1 = __importDefault(require("path"));
|
|
11
13
|
const crypto_1 = __importDefault(require("crypto"));
|
|
12
14
|
class MyReporter {
|
|
13
15
|
constructor() {
|
|
14
16
|
this.testExecutionData = [];
|
|
15
17
|
this.videos = [];
|
|
18
|
+
this.amikooFiles = [];
|
|
16
19
|
this.organizationId = '';
|
|
17
20
|
this.executionNumber = 0;
|
|
18
21
|
this.hashIds = [];
|
|
@@ -21,45 +24,60 @@ class MyReporter {
|
|
|
21
24
|
this.compilationError = false;
|
|
22
25
|
this.filesWithCompilationError = [];
|
|
23
26
|
this.testEndPromises = [];
|
|
27
|
+
this.testsInfo = [];
|
|
28
|
+
this.onBeginDonePromises = [];
|
|
24
29
|
}
|
|
25
30
|
async onBegin(config, suite) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
31
|
+
(0, reporterOrder_1.checkReporterOrder)(config);
|
|
32
|
+
// Store initialization work as a promise that onTestEnd will await
|
|
33
|
+
const initPromise = (async () => {
|
|
34
|
+
try {
|
|
35
|
+
// We need to obtain a token from control hub so we can send API requests.
|
|
36
|
+
this.key = process.env.AMIKOO_KEY || '';
|
|
37
|
+
const tokenResponse = await apiUtils_1.api.post('/validate_key', '', { "key": this.key });
|
|
38
|
+
if (tokenResponse.success && tokenResponse.data) {
|
|
39
|
+
this.access_token = tokenResponse.data.access_token;
|
|
40
|
+
}
|
|
41
|
+
const context = await (0, gitUtils_1.getGitContext)(this.access_token);
|
|
42
|
+
this.repositoryId = context.repositoryId;
|
|
43
|
+
this.repositoryName = context.repositoryName;
|
|
44
|
+
this.branch = context.branch;
|
|
45
|
+
this.owner = context.owner;
|
|
46
|
+
if (!this.access_token) {
|
|
47
|
+
console.warn('\n⚠ Warning: Failed to obtain access token');
|
|
48
|
+
console.warn(' Feedback data will not be sent to amikoo-reporter, and execution data will not be saved.\n');
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// Get execution number and test information in parallel
|
|
52
|
+
const [executionData, testsInfo] = await Promise.all([
|
|
53
|
+
(0, utils_1.getExecutionNumber)(this.access_token),
|
|
54
|
+
(0, utils_1.getTestsInfo)(suite, this.access_token)
|
|
55
|
+
]);
|
|
56
|
+
if (executionData && testsInfo) {
|
|
57
|
+
this.executionNumber = executionData.executionNumber;
|
|
58
|
+
this.organizationId = executionData.organizationId;
|
|
59
|
+
this.testsInfo = testsInfo;
|
|
60
|
+
}
|
|
61
|
+
console.log(`\n🚀 Starting test run`);
|
|
62
|
+
console.log(` Repository: ${this.repositoryName}`);
|
|
63
|
+
console.log(` Branch: ${this.branch}\n`);
|
|
64
|
+
}
|
|
48
65
|
}
|
|
49
|
-
|
|
50
|
-
console.error('
|
|
66
|
+
catch (error) {
|
|
67
|
+
console.error('\n✖ Error during reporter initialization:', error);
|
|
51
68
|
}
|
|
52
|
-
|
|
53
|
-
|
|
69
|
+
})();
|
|
70
|
+
this.onBeginDonePromises.push(initPromise);
|
|
54
71
|
}
|
|
55
72
|
async onTestBegin(test) {
|
|
56
|
-
console.log(`Starting test ${test.title}`);
|
|
73
|
+
console.log(` ▶ Starting execution of test : ${test.title}`);
|
|
57
74
|
}
|
|
58
75
|
async onError(error) {
|
|
59
|
-
console.log("Tests generated an error during execution. Error = ", error);
|
|
60
76
|
const message = error?.message?.replace(/^(.*: )+/, '').trim();
|
|
61
77
|
this.compilationError = true;
|
|
78
|
+
console.error(`\n✖ Compilation error: ${message}`);
|
|
62
79
|
if (error?.location?.file) {
|
|
80
|
+
console.error(` File: ${error.location.file}\n`);
|
|
63
81
|
this.filesWithCompilationError.push({
|
|
64
82
|
"file": error.location.file,
|
|
65
83
|
"message": message,
|
|
@@ -67,20 +85,40 @@ class MyReporter {
|
|
|
67
85
|
}
|
|
68
86
|
}
|
|
69
87
|
async onTestEnd(test, result) {
|
|
70
|
-
|
|
71
|
-
|
|
88
|
+
// Wait for onBegin to complete before processing test results
|
|
89
|
+
try {
|
|
90
|
+
await Promise.all(this.onBeginDonePromises);
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
console.error(' ✖ Error waiting for initialization:', error);
|
|
94
|
+
}
|
|
95
|
+
const statusIcon = result.status === 'passed' ? '✔' : '✖';
|
|
96
|
+
const statusText = result.status === 'passed' ? 'Passed' : 'Failed';
|
|
97
|
+
console.log(` ${statusIcon} Finished: ${test.title} (${statusText})`);
|
|
98
|
+
const promise = (async () => {
|
|
72
99
|
try {
|
|
100
|
+
// Normalize paths once for cross-platform compatibility (Windows backslashes → forward slashes)
|
|
101
|
+
const normalizedFullPath = test.location.file.replace(/\\/g, '/');
|
|
102
|
+
const normalizedRelativePath = path_1.default.relative(process.cwd(), test.location.file).replace(/\\/g, '/');
|
|
73
103
|
// Get clean title path without project name and empty strings
|
|
74
104
|
const filePath = path_1.default.basename(test.location.file);
|
|
75
|
-
// Get the file location relative to the repository
|
|
76
|
-
const fullPath = test.location.file;
|
|
77
|
-
const repoIndex = fullPath.indexOf(this.repositoryName);
|
|
78
|
-
const fileLocation = fullPath.slice(repoIndex + this.repositoryName.length + 1);
|
|
79
105
|
// Get the full test title including parent suites
|
|
80
106
|
const fullTitle = await (0, utils_1.getSuiteNames)(test);
|
|
107
|
+
// Look up the test from API results by file path and title
|
|
108
|
+
const matchedTest = (0, utils_1.findTest)(this.testsInfo, normalizedFullPath, fullTitle);
|
|
109
|
+
// Use matched test filePath, or fall back to repo-relative path to avoid leaking absolute paths
|
|
110
|
+
const fileLocation = matchedTest ? matchedTest.filePath : normalizedRelativePath;
|
|
81
111
|
// Create a unique hash ID for the test using repository ID, file path, full title, and commit SHA
|
|
82
112
|
const rawIdentity = `${this.owner}/${this.repositoryId}:${fileLocation}:${fullTitle}`;
|
|
83
113
|
const testId = crypto_1.default.createHash('sha256').update(rawIdentity).digest('hex');
|
|
114
|
+
// Get the error message if the test failed
|
|
115
|
+
let errorData = {};
|
|
116
|
+
try {
|
|
117
|
+
errorData = (0, utils_1.extractErrorDetails)(result) || {};
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// Silently ignore errors extracting error details - don't fail the reporter
|
|
121
|
+
}
|
|
84
122
|
const duration = parseInt(result.duration) / 1000;
|
|
85
123
|
const payload = {
|
|
86
124
|
hashId: testId,
|
|
@@ -94,7 +132,10 @@ class MyReporter {
|
|
|
94
132
|
fullTitle,
|
|
95
133
|
duration: duration,
|
|
96
134
|
executionAt: new Date().toISOString(),
|
|
97
|
-
result: result.status === "passed" ? true : false
|
|
135
|
+
result: result.status === "passed" ? true : false,
|
|
136
|
+
error: errorData,
|
|
137
|
+
systemOutput: (result.stdout) ? result.stdout.join(' ') : '',
|
|
138
|
+
systemError: (result.stderr) ? result.stderr.join(' ') : '',
|
|
98
139
|
};
|
|
99
140
|
this.testExecutionData.push(payload);
|
|
100
141
|
// Collect video for later batch processing
|
|
@@ -102,20 +143,24 @@ class MyReporter {
|
|
|
102
143
|
if (videoPath) {
|
|
103
144
|
this.videos.push({ path: videoPath, testId });
|
|
104
145
|
}
|
|
146
|
+
this.amikooFiles.push(...(0, amikooArtifacts_1.collectAmikooArtifacts)(result, testId, fullTitle, test.location.file));
|
|
105
147
|
}
|
|
106
148
|
catch (error) {
|
|
107
|
-
console.
|
|
108
|
-
reject(error);
|
|
149
|
+
console.error(` ✖ Error processing test "${test.title}":`, error);
|
|
109
150
|
}
|
|
110
|
-
|
|
111
|
-
});
|
|
151
|
+
})();
|
|
112
152
|
// save the promise so the onEnd can wait for this code to complete.
|
|
113
153
|
this.testEndPromises.push(promise);
|
|
114
154
|
}
|
|
115
155
|
async onEnd(result) {
|
|
116
|
-
console.log('
|
|
117
|
-
|
|
118
|
-
|
|
156
|
+
console.log('\n⏳ Waiting for all tests to complete...');
|
|
157
|
+
try {
|
|
158
|
+
await Promise.all([...this.onBeginDonePromises, ...this.testEndPromises]);
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
console.error('✖ Error waiting for test promises:', error);
|
|
162
|
+
}
|
|
163
|
+
console.log('✔ All tests completed\n');
|
|
119
164
|
if (this.executionNumber) {
|
|
120
165
|
// Process videos and get presigned URLs
|
|
121
166
|
const videoResult = await (0, videoUtils_1.processVideos)(this.videos, this.organizationId, this.executionNumber, this.access_token);
|
|
@@ -133,14 +178,48 @@ class MyReporter {
|
|
|
133
178
|
// Send API to BE here
|
|
134
179
|
const feedbackResponse = await apiUtils_1.api.post('/execution/feedback', this.access_token, feedbackData);
|
|
135
180
|
if (feedbackResponse.success) {
|
|
136
|
-
console.log('Execution report sent successfully');
|
|
181
|
+
console.log('✔ Execution report sent successfully\n');
|
|
182
|
+
// Check for warnings about tests not found
|
|
183
|
+
const responseData = feedbackResponse.data;
|
|
184
|
+
if (responseData?.testsNotFound?.length) {
|
|
185
|
+
console.warn(`⚠ ${responseData.warnings || 'Some tests were not found'}`);
|
|
186
|
+
responseData.testsNotFound.forEach((test) => {
|
|
187
|
+
console.warn(` • ${test.testName}`);
|
|
188
|
+
});
|
|
189
|
+
console.warn(' Please sync your repository to register these tests.\n');
|
|
190
|
+
}
|
|
137
191
|
}
|
|
138
192
|
else {
|
|
139
|
-
|
|
193
|
+
const errorData = (feedbackResponse.error || {});
|
|
194
|
+
console.error(`\n✖ Failed to send execution report\n`);
|
|
195
|
+
console.error(` ${errorData.message || errorData}\n`);
|
|
196
|
+
if (errorData.activeRepositories?.length) {
|
|
197
|
+
console.error(` Available repositories:`);
|
|
198
|
+
errorData.activeRepositories.forEach((repo) => {
|
|
199
|
+
console.error(` • ${repo.name} (${repo.id})`);
|
|
200
|
+
});
|
|
201
|
+
console.error('');
|
|
202
|
+
}
|
|
203
|
+
if (errorData.activeBranches?.length) {
|
|
204
|
+
console.error(` Available branches:`);
|
|
205
|
+
errorData.activeBranches.forEach((branch) => {
|
|
206
|
+
console.error(` • ${branch}`);
|
|
207
|
+
});
|
|
208
|
+
console.error('');
|
|
209
|
+
}
|
|
140
210
|
}
|
|
141
211
|
}
|
|
142
212
|
else {
|
|
143
|
-
console.warn('Execution number not available
|
|
213
|
+
console.warn('\n⚠ Execution number not available');
|
|
214
|
+
console.warn(' Execution report will not be sent to amikoo-reporter.');
|
|
215
|
+
console.warn(' Execution data will not be saved.\n');
|
|
216
|
+
}
|
|
217
|
+
if (this.access_token && this.amikooFiles.length) {
|
|
218
|
+
await (0, amikooArtifacts_1.uploadAmikooArtifacts)(this.amikooFiles, {
|
|
219
|
+
token: this.access_token,
|
|
220
|
+
amikooKey: this.key,
|
|
221
|
+
repoRoot: process.cwd(),
|
|
222
|
+
});
|
|
144
223
|
}
|
|
145
224
|
(0, utils_1.checkForUpdates)();
|
|
146
225
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controlHubReporter.js","sourceRoot":"","sources":["../controlHub/controlHubReporter.ts"],"names":[],"mappings":";;;;;AACA,yCAA2C;AAC3C,yCAAiC;AACjC,6CAA6E;AAC7E,
|
|
1
|
+
{"version":3,"file":"controlHubReporter.js","sourceRoot":"","sources":["../controlHub/controlHubReporter.ts"],"names":[],"mappings":";;;;;AACA,yCAA2C;AAC3C,yCAAiC;AACjC,6CAA6E;AAC7E,mCAA0H;AAC1H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@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkReporterOrder = checkReporterOrder;
|
|
4
|
+
const AMIKOO_PLAYWRIGHT_PACKAGE = '@muuktest/amikoo-playwright/reporter';
|
|
5
|
+
const CONTROLHUB_PACKAGE = '@muuktest/amikoo-reporter';
|
|
6
|
+
function checkReporterOrder(config) {
|
|
7
|
+
const reporters = config?.reporter;
|
|
8
|
+
if (!Array.isArray(reporters))
|
|
9
|
+
return;
|
|
10
|
+
const describe = (r) => {
|
|
11
|
+
if (typeof r === 'string')
|
|
12
|
+
return r;
|
|
13
|
+
if (Array.isArray(r) && typeof r[0] === 'string')
|
|
14
|
+
return r[0];
|
|
15
|
+
return '';
|
|
16
|
+
};
|
|
17
|
+
const amikooIdx = reporters.findIndex((r) => describe(r).includes(AMIKOO_PLAYWRIGHT_PACKAGE));
|
|
18
|
+
const controlhubIdx = reporters.findIndex((r) => describe(r).includes(CONTROLHUB_PACKAGE));
|
|
19
|
+
if (amikooIdx >= 0 && controlhubIdx >= 0 && amikooIdx > controlhubIdx) {
|
|
20
|
+
const bar = '==============================================================';
|
|
21
|
+
console.warn(bar);
|
|
22
|
+
console.warn(' AMIKOO REPORTER ORDER WARNING');
|
|
23
|
+
console.warn(` ${CONTROLHUB_PACKAGE} is listed before`);
|
|
24
|
+
console.warn(` ${AMIKOO_PLAYWRIGHT_PACKAGE} in playwright.config.`);
|
|
25
|
+
console.warn(` Reorder so ${AMIKOO_PLAYWRIGHT_PACKAGE} runs first,`);
|
|
26
|
+
console.warn(' otherwise its per-test enrichment may not be finalized in time.');
|
|
27
|
+
console.warn(bar);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=reporterOrder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporterOrder.js","sourceRoot":"","sources":["../controlHub/reporterOrder.ts"],"names":[],"mappings":";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,gBAAgB,yBAAyB,cAAc,CAAC,CAAC;QACtE,OAAO,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC;QAClF,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function requestSignedUrl(endpoint: string, amikooKey: string, testSlug: string): Promise<{
|
|
2
|
+
sourcePath: string;
|
|
3
|
+
signedUrl: string;
|
|
4
|
+
}>;
|
|
5
|
+
export declare function uploadZipToS3(zipPath: string, signedUrl: string): Promise<void>;
|
|
6
|
+
//# sourceMappingURL=s3Upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3Upload.d.ts","sourceRoot":"","sources":["../controlHub/s3Upload.ts"],"names":[],"mappings":"AAEA,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAiBpD;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAerF"}
|
package/dist/s3Upload.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.requestSignedUrl = requestSignedUrl;
|
|
7
|
+
exports.uploadZipToS3 = uploadZipToS3;
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
async function requestSignedUrl(endpoint, amikooKey, testSlug) {
|
|
10
|
+
const response = await fetch(endpoint, {
|
|
11
|
+
method: 'POST',
|
|
12
|
+
headers: { 'Content-Type': 'application/json' },
|
|
13
|
+
body: JSON.stringify({ key: amikooKey, test_name: testSlug }),
|
|
14
|
+
});
|
|
15
|
+
if (!response.ok) {
|
|
16
|
+
throw new Error(`Signed URL request failed: ${response.status} ${response.statusText}`);
|
|
17
|
+
}
|
|
18
|
+
const data = await response.json();
|
|
19
|
+
if (!data?.sourcePath || !data?.signedUrl) {
|
|
20
|
+
throw new Error('Signed URL response missing sourcePath or signedUrl');
|
|
21
|
+
}
|
|
22
|
+
return { sourcePath: data.sourcePath, signedUrl: data.signedUrl };
|
|
23
|
+
}
|
|
24
|
+
async function uploadZipToS3(zipPath, signedUrl) {
|
|
25
|
+
const buffer = fs_1.default.readFileSync(zipPath);
|
|
26
|
+
const response = await fetch(signedUrl, {
|
|
27
|
+
method: 'PUT',
|
|
28
|
+
body: buffer,
|
|
29
|
+
headers: {
|
|
30
|
+
'Content-Type': 'application/zip',
|
|
31
|
+
'x-amz-server-side-encryption': 'AES256',
|
|
32
|
+
'x-amz-meta-purpose': 'muukmcp',
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
if (!response.ok) {
|
|
36
|
+
throw new Error(`S3 upload failed: ${response.status} ${response.statusText}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=s3Upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3Upload.js","sourceRoot":"","sources":["../controlHub/s3Upload.ts"],"names":[],"mappings":";;;;;AAEA,4CAqBC;AAED,sCAeC;AAxCD,4CAAoB;AAEb,KAAK,UAAU,gBAAgB,CACpC,QAAgB,EAChB,SAAiB,EACjB,QAAgB;IAEhB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,EAAE;QACrC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;KAC9D,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED,MAAM,IAAI,GAAQ,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACxC,IAAI,CAAC,IAAI,EAAE,UAAU,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;AACpE,CAAC;AAEM,KAAK,UAAU,aAAa,CAAC,OAAe,EAAE,SAAiB;IACpE,MAAM,MAAM,GAAG,YAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,SAAS,EAAE;QACtC,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE;YACP,cAAc,EAAE,iBAAiB;YACjC,8BAA8B,EAAE,QAAQ;YACxC,oBAAoB,EAAE,SAAS;SAChC;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IACjF,CAAC;AACH,CAAC"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
export declare function getExecutionNumber(accessToken: string): Promise<{
|
|
2
|
+
executionNumber: number;
|
|
3
|
+
organizationId: string;
|
|
4
|
+
} | null>;
|
|
5
|
+
export declare function getTestsInfo(suite: any, accessToken: string): Promise<any[]>;
|
|
6
|
+
export declare function buildTestData(suite: any): Promise<Array<{
|
|
7
|
+
file: string;
|
|
8
|
+
name: string;
|
|
9
|
+
}>>;
|
|
10
|
+
export declare function findTest(tests: any[], fullFilePath: string, fullTitlePath: string): any | undefined;
|
|
1
11
|
export declare function getSuiteNames(test: any): Promise<string>;
|
|
2
12
|
export declare function checkForUpdates(): Promise<void>;
|
|
13
|
+
export declare function stripAnsi(str: string | undefined): string;
|
|
14
|
+
export declare function extractErrorDetails(result: any): {
|
|
15
|
+
message: string;
|
|
16
|
+
failedStep: {
|
|
17
|
+
title: string;
|
|
18
|
+
location: import("playwright/types/test").Location;
|
|
19
|
+
error: string;
|
|
20
|
+
stack: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
3
23
|
//# sourceMappingURL=utils.d.ts.map
|