odhin-reports-playwright 1.0.4 → 1.0.6
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/lib/generate.d.ts +1 -0
- package/lib/generate.js +39 -12
- package/lib/html/base.html +3 -0
- package/lib/types/execOptions.types.d.ts +2 -1
- package/package.json +1 -1
package/lib/generate.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ declare class Generate {
|
|
|
45
45
|
private TEST_FOLDER;
|
|
46
46
|
private THEME;
|
|
47
47
|
private INDEX_FILE;
|
|
48
|
+
private CURRENT_VERSION;
|
|
48
49
|
constructor(execOptions: ExecOptions);
|
|
49
50
|
onBegin(config: FullConfig, suite: Suite): Promise<void>;
|
|
50
51
|
onTestEnd(testCase: ExecTestCase, result: ExecTestResult): Promise<void>;
|
package/lib/generate.js
CHANGED
|
@@ -13,12 +13,13 @@ const node_util_1 = __importDefault(require("node:util"));
|
|
|
13
13
|
const process_1 = require("process");
|
|
14
14
|
class Generate {
|
|
15
15
|
constructor(execOptions) {
|
|
16
|
-
//
|
|
16
|
+
// Constants
|
|
17
17
|
this.OUTPUT_FOLDER = "odhin-reports";
|
|
18
18
|
this.TITLE = "Odhin Reports";
|
|
19
19
|
this.TEST_FOLDER = "tests";
|
|
20
20
|
this.THEME = "light";
|
|
21
21
|
this.INDEX_FILE = "index.html";
|
|
22
|
+
this.CURRENT_VERSION = "1.0.6";
|
|
22
23
|
this.execOptions = execOptions;
|
|
23
24
|
this.totalDuration = 0;
|
|
24
25
|
this.help = new help_1.default(this.execOptions);
|
|
@@ -72,18 +73,22 @@ class Generate {
|
|
|
72
73
|
this.execOptions.consoleLog !== undefined
|
|
73
74
|
? this.execOptions.consoleLog
|
|
74
75
|
: true;
|
|
76
|
+
this.execOptions.simpleConsoleLog =
|
|
77
|
+
this.execOptions.simpleConsoleLog !== undefined
|
|
78
|
+
? this.execOptions.simpleConsoleLog
|
|
79
|
+
: false;
|
|
75
80
|
this.execOptions.consoleError =
|
|
76
81
|
this.execOptions.consoleError !== undefined
|
|
77
82
|
? this.execOptions.consoleError
|
|
78
83
|
: true;
|
|
84
|
+
this.execOptions.testOutput =
|
|
85
|
+
this.execOptions.testOutput !== undefined
|
|
86
|
+
? this.execOptions.testOutput
|
|
87
|
+
: "only-on-failure";
|
|
79
88
|
this.execOptions.consoleTestOutput =
|
|
80
89
|
this.execOptions.consoleTestOutput !== undefined
|
|
81
90
|
? this.execOptions.consoleTestOutput
|
|
82
91
|
: false;
|
|
83
|
-
this.execOptions.simpleConsoleLog =
|
|
84
|
-
this.execOptions.simpleConsoleLog !== undefined
|
|
85
|
-
? this.execOptions.simpleConsoleLog
|
|
86
|
-
: false;
|
|
87
92
|
this.execOptions.initialTheme =
|
|
88
93
|
this.execOptions.initialTheme !== undefined
|
|
89
94
|
? this.execOptions.initialTheme
|
|
@@ -854,13 +859,35 @@ class Generate {
|
|
|
854
859
|
testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.TraceTabButton}}", trace !== "" ? this.help.printTraceTabButton(testCaseId) : "");
|
|
855
860
|
testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.Trace}}", trace);
|
|
856
861
|
let stdout = testCase.result.stdout.toString();
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
862
|
+
if (stdout !== "" && this.execOptions.testOutput === true) {
|
|
863
|
+
testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.StdoutTabButton}}", this.help.printStdoutTabButton(testCaseId));
|
|
864
|
+
testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.Stdout}}", this.help.printStdout(testCaseId, stdout));
|
|
865
|
+
}
|
|
866
|
+
else if (stdout !== "" &&
|
|
867
|
+
this.execOptions.testOutput === "only-on-failure" &&
|
|
868
|
+
testCase.result.status === "failed") {
|
|
869
|
+
testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.StdoutTabButton}}", this.help.printStdoutTabButton(testCaseId));
|
|
870
|
+
testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.Stdout}}", this.help.printStdout(testCaseId, stdout));
|
|
871
|
+
}
|
|
872
|
+
else {
|
|
873
|
+
testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.StdoutTabButton}}", "");
|
|
874
|
+
testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.Stdout}}", "");
|
|
875
|
+
}
|
|
860
876
|
let stderr = testCase.result.stderr.toString();
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
877
|
+
if (stderr !== "" && this.execOptions.testOutput === true) {
|
|
878
|
+
testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.StderrTabButton}}", this.help.printStderrTabButton(testCaseId));
|
|
879
|
+
testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.Stderr}}", this.help.printStderr(testCaseId, stderr));
|
|
880
|
+
}
|
|
881
|
+
else if (stderr !== "" &&
|
|
882
|
+
this.execOptions.testOutput === "only-on-failure" &&
|
|
883
|
+
testCase.result.status === "failed") {
|
|
884
|
+
testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.StderrTabButton}}", this.help.printStderrTabButton(testCaseId));
|
|
885
|
+
testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.Stderr}}", this.help.printStderr(testCaseId, stderr));
|
|
886
|
+
}
|
|
887
|
+
else {
|
|
888
|
+
testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.StderrTabButton}}", "");
|
|
889
|
+
testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.Stderr}}", "");
|
|
890
|
+
}
|
|
864
891
|
testCasesDetails += testCaseDetailsHtml;
|
|
865
892
|
});
|
|
866
893
|
this.content = this.content.replace("{{.TestCases}}", testCases);
|
|
@@ -899,7 +926,7 @@ class Generate {
|
|
|
899
926
|
this.base = this.base.replace("{{.SummaryFiles}}", summaryFiles);
|
|
900
927
|
this.base = this.base.replace("{{.SummaryProjects}}", summaryProjects);
|
|
901
928
|
this.base = this.base.replace("{{.Content}}", this.content);
|
|
902
|
-
this.base = this.base.replaceAll("{{.Version}}",
|
|
929
|
+
this.base = this.base.replaceAll("{{.Version}}", this.CURRENT_VERSION);
|
|
903
930
|
this.base = this.base.replaceAll("{{.ShortVersion}}", "v1");
|
|
904
931
|
// Create the final HTML report file
|
|
905
932
|
this.help.createFile(this.execOptions.outputFolder + "/" + this.execOptions.indexFilename, this.base);
|
package/lib/html/base.html
CHANGED
|
@@ -171,6 +171,9 @@
|
|
|
171
171
|
</a>
|
|
172
172
|
</div>
|
|
173
173
|
</div>
|
|
174
|
+
<div class="desc-modal odhin-text-1">
|
|
175
|
+
<img style="border-radius: 50px; margin-top: 10px;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFcAAABXCAMAAABGFileAAAAAXNSR0IArs4c6QAAAC1QTFRF+/38+fv68PP16uzw1Nfiur7SoabAkpe4foSrbnSgR0+HLjd3HCVrDRZgCRNfqTmH+QAAAo5JREFUeNrt2d2K4zAMhmHJ/5b86f4vd2vHbVMm2WGalB2WvJSUHORBCFIflK7+69jHEZ1dhJlB6eQ4oqd0dqH2Cv3iqvYSUdR1lYl0FOitxHrZRS541oKLhNEx17dMec1KPclF4gmb3lhM1466hjxhDSzAWfOaIQ64Ba64u2aH3Q5ThvrOPueN9E68dq3vOCzsefu9NaarGJVD85KuXWuRqACvezg+b4tcItXpnjTvYCu6faY7WaB/nekOb77F9eHa0f0icgEmzHL0fQs63UQ+3yq9TF6mW5jehNtwc3/e+RHd8okOscSxmWUapdYTWgIgTG/HCXc35Jxun4crgY6UcXfj6O6qp0NxnW62ntKSBjoY+w2XAx2O+cU9Of6EO+eV9tV1kenbfBGVGph6pY6Sp1ExhDrdKtWRk371LdNSFMm0WWoAzCCDUoOZwVr1y7zq83R1fMOEbi7SdA1lmwWgIgBal9SaiDYzUz/mlW3XLE/XNl3fgMTMQYA6HhYet2Z1umm6Mt26uMi873JeWCYnaP7hshOD33LbdG9V3t+DQHgpA/HpcoTFu9tiT19chVl1u3tQFB5RBPLK9c3y3Z29uDXBIC72RW/UUHkpAukHbqHYDJJ2XIFONwFhZw8aevLqLgdA23EzkLnnFeqerldr7uEy3frijiNr22XfgOqYo471TtdFNSv0nctezZBpq9gAaL8ID9fQGsxQ3cNt7unqdDMNWMzS3vmL1TmrNoKmfst/c0dO91ziWGrNgUYp91JgGq3dmLsQYyDifp2wpJ//rFNdubx7tPy09bz78RvunNfTyVXTj7n5I24L9SOuFf2Ma3a5l3u5l3u5l3u5l/vvXY61VxydHF//vf2m/gAUSD3C2nfZkAAAAABJRU5ErkJggg=="/>
|
|
176
|
+
</div>
|
|
174
177
|
</div>
|
|
175
178
|
</div>
|
|
176
179
|
</div>
|
|
@@ -9,9 +9,10 @@ export interface ExecOptions {
|
|
|
9
9
|
outputFolder: string;
|
|
10
10
|
startServer: boolean;
|
|
11
11
|
consoleLog: boolean;
|
|
12
|
+
simpleConsoleLog: boolean;
|
|
12
13
|
consoleError: boolean;
|
|
14
|
+
testOutput: boolean | "only-on-failure";
|
|
13
15
|
consoleTestOutput: boolean;
|
|
14
|
-
simpleConsoleLog: boolean;
|
|
15
16
|
initialTheme: string;
|
|
16
17
|
indexFilename: string;
|
|
17
18
|
}
|