There is a waitsForDone() function defined in SpecRunnerUtils.js that waits for a promise to resolve.