From 659a9f939731cae675b3d852952ff2cb637bd092 Mon Sep 17 00:00:00 2001 From: KJunker Date: Mon, 6 Sep 2021 21:22:39 +0200 Subject: [PATCH] html report merger skip not existing report (#85) * Issue https://github.com/Codeception/robo-paracept/issues/31 - Fixing headerline from NOT OK to Standard FAILED after merge - continue if report html file did not exist - print task warning message --- src/Merger/HtmlReportMerger.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Merger/HtmlReportMerger.php b/src/Merger/HtmlReportMerger.php index 5726713..d2ce82e 100644 --- a/src/Merger/HtmlReportMerger.php +++ b/src/Merger/HtmlReportMerger.php @@ -109,8 +109,12 @@ public function run() throw XPathExpressionException::malformedXPath($xpathExprRefNodes); } for ($k = 1, $kMax = count($this->src); $k < $kMax; $k++) { - $srcHTML = new DOMDocument(); $src = $this->src[$k]; + if (!file_exists($src) || !is_readable($src)) { + $this->printTaskWarning('File did not exists or is not readable: ' . $src); + continue; + } + $srcHTML = new DOMDocument(); $srcHTML->loadHTMLFile($src, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $this->countExecutionTime($srcHTML); $xpathExprSuiteNodes = "//div[@class='layout']/table/tr"; @@ -199,7 +203,7 @@ private function updateHeaderLine(DOMDocument $dstFile): void $statusNode = $nodeList[0]->childNodes[1]->childNodes[0]; $statusAttr = $statusNode->attributes[0]; if (0 !== ($this->countFailed + $this->countIncomplete + $this->countSkipped)) { - $statusNode->nodeValue = 'NOT OK'; + $statusNode->nodeValue = 'FAILED'; $statusAttr->value = 'color: red'; } $executionTimeNode->nodeValue = " ({$this->executionTimeSum}s)";