odhin-reports-playwright 1.0.4 → 1.0.5

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.js CHANGED
@@ -72,18 +72,22 @@ class Generate {
72
72
  this.execOptions.consoleLog !== undefined
73
73
  ? this.execOptions.consoleLog
74
74
  : true;
75
+ this.execOptions.simpleConsoleLog =
76
+ this.execOptions.simpleConsoleLog !== undefined
77
+ ? this.execOptions.simpleConsoleLog
78
+ : false;
75
79
  this.execOptions.consoleError =
76
80
  this.execOptions.consoleError !== undefined
77
81
  ? this.execOptions.consoleError
78
82
  : true;
83
+ this.execOptions.testOutput =
84
+ this.execOptions.testOutput !== undefined
85
+ ? this.execOptions.testOutput
86
+ : "only-on-failure";
79
87
  this.execOptions.consoleTestOutput =
80
88
  this.execOptions.consoleTestOutput !== undefined
81
89
  ? this.execOptions.consoleTestOutput
82
90
  : false;
83
- this.execOptions.simpleConsoleLog =
84
- this.execOptions.simpleConsoleLog !== undefined
85
- ? this.execOptions.simpleConsoleLog
86
- : false;
87
91
  this.execOptions.initialTheme =
88
92
  this.execOptions.initialTheme !== undefined
89
93
  ? this.execOptions.initialTheme
@@ -854,13 +858,35 @@ class Generate {
854
858
  testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.TraceTabButton}}", trace !== "" ? this.help.printTraceTabButton(testCaseId) : "");
855
859
  testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.Trace}}", trace);
856
860
  let stdout = testCase.result.stdout.toString();
857
- //stdout = "";
858
- testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.StdoutTabButton}}", stdout !== "" ? this.help.printStdoutTabButton(testCaseId) : "");
859
- testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.Stdout}}", stdout !== "" ? this.help.printStdout(testCaseId, stdout) : "");
861
+ if (stdout !== "" && this.execOptions.testOutput === true) {
862
+ testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.StdoutTabButton}}", this.help.printStdoutTabButton(testCaseId));
863
+ testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.Stdout}}", this.help.printStdout(testCaseId, stdout));
864
+ }
865
+ else if (stdout !== "" &&
866
+ this.execOptions.testOutput === "only-on-failure" &&
867
+ testCase.result.status === "failed") {
868
+ testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.StdoutTabButton}}", this.help.printStdoutTabButton(testCaseId));
869
+ testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.Stdout}}", this.help.printStdout(testCaseId, stdout));
870
+ }
871
+ else {
872
+ testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.StdoutTabButton}}", "");
873
+ testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.Stdout}}", "");
874
+ }
860
875
  let stderr = testCase.result.stderr.toString();
861
- //stderr = "";
862
- testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.StderrTabButton}}", stderr !== "" ? this.help.printStderrTabButton(testCaseId) : "");
863
- testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.Stderr}}", stderr !== "" ? this.help.printStderr(testCaseId, stderr) : "");
876
+ if (stderr !== "" && this.execOptions.testOutput === true) {
877
+ testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.StderrTabButton}}", this.help.printStderrTabButton(testCaseId));
878
+ testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.Stderr}}", this.help.printStderr(testCaseId, stderr));
879
+ }
880
+ else if (stderr !== "" &&
881
+ this.execOptions.testOutput === "only-on-failure" &&
882
+ testCase.result.status === "failed") {
883
+ testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.StderrTabButton}}", this.help.printStderrTabButton(testCaseId));
884
+ testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.Stderr}}", this.help.printStderr(testCaseId, stderr));
885
+ }
886
+ else {
887
+ testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.StderrTabButton}}", "");
888
+ testCaseDetailsHtml = testCaseDetailsHtml.replaceAll("{{.Stderr}}", "");
889
+ }
864
890
  testCasesDetails += testCaseDetailsHtml;
865
891
  });
866
892
  this.content = this.content.replace("{{.TestCases}}", testCases);
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "odhin-reports-playwright",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Odhin Reports for Playwright",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",