ortoni-report 4.0.0 → 4.0.2-beta.1
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/chunk-45EJSEX2.mjs +632 -0
- package/dist/chunk-75EAJL2U.mjs +632 -0
- package/dist/chunk-FGIYOFIC.mjs +632 -0
- package/dist/chunk-FHKWBHU6.mjs +633 -0
- package/dist/chunk-GLICR3VS.mjs +637 -0
- package/dist/chunk-HFO6XSKC.mjs +633 -0
- package/dist/chunk-HOZD6YIV.mjs +634 -0
- package/dist/chunk-IJO2YIFE.mjs +637 -0
- package/dist/chunk-INS3E7E6.mjs +638 -0
- package/dist/chunk-JEIWNUQY.mjs +632 -0
- package/dist/chunk-JPLAGYR7.mjs +632 -0
- package/dist/chunk-NM6ULN2O.mjs +632 -0
- package/dist/chunk-OZS6QIJS.mjs +638 -0
- package/dist/chunk-P57227VN.mjs +633 -0
- package/dist/chunk-QMTRYN5N.js +635 -0
- package/dist/chunk-TI33PMMQ.mjs +639 -0
- package/dist/chunk-Z5NBP5TS.mjs +635 -0
- package/dist/cli/cli.cjs +678 -0
- package/dist/cli/cli.d.cts +1 -0
- package/dist/cli/cli.js +604 -12
- package/dist/cli/cli.mjs +88 -8
- package/dist/ortoni-report.cjs +2134 -0
- package/dist/ortoni-report.d.cts +111 -0
- package/dist/ortoni-report.d.mts +1 -0
- package/dist/ortoni-report.d.ts +1 -0
- package/dist/ortoni-report.js +33 -4
- package/dist/ortoni-report.mjs +52 -567
- package/package.json +1 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Reporter, FullConfig, Suite, TestCase, TestResult, TestError, FullResult } from '@playwright/test/reporter';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Configuration options for OrtoniReport.
|
|
5
|
+
*/
|
|
6
|
+
interface OrtoniReportConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Open the report in local host (Trace viewer is accessible only in localhost)
|
|
9
|
+
* @example "always"| "never"| "on-failure";
|
|
10
|
+
* @default "never"
|
|
11
|
+
*/
|
|
12
|
+
open?: "always" | "never" | "on-failure";
|
|
13
|
+
/**
|
|
14
|
+
* The title of the HTML report.
|
|
15
|
+
* @example "Ortoni Playwright Test Report"
|
|
16
|
+
*/
|
|
17
|
+
title?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Add project on the list of the tests? (Filtering projects still works if hidden)
|
|
20
|
+
* @example true to display, false to hide.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
showProject?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The name of the project.
|
|
26
|
+
* @example "Ortoni Project"
|
|
27
|
+
*/
|
|
28
|
+
projectName?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The name of the author.
|
|
31
|
+
* @example "Koushik Chatterjee"
|
|
32
|
+
*/
|
|
33
|
+
authorName?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The type of tests being run.
|
|
36
|
+
* @example "Regression"
|
|
37
|
+
*/
|
|
38
|
+
testType?: string;
|
|
39
|
+
/**
|
|
40
|
+
* If true, images will be encoded in base64.
|
|
41
|
+
* Not recommended to use if many screenshots are present.
|
|
42
|
+
* @default false
|
|
43
|
+
* @example true
|
|
44
|
+
*/
|
|
45
|
+
base64Image?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* The local relative of the logo image.
|
|
48
|
+
* Recommended to keep within the report genrated folder.
|
|
49
|
+
* @default "ortoni-report/logo.png"
|
|
50
|
+
* @example "logo.png"
|
|
51
|
+
*/
|
|
52
|
+
logo?: string;
|
|
53
|
+
/**
|
|
54
|
+
* The filename to the html report.
|
|
55
|
+
* @example "index.html"
|
|
56
|
+
* @default "ortoni-report.html"
|
|
57
|
+
*/
|
|
58
|
+
filename?: string;
|
|
59
|
+
/**
|
|
60
|
+
* The folder name.
|
|
61
|
+
* @example "report"
|
|
62
|
+
* @default "ortoni-report"
|
|
63
|
+
*/
|
|
64
|
+
folderPath?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Port to connect
|
|
67
|
+
* @example 3600
|
|
68
|
+
*/
|
|
69
|
+
port?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Display console logs?
|
|
72
|
+
* @example boolean
|
|
73
|
+
* @default true
|
|
74
|
+
*/
|
|
75
|
+
stdIO?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Metadata for the report. ['Test Cycle': 'Cycle 1', 'Test Environment':'QA', etc]
|
|
78
|
+
* @example { "key": "value" } as string
|
|
79
|
+
*/
|
|
80
|
+
meta?: Record<string, string>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare class OrtoniReport implements Reporter {
|
|
84
|
+
private ortoniConfig;
|
|
85
|
+
private testResultProcessor;
|
|
86
|
+
private htmlGenerator;
|
|
87
|
+
private fileManager;
|
|
88
|
+
private serverManager;
|
|
89
|
+
private results;
|
|
90
|
+
private projectSet;
|
|
91
|
+
private overAllStatus;
|
|
92
|
+
private folderPath;
|
|
93
|
+
private outputFilename;
|
|
94
|
+
private outputPath;
|
|
95
|
+
private dbManager;
|
|
96
|
+
private shouldGenerateReport;
|
|
97
|
+
private showConsoleLogs;
|
|
98
|
+
private skipTraceViewer;
|
|
99
|
+
private config;
|
|
100
|
+
constructor(ortoniConfig?: OrtoniReportConfig);
|
|
101
|
+
private reportsCount;
|
|
102
|
+
onBegin(config: FullConfig, _suite: Suite): Promise<void>;
|
|
103
|
+
onStdOut(chunk: string | Buffer, _test: void | TestCase, _result: void | TestResult): void;
|
|
104
|
+
onTestEnd(test: TestCase, result: TestResult): void;
|
|
105
|
+
printsToStdio(): boolean;
|
|
106
|
+
onError(error: TestError): void;
|
|
107
|
+
onEnd(result: FullResult): Promise<void>;
|
|
108
|
+
onExit(): Promise<void>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export { OrtoniReport, type OrtoniReportConfig, OrtoniReport as default };
|
package/dist/ortoni-report.d.mts
CHANGED
|
@@ -96,6 +96,7 @@ declare class OrtoniReport implements Reporter {
|
|
|
96
96
|
private shouldGenerateReport;
|
|
97
97
|
private showConsoleLogs;
|
|
98
98
|
private skipTraceViewer;
|
|
99
|
+
private config;
|
|
99
100
|
constructor(ortoniConfig?: OrtoniReportConfig);
|
|
100
101
|
private reportsCount;
|
|
101
102
|
onBegin(config: FullConfig, _suite: Suite): Promise<void>;
|
package/dist/ortoni-report.d.ts
CHANGED
|
@@ -96,6 +96,7 @@ declare class OrtoniReport implements Reporter {
|
|
|
96
96
|
private shouldGenerateReport;
|
|
97
97
|
private showConsoleLogs;
|
|
98
98
|
private skipTraceViewer;
|
|
99
|
+
private config;
|
|
99
100
|
constructor(ortoniConfig?: OrtoniReportConfig);
|
|
100
101
|
private reportsCount;
|
|
101
102
|
onBegin(config: FullConfig, _suite: Suite): Promise<void>;
|
package/dist/ortoni-report.js
CHANGED
|
@@ -55,14 +55,21 @@ var FileManager = class {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
writeReportFile(filename, data) {
|
|
58
|
-
const templatePath = import_path.default.
|
|
58
|
+
const templatePath = import_path.default.join(__dirname, "..", "index.html");
|
|
59
|
+
console.log("temp path - " + templatePath);
|
|
59
60
|
let html = import_fs.default.readFileSync(templatePath, "utf-8");
|
|
60
61
|
const reportJSON = JSON.stringify({
|
|
61
62
|
data
|
|
62
63
|
});
|
|
63
64
|
html = html.replace("__ORTONI_TEST_REPORTDATA__", reportJSON);
|
|
65
|
+
import_fs.default.writeFileSync(filename, html);
|
|
66
|
+
return filename;
|
|
67
|
+
}
|
|
68
|
+
writeRawFile(filename, data) {
|
|
64
69
|
const outputPath = import_path.default.join(process.cwd(), this.folderPath, filename);
|
|
65
|
-
import_fs.default.
|
|
70
|
+
import_fs.default.mkdirSync(import_path.default.dirname(outputPath), { recursive: true });
|
|
71
|
+
const content = typeof data === "string" ? data : JSON.stringify(data, null, 2);
|
|
72
|
+
import_fs.default.writeFileSync(outputPath, content, "utf-8");
|
|
66
73
|
return outputPath;
|
|
67
74
|
}
|
|
68
75
|
copyTraceViewerAssets(skip) {
|
|
@@ -209,13 +216,11 @@ var HTMLGenerator = class {
|
|
|
209
216
|
meta: this.ortoniConfig.meta
|
|
210
217
|
},
|
|
211
218
|
preferences: {
|
|
212
|
-
theme: this.ortoniConfig.preferredTheme,
|
|
213
219
|
logo: this.ortoniConfig.logo || void 0,
|
|
214
220
|
showProject: this.ortoniConfig.showProject || false
|
|
215
221
|
},
|
|
216
222
|
analytics: {
|
|
217
223
|
reportData: await this.getReportData()
|
|
218
|
-
// chartTrendData: await this.chartTrendData(),
|
|
219
224
|
}
|
|
220
225
|
};
|
|
221
226
|
}
|
|
@@ -2024,6 +2029,7 @@ var OrtoniReport = class {
|
|
|
2024
2029
|
await this.dbManager.initialize(
|
|
2025
2030
|
import_path6.default.join(this.folderPath, "ortoni-data-history.sqlite")
|
|
2026
2031
|
);
|
|
2032
|
+
this.config = config?.shard;
|
|
2027
2033
|
}
|
|
2028
2034
|
onStdOut(chunk, _test, _result) {
|
|
2029
2035
|
if (this.reportsCount == 1 && this.showConsoleLogs) {
|
|
@@ -2059,6 +2065,29 @@ var OrtoniReport = class {
|
|
|
2059
2065
|
(r) => r.status !== "skipped"
|
|
2060
2066
|
);
|
|
2061
2067
|
const totalDuration = result.duration;
|
|
2068
|
+
if (this.config && this.config.total > 1) {
|
|
2069
|
+
const shard = this.config;
|
|
2070
|
+
const shardFile = `ortoni-shard-${shard.current}-of-${shard.total}.json`;
|
|
2071
|
+
const shardData = {
|
|
2072
|
+
status: result.status,
|
|
2073
|
+
duration: totalDuration,
|
|
2074
|
+
results: this.results,
|
|
2075
|
+
projectSet: Array.from(this.projectSet),
|
|
2076
|
+
userConfig: {
|
|
2077
|
+
projectName: this.ortoniConfig.projectName,
|
|
2078
|
+
authorName: this.ortoniConfig.authorName,
|
|
2079
|
+
type: this.ortoniConfig.testType,
|
|
2080
|
+
title: this.ortoniConfig.title
|
|
2081
|
+
},
|
|
2082
|
+
userMeta: {
|
|
2083
|
+
meta: this.ortoniConfig.meta
|
|
2084
|
+
}
|
|
2085
|
+
};
|
|
2086
|
+
this.fileManager.writeRawFile(shardFile, shardData);
|
|
2087
|
+
console.log(`\u{1F4E6} OrtoniReport wrote shard file: ${shardFile}`);
|
|
2088
|
+
this.shouldGenerateReport = false;
|
|
2089
|
+
return;
|
|
2090
|
+
}
|
|
2062
2091
|
const runId = await this.dbManager.saveTestRun();
|
|
2063
2092
|
if (runId !== null) {
|
|
2064
2093
|
await this.dbManager.saveTestResults(runId, this.results);
|