Text

def message = $("#message") message.should == "Select option" def message = $("#message") message.should == ~/option/ def menu = $("#menu ul li") menu.should == ["Hello", "Text", "World"] def message = $("#message") message.should contain("option") def menu = $("#menu ul li").all() menu.should contain("Text") Note: all() is used at element declaration time to disambiguate between contain text in the first element and in the list of elements. It is not required when you do an explicit comparison with the list on the right, since then WebTau can deduce the desired outcome. def menu = $("#menu ul li") menu.should == ["Hello", ~/T..t/, "World"]

Numbers

def total = $("#total") total.should == 300.6 def total = $("#total") total.shouldBe > 200 def total = $("#total") total.shouldBe >= 300 def split = $("#split ul li") split.should == [100, 28, 172.6] def split = $("#split ul li") split.should == [100, lessThan(100), greaterThanOrEqual(150)]

State

<div><button id="action" disabled>Click me</button> <div id="feedback" style="display: none;"></div> </div> def button = $("#action") button.shouldBe disabled button.shouldNotBe enabled def feedback = $("#feedback") feedback.shouldBe hidden feedback.shouldNotBe visible

Snapshot And Change

def number = $("#number-to-change") def trigger = $("#change-number") number.takeSnapshot() trigger.click() number.waitTo change > taking value snapshot by css #number-to-change . value snapshot is taken for by css #number-to-change (19ms) > clicking by css #change-number . clicked by css #change-number (222ms) > waiting for by css #number-to-change to change . by css #number-to-change changed (18ms)