Make TestSpec.js more robust by using done() method to wait for async events to finish