implement function waitFor() for yui test