You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2021/01/12 10:59:05 UTC

[myfaces-tobago] branch master updated: integration-tests: add failure details

This is an automated email from the ASF dual-hosted git repository.

bommel pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/master by this push:
     new 296231b  integration-tests: add failure details
296231b is described below

commit 296231bf66a04d1bbf4dc9ce9f0ce455fa9efbb0
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Tue Jan 12 11:40:08 2021 +0100

    integration-tests: add failure details
    
    * log details if a test failed
---
 .../tobago/example/demo/integration/FrontendBase.java      | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/integration/FrontendBase.java b/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/integration/FrontendBase.java
index 319d8f0..99598ce 100644
--- a/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/integration/FrontendBase.java
+++ b/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/integration/FrontendBase.java
@@ -121,9 +121,10 @@ abstract class FrontendBase {
     return webDriver.findElements(By.cssSelector(".jasmine-symbol-summary li"));
   }
 
-  void parseJasmineResults(List<WebElement> results, String path) {
+  void parseJasmineResults(List<WebElement> results, String path) throws MalformedURLException, UnknownHostException {
     Assertions.assertTrue(results.size() > 0, path + " no results detected");
 
+    boolean fail = false;
     StringBuilder stringBuilder = new StringBuilder();
     stringBuilder.append("\n");
     stringBuilder.append(path);
@@ -133,10 +134,16 @@ abstract class FrontendBase {
         stringBuilder.append("✅ passed");
       } else {
         stringBuilder.append("❌ failed");
+        fail = true;
       }
       stringBuilder.append(": ");
       stringBuilder.append(result.getAttribute("title"));
     }
+    if (fail) {
+      stringBuilder.append("\n");
+      stringBuilder.append("failures details:\n");
+      stringBuilder.append(getFailureDetails());
+    }
     LOG.info(stringBuilder.toString());
 
     for (WebElement result : results) {
@@ -145,6 +152,11 @@ abstract class FrontendBase {
     }
   }
 
+  String getFailureDetails() throws MalformedURLException, UnknownHostException {
+    WebElement failures = getWebDriver().findElement(By.cssSelector(".jasmine-failures"));
+    return failures.getText();
+  }
+
   String getTimeLeft(final LocalTime startTime, final int testSize, final int testNo) {
     final LocalTime now = LocalTime.now();
     final Duration completeWaitTime = Duration.between(startTime, now).dividedBy(testNo).multipliedBy(testSize);