youtube.test.hasPlayed

getYoutube(id).test.hasPlayed() (since beta 0.3) Tests whether the end of the video was reached at least once. Note that the video need not have fully played, if the position was manually set before reaching the end.

voicerecorder.test.recorded

The VoiceRecorder element is deprecated since PennController 1.8. See instead. getVoiceRecorder(id).test.playing() (since beta 0.3) Tests whether a recording was completed.

voicerecorder.test.playing

The VoiceRecorder element is deprecated since PennController 1.8. See instead. getVoiceRecorder(id).test.playing() (since beta 0.3) Tests whether the recording is currently being played back.

voicerecorder.test.hasPlayed

The VoiceRecorder element is deprecated since PennController 1.8. See instead. getVoiceRecorder(id).test.hasPlayed() (since beta 0.3) Tests whether the recording was ever played back.

var.test.is

getVar(id).test.is( value ) (since beta 0.3) or getVar(id).test.is( function ) Tests the value of the Var element. You can pass a function which takes the element’s value as its argument and returns true or false. Example: [js highlight=”20,21″ try=”true”]newVar(“trialsLeft”, 3) , newText(“remain”, ” Number of remaining attempts: “) .settings.after( newText(“trial”, “3”) ) , newTextInput(“guess”, “Guess …

timer.test.running

getTimer(id).test.running() (since beta 0.3) Tests whether the timer is currently running. Example: [js highlight=”22-24″ try=”true”] newTooltip(“not running”, “The timer is not running”) , newText(“on”, “[on]”) .settings.before( newText(“off”, “[off]”) ) .print() , newSelector(“switch”) .settings.add( getText(“on”) , getText(“off”) ) , newTimer(“quick”, 500) .settings.callback( getSelector(“switch”).select(getText(“off”)) ) , getSelector(“switch”) .settings.callback( getSelector(“switch”).test.selected( getText(“on”) ) .success( getTimer(“quick”).start() ) ) , newButton(“target”, …

timer.test.ended

getTimer(id).test.ended() (since beta 0.3) Tests whether the timer has ended. Example: [js highlight=”12″ try=”true”] newText(“start”, “Ready… go!”) .print() , newTimer(“hurry”, 1000) .start() , newButton(“click”, “Click me!”) .print() .wait() , getTimer(“hurry”) .test.ended() .success( newText(“slow”, “Too slow…”).print() ) .failure( newText(“fast”, “Good job!”).print() ) [/js] Adds a line of text saying Ready… go! to the screen, starts a …

textinput.test.text

getTextInput(id).test.text(“string”) or getScale(id).test.text( /RegExp/ ) Tests for a match with the text in the input box. Example: [js highlight=”7″ try=”true”]newTextInput(“haiku”, “hatsu shigure\nsaru mo komino o\nhoshige nari”) .settings.lines(3) .print() , newButton(“save”, “Save”) .print() .wait( getTextInput(“haiku”).test.text(/^.+[\r\n].+[\r\n].+$/) )[/js] Adds a 3-line input box to the screen containing a haiku (note the \n to insert linebreaks in the text) …

text.test.text

getText(id).test.text( string ) or getText(id).test.text( /RegExp/ ) (since beta 0.3) Tests whether the text matches the string (identical, case-sensitive) or the regular expression.

selector.test.selected

getSelector(id).test.selected() or getSelector(id).test.selected( element ) Tests whether an element is selected. When testing an element, remember to use a get* command, as simply typing its ID will fail (ie. test for getImage(“square”), not just “square”) Example: [js highlight=”12″ try=”true”] newImage(“square”, “square.png”) , newImage(“triangle”, “triangle.png”) .settings.before( getImage(“square”) ) .print() , newSelector(“shapes”) .settings.add( getImage(“square”) , getImage(“triangle”) ) …