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 menu = $('#menu ul li') menu.should contain('Text') 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

def button = $("#action") button.should beDisabled() button.shouldNot beEnabled() def feedback = $("#feedback") feedback.should beHidden() feedback.shouldNot beVisible() <div> <button id="action" disabled>Click me</button> <div id="feedback" style="display: none;"></div> </div>