diff --git a/IPython/html/tests/services/kernel.js b/IPython/html/tests/services/kernel.js
index c9f1c19..a944bd4 100644
--- a/IPython/html/tests/services/kernel.js
+++ b/IPython/html/tests/services/kernel.js
@@ -269,6 +269,8 @@ casper.notebook_test(function () {
});
}
);
+ // wait for any last idle/busy messages to be handled
+ this.wait_for_kernel_ready();
// start the kernel back up
this.thenEvaluate(function () {