getTimer(id).test.running() (since beta 0.3)

Tests whether the timer is currently running.


[js highlight=”22-24″ try=”true”]
newTooltip(“not running”, “The timer is not running”)
newText(“on”, “[on]”)
.settings.before( newText(“off”, “[off]”) )
.settings.add( getText(“on”) , getText(“off”) )
newTimer(“quick”, 500)
.settings.callback( getSelector(“switch”).select(getText(“off”)) )
getSelector(“switch”).test.selected( getText(“on”) )
.success( getTimer(“quick”).start() )
newButton(“target”, “Click here within 500ms of start”)
.failure( getTooltip(“not running”).print(“target”) )

Shows off and on on a single line above a button reading Click here within 500ms of start. When on is clicked, the 500ms timer starts. If the button is clicked within 500ms, then the running test is successful and the click is validated. If the target button is clicked before the timer has started (i.e. before on was clicked) or after the timer has ended, the running test fails and the wait command does not release the execution of the script: the click is not validated and a new attempt at a on-target click sequence within 500ms is necessary.