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 2024/07/02 10:09:51 UTC

(myfaces-tobago) branch main updated: feature: add waitMs function to tobago-test-tool

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 11a1fb401b feature: add waitMs function to tobago-test-tool
11a1fb401b is described below

commit 11a1fb401b9242e95c4079db2803b76dba133fde
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Tue Jul 2 11:00:09 2024 +0200

    feature: add waitMs function to tobago-test-tool
---
 .../META-INF/resources/tobago/test/tobago-test-tool.js    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

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 6a78f1c744..9aeeb98e64 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
@@ -64,6 +64,7 @@ class JasmineTestTool {
   steps = [];
   done;
   timeout;
+  waitTimestamp;
 
   /**
    * @param done function from Jasmine; must called if all Steps done or timeout
@@ -174,6 +175,20 @@ class JasmineTestTool {
     });
   }
 
+  waitMs(milliseconds) {
+    this.steps.push({
+      type: "do",
+      func: () => this.waitTimestamp = Date.now() + milliseconds,
+      substep: 1
+    });
+
+    this.steps.push({
+      type: "wait",
+      func: () => Date.now() > this.waitTimestamp,
+      substep: 1
+    });
+  }
+
   start() {
     const steps = this.steps;
     let done = this.done;