You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2020/03/27 13:14:31 UTC

[myfaces-tobago] branch master updated: improve jasmine test tools

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

hnoeth 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 98d4bcb  improve jasmine test tools
98d4bcb is described below

commit 98d4bcb7dc20645cc79d1e44678fd68f1bdb273d
Author: Henning Nöth <hn...@apache.org>
AuthorDate: Fri Mar 27 14:12:07 2020 +0100

    improve jasmine test tools
    
    * better message for timed out step
    * test doesn't end if timeout
    
    Issue: TOBAGO-2022
---
 .../resources/tobago/test/tobago-test-tool.js      | 30 ++++++++++------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/tobago-tool/tobago-tool-test/src/main/resources/META-INF/resources/tobago/test/tobago-test-tool.js b/tobago-tool/tobago-tool-test/src/main/resources/META-INF/resources/tobago/test/tobago-test-tool.js
index 52e7fff..d120769 100644
--- a/tobago-tool/tobago-tool-test/src/main/resources/META-INF/resources/tobago/test/tobago-test-tool.js
+++ b/tobago-tool/tobago-tool-test/src/main/resources/META-INF/resources/tobago/test/tobago-test-tool.js
@@ -261,26 +261,26 @@ class JasmineTestTool {
   }
 
   cycle() {
-    let nextStep = this.getNextStep();
+    const nextStep = this.getNextStep();
 
     if (this.isFinished()) {
       this.done();
     } else if (this.isTimeout()) {
-      fail("Timeout!");
-      this.done();
-    } else if (this.isStepValid(nextStep)) {
-      if (nextStep.type === "do") {
-        nextStep.func();
+      fail("Timeout of '" + nextStep.type + "'-step: " + nextStep.func);
+      nextStep.done = true;
+      this.resetTimeout();
+      window.setTimeout(this.cycle.bind(this), this.cycleTiming);
+    } else if (nextStep.type === "do") {
+      nextStep.func();
+      nextStep.done = true;
+      this.resetTimeout();
+      window.setTimeout(this.cycle.bind(this), this.cycleTiming);
+    } else if (nextStep.type === "wait") {
+      if (nextStep.func()) {
         nextStep.done = true;
         this.resetTimeout();
-        window.setTimeout(this.cycle.bind(this), this.cycleTiming);
-      } else if (nextStep.type === "wait") {
-        if (nextStep.func()) {
-          nextStep.done = true;
-          this.resetTimeout();
-        }
-        window.setTimeout(this.cycle.bind(this), this.cycleTiming);
       }
+      window.setTimeout(this.cycle.bind(this), this.cycleTiming);
     } else {
       fail("an unexpected error has occurred!");
       this.done();
@@ -305,10 +305,6 @@ class JasmineTestTool {
     return null;
   }
 
-  isStepValid(step) {
-    return step && (step.type === "do" || step.type === "wait");
-  }
-
   isTimeout() {
     return Date.now() > (this.lastStepExecution + this.timeout);
   }